Merge "Record the trimmed cmd string for logs"
diff --git a/api/16.txt b/api/16.txt
index 6543ab0..8ff7675 100644
--- a/api/16.txt
+++ b/api/16.txt
@@ -10771,8 +10771,6 @@
     method public void setAudioEncodingBitRate(int);
     method public void setAudioSamplingRate(int);
     method public void setAudioSource(int) throws java.lang.IllegalStateException;
-    method public deprecated void setAuxiliaryOutputFile(java.io.FileDescriptor);
-    method public deprecated void setAuxiliaryOutputFile(java.lang.String);
     method public void setCamera(android.hardware.Camera);
     method public void setCaptureRate(double);
     method public void setLocation(float, float);
diff --git a/api/current.txt b/api/current.txt
index 6fdd161..ad84895 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -75,7 +75,9 @@
     field public static final deprecated java.lang.String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY";
     field public static final java.lang.String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
     field public static final java.lang.String READ_CALENDAR = "android.permission.READ_CALENDAR";
+    field public static final java.lang.String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
     field public static final java.lang.String READ_CONTACTS = "android.permission.READ_CONTACTS";
+    field public static final java.lang.String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
     field public static final java.lang.String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER";
     field public static final java.lang.String READ_HISTORY_BOOKMARKS = "com.android.browser.permission.READ_HISTORY_BOOKMARKS";
     field public static final java.lang.String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE";
@@ -120,6 +122,7 @@
     field public static final java.lang.String WAKE_LOCK = "android.permission.WAKE_LOCK";
     field public static final java.lang.String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS";
     field public static final java.lang.String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR";
+    field public static final java.lang.String WRITE_CALL_LOG = "android.permission.WRITE_CALL_LOG";
     field public static final java.lang.String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
     field public static final java.lang.String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
     field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
@@ -8034,6 +8037,9 @@
     ctor public Camera();
     method public void applyToCanvas(android.graphics.Canvas);
     method public float dotWithNormal(float, float, float);
+    method public float getLocationX();
+    method public float getLocationY();
+    method public float getLocationZ();
     method public void getMatrix(android.graphics.Matrix);
     method public void restore();
     method public void rotate(float, float, float);
@@ -9065,6 +9071,7 @@
     method public int getMinimumWidth();
     method public abstract int getOpacity();
     method public boolean getPadding(android.graphics.Rect);
+    method public int getResolvedLayoutDirectionSelf();
     method public int[] getState();
     method public android.graphics.Region getTransparentRegion();
     method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
@@ -9099,6 +9106,10 @@
     method public abstract void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
   }
 
+  public static abstract interface Drawable.Callback2 implements android.graphics.drawable.Drawable.Callback {
+    method public abstract int getResolvedLayoutDirection(android.graphics.drawable.Drawable);
+  }
+
   public static abstract class Drawable.ConstantState {
     ctor public Drawable.ConstantState();
     method public abstract int getChangingConfigurations();
@@ -10930,8 +10941,6 @@
     method public void setAudioEncodingBitRate(int);
     method public void setAudioSamplingRate(int);
     method public void setAudioSource(int) throws java.lang.IllegalStateException;
-    method public deprecated void setAuxiliaryOutputFile(java.io.FileDescriptor);
-    method public deprecated void setAuxiliaryOutputFile(java.lang.String);
     method public void setCamera(android.hardware.Camera);
     method public void setCaptureRate(double);
     method public void setLocation(float, float);
@@ -21635,6 +21644,10 @@
     method public android.util.JsonWriter value(java.lang.Number) throws java.io.IOException;
   }
 
+  public class LocaleUtil {
+    method public static int getLayoutDirectionFromLocale(java.util.Locale);
+  }
+
   public final class Log {
     method public static int d(java.lang.String, java.lang.String);
     method public static int d(java.lang.String, java.lang.String, java.lang.Throwable);
@@ -22100,8 +22113,11 @@
   public class Gravity {
     ctor public Gravity();
     method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect);
+    method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect, int);
     method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect);
+    method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect, int);
     method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect);
+    method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect, int);
     method public static int getAbsoluteGravity(int, int);
     method public static boolean isHorizontal(int);
     method public static boolean isVertical(int);
@@ -23109,7 +23125,7 @@
     method public void recycle();
   }
 
-  public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
+  public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.graphics.drawable.Drawable.Callback2 android.view.KeyEvent.Callback {
     ctor public View(android.content.Context);
     ctor public View(android.content.Context, android.util.AttributeSet);
     ctor public View(android.content.Context, android.util.AttributeSet, int);
@@ -23189,6 +23205,7 @@
     method public final int getBottom();
     method protected float getBottomFadingEdgeStrength();
     method protected int getBottomPaddingOffset();
+    method public float getCameraDistance();
     method public java.lang.CharSequence getContentDescription();
     method public final android.content.Context getContext();
     method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 901f7c7..da38df1 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -61,6 +61,8 @@
     private boolean mWaitOption = false;
     private boolean mStopOption = false;
 
+    private boolean mOpenglTraceOption = false;
+
     private int mRepeat = 0;
 
     private String mProfileFile;
@@ -151,6 +153,7 @@
         mDebugOption = false;
         mWaitOption = false;
         mStopOption = false;
+        mOpenglTraceOption = false;
         mRepeat = 0;
         mProfileFile = null;
         Uri data = null;
@@ -307,6 +310,8 @@
                 mRepeat = Integer.parseInt(nextArgRequired());
             } else if (opt.equals("-S")) {
                 mStopOption = true;
+            } else if (opt.equals("--opengl-trace")) {
+                mOpenglTraceOption = true;
             } else {
                 System.err.println("Error: Unknown option: " + opt);
                 showUsage();
@@ -440,17 +445,19 @@
                     return;
                 }
             }
-    
+
             IActivityManager.WaitResult result = null;
             int res;
             if (mWaitOption) {
                 result = mAm.startActivityAndWait(null, intent, mimeType,
-                            null, 0, null, null, 0, false, mDebugOption,
+                            null, 0, null, null, 0, false,
+                            mDebugOption, mOpenglTraceOption,
                             mProfileFile, fd, mProfileAutoStop);
                 res = result.result;
             } else {
                 res = mAm.startActivity(null, intent, mimeType,
-                        null, 0, null, null, 0, false, mDebugOption,
+                        null, 0, null, null, 0, false,
+                        mDebugOption, mOpenglTraceOption,
                         mProfileFile, fd, mProfileAutoStop);
             }
             PrintStream out = mWaitOption ? System.out : System.err;
@@ -1277,7 +1284,7 @@
         System.err.println(
                 "usage: am [subcommand] [options]\n" +
                 "usage: am start [-D] [-W] [-P <FILE>] [--start-profiler <FILE>]\n" +
-                "               [--R COUNT] [-S] <INTENT>\n" +
+                "               [--R COUNT] [-S] [--opengl-trace] <INTENT>\n" +
                 "       am startservice <INTENT>\n" +
                 "       am force-stop <PACKAGE>\n" +
                 "       am kill <PACKAGE>\n" +
@@ -1304,6 +1311,7 @@
                 "    -R: repeat the activity launch <COUNT> times.  Prior to each repeat,\n" +
                 "        the top activity will be finished.\n" +
                 "    -S: force stop the target app before starting the activity\n" +
+                "    --opengl-trace: enable tracing of OpenGL functions\n" +
                 "\n" +
                 "am startservice: start a Service.\n" +
                 "\n" +
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index f26747b..e41b666 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -14,9 +14,9 @@
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
 	frameworks/base/media/libstagefright/include \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
-        external/skia/include/core \
-        external/skia/include/images \
+	$(TOP)/frameworks/native/include/media/openmax \
+	external/skia/include/core \
+	external/skia/include/images \
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -40,7 +40,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -64,7 +64,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -89,7 +89,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -113,7 +113,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -137,7 +137,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
@@ -162,7 +162,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index a463a62..9ebbe03 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -104,7 +104,7 @@
  * </ul>
  * <h3>Retrieving window content</h3>
  * <p>
- * An service can specify in its declaration that it can retrieve the active window
+ * A service can specify in its declaration that it can retrieve the active window
  * content which is represented as a tree of {@link AccessibilityNodeInfo}. Note that
  * declaring this capability requires that the service declares its configuration via
  * an XML resource referenced by {@link #SERVICE_META_DATA}.
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index eae0a4c..b55fda4 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -503,26 +503,38 @@
     public static String feedbackTypeToString(int feedbackType) {
         StringBuilder builder = new StringBuilder();
         builder.append("[");
-        while (feedbackType > 0) {
+        while (feedbackType != 0) {
             final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
             feedbackType &= ~feedbackTypeFlag;
-            if (builder.length() > 1) {
-                builder.append(", ");
-            }
             switch (feedbackTypeFlag) {
                 case FEEDBACK_AUDIBLE:
+                    if (builder.length() > 1) {
+                        builder.append(", ");
+                    }
                     builder.append("FEEDBACK_AUDIBLE");
                     break;
                 case FEEDBACK_HAPTIC:
+                    if (builder.length() > 1) {
+                        builder.append(", ");
+                    }
                     builder.append("FEEDBACK_HAPTIC");
                     break;
                 case FEEDBACK_GENERIC:
+                    if (builder.length() > 1) {
+                        builder.append(", ");
+                    }
                     builder.append("FEEDBACK_GENERIC");
                     break;
                 case FEEDBACK_SPOKEN:
+                    if (builder.length() > 1) {
+                        builder.append(", ");
+                    }
                     builder.append("FEEDBACK_SPOKEN");
                     break;
                 case FEEDBACK_VISUAL:
+                    if (builder.length() > 1) {
+                        builder.append(", ");
+                    }
                     builder.append("FEEDBACK_VISUAL");
                     break;
             }
diff --git a/core/java/android/accounts/AbstractAccountAuthenticator.java b/core/java/android/accounts/AbstractAccountAuthenticator.java
index 7183267..e9535ab 100644
--- a/core/java/android/accounts/AbstractAccountAuthenticator.java
+++ b/core/java/android/accounts/AbstractAccountAuthenticator.java
@@ -59,7 +59,7 @@
  * "Account & Sync" settings page and one user of the android:smallIcon is the Contact Application's
  * tab panels.
  * <p>
- * The preferences attribute points to an PreferenceScreen xml hierarchy that contains
+ * The preferences attribute points to a PreferenceScreen xml hierarchy that contains
  * a list of PreferenceScreens that can be invoked to manage the authenticator. An example is:
  * <pre>
  * &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
diff --git a/core/java/android/animation/Animator.java b/core/java/android/animation/Animator.java
index e01fa1a..788765d 100644
--- a/core/java/android/animation/Animator.java
+++ b/core/java/android/animation/Animator.java
@@ -208,7 +208,7 @@
      * this call to its child objects to tell them to set up the values. A
      * ObjectAnimator object will use the information it has about its target object
      * and PropertyValuesHolder objects to get the start values for its properties.
-     * An ValueAnimator object will ignore the request since it does not have enough
+     * A ValueAnimator object will ignore the request since it does not have enough
      * information (such as a target object) to gather these values.
      */
     public void setupStartValues() {
@@ -220,7 +220,7 @@
      * this call to its child objects to tell them to set up the values. A
      * ObjectAnimator object will use the information it has about its target object
      * and PropertyValuesHolder objects to get the start values for its properties.
-     * An ValueAnimator object will ignore the request since it does not have enough
+     * A ValueAnimator object will ignore the request since it does not have enough
      * information (such as a target object) to gather these values.
      */
     public void setupEndValues() {
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index 954ae66..f69120a 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -400,7 +400,7 @@
 
     /**
      * Sets the values, per property, being animated between. This function is called internally
-     * by the constructors of ValueAnimator that take a list of values. But an ValueAnimator can
+     * by the constructors of ValueAnimator that take a list of values. But a ValueAnimator can
      * be constructed without values and this method can be called to set the values manually
      * instead.
      *
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index f895431..0f2aa46 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -203,8 +203,8 @@
  * with the user.  Between these two methods you can maintain resources that
  * are needed to show the activity to the user.  For example, you can register
  * a {@link android.content.BroadcastReceiver} in onStart() to monitor for changes
- * that impact your UI, and unregister it in onStop() when the user an no
- * longer see what you are displaying.  The onStart() and onStop() methods
+ * that impact your UI, and unregister it in onStop() when the user no
+ * longer sees what you are displaying.  The onStart() and onStop() methods
  * can be called multiple times, as the activity becomes visible and hidden
  * to the user.
  * 
@@ -3388,17 +3388,16 @@
                 intent.setAllowFds(false);
                 result = ActivityManagerNative.getDefault()
                     .startActivity(mMainThread.getApplicationThread(),
-                            intent, intent.resolveTypeIfNeeded(
-                                    getContentResolver()),
+                            intent, intent.resolveTypeIfNeeded(getContentResolver()),
                             null, 0,
-                            mToken, mEmbeddedID, requestCode, true, false,
-                            null, null, false);
+                            mToken, mEmbeddedID, requestCode, true /* onlyIfNeeded */,
+                            false, false, null, null, false);
             } catch (RemoteException e) {
                 // Empty
             }
-            
+
             Instrumentation.checkStartActivityResult(result, intent);
-            
+
             if (requestCode >= 0) {
                 // If this start is requesting a result, we can avoid making
                 // the activity visible until the result is received.  Setting
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index b952649..7daaf7d 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -120,17 +120,19 @@
             Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
             int grantedMode = data.readInt();
             IBinder resultTo = data.readStrongBinder();
-            String resultWho = data.readString();    
+            String resultWho = data.readString();
             int requestCode = data.readInt();
             boolean onlyIfNeeded = data.readInt() != 0;
             boolean debug = data.readInt() != 0;
+            boolean openglTrace = data.readInt() != 0;
             String profileFile = data.readString();
             ParcelFileDescriptor profileFd = data.readInt() != 0
                     ? data.readFileDescriptor() : null;
             boolean autoStopProfiler = data.readInt() != 0;
             int result = startActivity(app, intent, resolvedType,
                     grantedUriPermissions, grantedMode, resultTo, resultWho,
-                    requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
+                    requestCode, onlyIfNeeded, debug, openglTrace,
+                    profileFile, profileFd, autoStopProfiler);
             reply.writeNoException();
             reply.writeInt(result);
             return true;
@@ -146,17 +148,19 @@
             Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
             int grantedMode = data.readInt();
             IBinder resultTo = data.readStrongBinder();
-            String resultWho = data.readString();    
+            String resultWho = data.readString();
             int requestCode = data.readInt();
             boolean onlyIfNeeded = data.readInt() != 0;
             boolean debug = data.readInt() != 0;
+            boolean openglTrace = data.readInt() != 0;
             String profileFile = data.readString();
             ParcelFileDescriptor profileFd = data.readInt() != 0
                     ? data.readFileDescriptor() : null;
             boolean autoStopProfiler = data.readInt() != 0;
             WaitResult result = startActivityAndWait(app, intent, resolvedType,
                     grantedUriPermissions, grantedMode, resultTo, resultWho,
-                    requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
+                    requestCode, onlyIfNeeded, debug, openglTrace,
+                    profileFile, profileFd, autoStopProfiler);
             reply.writeNoException();
             result.writeToParcel(reply, 0);
             return true;
@@ -1607,17 +1611,17 @@
     {
         mRemote = remote;
     }
-    
+
     public IBinder asBinder()
     {
         return mRemote;
     }
-    
+
     public int startActivity(IApplicationThread caller, Intent intent,
             String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
             IBinder resultTo, String resultWho,
             int requestCode, boolean onlyIfNeeded,
-            boolean debug, String profileFile, ParcelFileDescriptor profileFd,
+            boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
             boolean autoStopProfiler) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -1632,6 +1636,7 @@
         data.writeInt(requestCode);
         data.writeInt(onlyIfNeeded ? 1 : 0);
         data.writeInt(debug ? 1 : 0);
+        data.writeInt(openglTrace ? 1 : 0);
         data.writeString(profileFile);
         if (profileFd != null) {
             data.writeInt(1);
@@ -1651,7 +1656,7 @@
             String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
             IBinder resultTo, String resultWho,
             int requestCode, boolean onlyIfNeeded,
-            boolean debug, String profileFile, ParcelFileDescriptor profileFd,
+            boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
             boolean autoStopProfiler) throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
@@ -1666,6 +1671,7 @@
         data.writeInt(requestCode);
         data.writeInt(onlyIfNeeded ? 1 : 0);
         data.writeInt(debug ? 1 : 0);
+        data.writeInt(openglTrace ? 1 : 0);
         data.writeString(profileFile);
         if (profileFd != null) {
             data.writeInt(1);
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index aa15f39..2610d87 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -376,6 +376,7 @@
         Bundle instrumentationArgs;
         IInstrumentationWatcher instrumentationWatcher;
         int debugMode;
+        boolean enableOpenGlTrace;
         boolean restrictedBackupMode;
         boolean persistent;
         Configuration config;
@@ -676,8 +677,8 @@
                 ComponentName instrumentationName, String profileFile,
                 ParcelFileDescriptor profileFd, boolean autoStopProfiler,
                 Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher,
-                int debugMode, boolean isRestrictedBackupMode, boolean persistent,
-                Configuration config, CompatibilityInfo compatInfo,
+                int debugMode, boolean enableOpenGlTrace, boolean isRestrictedBackupMode,
+                boolean persistent, Configuration config, CompatibilityInfo compatInfo,
                 Map<String, IBinder> services, Bundle coreSettings) {
 
             if (services != null) {
@@ -695,6 +696,7 @@
             data.instrumentationArgs = instrumentationArgs;
             data.instrumentationWatcher = instrumentationWatcher;
             data.debugMode = debugMode;
+            data.enableOpenGlTrace = enableOpenGlTrace;
             data.restrictedBackupMode = isRestrictedBackupMode;
             data.persistent = persistent;
             data.config = config;
@@ -3912,6 +3914,11 @@
             }
         }
 
+        // Enable OpenGL tracing if required
+        if (data.enableOpenGlTrace) {
+            GLUtils.enableTracing();
+        }
+
         /**
          * Initialize the default http proxy in this process for the reasons we set the time zone.
          */
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index e75d7b4..437362b 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -267,6 +267,7 @@
             IBinder binder = data.readStrongBinder();
             IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
             int testMode = data.readInt();
+            boolean openGlTrace = data.readInt() != 0;
             boolean restrictedBackupMode = (data.readInt() != 0);
             boolean persistent = (data.readInt() != 0);
             Configuration config = Configuration.CREATOR.createFromParcel(data);
@@ -275,11 +276,11 @@
             Bundle coreSettings = data.readBundle();
             bindApplication(packageName, info,
                             providers, testName, profileName, profileFd, autoStopProfiler,
-                            testArgs, testWatcher, testMode, restrictedBackupMode, persistent,
-                            config, compatInfo, services, coreSettings);
+                            testArgs, testWatcher, testMode, openGlTrace, restrictedBackupMode,
+                            persistent, config, compatInfo, services, coreSettings);
             return true;
         }
-        
+
         case SCHEDULE_EXIT_TRANSACTION:
         {
             data.enforceInterface(IApplicationThread.descriptor);
@@ -849,8 +850,9 @@
     public final void bindApplication(String packageName, ApplicationInfo info,
             List<ProviderInfo> providers, ComponentName testName, String profileName,
             ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
-            IInstrumentationWatcher testWatcher, int debugMode, boolean restrictedBackupMode,
-            boolean persistent, Configuration config, CompatibilityInfo compatInfo,
+            IInstrumentationWatcher testWatcher, int debugMode, boolean openGlTrace,
+            boolean restrictedBackupMode, boolean persistent,
+            Configuration config, CompatibilityInfo compatInfo,
             Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
         Parcel data = Parcel.obtain();
         data.writeInterfaceToken(IApplicationThread.descriptor);
@@ -874,6 +876,7 @@
         data.writeBundle(testArgs);
         data.writeStrongInterface(testWatcher);
         data.writeInt(debugMode);
+        data.writeInt(openGlTrace ? 1 : 0);
         data.writeInt(restrictedBackupMode ? 1 : 0);
         data.writeInt(persistent ? 1 : 0);
         config.writeToParcel(data, 0);
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index f1ce2bb..f04ff6a 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -591,7 +591,7 @@
     }
 
     /**
-     * Called when an key shortcut event is not handled by any of the views in the Dialog.
+     * Called when a key shortcut event is not handled by any of the views in the Dialog.
      * Override this method to implement global key shortcuts for the Dialog.
      * Key shortcuts can also be implemented by setting the
      * {@link MenuItem#setShortcut(char, char) shortcut} property of menu items.
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index ea2545f..acebf58 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -84,12 +84,12 @@
     public int startActivity(IApplicationThread caller,
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo, String resultWho, int requestCode,
-            boolean onlyIfNeeded, boolean debug, String profileFile,
+            boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile,
             ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException;
     public WaitResult startActivityAndWait(IApplicationThread caller,
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo, String resultWho, int requestCode,
-            boolean onlyIfNeeded, boolean debug, String profileFile,
+            boolean onlyIfNeeded, boolean debug, boolean openglTrace, String profileFile,
             ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException;
     public int startActivityWithConfig(IApplicationThread caller,
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 6ad1736a..70029d2 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -89,7 +89,7 @@
     void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers,
             ComponentName testName, String profileName, ParcelFileDescriptor profileFd,
             boolean autoStopProfiler, Bundle testArguments, IInstrumentationWatcher testWatcher,
-            int debugMode, boolean restrictedBackupMode, boolean persistent,
+            int debugMode, boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
             Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
             Bundle coreSettings) throws RemoteException;
     void scheduleExit() throws RemoteException;
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index c037ffb..a34e1d3 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -1384,7 +1384,7 @@
                 .startActivity(whoThread, intent,
                         intent.resolveTypeIfNeeded(who.getContentResolver()),
                         null, 0, token, target != null ? target.mEmbeddedID : null,
-                        requestCode, false, false, null, null, false);
+                        requestCode, false, false, false, null, null, false);
             checkStartActivityResult(result, intent);
         } catch (RemoteException e) {
         }
@@ -1482,7 +1482,8 @@
                 .startActivity(whoThread, intent,
                         intent.resolveTypeIfNeeded(who.getContentResolver()),
                         null, 0, token, target != null ? target.mWho : null,
-                        requestCode, false, false, null, null, false);
+                        requestCode, false, false /* debug */, false /* openglTrace */,
+                        null, null, false);
             checkStartActivityResult(result, intent);
         } catch (RemoteException e) {
         }
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index b0637a7..c95066c 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -351,7 +351,7 @@
 
     /**
      * Cancel a currently active PendingIntent.  Only the original application
-     * owning an PendingIntent can cancel it.
+     * owning a PendingIntent can cancel it.
      */
     public void cancel() {
         try {
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index be4b8af..207ae76 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -453,7 +453,7 @@
     
     /**
      * Called by the system to notify a Service that it is no longer used and is being removed.  The
-     * service should clean up an resources it holds (threads, registered
+     * service should clean up any resources it holds (threads, registered
      * receivers, etc) at this point.  Upon return, there will be no more calls
      * in to this Service object and it is effectively dead.  Do not call this method directly.
      */
diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java
index 43cd330..30b65de 100644
--- a/core/java/android/app/admin/DeviceAdminReceiver.java
+++ b/core/java/android/app/admin/DeviceAdminReceiver.java
@@ -165,7 +165,7 @@
             = "android.app.action.ACTION_PASSWORD_EXPIRING";
 
     /**
-     * Name under which an DevicePolicy component publishes information
+     * Name under which a DevicePolicy component publishes information
      * about itself.  This meta-data must reference an XML resource containing
      * a device-admin tag.  XXX TO DO: describe syntax.
      */
diff --git a/core/java/android/bluetooth/AtCommandResult.java b/core/java/android/bluetooth/AtCommandResult.java
index 375a6dd..9675234 100644
--- a/core/java/android/bluetooth/AtCommandResult.java
+++ b/core/java/android/bluetooth/AtCommandResult.java
@@ -17,7 +17,7 @@
 package android.bluetooth;
 
 /**
- * The result of execution of an single AT command.<p>
+ * The result of execution of a single AT command.<p>
  *
  *
  * This class can represent the final response to an AT command line, and also
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 189e8fc..04af5f7 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -193,7 +193,7 @@
     public static final String EXTRA_RSSI = "android.bluetooth.device.extra.RSSI";
 
     /**
-     * Used as an Parcelable {@link BluetoothClass} extra field in {@link
+     * Used as a Parcelable {@link BluetoothClass} extra field in {@link
      * #ACTION_FOUND} and {@link #ACTION_CLASS_CHANGED} intents.
      */
     public static final String EXTRA_CLASS = "android.bluetooth.device.extra.CLASS";
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java
index 2683bef..639ae1a 100644
--- a/core/java/android/bluetooth/BluetoothPbap.java
+++ b/core/java/android/bluetooth/BluetoothPbap.java
@@ -60,7 +60,7 @@
     public static final String PBAP_PREVIOUS_STATE =
         "android.bluetooth.pbap.intent.PBAP_PREVIOUS_STATE";
 
-    /** Indicates the state of an pbap connection state has changed.
+    /** Indicates the state of a pbap connection state has changed.
      *  This intent will always contain PBAP_STATE, PBAP_PREVIOUS_STATE and
      *  BluetoothIntent.ADDRESS extras.
      */
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 12e3ccf..ec67d8c 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -16,6 +16,8 @@
 
 package android.content;
 
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+
 import android.content.pm.PackageManager;
 import android.content.pm.PathPermission;
 import android.content.pm.ProviderInfo;
@@ -30,6 +32,7 @@
 import android.os.ParcelFileDescriptor;
 import android.os.Process;
 import android.os.RemoteException;
+import android.os.UserId;
 import android.util.Log;
 
 import java.io.File;
@@ -267,90 +270,116 @@
             return CancellationSignal.createTransport();
         }
 
-        private void enforceReadPermission(Uri uri) {
-            final int uid = Binder.getCallingUid();
-            if (uid == mMyUid) {
-                return;
-            }
-            
+        private boolean hasReadPermission(Uri uri) {
             final Context context = getContext();
-            final String rperm = getReadPermission();
             final int pid = Binder.getCallingPid();
-            if (mExported && (rperm == null
-                    || context.checkPermission(rperm, pid, uid)
-                    == PackageManager.PERMISSION_GRANTED)) {
-                return;
-            }
-            
-            PathPermission[] pps = getPathPermissions();
-            if (pps != null) {
-                final String path = uri.getPath();
-                int i = pps.length;
-                while (i > 0) {
-                    i--;
-                    final PathPermission pp = pps[i];
-                    final String pprperm = pp.getReadPermission();
-                    if (pprperm != null && pp.match(path)) {
-                        if (context.checkPermission(pprperm, pid, uid)
-                                == PackageManager.PERMISSION_GRANTED) {
-                            return;
+            final int uid = Binder.getCallingUid();
+
+            if (uid == mMyUid) {
+                return true;
+
+            } else if (mExported) {
+                final String componentPerm = getReadPermission();
+                if (componentPerm != null
+                        && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
+                    return true;
+                }
+
+                // track if unprotected read is allowed; any denied
+                // <path-permission> below removes this ability
+                boolean allowDefaultRead = (componentPerm == null);
+
+                final PathPermission[] pps = getPathPermissions();
+                if (pps != null) {
+                    final String path = uri.getPath();
+                    for (PathPermission pp : pps) {
+                        final String pathPerm = pp.getReadPermission();
+                        if (pathPerm != null && pp.match(path)) {
+                            if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
+                                return true;
+                            } else {
+                                // any denied <path-permission> means we lose
+                                // default <provider> access.
+                                allowDefaultRead = false;
+                            }
                         }
                     }
                 }
+
+                // if we passed <path-permission> checks above, and no default
+                // <provider> permission, then allow access.
+                if (allowDefaultRead) return true;
             }
-            
-            if (context.checkUriPermission(uri, pid, uid,
-                    Intent.FLAG_GRANT_READ_URI_PERMISSION)
-                    == PackageManager.PERMISSION_GRANTED) {
+
+            // last chance, check against any uri grants
+            if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_READ_URI_PERMISSION)
+                    == PERMISSION_GRANTED) {
+                return true;
+            }
+
+            return false;
+        }
+
+        private void enforceReadPermission(Uri uri) {
+            if (hasReadPermission(uri)) {
                 return;
             }
-            
+
             String msg = "Permission Denial: reading "
                     + ContentProvider.this.getClass().getName()
                     + " uri " + uri + " from pid=" + Binder.getCallingPid()
                     + ", uid=" + Binder.getCallingUid()
-                    + " requires " + rperm;
+                    + " requires " + getReadPermission();
             throw new SecurityException(msg);
         }
 
         private boolean hasWritePermission(Uri uri) {
+            final Context context = getContext();
+            final int pid = Binder.getCallingPid();
             final int uid = Binder.getCallingUid();
+
             if (uid == mMyUid) {
                 return true;
-            }
-            
-            final Context context = getContext();
-            final String wperm = getWritePermission();
-            final int pid = Binder.getCallingPid();
-            if (mExported && (wperm == null
-                    || context.checkPermission(wperm, pid, uid)
-                    == PackageManager.PERMISSION_GRANTED)) {
-                return true;
-            }
-            
-            PathPermission[] pps = getPathPermissions();
-            if (pps != null) {
-                final String path = uri.getPath();
-                int i = pps.length;
-                while (i > 0) {
-                    i--;
-                    final PathPermission pp = pps[i];
-                    final String ppwperm = pp.getWritePermission();
-                    if (ppwperm != null && pp.match(path)) {
-                        if (context.checkPermission(ppwperm, pid, uid)
-                                == PackageManager.PERMISSION_GRANTED) {
-                            return true;
+
+            } else if (mExported) {
+                final String componentPerm = getWritePermission();
+                if (componentPerm != null
+                        && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
+                    return true;
+                }
+
+                // track if unprotected write is allowed; any denied
+                // <path-permission> below removes this ability
+                boolean allowDefaultWrite = (componentPerm == null);
+
+                final PathPermission[] pps = getPathPermissions();
+                if (pps != null) {
+                    final String path = uri.getPath();
+                    for (PathPermission pp : pps) {
+                        final String pathPerm = pp.getWritePermission();
+                        if (pathPerm != null && pp.match(path)) {
+                            if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
+                                return true;
+                            } else {
+                                // any denied <path-permission> means we lose
+                                // default <provider> access.
+                                allowDefaultWrite = false;
+                            }
                         }
                     }
                 }
+
+                // if we passed <path-permission> checks above, and no default
+                // <provider> permission, then allow access.
+                if (allowDefaultWrite) return true;
             }
-            
-            if (context.checkUriPermission(uri, pid, uid,
-                    Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
-                    == PackageManager.PERMISSION_GRANTED) {
+
+            // last chance, check against any uri grants
+            if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
+                    == PERMISSION_GRANTED) {
                 return true;
             }
-            
+
             return false;
         }
         
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 7a612bc..2930998 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -917,7 +917,7 @@
     }
 
     /**
-     * Call an provider-defined method.  This can be used to implement
+     * Call a provider-defined method.  This can be used to implement
      * read or write interfaces which are cheaper than using a Cursor and/or
      * do not fit into the traditional table model.
      *
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 111f45e..0e9e256 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1270,7 +1270,7 @@
     /**
      * Connect to an application service, creating it if needed.  This defines
      * a dependency between your application and the service.  The given
-     * <var>conn</var> will receive the service object when its created and be
+     * <var>conn</var> will receive the service object when it is created and be
      * told if it dies and restarts.  The service will be considered required
      * by the system only for as long as the calling context exists.  For
      * example, if this Context is an Activity that is stopped, the service will
@@ -1279,15 +1279,15 @@
      * <p>This function will throw {@link SecurityException} if you do not
      * have permission to bind to the given service.
      *
-     * <p class="note">Note: this method <em>can not be called from an
+     * <p class="note">Note: this method <em>can not be called from a
      * {@link BroadcastReceiver} component</em>.  A pattern you can use to
-     * communicate from an BroadcastReceiver to a Service is to call
+     * communicate from a BroadcastReceiver to a Service is to call
      * {@link #startService} with the arguments containing the command to be
      * sent, with the service calling its
      * {@link android.app.Service#stopSelf(int)} method when done executing
      * that command.  See the API demo App/Service/Service Start Arguments
      * Controller for an illustration of this.  It is okay, however, to use
-     * this method from an BroadcastReceiver that has been registered with
+     * this method from a BroadcastReceiver that has been registered with
      * {@link #registerReceiver}, since the lifetime of this BroadcastReceiver
      * is tied to another object (the one that registered it).</p>
      *
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 5739119..6cf5b43 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -843,10 +843,10 @@
      * just say what kind of data is desired, not a URI of existing data from
      * which the user can pick.  A ACTION_GET_CONTENT could allow the user to
      * create the data as it runs (for example taking a picture or recording a
-     * sound), let them browser over the web and download the desired data,
+     * sound), let them browse over the web and download the desired data,
      * etc.
      * <p>
-     * There are two main ways to use this action: if you want an specific kind
+     * There are two main ways to use this action: if you want a specific kind
      * of data, such as a person contact, you set the MIME type to the kind of
      * data you want and launch it with {@link Context#startActivity(Intent)}.
      * The system will then launch the best application to select that kind
@@ -864,12 +864,12 @@
      * broad MIME type (such as image/* or {@literal *}/*), resulting in a
      * broad range of content types the user can select from.
      * <p>
-     * When using such a broad GET_CONTENT action, it is often desireable to
+     * When using such a broad GET_CONTENT action, it is often desirable to
      * only pick from data that can be represented as a stream.  This is
      * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent.
      * <p>
      * Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that
-     * the launched content chooser only return results representing data that
+     * the launched content chooser only returns results representing data that
      * is locally available on the device.  For example, if this extra is set
      * to true then an image picker should not show any pictures that are available
      * from a remote server but not already on the local device (thus requiring
@@ -1908,14 +1908,14 @@
     // location; they are not general-purpose actions.
 
     /**
-     * Broadcast Action: An GTalk connection has been established.
+     * Broadcast Action: A GTalk connection has been established.
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_GTALK_SERVICE_CONNECTED =
             "android.intent.action.GTALK_CONNECTED";
 
     /**
-     * Broadcast Action: An GTalk connection has been disconnected.
+     * Broadcast Action: A GTalk connection has been disconnected.
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_GTALK_SERVICE_DISCONNECTED =
@@ -2200,7 +2200,7 @@
     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
     public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
     /**
-     * Intended to be used as a tab inside of an containing TabActivity.
+     * Intended to be used as a tab inside of a containing TabActivity.
      */
     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
     public static final String CATEGORY_TAB = "android.intent.category.TAB";
@@ -2256,7 +2256,7 @@
      */
     public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST";
     /**
-     * To be used as an sample code example (not part of the normal user
+     * To be used as a sample code example (not part of the normal user
      * experience).
      */
     public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE";
@@ -2506,7 +2506,7 @@
     public static final String EXTRA_KEY_CONFIRM = "android.intent.extra.KEY_CONFIRM";
 
     /**
-     * Used as an boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or
+     * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or
      * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} intents to override the default action
      * of restarting the application.
      */
@@ -3704,7 +3704,7 @@
     }
 
     /**
-     * Check if an category exists in the intent.
+     * Check if a category exists in the intent.
      *
      * @param category The category to check.
      *
@@ -4623,7 +4623,7 @@
 
     /**
      * Add a new category to the intent.  Categories provide additional detail
-     * about the action the intent is perform.  When resolving an intent, only
+     * about the action the intent performs.  When resolving an intent, only
      * activities that provide <em>all</em> of the requested categories will be
      * used.
      *
@@ -4646,7 +4646,7 @@
     }
 
     /**
-     * Remove an category from an intent.
+     * Remove a category from an intent.
      *
      * @param category The category to remove.
      *
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f2133d8..544bd9c 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -119,7 +119,7 @@
      * {@link PackageInfo} flag: return the
      * {@link PackageInfo#gids group ids} that are associated with an
      * application.
-     * This applies for any API returning an PackageInfo class, either
+     * This applies for any API returning a PackageInfo class, either
      * directly or nested inside of another.
      */
     public static final int GET_GIDS                    = 0x00000100;
@@ -142,7 +142,7 @@
      * {@link ProviderInfo} flag: return the
      * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
      * that are associated with a content provider.
-     * This applies for any API returning an ProviderInfo class, either
+     * This applies for any API returning a ProviderInfo class, either
      * directly or nested inside of another.
      */
     public static final int GET_URI_PERMISSION_PATTERNS  = 0x00000800;
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index e88ee02..207f077 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -89,11 +89,25 @@
             this.fileVersion = fileVersion;
         }
     }
-    
+
+    /** @hide */
+    public static class SplitPermissionInfo {
+        public final String rootPerm;
+        public final String[] newPerms;
+
+        public SplitPermissionInfo(String rootPerm, String[] newPerms) {
+            this.rootPerm = rootPerm;
+            this.newPerms = newPerms;
+        }
+    }
+
     /**
      * List of new permissions that have been added since 1.0.
      * NOTE: These must be declared in SDK version order, with permissions
      * added to older SDKs appearing before those added to newer SDKs.
+     * If sdkVersion is 0, then this is not a permission that we want to
+     * automatically add to older apps, but we do want to allow it to be
+     * granted during a platform update.
      * @hide
      */
     public static final PackageParser.NewPermissionInfo NEW_PERMISSIONS[] =
@@ -104,6 +118,17 @@
                     android.os.Build.VERSION_CODES.DONUT, 0)
     };
 
+    /**
+     * List of permissions that have been split into more granular or dependent
+     * permissions.
+     * @hide
+     */
+    public static final PackageParser.SplitPermissionInfo SPLIT_PERMISSIONS[] =
+        new PackageParser.SplitPermissionInfo[] {
+            new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
+                    new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE })
+    };
+
     private String mArchiveSourcePath;
     private String[] mSeparateProcesses;
     private boolean mOnlyCoreApps;
@@ -1245,7 +1270,23 @@
         if (implicitPerms != null) {
             Slog.i(TAG, implicitPerms.toString());
         }
-        
+
+        final int NS = PackageParser.SPLIT_PERMISSIONS.length;
+        for (int is=0; is<NS; is++) {
+            final PackageParser.SplitPermissionInfo spi
+                    = PackageParser.SPLIT_PERMISSIONS[is];
+            if (!pkg.requestedPermissions.contains(spi.rootPerm)) {
+                break;
+            }
+            for (int in=0; in<spi.newPerms.length; in++) {
+                final String perm = spi.newPerms[in];
+                if (!pkg.requestedPermissions.contains(perm)) {
+                    pkg.requestedPermissions.add(perm);
+                    pkg.requestedPermissionsRequired.add(Boolean.TRUE);
+                }
+            }
+        }
+
         if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
                 && pkg.applicationInfo.targetSdkVersion
                         >= android.os.Build.VERSION_CODES.DONUT)) {
diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java
index 94a23cb..e9b06c6 100644
--- a/core/java/android/database/sqlite/SQLiteProgram.java
+++ b/core/java/android/database/sqlite/SQLiteProgram.java
@@ -64,19 +64,19 @@
                 break;
         }
 
-        if (mNumParameters != 0) {
-            mBindArgs = new Object[mNumParameters];
-        } else {
-            mBindArgs = null;
+        if (bindArgs != null && bindArgs.length > mNumParameters) {
+            throw new IllegalArgumentException("Too many bind arguments.  "
+                    + bindArgs.length + " arguments were provided but the statement needs "
+                    + mNumParameters + " arguments.");
         }
 
-        if (bindArgs != null) {
-            if (bindArgs.length > mNumParameters) {
-                throw new IllegalArgumentException("Too many bind arguments.  "
-                        + bindArgs.length + " arguments were provided but the statement needs "
-                        + mNumParameters + " arguments.");
+        if (mNumParameters != 0) {
+            mBindArgs = new Object[mNumParameters];
+            if (bindArgs != null) {
+                System.arraycopy(bindArgs, 0, mBindArgs, 0, bindArgs.length);
             }
-            System.arraycopy(bindArgs, 0, mBindArgs, 0, bindArgs.length);
+        } else {
+            mBindArgs = null;
         }
     }
 
diff --git a/core/java/android/emoji/EmojiFactory.java b/core/java/android/emoji/EmojiFactory.java
index e0b12ae..8fd8695 100644
--- a/core/java/android/emoji/EmojiFactory.java
+++ b/core/java/android/emoji/EmojiFactory.java
@@ -33,7 +33,7 @@
     
     private int sCacheSize = 100;
     
-    // HashMap for caching Bitmap object. In order not to make an cache object
+    // HashMap for caching Bitmap object. In order not to make a cache object
     // blow up, we use LinkedHashMap with size limit.
     private class CustomLinkedHashMap<K, V> extends LinkedHashMap<K, V> {
         public CustomLinkedHashMap() {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 573e6ea..fbcbb32 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1358,7 +1358,7 @@
     /**
      * Returns an empty {@link Parameters} for testing purpose.
      *
-     * @return an Parameter object.
+     * @return a Parameter object.
      *
      * @hide
      */
@@ -1907,12 +1907,12 @@
          * @param value the String value of the parameter
          */
         public void set(String key, String value) {
-            if (key.indexOf('=') != -1 || key.indexOf(';') != -1) {
-                Log.e(TAG, "Key \"" + key + "\" contains invalid character (= or ;)");
+            if (key.indexOf('=') != -1 || key.indexOf(';') != -1 || key.indexOf(0) != -1) {
+                Log.e(TAG, "Key \"" + key + "\" contains invalid character (= or ; or \\0)");
                 return;
             }
-            if (value.indexOf('=') != -1 || value.indexOf(';') != -1) {
-                Log.e(TAG, "Value \"" + value + "\" contains invalid character (= or ;)");
+            if (value.indexOf('=') != -1 || value.indexOf(';') != -1 || value.indexOf(0) != -1) {
+                Log.e(TAG, "Value \"" + value + "\" contains invalid character (= or ; or \\0)");
                 return;
             }
 
@@ -3127,7 +3127,7 @@
         public void getFocusDistances(float[] output) {
             if (output == null || output.length != 3) {
                 throw new IllegalArgumentException(
-                        "output must be an float array with three elements.");
+                        "output must be a float array with three elements.");
             }
             splitFloat(get(KEY_FOCUS_DISTANCES), output);
         }
diff --git a/core/java/android/hardware/Sensor.java b/core/java/android/hardware/Sensor.java
index 68fc101..63fb32d 100644
--- a/core/java/android/hardware/Sensor.java
+++ b/core/java/android/hardware/Sensor.java
@@ -57,7 +57,7 @@
     public static final int TYPE_GYROSCOPE = 4;
 
     /**
-     * A constant describing an light sensor type. See
+     * A constant describing a light sensor type. See
      * {@link android.hardware.SensorEvent#values SensorEvent.values} for more
      * details.
      */
@@ -77,7 +77,7 @@
     public static final int TYPE_TEMPERATURE = 7;
 
     /**
-     * A constant describing an proximity sensor type. See
+     * A constant describing a proximity sensor type. See
      * {@link android.hardware.SensorEvent#values SensorEvent.values} for more
      * details.
      */
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 53cdf21..ba7dc4a3 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -2173,7 +2173,7 @@
      * This is called when, while currently displayed in extract mode, the
      * current input target changes.  The default implementation will
      * auto-hide the IME if the new target is not a full editor, since this
-     * can be an confusing experience for the user.
+     * can be a confusing experience for the user.
      */
     public void onExtractingInputChanged(EditorInfo ei) {
         if (ei.inputType == InputType.TYPE_NULL) {
diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java
index 04cf1a3..5b94784 100644
--- a/core/java/android/net/NetworkPolicy.java
+++ b/core/java/android/net/NetworkPolicy.java
@@ -36,6 +36,7 @@
 
     public final NetworkTemplate template;
     public int cycleDay;
+    public String cycleTimezone;
     public long warningBytes;
     public long limitBytes;
     public long lastWarningSnooze;
@@ -44,15 +45,18 @@
 
     private static final long DEFAULT_MTU = 1500;
 
-    public NetworkPolicy(NetworkTemplate template, int cycleDay, long warningBytes,
-            long limitBytes, boolean metered) {
-        this(template, cycleDay, warningBytes, limitBytes, SNOOZE_NEVER, SNOOZE_NEVER, metered);
+    public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
+            long warningBytes, long limitBytes, boolean metered) {
+        this(template, cycleDay, cycleTimezone, warningBytes, limitBytes, SNOOZE_NEVER,
+                SNOOZE_NEVER, metered);
     }
 
-    public NetworkPolicy(NetworkTemplate template, int cycleDay, long warningBytes,
-            long limitBytes, long lastWarningSnooze, long lastLimitSnooze, boolean metered) {
+    public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
+            long warningBytes, long limitBytes, long lastWarningSnooze, long lastLimitSnooze,
+            boolean metered) {
         this.template = checkNotNull(template, "missing NetworkTemplate");
         this.cycleDay = cycleDay;
+        this.cycleTimezone = checkNotNull(cycleTimezone, "missing cycleTimezone");
         this.warningBytes = warningBytes;
         this.limitBytes = limitBytes;
         this.lastWarningSnooze = lastWarningSnooze;
@@ -63,6 +67,7 @@
     public NetworkPolicy(Parcel in) {
         template = in.readParcelable(null);
         cycleDay = in.readInt();
+        cycleTimezone = in.readString();
         warningBytes = in.readLong();
         limitBytes = in.readLong();
         lastWarningSnooze = in.readLong();
@@ -70,10 +75,11 @@
         metered = in.readInt() != 0;
     }
 
-    /** {@inheritDoc} */
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeParcelable(template, flags);
         dest.writeInt(cycleDay);
+        dest.writeString(cycleTimezone);
         dest.writeLong(warningBytes);
         dest.writeLong(limitBytes);
         dest.writeLong(lastWarningSnooze);
@@ -81,7 +87,7 @@
         dest.writeInt(metered ? 1 : 0);
     }
 
-    /** {@inheritDoc} */
+    @Override
     public int describeContents() {
         return 0;
     }
@@ -112,7 +118,7 @@
         lastLimitSnooze = SNOOZE_NEVER;
     }
 
-    /** {@inheritDoc} */
+    @Override
     public int compareTo(NetworkPolicy another) {
         if (another == null || another.limitBytes == LIMIT_DISABLED) {
             // other value is missing or disabled; we win
@@ -127,8 +133,8 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(template, cycleDay, warningBytes, limitBytes, lastWarningSnooze,
-                lastLimitSnooze, metered);
+        return Objects.hashCode(template, cycleDay, cycleTimezone, warningBytes, limitBytes,
+                lastWarningSnooze, lastLimitSnooze, metered);
     }
 
     @Override
@@ -139,6 +145,7 @@
                     && limitBytes == other.limitBytes
                     && lastWarningSnooze == other.lastWarningSnooze
                     && lastLimitSnooze == other.lastLimitSnooze && metered == other.metered
+                    && Objects.equal(cycleTimezone, other.cycleTimezone)
                     && Objects.equal(template, other.template);
         }
         return false;
@@ -146,17 +153,19 @@
 
     @Override
     public String toString() {
-        return "NetworkPolicy[" + template + "]: cycleDay=" + cycleDay + ", warningBytes="
-                + warningBytes + ", limitBytes=" + limitBytes + ", lastWarningSnooze="
-                + lastWarningSnooze + ", lastLimitSnooze=" + lastLimitSnooze + ", metered="
-                + metered;
+        return "NetworkPolicy[" + template + "]: cycleDay=" + cycleDay + ", cycleTimezone="
+                + cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes
+                + ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze="
+                + lastLimitSnooze + ", metered=" + metered;
     }
 
     public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
+        @Override
         public NetworkPolicy createFromParcel(Parcel in) {
             return new NetworkPolicy(in);
         }
 
+        @Override
         public NetworkPolicy[] newArray(int size) {
             return new NetworkPolicy[size];
         }
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index 9d253c7..7173751 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -131,7 +131,7 @@
      * @hide
      */
     public static long computeLastCycleBoundary(long currentTime, NetworkPolicy policy) {
-        final Time now = new Time(Time.TIMEZONE_UTC);
+        final Time now = new Time(policy.cycleTimezone);
         now.set(currentTime);
 
         // first, find cycle boundary for current month
@@ -157,7 +157,7 @@
 
     /** {@hide} */
     public static long computeNextCycleBoundary(long currentTime, NetworkPolicy policy) {
-        final Time now = new Time(Time.TIMEZONE_UTC);
+        final Time now = new Time(policy.cycleTimezone);
         now.set(currentTime);
 
         // first, find cycle boundary for current month
@@ -183,7 +183,7 @@
 
     /**
      * Snap to the cycle day for the current month given; when cycle day doesn't
-     * exist, it snaps to 1st of following month.
+     * exist, it snaps to last second of current month.
      *
      * @hide
      */
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 863304c..1cd73d2 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -64,7 +64,7 @@
     public static final int SSL_MAX_ERROR = 6;
 
     /**
-     * The SSL error set bitfield (each individual error is an bit index;
+     * The SSL error set bitfield (each individual error is a bit index;
      * multiple individual errors can be OR-ed)
      */
     int mErrors;
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 1507387..788ab74 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -458,7 +458,7 @@
     }
 
     /**
-     * Write an byte array into the parcel at the current {@link #dataPosition},
+     * Write a byte array into the parcel at the current {@link #dataPosition},
      * growing {@link #dataCapacity} if needed.
      * @param b Bytes to place into the parcel.
      * @param offset Index of first byte to be written.
@@ -553,7 +553,7 @@
     }
 
     /**
-     * Write an byte value into the parcel at the current dataPosition(),
+     * Write a byte value into the parcel at the current dataPosition(),
      * growing dataCapacity() if needed.
      */
     public final void writeByte(byte val) {
diff --git a/core/java/android/os/ParcelUuid.java b/core/java/android/os/ParcelUuid.java
index 88fcfc5..2c68ddd 100644
--- a/core/java/android/os/ParcelUuid.java
+++ b/core/java/android/os/ParcelUuid.java
@@ -42,7 +42,7 @@
      *
      * @param uuid
      *            the UUID string to parse.
-     * @return an ParcelUuid instance.
+     * @return a ParcelUuid instance.
      * @throws NullPointerException
      *             if {@code uuid} is {@code null}.
      * @throws IllegalArgumentException
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
new file mode 100644
index 0000000..af94a37
--- /dev/null
+++ b/core/java/android/os/Trace.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 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.os;
+
+/**
+ * Writes trace events to the kernel trace buffer.  These trace events can be
+ * collected using the "atrace" program for offline analysis.
+ *
+ * This tracing mechanism is independent of the method tracing mechanism
+ * offered by {@link Debug#startMethodTracing}.  In particular, it enables
+ * tracing of events that occur across processes.
+ *
+ * @hide
+ */
+public final class Trace {
+    // These tags must be kept in sync with frameworks/native/include/utils/Trace.h.
+    public static final long TRACE_TAG_NEVER = 0;
+    public static final long TRACE_TAG_ALWAYS = 1L << 0;
+    public static final long TRACE_TAG_GRAPHICS = 1L << 1;
+    public static final long TRACE_TAG_INPUT = 1L << 2;
+    public static final long TRACE_TAG_VIEW = 1L << 3;
+
+    private static final long sEnabledTags = nativeGetEnabledTags();
+
+    private static native long nativeGetEnabledTags();
+    private static native void nativeTraceCounter(long tag, String name, int value);
+    private static native void nativeTraceBegin(long tag, String name);
+    private static native void nativeTraceEnd(long tag);
+
+    private Trace() {
+    }
+
+    /**
+     * Returns true if a trace tag is enabled.
+     *
+     * @param traceTag The trace tag to check.
+     * @return True if the trace tag is valid.
+     */
+    public static boolean isTagEnabled(long traceTag) {
+        return (sEnabledTags & traceTag) != 0;
+    }
+
+    /**
+     * Writes trace message to indicate the value of a given counter.
+     *
+     * @param traceTag The trace tag.
+     * @param counterName The counter name to appear in the trace.
+     * @param counterValue The counter value.
+     */
+    public static void traceCounter(long traceTag, String counterName, int counterValue) {
+        if ((sEnabledTags & traceTag) != 0) {
+            nativeTraceCounter(traceTag, counterName, counterValue);
+        }
+    }
+
+    /**
+     * Writes a trace message to indicate that a given method has begun.
+     * Must be followed by a call to {@link #traceEnd} using the same tag.
+     *
+     * @param traceTag The trace tag.
+     * @param methodName The method name to appear in the trace.
+     */
+    public static void traceBegin(long traceTag, String methodName) {
+        if ((sEnabledTags & traceTag) != 0) {
+            nativeTraceBegin(traceTag, methodName);
+        }
+    }
+
+    /**
+     * Writes a trace message to indicate that the current method has ended.
+     * Must be called exactly once for each call to {@link #traceBegin} using the same tag.
+     *
+     * @param traceTag The trace tag.
+     */
+    public static void traceEnd(long traceTag) {
+        if ((sEnabledTags & traceTag) != 0) {
+            nativeTraceEnd(traceTag);
+        }
+    }
+}
diff --git a/core/java/android/provider/Contacts.java b/core/java/android/provider/Contacts.java
index a29ecb5..c7e3c08 100644
--- a/core/java/android/provider/Contacts.java
+++ b/core/java/android/provider/Contacts.java
@@ -84,7 +84,7 @@
     @Deprecated
     public static final int KIND_ORGANIZATION = 4;
     /**
-     * Signifies an Phone row that is stored in the Phones table
+     * Signifies a Phone row that is stored in the Phones table
      * @deprecated see {@link android.provider.ContactsContract}
      */
     @Deprecated
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 6c6b118..38945c2 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -192,7 +192,7 @@
 
     /**
      * Standard Intent action that can be sent to have the camera application
-     * capture an video and return it.
+     * capture a video and return it.
      * <p>
      * The caller may pass in an extra EXTRA_VIDEO_QUALITY to control the video quality.
      * <p>
@@ -441,12 +441,12 @@
             public static final int MEDIA_TYPE_AUDIO = 2;
 
             /**
-             * Constant for the {@link #MEDIA_TYPE} column indicating that file is an video file.
+             * Constant for the {@link #MEDIA_TYPE} column indicating that file is a video file.
              */
             public static final int MEDIA_TYPE_VIDEO = 3;
 
             /**
-             * Constant for the {@link #MEDIA_TYPE} column indicating that file is an playlist file.
+             * Constant for the {@link #MEDIA_TYPE} column indicating that file is a playlist file.
              */
             public static final int MEDIA_TYPE_PLAYLIST = 4;
         }
diff --git a/core/java/android/server/BluetoothBondState.java b/core/java/android/server/BluetoothBondState.java
index fbc1c27..0446f02 100644
--- a/core/java/android/server/BluetoothBondState.java
+++ b/core/java/android/server/BluetoothBondState.java
@@ -140,7 +140,7 @@
             return;
         }
 
-        // Check if this was an pending outgoing bonding.
+        // Check if this was a pending outgoing bonding.
         // If yes, reset the state.
         if (oldState == BluetoothDevice.BOND_BONDING) {
             if (address.equals(mPendingOutgoingBonding)) {
diff --git a/core/java/android/text/method/BaseMovementMethod.java b/core/java/android/text/method/BaseMovementMethod.java
index f554b90..113a4be 100644
--- a/core/java/android/text/method/BaseMovementMethod.java
+++ b/core/java/android/text/method/BaseMovementMethod.java
@@ -350,7 +350,7 @@
     }
 
     /**
-     * Performs an line-end movement action.
+     * Performs a line-end movement action.
      * Moves the cursor or scrolls to the end of the line.
      *
      * @param widget The text view.
diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java
index 9953252..60526e1 100644
--- a/core/java/android/util/LocaleUtil.java
+++ b/core/java/android/util/LocaleUtil.java
@@ -24,7 +24,6 @@
 /**
  * Various utilities for Locales
  *
- * @hide
  */
 public class LocaleUtil {
 
@@ -41,9 +40,7 @@
      * {@link View#LAYOUT_DIRECTION_LTR} or
      * {@link View#LAYOUT_DIRECTION_RTL}.
      *
-     * Be careful: this code will need to be changed when vertical scripts will be supported
-     *
-     * @hide
+     * Be careful: this code will need to be updated when vertical scripts will be supported
      */
     public static int getLayoutDirectionFromLocale(Locale locale) {
         if (locale != null && !locale.equals(Locale.ROOT)) {
@@ -69,7 +66,7 @@
      * {@link View#LAYOUT_DIRECTION_LTR} or
      * {@link View#LAYOUT_DIRECTION_RTL}.
      *
-     * Be careful: this code will need to be changed when vertical scripts will be supported
+     * Be careful: this code will need to be updated when vertical scripts will be supported
      *
      * @hide
      */
diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java
index 10edc06..d217cab 100644
--- a/core/java/android/view/Choreographer.java
+++ b/core/java/android/view/Choreographer.java
@@ -92,8 +92,8 @@
 
     private Callback mCallbackPool;
 
-    private Callback mAnimationCallbacks;
-    private Callback mDrawCallbacks;
+    private final CallbackQueue mAnimationCallbackQueue = new CallbackQueue();
+    private final CallbackQueue mDrawCallbackQueue = new CallbackQueue();
 
     private boolean mAnimationScheduled;
     private boolean mDrawScheduled;
@@ -205,10 +205,15 @@
             throw new IllegalArgumentException("action must not be null");
         }
 
+        if (DEBUG) {
+            Log.d(TAG, "PostAnimationCallback: " + action + ", token=" + token
+                    + ", delayMillis=" + delayMillis);
+        }
+
         synchronized (mLock) {
             final long now = SystemClock.uptimeMillis();
             final long dueTime = now + delayMillis;
-            mAnimationCallbacks = addCallbackLocked(mAnimationCallbacks, dueTime, action, token);
+            mAnimationCallbackQueue.addCallbackLocked(dueTime, action, token);
 
             if (dueTime <= now) {
                 scheduleAnimationLocked(now);
@@ -231,8 +236,12 @@
      * @see #postAnimationCallbackDelayed
      */
     public void removeAnimationCallbacks(Runnable action, Object token) {
+        if (DEBUG) {
+            Log.d(TAG, "RemoveAnimationCallbacks: " + action + ", token=" + token);
+        }
+
         synchronized (mLock) {
-            mAnimationCallbacks = removeCallbacksLocked(mAnimationCallbacks, action, token);
+            mAnimationCallbackQueue.removeCallbacksLocked(action, token);
             if (action != null && token == null) {
                 mHandler.removeMessages(MSG_DO_SCHEDULE_ANIMATION, action);
             }
@@ -268,10 +277,15 @@
             throw new IllegalArgumentException("action must not be null");
         }
 
+        if (DEBUG) {
+            Log.d(TAG, "PostDrawCallback: " + action + ", token=" + token
+                    + ", delayMillis=" + delayMillis);
+        }
+
         synchronized (mLock) {
             final long now = SystemClock.uptimeMillis();
             final long dueTime = now + delayMillis;
-            mDrawCallbacks = addCallbackLocked(mDrawCallbacks, dueTime, action, token);
+            mDrawCallbackQueue.addCallbackLocked(dueTime, action, token);
             scheduleDrawLocked(now);
 
             if (dueTime <= now) {
@@ -295,8 +309,12 @@
      * @see #postDrawCallbackDelayed
      */
     public void removeDrawCallbacks(Runnable action, Object token) {
+        if (DEBUG) {
+            Log.d(TAG, "RemoveDrawCallbacks: " + action + ", token=" + token);
+        }
+
         synchronized (mLock) {
-            mDrawCallbacks = removeCallbacksLocked(mDrawCallbacks, action, token);
+            mDrawCallbackQueue.removeCallbacksLocked(action, token);
             if (action != null && token == null) {
                 mHandler.removeMessages(MSG_DO_SCHEDULE_DRAW, action);
             }
@@ -373,24 +391,7 @@
             }
             mLastAnimationTime = start;
 
-            callbacks = mAnimationCallbacks;
-            if (callbacks != null) {
-                if (callbacks.dueTime > start) {
-                    callbacks = null;
-                } else {
-                    Callback predecessor = callbacks;
-                    Callback successor = predecessor.next;
-                    while (successor != null) {
-                        if (successor.dueTime > start) {
-                            predecessor.next = null;
-                            break;
-                        }
-                        predecessor = successor;
-                        successor = successor.next;
-                    }
-                    mAnimationCallbacks = successor;
-                }
-            }
+            callbacks = mAnimationCallbackQueue.extractDueCallbacksLocked(start);
         }
 
         if (callbacks != null) {
@@ -421,24 +422,7 @@
             }
             mLastDrawTime = start;
 
-            callbacks = mDrawCallbacks;
-            if (callbacks != null) {
-                if (callbacks.dueTime > start) {
-                    callbacks = null;
-                } else {
-                    Callback predecessor = callbacks;
-                    Callback successor = predecessor.next;
-                    while (successor != null) {
-                        if (successor.dueTime > start) {
-                            predecessor.next = null;
-                            break;
-                        }
-                        predecessor = successor;
-                        successor = successor.next;
-                    }
-                    mDrawCallbacks = successor;
-                }
-            }
+            callbacks = mDrawCallbackQueue.extractDueCallbacksLocked(start);
         }
 
         if (callbacks != null) {
@@ -464,7 +448,7 @@
     void doScheduleAnimation() {
         synchronized (mLock) {
             final long now = SystemClock.uptimeMillis();
-            if (mAnimationCallbacks != null && mAnimationCallbacks.dueTime <= now) {
+            if (mAnimationCallbackQueue.hasDueCallbacksLocked(now)) {
                 scheduleAnimationLocked(now);
             }
         }
@@ -473,7 +457,7 @@
     void doScheduleDraw() {
         synchronized (mLock) {
             final long now = SystemClock.uptimeMillis();
-            if (mDrawCallbacks != null && mDrawCallbacks.dueTime <= now) {
+            if (mDrawCallbackQueue.hasDueCallbacksLocked(now)) {
                 scheduleDrawLocked(now);
             }
         }
@@ -487,50 +471,12 @@
         return Looper.myLooper() == mLooper;
     }
 
-    private Callback addCallbackLocked(Callback head,
-            long dueTime, Runnable action, Object token) {
-        Callback callback = obtainCallbackLocked(dueTime, action, token);
-        if (head == null) {
-            return callback;
-        }
-        Callback entry = head;
-        if (dueTime < entry.dueTime) {
-            callback.next = entry;
-            return callback;
-        }
-        while (entry.next != null) {
-            if (dueTime < entry.next.dueTime) {
-                callback.next = entry.next;
-                break;
-            }
-            entry = entry.next;
-        }
-        entry.next = callback;
-        return head;
-    }
-
-    private Callback removeCallbacksLocked(Callback head, Runnable action, Object token) {
-        Callback predecessor = null;
-        for (Callback callback = head; callback != null;) {
-            final Callback next = callback.next;
-            if ((action == null || callback.action == action)
-                    && (token == null || callback.token == token)) {
-                if (predecessor != null) {
-                    predecessor.next = next;
-                } else {
-                    head = next;
-                }
-                recycleCallbackLocked(callback);
-            } else {
-                predecessor = callback;
-            }
-            callback = next;
-        }
-        return head;
-    }
-
     private void runCallbacks(Callback head) {
         while (head != null) {
+            if (DEBUG) {
+                Log.d(TAG, "RunCallback: " + head.action + ", token=" + head.token
+                        + ", waitMillis=" + (SystemClock.uptimeMillis() - head.dueTime));
+            }
             head.action.run();
             head = head.next;
         }
@@ -609,4 +555,73 @@
         public Runnable action;
         public Object token;
     }
+
+    private final class CallbackQueue {
+        private Callback mHead;
+
+        public boolean hasDueCallbacksLocked(long now) {
+            return mHead != null && mHead.dueTime <= now;
+        }
+
+        public Callback extractDueCallbacksLocked(long now) {
+            Callback callbacks = mHead;
+            if (callbacks == null || callbacks.dueTime > now) {
+                return null;
+            }
+
+            Callback last = callbacks;
+            Callback next = last.next;
+            while (next != null) {
+                if (next.dueTime > now) {
+                    last.next = null;
+                    break;
+                }
+                last = next;
+                next = next.next;
+            }
+            mHead = next;
+            return callbacks;
+        }
+
+        public void addCallbackLocked(long dueTime, Runnable action, Object token) {
+            Callback callback = obtainCallbackLocked(dueTime, action, token);
+            Callback entry = mHead;
+            if (entry == null) {
+                mHead = callback;
+                return;
+            }
+            if (dueTime < entry.dueTime) {
+                callback.next = entry;
+                mHead = callback;
+                return;
+            }
+            while (entry.next != null) {
+                if (dueTime < entry.next.dueTime) {
+                    callback.next = entry.next;
+                    break;
+                }
+                entry = entry.next;
+            }
+            entry.next = callback;
+        }
+
+        public void removeCallbacksLocked(Runnable action, Object token) {
+            Callback predecessor = null;
+            for (Callback callback = mHead; callback != null;) {
+                final Callback next = callback.next;
+                if ((action == null || callback.action == action)
+                        && (token == null || callback.token == token)) {
+                    if (predecessor != null) {
+                        predecessor.next = next;
+                    } else {
+                        mHead = next;
+                    }
+                    recycleCallbackLocked(callback);
+                } else {
+                    predecessor = callback;
+                }
+                callback = next;
+            }
+        }
+    }
 }
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
index f60c8f0..a50f09f 100644
--- a/core/java/android/view/DisplayList.java
+++ b/core/java/android/view/DisplayList.java
@@ -70,4 +70,204 @@
      * @return The size of this display list in bytes
      */
     public abstract int getSize();
+
+    ///////////////////////////////////////////////////////////////////////////
+    // DisplayList Property Setters
+    ///////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Set the caching property on the DisplayList, which indicates whether the DisplayList
+     * holds a layer. Layer DisplayLists should avoid creating an alpha layer, since alpha is
+     * handled in the drawLayer operation directly (and more efficiently).
+     *
+     * @param caching true if the DisplayList represents a hardware layer, false otherwise.
+     */
+    public abstract void setCaching(boolean caching);
+
+    /**
+     * Set whether the DisplayList should clip itself to its bounds. This property is controlled by
+     * the view's parent.
+     *
+     * @param clipChildren true if the DisplayList should clip to its bounds
+     */
+    public abstract void setClipChildren(boolean clipChildren);
+
+    /**
+     * Set the application scale on the DisplayList. This scale is incurred by applications that
+     * are auto-scaled for compatibility reasons. By default, the value is 1 (unscaled).
+     *
+     * @param scale The scaling factor
+     */
+    public abstract void setApplicationScale(float scale);
+
+    /**
+     * Sets the alpha value for the DisplayList
+     *
+     * @param alpha The translucency of the DisplayList
+     * @see View#setAlpha(float)
+     */
+    public abstract void setAlpha(float alpha);
+
+    /**
+     * Sets the translationX value for the DisplayList
+     *
+     * @param translationX The translationX value of the DisplayList
+     * @see View#setTranslationX(float)
+     */
+    public abstract void setTranslationX(float translationX);
+
+    /**
+     * Sets the translationY value for the DisplayList
+     *
+     * @param translationY The translationY value of the DisplayList
+     * @see View#setTranslationY(float)
+     */
+    public abstract void setTranslationY(float translationY);
+
+    /**
+     * Sets the rotation value for the DisplayList
+     *
+     * @param rotation The rotation value of the DisplayList
+     * @see View#setRotation(float)
+     */
+    public abstract void setRotation(float rotation);
+
+    /**
+     * Sets the rotationX value for the DisplayList
+     *
+     * @param rotationX The rotationX value of the DisplayList
+     * @see View#setRotationX(float)
+     */
+    public abstract void setRotationX(float rotationX);
+
+    /**
+     * Sets the rotationY value for the DisplayList
+     *
+     * @param rotationY The rotationY value of the DisplayList
+     * @see View#setRotationY(float)
+     */
+    public abstract void setRotationY(float rotationY);
+
+    /**
+     * Sets the scaleX value for the DisplayList
+     *
+     * @param scaleX The scaleX value of the DisplayList
+     * @see View#setScaleX(float)
+     */
+    public abstract void setScaleX(float scaleX);
+
+    /**
+     * Sets the scaleY value for the DisplayList
+     *
+     * @param scaleY The scaleY value of the DisplayList
+     * @see View#setScaleY(float)
+     */
+    public abstract void setScaleY(float scaleY);
+
+    /**
+     * Sets all of the transform-related values of the View onto the DisplayList
+     *
+     * @param alpha The alpha value of the DisplayList
+     * @param translationX The translationX value of the DisplayList
+     * @param translationY The translationY value of the DisplayList
+     * @param rotation The rotation value of the DisplayList
+     * @param rotationX The rotationX value of the DisplayList
+     * @param rotationY The rotationY value of the DisplayList
+     * @param scaleX The scaleX value of the DisplayList
+     * @param scaleY The scaleY value of the DisplayList
+     */
+    public abstract void setTransformationInfo(float alpha, float translationX, float translationY,
+            float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
+
+    /**
+     * Sets the pivotX value for the DisplayList
+     *
+     * @param pivotX The pivotX value of the DisplayList
+     * @see View#setPivotX(float)
+     */
+    public abstract void setPivotX(float pivotX);
+
+    /**
+     * Sets the pivotY value for the DisplayList
+     *
+     * @param pivotY The pivotY value of the DisplayList
+     * @see View#setPivotY(float)
+     */
+    public abstract void setPivotY(float pivotY);
+
+    /**
+     * Sets the camera distance for the DisplayList
+     *
+     * @param distance The distance in z of the camera of the DisplayList
+     * @see View#setCameraDistance(float)
+     */
+    public abstract void setCameraDistance(float distance);
+
+    /**
+     * Sets the left value for the DisplayList
+     *
+     * @param left The left value of the DisplayList
+     * @see View#setLeft(int)
+     */
+    public abstract void setLeft(int left);
+
+    /**
+     * Sets the top value for the DisplayList
+     *
+     * @param top The top value of the DisplayList
+     * @see View#setTop(int)
+     */
+    public abstract void setTop(int top);
+
+    /**
+     * Sets the right value for the DisplayList
+     *
+     * @param right The right value of the DisplayList
+     * @see View#setRight(int)
+     */
+    public abstract void setRight(int right);
+
+    /**
+     * Sets the bottom value for the DisplayList
+     *
+     * @param bottom The bottom value of the DisplayList
+     * @see View#setBottom(int)
+     */
+    public abstract void setBottom(int bottom);
+
+    /**
+     * Sets the left and top values for the DisplayList
+     *
+     * @param left The left value of the DisplayList
+     * @param top The top value of the DisplayList
+     * @see View#setLeft(int)
+     * @see View#setTop(int)
+     */
+    public abstract void setLeftTop(int left, int top);
+
+    /**
+     * Sets the left and top values for the DisplayList
+     *
+     * @param left The left value of the DisplayList
+     * @param top The top value of the DisplayList
+     * @see View#setLeft(int)
+     * @see View#setTop(int)
+     */
+    public abstract void setLeftTopRightBottom(int left, int top, int right, int bottom);
+
+    /**
+     * Offsets the left and right values for the DisplayList
+     *
+     * @param offset The amount that the left and right values of the DisplayList are offset
+     * @see View#offsetLeftAndRight(int)
+     */
+    public abstract void offsetLeftRight(int offset);
+
+    /**
+     * Offsets the top and bottom values for the DisplayList
+     *
+     * @param offset The amount that the top and bottom values of the DisplayList are offset
+     * @see View#offsetTopAndBottom(int)
+     */
+    public abstract void offsetTopBottom(int offset);
 }
diff --git a/core/java/android/view/GLES20DisplayList.java b/core/java/android/view/GLES20DisplayList.java
index 969c9ab..9b4cf21 100644
--- a/core/java/android/view/GLES20DisplayList.java
+++ b/core/java/android/view/GLES20DisplayList.java
@@ -96,6 +96,251 @@
         return GLES20Canvas.getDisplayListSize(mFinalizer.mNativeDisplayList);
     }
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Native View Properties
+    ///////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void setCaching(boolean caching) {
+        try {
+            nSetCaching(getNativeDisplayList(), caching);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setClipChildren(boolean clipChildren) {
+        try {
+            nSetClipChildren(getNativeDisplayList(), clipChildren);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setApplicationScale(float scale) {
+        try {
+            nSetApplicationScale(getNativeDisplayList(), scale);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setAlpha(float alpha) {
+        try {
+            nSetAlpha(getNativeDisplayList(), alpha);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setTranslationX(float translationX) {
+        try {
+            nSetTranslationX(getNativeDisplayList(), translationX);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setTranslationY(float translationY) {
+        try {
+            nSetTranslationY(getNativeDisplayList(), translationY);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setRotation(float rotation) {
+        try {
+            nSetRotation(getNativeDisplayList(), rotation);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setRotationX(float rotationX) {
+        try {
+            nSetRotationX(getNativeDisplayList(), rotationX);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setRotationY(float rotationY) {
+        try {
+            nSetRotationY(getNativeDisplayList(), rotationY);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setScaleX(float scaleX) {
+        try {
+            nSetScaleX(getNativeDisplayList(), scaleX);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setScaleY(float scaleY) {
+        try {
+            nSetScaleY(getNativeDisplayList(), scaleY);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setTransformationInfo(float alpha, float translationX, float translationY,
+            float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
+        try {
+            nSetTransformationInfo(getNativeDisplayList(), alpha, translationX, translationY,
+                    rotation, rotationX, rotationY, scaleX, scaleY);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setPivotX(float pivotX) {
+        try {
+            nSetPivotX(getNativeDisplayList(), pivotX);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setPivotY(float pivotY) {
+        try {
+            nSetPivotY(getNativeDisplayList(), pivotY);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setCameraDistance(float distance) {
+        try {
+            nSetCameraDistance(getNativeDisplayList(), distance);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setLeft(int left) {
+        try {
+            nSetLeft(getNativeDisplayList(), left);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setTop(int top) {
+        try {
+            nSetTop(getNativeDisplayList(), top);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setRight(int right) {
+        try {
+            nSetRight(getNativeDisplayList(), right);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setBottom(int bottom) {
+        try {
+            nSetBottom(getNativeDisplayList(), bottom);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setLeftTop(int left, int top) {
+        try {
+            nSetLeftTop(getNativeDisplayList(), left, top);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
+        try {
+            nSetLeftTopRightBottom(getNativeDisplayList(), left, top, right, bottom);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void offsetLeftRight(int offset) {
+        try {
+            nOffsetLeftRight(getNativeDisplayList(), offset);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    @Override
+    public void offsetTopBottom(int offset) {
+        try {
+            nOffsetTopBottom(getNativeDisplayList(), offset);
+        } catch (IllegalStateException e) {
+            // invalid DisplayList okay: we'll set current values the next time we render to it
+        }
+    }
+
+    private static native void nOffsetTopBottom(int displayList, int offset);
+    private static native void nOffsetLeftRight(int displayList, int offset);
+    private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
+            int right, int bottom);
+    private static native void nSetLeftTop(int displayList, int left, int top);
+    private static native void nSetBottom(int displayList, int bottom);
+    private static native void nSetRight(int displayList, int right);
+    private static native void nSetTop(int displayList, int top);
+    private static native void nSetLeft(int displayList, int left);
+    private static native void nSetCameraDistance(int displayList, float distance);
+    private static native void nSetPivotY(int displayList, float pivotY);
+    private static native void nSetPivotX(int displayList, float pivotX);
+    private static native void nSetCaching(int displayList, boolean caching);
+    private static native void nSetClipChildren(int displayList, boolean clipChildren);
+    private static native void nSetApplicationScale(int displayList, float scale);
+    private static native void nSetAlpha(int displayList, float alpha);
+    private static native void nSetTranslationX(int displayList, float translationX);
+    private static native void nSetTranslationY(int displayList, float translationY);
+    private static native void nSetRotation(int displayList, float rotation);
+    private static native void nSetRotationX(int displayList, float rotationX);
+    private static native void nSetRotationY(int displayList, float rotationY);
+    private static native void nSetScaleX(int displayList, float scaleX);
+    private static native void nSetScaleY(int displayList, float scaleY);
+    private static native void nSetTransformationInfo(int displayList, float alpha,
+            float translationX, float translationY, float rotation, float rotationX,
+            float rotationY, float scaleX, float scaleY);
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Finalization
+    ///////////////////////////////////////////////////////////////////////////
+
     private static class DisplayListFinalizer {
         final int mNativeDisplayList;
 
diff --git a/core/java/android/view/Gravity.java b/core/java/android/view/Gravity.java
index 63f5ec1..f031fe7 100644
--- a/core/java/android/view/Gravity.java
+++ b/core/java/android/view/Gravity.java
@@ -153,7 +153,8 @@
      *                container.
      * @param layoutDirection The layout direction.
      *
-     * @hide
+     * @see {@link View#LAYOUT_DIRECTION_LTR}
+     * @see {@link View#LAYOUT_DIRECTION_RTL}
      */
     public static void apply(int gravity, int w, int h, Rect container,
             Rect outRect, int layoutDirection) {
@@ -268,6 +269,37 @@
     }
 
     /**
+     * Apply a gravity constant to an object.
+     *
+     * @param gravity The desired placement of the object, as defined by the
+     *                constants in this class.
+     * @param w The horizontal size of the object.
+     * @param h The vertical size of the object.
+     * @param container The frame of the containing space, in which the object
+     *                  will be placed.  Should be large enough to contain the
+     *                  width and height of the object.
+     * @param xAdj Offset to apply to the X axis.  If gravity is LEFT this
+     *             pushes it to the right; if gravity is RIGHT it pushes it to
+     *             the left; if gravity is CENTER_HORIZONTAL it pushes it to the
+     *             right or left; otherwise it is ignored.
+     * @param yAdj Offset to apply to the Y axis.  If gravity is TOP this pushes
+     *             it down; if gravity is BOTTOM it pushes it up; if gravity is
+     *             CENTER_VERTICAL it pushes it down or up; otherwise it is
+     *             ignored.
+     * @param outRect Receives the computed frame of the object in its
+     *                container.
+     * @param layoutDirection The layout direction.
+     *
+     * @see {@link View#LAYOUT_DIRECTION_LTR}
+     * @see {@link View#LAYOUT_DIRECTION_RTL}
+     */
+    public static void apply(int gravity, int w, int h, Rect container,
+                             int xAdj, int yAdj, Rect outRect, int layoutDirection) {
+        int absGravity = getAbsoluteGravity(gravity, layoutDirection);
+        apply(absGravity, w, h, container, xAdj, yAdj, outRect);
+    }
+
+    /**
      * Apply additional gravity behavior based on the overall "display" that an
      * object exists in.  This can be used after
      * {@link #apply(int, int, int, Rect, int, int, Rect)} to place the object
@@ -320,7 +352,32 @@
             }
         }
     }
-    
+
+    /**
+     * Apply additional gravity behavior based on the overall "display" that an
+     * object exists in.  This can be used after
+     * {@link #apply(int, int, int, Rect, int, int, Rect)} to place the object
+     * within a visible display.  By default this moves or clips the object
+     * to be visible in the display; the gravity flags
+     * {@link #DISPLAY_CLIP_HORIZONTAL} and {@link #DISPLAY_CLIP_VERTICAL}
+     * can be used to change this behavior.
+     *
+     * @param gravity Gravity constants to modify the placement within the
+     * display.
+     * @param display The rectangle of the display in which the object is
+     * being placed.
+     * @param inoutObj Supplies the current object position; returns with it
+     * modified if needed to fit in the display.
+     * @param layoutDirection The layout direction.
+     *
+     * @see {@link View#LAYOUT_DIRECTION_LTR}
+     * @see {@link View#LAYOUT_DIRECTION_RTL}
+     */
+    public static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection) {
+        int absGravity = getAbsoluteGravity(gravity, layoutDirection);
+        applyDisplay(absGravity, display, inoutObj);
+    }
+
     /**
      * <p>Indicate whether the supplied gravity has a vertical pull.</p>
      *
diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java
index a97167b..e73f7bf 100644
--- a/core/java/android/view/HardwareLayer.java
+++ b/core/java/android/view/HardwareLayer.java
@@ -36,6 +36,7 @@
     
     int mWidth;
     int mHeight;
+    DisplayList mDisplayList;
 
     boolean mOpaque;
 
@@ -79,6 +80,24 @@
     }
 
     /**
+     * Returns the DisplayList for the layer.
+     *
+     * @return The DisplayList of the hardware layer
+     */
+    DisplayList getDisplayList() {
+        return mDisplayList;
+    }
+
+    /**
+     * Sets the DisplayList for the layer.
+     *
+     * @param displayList The new DisplayList for this layer
+     */
+    void setDisplayList(DisplayList displayList) {
+        mDisplayList = displayList;
+    }
+
+    /**
      * Returns whether or not this layer is opaque.
      * 
      * @return True if the layer is opaque, false otherwise
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7ab79ff..bf48ff2 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -336,9 +336,10 @@
  * Padding can be used to offset the content of the view by a specific amount of
  * pixels. For instance, a left padding of 2 will push the view's content by
  * 2 pixels to the right of the left edge. Padding can be set using the
- * {@link #setPadding(int, int, int, int)} method and queried by calling
- * {@link #getPaddingLeft()}, {@link #getPaddingTop()},
- * {@link #getPaddingRight()}, {@link #getPaddingBottom()}.
+ * {@link #setPadding(int, int, int, int)} or {@link #setPaddingRelative(int, int, int, int)}
+ * method and queried by calling {@link #getPaddingLeft()}, {@link #getPaddingTop()},
+ * {@link #getPaddingRight()}, {@link #getPaddingBottom()}, {@link #getPaddingStart()},
+ * {@link #getPaddingEnd()}.
  * </p>
  *
  * <p>
@@ -1497,6 +1498,14 @@
     static final ThreadLocal<Rect> sThreadLocal = new ThreadLocal<Rect>();
 
     /**
+     * Temporary flag, used to enable processing of View properties in the native DisplayList
+     * object instead of during draw(). Soon to be enabled by default for hardware-accelerated
+     * apps.
+     * @hide
+     */
+    protected static final boolean USE_DISPLAY_LIST_PROPERTIES = false;
+
+    /**
      * Map used to store views' tags.
      */
     private SparseArray<Object> mKeyedTags;
@@ -7283,6 +7292,24 @@
     }
 
     /**
+     * Gets the distance along the Z axis from the camera to this view.
+     *
+     * @see #setCameraDistance(float)
+     *
+     * @return The distance along the Z axis.
+     */
+    public float getCameraDistance() {
+        ensureTransformationInfo();
+        final float dpi = mResources.getDisplayMetrics().densityDpi;
+        final TransformationInfo info = mTransformationInfo;
+        if (info.mCamera == null) {
+            info.mCamera = new Camera();
+            info.matrix3D = new Matrix();
+        }
+        return -(info.mCamera.getLocationZ() * dpi);
+    }
+
+    /**
      * <p>Sets the distance along the Z axis (orthogonal to the X/Y plane on which
      * views are drawn) from the camera to this view. The camera's distance
      * affects 3D transformations, for instance rotations around the X and Y
@@ -7337,6 +7364,9 @@
         info.mMatrixDirty = true;
 
         invalidate(false);
+        if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+            mDisplayList.setCameraDistance(distance);
+        }
     }
 
     /**
@@ -7378,6 +7408,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setRotation(rotation);
+            }
         }
     }
 
@@ -7425,6 +7458,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setRotationY(rotationY);
+            }
         }
     }
 
@@ -7472,6 +7508,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setRotationX(rotationX);
+            }
         }
     }
 
@@ -7511,6 +7550,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setScaleX(scaleX);
+            }
         }
     }
 
@@ -7550,6 +7592,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setScaleY(scaleY);
+            }
         }
     }
 
@@ -7595,6 +7640,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setPivotX(pivotX);
+            }
         }
     }
 
@@ -7639,6 +7687,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setPivotY(pivotY);
+            }
         }
     }
 
@@ -7685,6 +7736,9 @@
             } else {
                 mPrivateFlags &= ~ALPHA_SET;
                 invalidate(false);
+                if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                    mDisplayList.setAlpha(alpha);
+                }
             }
         }
     }
@@ -7709,6 +7763,9 @@
                 return true;
             } else {
                 mPrivateFlags &= ~ALPHA_SET;
+                if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                    mDisplayList.setAlpha(alpha);
+                }
             }
         }
         return false;
@@ -7758,6 +7815,9 @@
             int oldHeight = mBottom - mTop;
 
             mTop = top;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setTop(mTop);
+            }
 
             onSizeChanged(width, mBottom - mTop, width, oldHeight);
 
@@ -7824,6 +7884,9 @@
             int oldHeight = mBottom - mTop;
 
             mBottom = bottom;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setBottom(mBottom);
+            }
 
             onSizeChanged(width, mBottom - mTop, width, oldHeight);
 
@@ -7884,6 +7947,9 @@
             int height = mBottom - mTop;
 
             mLeft = left;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setLeft(left);
+            }
 
             onSizeChanged(mRight - mLeft, height, oldWidth, height);
 
@@ -7897,6 +7963,9 @@
             }
             mBackgroundSizeChanged = true;
             invalidateParentIfNeeded();
+            if (USE_DISPLAY_LIST_PROPERTIES) {
+
+            }
         }
     }
 
@@ -7941,6 +8010,9 @@
             int height = mBottom - mTop;
 
             mRight = right;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setRight(mRight);
+            }
 
             onSizeChanged(mRight - mLeft, height, oldWidth, height);
 
@@ -8037,6 +8109,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setTranslationX(translationX);
+            }
         }
     }
 
@@ -8074,6 +8149,9 @@
             info.mMatrixDirty = true;
             mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
             invalidate(false);
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setTranslationY(translationY);
+            }
         }
     }
 
@@ -8206,6 +8284,9 @@
 
             mTop += offset;
             mBottom += offset;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.offsetTopBottom(offset);
+            }
 
             if (!matrixIsIdentity) {
                 mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
@@ -8247,6 +8328,9 @@
 
             mLeft += offset;
             mRight += offset;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.offsetLeftRight(offset);
+            }
 
             if (!matrixIsIdentity) {
                 mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
@@ -8870,13 +8954,15 @@
      *         (for instance, if the Runnable was not in the queue already.)
      */
     public boolean removeCallbacks(Runnable action) {
-        final AttachInfo attachInfo = mAttachInfo;
-        if (attachInfo != null) {
-            attachInfo.mHandler.removeCallbacks(action);
-            attachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(action, null);
-        } else {
-            // Assume that post will succeed later
-            ViewRootImpl.getRunQueue().removeCallbacks(action);
+        if (action != null) {
+            final AttachInfo attachInfo = mAttachInfo;
+            if (attachInfo != null) {
+                attachInfo.mHandler.removeCallbacks(action);
+                attachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(action, null);
+            } else {
+                // Assume that post will succeed later
+                ViewRootImpl.getRunQueue().removeCallbacks(action);
+            }
         }
         return true;
     }
@@ -9817,8 +9903,8 @@
      *
      * @param layoutDirection the direction of the layout
      *
-     * {@link #LAYOUT_DIRECTION_LTR}
-     * {@link #LAYOUT_DIRECTION_RTL}
+     * @see {@link #LAYOUT_DIRECTION_LTR}
+     * @see {@link #LAYOUT_DIRECTION_RTL}
      */
     public void onPaddingChanged(int layoutDirection) {
     }
@@ -10381,7 +10467,7 @@
                 return null;
             }
 
-            mHardwareLayer.redraw(getDisplayList(), mLocalDirtyRect);
+            mHardwareLayer.redraw(getHardwareLayerDisplayList(mHardwareLayer), mLocalDirtyRect);
             mLocalDirtyRect.setEmpty();
         }
 
@@ -10533,6 +10619,129 @@
     }
 
     /**
+     * Returns a DisplayList. If the incoming displayList is null, one will be created.
+     * Otherwise, the same display list will be returned (after having been rendered into
+     * along the way, depending on the invalidation state of the view).
+     *
+     * @param displayList The previous version of this displayList, could be null.
+     * @param isLayer Whether the requester of the display list is a layer. If so,
+     * the view will avoid creating a layer inside the resulting display list.
+     * @return A new or reused DisplayList object.
+     */
+    private DisplayList getDisplayList(DisplayList displayList, boolean isLayer) {
+        if (!canHaveDisplayList()) {
+            return null;
+        }
+
+        if (((mPrivateFlags & DRAWING_CACHE_VALID) == 0 ||
+                displayList == null || !displayList.isValid() ||
+                (!isLayer && mRecreateDisplayList))) {
+            // Don't need to recreate the display list, just need to tell our
+            // children to restore/recreate theirs
+            if (displayList != null && displayList.isValid() &&
+                    !isLayer && !mRecreateDisplayList) {
+                mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
+                mPrivateFlags &= ~DIRTY_MASK;
+                dispatchGetDisplayList();
+
+                return displayList;
+            }
+
+            if (!isLayer) {
+                // If we got here, we're recreating it. Mark it as such to ensure that
+                // we copy in child display lists into ours in drawChild()
+                mRecreateDisplayList = true;
+            }
+            if (displayList == null) {
+                final String name = getClass().getSimpleName();
+                displayList = mAttachInfo.mHardwareRenderer.createDisplayList(name);
+                // If we're creating a new display list, make sure our parent gets invalidated
+                // since they will need to recreate their display list to account for this
+                // new child display list.
+                invalidateParentCaches();
+            }
+
+            boolean caching = false;
+            final HardwareCanvas canvas = displayList.start();
+            int restoreCount = 0;
+            int width = mRight - mLeft;
+            int height = mBottom - mTop;
+
+            try {
+                canvas.setViewport(width, height);
+                // The dirty rect should always be null for a display list
+                canvas.onPreDraw(null);
+                int layerType = (
+                        !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ?
+                        getLayerType() : LAYER_TYPE_NONE;
+                if (!isLayer && layerType == LAYER_TYPE_HARDWARE && USE_DISPLAY_LIST_PROPERTIES) {
+                    final HardwareLayer layer = getHardwareLayer();
+                    if (layer != null && layer.isValid()) {
+                        canvas.drawHardwareLayer(layer, 0, 0, mLayerPaint);
+                    } else {
+                        canvas.saveLayer(0, 0,
+                                mRight - mLeft, mBottom - mTop, mLayerPaint,
+                                Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
+                    }
+                    caching = true;
+                } else {
+
+                    computeScroll();
+
+                    if (!USE_DISPLAY_LIST_PROPERTIES) {
+                        restoreCount = canvas.save();
+                    }
+                    canvas.translate(-mScrollX, -mScrollY);
+                    if (!isLayer) {
+                        mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
+                        mPrivateFlags &= ~DIRTY_MASK;
+                    }
+
+                    // Fast path for layouts with no backgrounds
+                    if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
+                        dispatchDraw(canvas);
+                    } else {
+                        draw(canvas);
+                    }
+                }
+            } finally {
+                if (USE_DISPLAY_LIST_PROPERTIES) {
+                    canvas.restoreToCount(restoreCount);
+                }
+                canvas.onPostDraw();
+
+                displayList.end();
+                if (USE_DISPLAY_LIST_PROPERTIES) {
+                    displayList.setCaching(caching);
+                }
+                if (isLayer && USE_DISPLAY_LIST_PROPERTIES) {
+                    displayList.setLeftTopRightBottom(0, 0, width, height);
+                } else {
+                    setDisplayListProperties(displayList);
+                }
+            }
+        } else if (!isLayer) {
+            mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
+            mPrivateFlags &= ~DIRTY_MASK;
+        }
+
+        return displayList;
+    }
+
+    /**
+     * Get the DisplayList for the HardwareLayer
+     *
+     * @param layer The HardwareLayer whose DisplayList we want
+     * @return A DisplayList fopr the specified HardwareLayer
+     */
+    private DisplayList getHardwareLayerDisplayList(HardwareLayer layer) {
+        DisplayList displayList = getDisplayList(layer.getDisplayList(), true);
+        layer.setDisplayList(displayList);
+        return displayList;
+    }
+
+
+    /**
      * <p>Returns a display list that can be used to draw this view again
      * without executing its draw method.</p>
      *
@@ -10541,70 +10750,7 @@
      * @hide
      */
     public DisplayList getDisplayList() {
-        if (!canHaveDisplayList()) {
-            return null;
-        }
-
-        if (((mPrivateFlags & DRAWING_CACHE_VALID) == 0 ||
-                mDisplayList == null || !mDisplayList.isValid() ||
-                mRecreateDisplayList)) {
-            // Don't need to recreate the display list, just need to tell our
-            // children to restore/recreate theirs
-            if (mDisplayList != null && mDisplayList.isValid() &&
-                    !mRecreateDisplayList) {
-                mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
-                mPrivateFlags &= ~DIRTY_MASK;
-                dispatchGetDisplayList();
-
-                return mDisplayList;
-            }
-
-            // If we got here, we're recreating it. Mark it as such to ensure that
-            // we copy in child display lists into ours in drawChild()
-            mRecreateDisplayList = true;
-            if (mDisplayList == null) {
-                final String name = getClass().getSimpleName();
-                mDisplayList = mAttachInfo.mHardwareRenderer.createDisplayList(name);
-                // If we're creating a new display list, make sure our parent gets invalidated
-                // since they will need to recreate their display list to account for this
-                // new child display list.
-                invalidateParentCaches();
-            }
-
-            final HardwareCanvas canvas = mDisplayList.start();
-            int restoreCount = 0;
-            try {
-                int width = mRight - mLeft;
-                int height = mBottom - mTop;
-
-                canvas.setViewport(width, height);
-                // The dirty rect should always be null for a display list
-                canvas.onPreDraw(null);
-
-                computeScroll();
-
-                restoreCount = canvas.save();
-                canvas.translate(-mScrollX, -mScrollY);
-                mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
-                mPrivateFlags &= ~DIRTY_MASK;
-
-                // Fast path for layouts with no backgrounds
-                if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
-                    dispatchDraw(canvas);
-                } else {
-                    draw(canvas);
-                }
-            } finally {
-                canvas.restoreToCount(restoreCount);
-                canvas.onPostDraw();
-
-                mDisplayList.end();
-            }
-        } else {
-            mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID;
-            mPrivateFlags &= ~DIRTY_MASK;
-        }
-
+        mDisplayList = getDisplayList(mDisplayList, false);
         return mDisplayList;
     }
 
@@ -11074,13 +11220,13 @@
     }
     
     /**
-     * <p>Indicates whether this view is attached to an hardware accelerated
+     * <p>Indicates whether this view is attached to a hardware accelerated
      * window or not.</p>
      *
      * <p>Even if this method returns true, it does not mean that every call
      * to {@link #draw(android.graphics.Canvas)} will be made with an hardware
      * accelerated {@link android.graphics.Canvas}. For instance, if this view
-     * is drawn onto an offscren {@link android.graphics.Bitmap} and its
+     * is drawn onto an offscreen {@link android.graphics.Bitmap} and its
      * window is hardware accelerated,
      * {@link android.graphics.Canvas#isHardwareAccelerated()} will likely
      * return false, and this method will return true.</p>
@@ -11149,19 +11295,57 @@
         return more;
     }
 
+    void setDisplayListProperties() {
+        setDisplayListProperties(mDisplayList);
+    }
+
+    /**
+     * This method is called by getDisplayList() when a display list is created or re-rendered.
+     * It sets or resets the current value of all properties on that display list (resetting is
+     * necessary when a display list is being re-created, because we need to make sure that
+     * previously-set transform values
+     */
+    void setDisplayListProperties(DisplayList displayList) {
+        if (USE_DISPLAY_LIST_PROPERTIES && displayList != null) {
+            displayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+            if (mParent instanceof ViewGroup) {
+                displayList.setClipChildren(
+                        (((ViewGroup)mParent).mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);
+            }
+            if (mAttachInfo != null && mAttachInfo.mScalingRequired &&
+                    mAttachInfo.mApplicationScale != 1.0f) {
+                displayList.setApplicationScale(1f / mAttachInfo.mApplicationScale);
+            }
+            if (mTransformationInfo != null) {
+                displayList.setTransformationInfo(mTransformationInfo.mAlpha,
+                        mTransformationInfo.mTranslationX, mTransformationInfo.mTranslationY,
+                        mTransformationInfo.mRotation, mTransformationInfo.mRotationX,
+                        mTransformationInfo.mRotationY, mTransformationInfo.mScaleX,
+                        mTransformationInfo.mScaleY);
+                displayList.setCameraDistance(getCameraDistance());
+                if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == PIVOT_EXPLICITLY_SET) {
+                    displayList.setPivotX(getPivotX());
+                    displayList.setPivotY(getPivotY());
+                }
+            }
+        }
+    }
+
     /**
      * This method is called by ViewGroup.drawChild() to have each child view draw itself.
      * This draw() method is an implementation detail and is not intended to be overridden or
      * to be called from anywhere else other than ViewGroup.drawChild().
      */
     boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
+        boolean useDisplayListProperties = USE_DISPLAY_LIST_PROPERTIES && mAttachInfo != null &&
+                mAttachInfo.mHardwareAccelerated;
         boolean more = false;
         final boolean childHasIdentityMatrix = hasIdentityMatrix();
         final int flags = parent.mGroupFlags;
 
-        if ((flags & parent.FLAG_CLEAR_TRANSFORMATION) == parent.FLAG_CLEAR_TRANSFORMATION) {
+        if ((flags & ViewGroup.FLAG_CLEAR_TRANSFORMATION) == ViewGroup.FLAG_CLEAR_TRANSFORMATION) {
             parent.mChildTransformation.clear();
-            parent.mGroupFlags &= ~parent.FLAG_CLEAR_TRANSFORMATION;
+            parent.mGroupFlags &= ~ViewGroup.FLAG_CLEAR_TRANSFORMATION;
         }
 
         Transformation transformToApply = null;
@@ -11172,8 +11356,8 @@
         int layerType = parent.mDrawLayers ? getLayerType() : LAYER_TYPE_NONE;
 
         final boolean hardwareAccelerated = canvas.isHardwareAccelerated();
-        if ((flags & parent.FLAG_CHILDREN_DRAWN_WITH_CACHE) == parent.FLAG_CHILDREN_DRAWN_WITH_CACHE ||
-                (flags & parent.FLAG_ALWAYS_DRAWN_WITH_CACHE) == parent.FLAG_ALWAYS_DRAWN_WITH_CACHE) {
+        if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 ||
+                (flags & ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) != 0) {
             caching = true;
             if (mAttachInfo != null) scalingRequired = mAttachInfo.mScalingRequired;
         } else {
@@ -11185,8 +11369,7 @@
             more = drawAnimation(parent, drawingTime, a, scalingRequired);
             concatMatrix = a.willChangeTransformationMatrix();
             transformToApply = parent.mChildTransformation;
-        } else if ((flags & parent.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) ==
-                parent.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) {
+        } else if ((flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
             final boolean hasTransform =
                     parent.getChildStaticTransformation(this, parent.mChildTransformation);
             if (hasTransform) {
@@ -11236,6 +11419,11 @@
                         buildDrawingCache(true);
                         cache = getDrawingCache(true);
                         break;
+                    case LAYER_TYPE_HARDWARE:
+                        if (useDisplayListProperties) {
+                            hasDisplayList = canHaveDisplayList();
+                        }
+                        break;
                     case LAYER_TYPE_NONE:
                         // Delay getting the display list until animation-driven alpha values are
                         // set up and possibly passed on to the view
@@ -11244,24 +11432,33 @@
                 }
             }
         }
+        useDisplayListProperties &= hasDisplayList;
 
         final boolean hasNoCache = cache == null || hasDisplayList;
         final boolean offsetForScroll = cache == null && !hasDisplayList &&
                 layerType != LAYER_TYPE_HARDWARE;
 
-        final int restoreTo = canvas.save();
+        int restoreTo = -1;
+        if (!useDisplayListProperties) {
+            restoreTo = canvas.save();
+        }
         if (offsetForScroll) {
             canvas.translate(mLeft - sx, mTop - sy);
         } else {
-            canvas.translate(mLeft, mTop);
+            if (!useDisplayListProperties) {
+                canvas.translate(mLeft, mTop);
+            }
             if (scalingRequired) {
+                if (useDisplayListProperties) {
+                    restoreTo = canvas.save();
+                }
                 // mAttachInfo cannot be null, otherwise scalingRequired == false
                 final float scale = 1.0f / mAttachInfo.mApplicationScale;
                 canvas.scale(scale, scale);
             }
         }
 
-        float alpha = getAlpha();
+        float alpha = useDisplayListProperties ? 1 : getAlpha();
         if (transformToApply != null || alpha < 1.0f || !hasIdentityMatrix()) {
             if (transformToApply != null || !childHasIdentityMatrix) {
                 int transX = 0;
@@ -11276,20 +11473,22 @@
                     if (concatMatrix) {
                         // Undo the scroll translation, apply the transformation matrix,
                         // then redo the scroll translate to get the correct result.
-                        canvas.translate(-transX, -transY);
-                        canvas.concat(transformToApply.getMatrix());
-                        canvas.translate(transX, transY);
-                        parent.mGroupFlags |= parent.FLAG_CLEAR_TRANSFORMATION;
+                        if (!hasDisplayList) {
+                            canvas.translate(-transX, -transY);
+                            canvas.concat(transformToApply.getMatrix());
+                            canvas.translate(transX, transY);
+                        }
+                        parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
                     }
 
                     float transformAlpha = transformToApply.getAlpha();
                     if (transformAlpha < 1.0f) {
                         alpha *= transformToApply.getAlpha();
-                        parent.mGroupFlags |= parent.FLAG_CLEAR_TRANSFORMATION;
+                        parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
                     }
                 }
 
-                if (!childHasIdentityMatrix) {
+                if (!childHasIdentityMatrix && !useDisplayListProperties) {
                     canvas.translate(-transX, -transY);
                     canvas.concat(getMatrix());
                     canvas.translate(transX, transY);
@@ -11297,20 +11496,22 @@
             }
 
             if (alpha < 1.0f) {
-                parent.mGroupFlags |= parent.FLAG_CLEAR_TRANSFORMATION;
+                parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
                 if (hasNoCache) {
                     final int multipliedAlpha = (int) (255 * alpha);
                     if (!onSetAlpha(multipliedAlpha)) {
                         int layerFlags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
-                        if ((flags & parent.FLAG_CLIP_CHILDREN) == parent.FLAG_CLIP_CHILDREN ||
+                        if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) != 0 ||
                                 layerType != LAYER_TYPE_NONE) {
                             layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG;
                         }
                         if (layerType == LAYER_TYPE_NONE) {
-                            final int scrollX = hasDisplayList ? 0 : sx;
-                            final int scrollY = hasDisplayList ? 0 : sy;
-                            canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
-                                    scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
+                            if (!useDisplayListProperties) {
+                                final int scrollX = hasDisplayList ? 0 : sx;
+                                final int scrollY = hasDisplayList ? 0 : sy;
+                                canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
+                                        scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
+                            }
                         }
                     } else {
                         // Alpha is handled by the child directly, clobber the layer's alpha
@@ -11323,7 +11524,8 @@
             mPrivateFlags &= ~ALPHA_SET;
         }
 
-        if ((flags & parent.FLAG_CLIP_CHILDREN) == parent.FLAG_CLIP_CHILDREN) {
+        if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN &&
+                !useDisplayListProperties) {
             if (offsetForScroll) {
                 canvas.clipRect(sx, sy, sx + (mRight - mLeft), sy + (mBottom - mTop));
             } else {
@@ -11348,7 +11550,7 @@
 
         if (hasNoCache) {
             boolean layerRendered = false;
-            if (layerType == LAYER_TYPE_HARDWARE) {
+            if (layerType == LAYER_TYPE_HARDWARE && !useDisplayListProperties) {
                 final HardwareLayer layer = getHardwareLayer();
                 if (layer != null && layer.isValid()) {
                     mLayerPaint.setAlpha((int) (alpha * 255));
@@ -11394,11 +11596,10 @@
                 }
                 if (alpha < 1.0f) {
                     cachePaint.setAlpha((int) (alpha * 255));
-                    parent.mGroupFlags |= parent.FLAG_ALPHA_LOWER_THAN_ONE;
-                } else if  ((flags & parent.FLAG_ALPHA_LOWER_THAN_ONE) ==
-                        parent.FLAG_ALPHA_LOWER_THAN_ONE) {
+                    parent.mGroupFlags |= ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;
+                } else if  ((flags & ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE) != 0) {
                     cachePaint.setAlpha(255);
-                    parent.mGroupFlags &= ~parent.FLAG_ALPHA_LOWER_THAN_ONE;
+                    parent.mGroupFlags &= ~ViewGroup.FLAG_ALPHA_LOWER_THAN_ONE;
                 }
             } else {
                 cachePaint = mLayerPaint;
@@ -11407,7 +11608,9 @@
             canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint);
         }
 
-        canvas.restoreToCount(restoreTo);
+        if (restoreTo >= 0) {
+            canvas.restoreToCount(restoreTo);
+        }
 
         if (a != null && !more) {
             if (!hardwareAccelerated && !a.getFillAfter()) {
@@ -11865,6 +12068,9 @@
             mTop = top;
             mRight = right;
             mBottom = bottom;
+            if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+                mDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+            }
 
             mPrivateFlags |= HAS_BOUNDS;
 
@@ -11981,7 +12187,7 @@
      * @see #drawableStateChanged
      */
     public void unscheduleDrawable(Drawable who) {
-        if (mAttachInfo != null) {
+        if (mAttachInfo != null && who != null) {
             mAttachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(null, who);
         }
     }
@@ -12471,9 +12677,9 @@
     }
 
     /**
-     * Returns the start padding of this view. If there are inset and enabled
-     * scrollbars, this value may include the space required to display the
-     * scrollbars as well.
+     * Returns the start padding of this view depending on its resolved layout direction.
+     * If there are inset and enabled scrollbars, this value may include the space
+     * required to display the scrollbars as well.
      *
      * @return the start padding in pixels
      */
@@ -12494,9 +12700,9 @@
     }
 
     /**
-     * Returns the end padding of this view. If there are inset and enabled
-     * scrollbars, this value may include the space required to display the
-     * scrollbars as well.
+     * Returns the end padding of this view depending on its resolved layout direction.
+     * If there are inset and enabled scrollbars, this value may include the space
+     * required to display the scrollbars as well.
      *
      * @return the end padding in pixels
      */
@@ -13143,7 +13349,7 @@
     }
 
     /**
-     * Creates an string of whitespaces used for indentation.
+     * Creates a string of whitespaces used for indentation.
      *
      * @param depth the indentation level
      * @return a String containing (depth * 2 + 3) * 2 white spaces
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index b455ad5..20183ee 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -305,8 +305,9 @@
         mScaledTouchExplorationTapSlop = (int) (density * TOUCH_EXPLORATION_TAP_SLOP + 0.5f);
         mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
 
+        final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
         // Size of the screen in bytes, in ARGB_8888 format
-        mMaximumDrawingCacheSize = 4 * metrics.widthPixels * metrics.heightPixels;
+        mMaximumDrawingCacheSize = 4 * display.getRawWidth() * display.getRawHeight();
 
         mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
         mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 2a17845..8f6badf 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -264,7 +264,7 @@
 
     /**
      * Defines a mapping from an int value to a String. Such a mapping can be used
-     * in a @ExportedProperty to provide more meaningful values to the end user.
+     * in an @ExportedProperty to provide more meaningful values to the end user.
      *
      * @see android.view.ViewDebug.ExportedProperty
      */
@@ -287,8 +287,8 @@
     }
 
     /**
-     * Defines a mapping from an flag to a String. Such a mapping can be used
-     * in a @ExportedProperty to provide more meaningful values to the end user.
+     * Defines a mapping from a flag to a String. Such a mapping can be used
+     * in an @ExportedProperty to provide more meaningful values to the end user.
      *
      * @see android.view.ViewDebug.ExportedProperty
      */
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index c9e0242..1993ce6 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2736,7 +2736,18 @@
      * @attr ref android.R.styleable#ViewGroup_clipChildren
      */
     public void setClipChildren(boolean clipChildren) {
-        setBooleanFlag(FLAG_CLIP_CHILDREN, clipChildren);
+        boolean previousValue = (mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN;
+        if (clipChildren != previousValue) {
+            setBooleanFlag(FLAG_CLIP_CHILDREN, clipChildren);
+            if (USE_DISPLAY_LIST_PROPERTIES) {
+                for (int i = 0; i < mChildrenCount; ++i) {
+                    View child = getChildAt(i);
+                    if (child.mDisplayList != null) {
+                        child.mDisplayList.setClipChildren(clipChildren);
+                    }
+                }
+            }
+        }
     }
 
     /**
@@ -3973,6 +3984,9 @@
             final View v = children[i];
             v.mTop += offset;
             v.mBottom += offset;
+            if (USE_DISPLAY_LIST_PROPERTIES && v.mDisplayList != null) {
+                v.mDisplayList.offsetTopBottom(offset);
+            }
         }
     }
 
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index 0fdcd0f..fe0e659 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -866,6 +866,8 @@
                 info.mAlpha = value;
                 break;
         }
+        // TODO: optimize to set only the properties that have changed
+        mView.setDisplayListProperties();
     }
 
     /**
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 72365c7..4472f8c 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -51,6 +51,7 @@
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.os.SystemProperties;
+import android.os.Trace;
 import android.util.AndroidRuntimeException;
 import android.util.DisplayMetrics;
 import android.util.EventLog;
@@ -960,7 +961,12 @@
             }
         }
 
-        performTraversals();
+        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "performTraversals");
+        try {
+            performTraversals();
+        } finally {
+            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+        }
 
         if (ViewDebug.DEBUG_LATENCY) {
             long now = System.nanoTime();
@@ -1919,7 +1925,13 @@
 
         final boolean fullRedrawNeeded = mFullRedrawNeeded;
         mFullRedrawNeeded = false;
-        draw(fullRedrawNeeded);
+
+        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "draw");
+        try {
+            draw(fullRedrawNeeded);
+        } finally {
+            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+        }
 
         if (ViewDebug.DEBUG_LATENCY) {
             long now = System.nanoTime();
@@ -2897,17 +2909,22 @@
             q.mDeliverTimeNanos = System.nanoTime();
         }
 
-        if (q.mEvent instanceof KeyEvent) {
-            deliverKeyEvent(q);
-        } else {
-            final int source = q.mEvent.getSource();
-            if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
-                deliverPointerEvent(q);
-            } else if ((source & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) {
-                deliverTrackballEvent(q);
+        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "deliverInputEvent");
+        try {
+            if (q.mEvent instanceof KeyEvent) {
+                deliverKeyEvent(q);
             } else {
-                deliverGenericMotionEvent(q);
+                final int source = q.mEvent.getSource();
+                if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
+                    deliverPointerEvent(q);
+                } else if ((source & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) {
+                    deliverTrackballEvent(q);
+                } else {
+                    deliverGenericMotionEvent(q);
+                }
             }
+        } finally {
+            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
         }
     }
 
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index c0eb65b..f3ef329 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -787,10 +787,10 @@
          * hardware accelerated.  This is used for the starting preview windows
          * in the system process, which don't need to have the overhead of
          * hardware acceleration (they are just a static rendering), but should
-         * be rendered as much to match the actual window of the app even if it
+         * be rendered as such to match the actual window of the app even if it
          * is hardware accelerated.
          * Even if the window isn't hardware accelerated, still do its rendering
-         * as if it is.
+         * as if it was.
          * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
          * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
          * is generally disabled. This flag must be specified in addition to 
@@ -803,7 +803,7 @@
 
         /**
          * In the system process, we globally do not use hardware acceleration
-         * because there are many threads doing UI there and they an conflict.
+         * because there are many threads doing UI there and they conflict.
          * If certain parts of the UI that really do want to use hardware
          * acceleration, this flag can be set to force it.  This is basically
          * for the lock screen.  Anyone else using it, you are probably wrong.
@@ -814,7 +814,7 @@
 
         /**
          * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
-         * may elect to skp these notifications if they are no doing anything productive with
+         * may elect to skip these notifications if they are not doing anything productive with
          * them (they do not affect the wallpaper scrolling operation) by calling
          * {@link
          * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index c094fda..03c6211 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -994,7 +994,7 @@
     protected void enforceNotSealed() {
         if (isSealed()) {
             throw new IllegalStateException("Cannot perform this "
-                    + "action on an sealed instance.");
+                    + "action on a sealed instance.");
         }
     }
 
diff --git a/core/java/android/view/accessibility/AccessibilityRecord.java b/core/java/android/view/accessibility/AccessibilityRecord.java
index 23b235c..bc6074f 100644
--- a/core/java/android/view/accessibility/AccessibilityRecord.java
+++ b/core/java/android/view/accessibility/AccessibilityRecord.java
@@ -632,7 +632,7 @@
     void enforceNotSealed() {
         if (isSealed()) {
             throw new IllegalStateException("Cannot perform this "
-                    + "action on an sealed instance.");
+                    + "action on a sealed instance.");
         }
     }
 
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 3b6ebbe..0e5ff20 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -62,6 +62,9 @@
  * <p>Topics covered here:
  * <ol>
  * <li><a href="#ArchitectureOverview">Architecture Overview</a>
+ * <li><a href="#Applications">Applications</a>
+ * <li><a href="#InputMethods">Input Methods</a>
+ * <li><a href="#Security">Security</a>
  * </ol>
  * 
  * <a name="ArchitectureOverview"></a>
diff --git a/core/java/android/view/textservice/SpellCheckerInfo.java b/core/java/android/view/textservice/SpellCheckerInfo.java
index 9d8475d..137743a 100644
--- a/core/java/android/view/textservice/SpellCheckerInfo.java
+++ b/core/java/android/view/textservice/SpellCheckerInfo.java
@@ -38,7 +38,7 @@
 import java.util.ArrayList;
 
 /**
- * This class is used to specify meta information of an spell checker.
+ * This class is used to specify meta information of a spell checker.
  */
 public final class SpellCheckerInfo implements Parcelable {
     private static final String TAG = SpellCheckerInfo.class.getSimpleName();
@@ -53,7 +53,7 @@
     private final String mSettingsActivityName;
 
     /**
-     * The array of the subtypes.
+     * The array of subtypes.
      */
     private final ArrayList<SpellCheckerSubtype> mSubtypes = new ArrayList<SpellCheckerSubtype>();
 
diff --git a/core/java/android/webkit/AutoCompletePopup.java b/core/java/android/webkit/AutoCompletePopup.java
new file mode 100644
index 0000000..674428a
--- /dev/null
+++ b/core/java/android/webkit/AutoCompletePopup.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2012 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.webkit;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.os.Message;
+import android.text.Editable;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.AbsoluteLayout;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Filter;
+import android.widget.Filterable;
+import android.widget.ListAdapter;
+import android.widget.ListPopupWindow;
+
+class AutoCompletePopup implements OnItemClickListener, Filter.FilterListener {
+    private static class AnchorView extends View {
+        AnchorView(Context context) {
+            super(context);
+            setFocusable(false);
+        }
+    }
+    private static final int AUTOFILL_FORM = 100;
+    private boolean mIsAutoFillProfileSet;
+    private Handler mHandler;
+    private int mQueryId;
+    private Rect mNodeBounds = new Rect();
+    private int mNodeLayerId;
+    private ListPopupWindow mPopup;
+    private Filter mFilter;
+    private CharSequence mText;
+    private ListAdapter mAdapter;
+    private boolean mIsFocused;
+    private View mAnchor;
+    private WebViewClassic.WebViewInputConnection mInputConnection;
+    private WebViewClassic mWebView;
+
+    public AutoCompletePopup(Context context,
+            WebViewClassic webView,
+            WebViewClassic.WebViewInputConnection inputConnection) {
+        mInputConnection = inputConnection;
+        mWebView = webView;
+        mPopup = new ListPopupWindow(context);
+        mAnchor = new AnchorView(context);
+        mWebView.getWebView().addView(mAnchor);
+        mPopup.setOnItemClickListener(this);
+        mPopup.setAnchorView(mAnchor);
+        mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
+        mHandler = new Handler() {
+            @Override
+            public void handleMessage(Message msg) {
+                switch (msg.what) {
+                case AUTOFILL_FORM:
+                    mWebView.autoFillForm(mQueryId);
+                    break;
+                }
+            }
+        };
+    }
+
+    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK && mPopup.isShowing()) {
+            // special case for the back key, we do not even try to send it
+            // to the drop down list but instead, consume it immediately
+            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
+                KeyEvent.DispatcherState state = mAnchor.getKeyDispatcherState();
+                if (state != null) {
+                    state.startTracking(event, this);
+                }
+                return true;
+            } else if (event.getAction() == KeyEvent.ACTION_UP) {
+                KeyEvent.DispatcherState state = mAnchor.getKeyDispatcherState();
+                if (state != null) {
+                    state.handleUpEvent(event);
+                }
+                if (event.isTracking() && !event.isCanceled()) {
+                    mPopup.dismiss();
+                    return true;
+                }
+            }
+        }
+        if (mPopup.isShowing()) {
+            return mPopup.onKeyPreIme(keyCode, event);
+        }
+        return false;
+    }
+
+    public void setFocused(boolean isFocused) {
+        mIsFocused = isFocused;
+        if (!mIsFocused) {
+            mPopup.dismiss();
+        }
+    }
+
+    public void setText(CharSequence text) {
+        mText = text;
+        if (mFilter != null) {
+            mFilter.filter(text, this);
+        }
+    }
+
+    public void setAutoFillQueryId(int queryId) {
+        mQueryId = queryId;
+    }
+
+    public void clearAdapter() {
+        mAdapter = null;
+        mFilter = null;
+        mPopup.dismiss();
+        mPopup.setAdapter(null);
+    }
+
+    public <T extends ListAdapter & Filterable> void setAdapter(T adapter) {
+        mPopup.setAdapter(adapter);
+        mAdapter = adapter;
+        if (adapter != null) {
+            mFilter = adapter.getFilter();
+            mFilter.filter(mText, this);
+        } else {
+            mFilter = null;
+        }
+        resetRect();
+    }
+
+    public void setNodeBounds(Rect nodeBounds, int layerId) {
+        mNodeBounds.set(nodeBounds);
+        mNodeLayerId = layerId;
+        resetRect();
+    }
+
+    public void resetRect() {
+        int left = mWebView.contentToViewX(mNodeBounds.left);
+        int right = mWebView.contentToViewX(mNodeBounds.right);
+        int width = right - left;
+        mPopup.setWidth(width);
+
+        int bottom = mWebView.contentToViewY(mNodeBounds.bottom);
+        int top = mWebView.contentToViewY(mNodeBounds.top);
+        int height = bottom - top;
+
+        AbsoluteLayout.LayoutParams lp =
+                (AbsoluteLayout.LayoutParams) mAnchor.getLayoutParams();
+        boolean needsUpdate = false;
+        if (null == lp) {
+            lp = new AbsoluteLayout.LayoutParams(width, height, left, top);
+        } else {
+            if ((lp.x != left) || (lp.y != top) || (lp.width != width)
+                    || (lp.height != height)) {
+                needsUpdate = true;
+                lp.x = left;
+                lp.y = top;
+                lp.width = width;
+                lp.height = height;
+            }
+        }
+        if (needsUpdate) {
+            mAnchor.setLayoutParams(lp);
+        }
+        if (mPopup.isShowing()) {
+            mPopup.show(); // update its position
+        }
+    }
+
+    public void scrollDelta(int layerId, int dx, int dy) {
+        if (layerId == mNodeLayerId) {
+            mNodeBounds.offset(dx, dy);
+            resetRect();
+        }
+    }
+
+    // AdapterView.OnItemClickListener implementation
+    @Override
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        if (id == 0 && position == 0 && mInputConnection.getIsAutoFillable()) {
+            mText = "";
+            pushTextToInputConnection();
+            // Blank out the text box while we wait for WebCore to fill the form.
+            if (mIsAutoFillProfileSet) {
+                // Call a webview method to tell WebCore to autofill the form.
+                mWebView.autoFillForm(mQueryId);
+            } else {
+                // There is no autofill profile setup yet and the user has
+                // elected to try and set one up. Call through to the
+                // embedder to action that.
+                mWebView.getWebChromeClient().setupAutoFill(
+                        mHandler.obtainMessage(AUTOFILL_FORM));
+            }
+        } else {
+            Object selectedItem;
+            if (position < 0) {
+                selectedItem = mPopup.getSelectedItem();
+            } else {
+                selectedItem = mAdapter.getItem(position);
+            }
+            if (selectedItem != null) {
+                setText(mFilter.convertResultToString(selectedItem));
+                pushTextToInputConnection();
+            }
+        }
+        mPopup.dismiss();
+    }
+
+    public void setIsAutoFillProfileSet(boolean isAutoFillProfileSet) {
+        mIsAutoFillProfileSet = isAutoFillProfileSet;
+    }
+
+    private void pushTextToInputConnection() {
+        Editable oldText = mInputConnection.getEditable();
+        mInputConnection.setSelection(0, oldText.length());
+        mInputConnection.replaceSelection(mText);
+        mInputConnection.setSelection(mText.length(), mText.length());
+    }
+
+    @Override
+    public void onFilterComplete(int count) {
+        if (!mIsFocused) {
+            mPopup.dismiss();
+            return;
+        }
+
+        boolean showDropDown = (count > 0) &&
+                (mInputConnection.getIsAutoFillable() || mText.length() > 0);
+        if (showDropDown) {
+            if (!mPopup.isShowing()) {
+                // Make sure the list does not obscure the IME when shown for the first time.
+                mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
+            }
+            mPopup.show();
+            mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
+        } else {
+            mPopup.dismiss();
+        }
+    }
+}
+
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index 542dd21..9970c93 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -182,7 +182,7 @@
     }
 
     /**
-     * @return True iff the url is an proxy url to allow cookieless network 
+     * @return True iff the url is a proxy url to allow cookieless network
      * requests from a file url.
      * @deprecated Cookieless proxy is no longer supported.
      */
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 5db2431..09ce1e2 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -375,7 +375,7 @@
      * InputConnection used for ContentEditable. This captures changes
      * to the text and sends them either as key strokes or text changes.
      */
-    private class WebViewInputConnection extends BaseInputConnection {
+    class WebViewInputConnection extends BaseInputConnection {
         // Used for mapping characters to keys typed.
         private KeyCharacterMap mKeyCharacterMap;
         private boolean mIsKeySentByMe;
@@ -383,11 +383,31 @@
         private int mImeOptions;
         private String mHint;
         private int mMaxLength;
+        private boolean mIsAutoFillable;
+        private boolean mIsAutoCompleteEnabled;
+        private String mName;
 
         public WebViewInputConnection() {
             super(mWebView, true);
         }
 
+        public void setAutoFillable(int queryId) {
+            mIsAutoFillable = getSettings().getAutoFillEnabled()
+                    && (queryId != WebTextView.FORM_NOT_AUTOFILLABLE);
+            int variation = mInputType & EditorInfo.TYPE_MASK_VARIATION;
+            if (variation != EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD
+                    && (mIsAutoFillable || mIsAutoCompleteEnabled)) {
+                if (mName != null && mName.length() > 0) {
+                    requestFormData(mName, mFieldPointer, mIsAutoFillable,
+                            mIsAutoCompleteEnabled);
+                }
+            }
+        }
+
+        public boolean getIsAutoFillable() {
+            return mIsAutoFillable;
+        }
+
         @Override
         public boolean sendKeyEvent(KeyEvent event) {
             // Some IMEs send key events directly using sendKeyEvents.
@@ -528,9 +548,13 @@
             if (!initData.mIsSpellCheckEnabled) {
                 inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
             }
-            if (WebTextView.TEXT_AREA != type
-                    && initData.mIsTextFieldNext) {
-                imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;
+            if (WebTextView.TEXT_AREA != type) {
+                if (initData.mIsTextFieldNext) {
+                    imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;
+                }
+                if (initData.mIsTextFieldPrev) {
+                    imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS;
+                }
             }
             switch (type) {
                 case WebTextView.NORMAL_TEXT_FIELD:
@@ -582,6 +606,9 @@
             mInputType = inputType;
             mImeOptions = imeOptions;
             mMaxLength = initData.mMaxLength;
+            mIsAutoCompleteEnabled = initData.mIsAutoCompleteEnabled;
+            mName = initData.mName;
+            mAutoCompletePopup.clearAdapter();
         }
 
         public void setupEditorInfo(EditorInfo outAttrs) {
@@ -629,6 +656,13 @@
                         REPLACE_TEXT, start,  end, text.toString());
                 mPrivateHandler.sendMessage(replaceMessage);
             }
+            if (mAutoCompletePopup != null) {
+                StringBuilder newText = new StringBuilder();
+                newText.append(editable.subSequence(0, start));
+                newText.append(text);
+                newText.append(editable.subSequence(end, editable.length()));
+                mAutoCompletePopup.setText(newText.toString());
+            }
             mIsKeySentByMe = false;
         }
 
@@ -795,6 +829,7 @@
     WebViewInputConnection mInputConnection = null;
     private int mFieldPointer;
     private PastePopupWindow mPasteWindow;
+    AutoCompletePopup mAutoCompletePopup;
 
     private static class OnTrimMemoryListener implements ComponentCallbacks2 {
         private static OnTrimMemoryListener sInstance = null;
@@ -1104,6 +1139,7 @@
     private static final int SWITCH_TO_SHORTPRESS       = 3;
     private static final int SWITCH_TO_LONGPRESS        = 4;
     private static final int RELEASE_SINGLE_TAP         = 5;
+    private static final int REQUEST_FORM_DATA          = 6;
     private static final int DRAG_HELD_MOTIONLESS       = 8;
     private static final int AWAKEN_SCROLL_BARS         = 9;
     private static final int PREVENT_DEFAULT_TIMEOUT    = 10;
@@ -1156,6 +1192,9 @@
     static final int REPLACE_TEXT                       = 143;
     static final int CLEAR_CARET_HANDLE                 = 144;
     static final int KEY_PRESS                          = 145;
+    static final int RELOCATE_AUTO_COMPLETE_POPUP       = 146;
+    static final int FOCUS_NODE_CHANGED                 = 147;
+    static final int AUTOFILL_FORM                      = 148;
 
     private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
     private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -3560,7 +3599,9 @@
     @Override
     public void clearFormData() {
         checkThread();
-        // TODO: Implement b/6083041
+        if (mAutoCompletePopup != null) {
+            mAutoCompletePopup.clearAdapter();
+        }
     }
 
     /**
@@ -3861,12 +3902,12 @@
     }
 
     private void scrollLayerTo(int x, int y) {
-        if (x == mScrollingLayerRect.left && y == mScrollingLayerRect.top) {
+        int dx = mScrollingLayerRect.left - x;
+        int dy = mScrollingLayerRect.top - y;
+        if (dx == 0 && y == 0) {
             return;
         }
         if (mSelectingText) {
-            int dx = mScrollingLayerRect.left - x;
-            int dy = mScrollingLayerRect.top - y;
             if (mSelectCursorBaseLayerId == mCurrentScrollingLayerId) {
                 mSelectCursorBase.offset(dx, dy);
             }
@@ -3874,6 +3915,9 @@
                 mSelectCursorExtent.offset(dx, dy);
             }
         }
+        if (mAutoCompletePopup != null) {
+            mAutoCompletePopup.scrollDelta(mCurrentScrollingLayerId, dx, dy);
+        }
         nativeScrollLayer(mCurrentScrollingLayerId, x, y);
         mScrollingLayerRect.left = x;
         mScrollingLayerRect.top = y;
@@ -4726,6 +4770,7 @@
     }
 
     private void onZoomAnimationEnd() {
+        mPrivateHandler.sendEmptyMessage(RELOCATE_AUTO_COMPLETE_POPUP);
     }
 
     void onFixedLengthZoomAnimationStart() {
@@ -4880,11 +4925,20 @@
     public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
         if (mInputConnection == null) {
             mInputConnection = new WebViewInputConnection();
+            mAutoCompletePopup = new AutoCompletePopup(mContext, this,
+                    mInputConnection);
         }
         mInputConnection.setupEditorInfo(outAttrs);
         return mInputConnection;
     }
 
+    private void relocateAutoCompletePopup() {
+        if (mAutoCompletePopup != null) {
+            mAutoCompletePopup.resetRect();
+            mAutoCompletePopup.setText(mInputConnection.getEditable());
+        }
+    }
+
     /**
      * Called in response to a message from webkit telling us that the soft
      * keyboard should be launched.
@@ -4916,6 +4970,91 @@
     }
 
     /**
+     * Called by AutoCompletePopup to find saved form data associated with the
+     * textfield
+     * @param name Name of the textfield.
+     * @param nodePointer Pointer to the node of the textfield, so it can be
+     *          compared to the currently focused textfield when the data is
+     *          retrieved.
+     * @param autoFillable true if WebKit has determined this field is part of
+     *          a form that can be auto filled.
+     * @param autoComplete true if the attribute "autocomplete" is set to true
+     *          on the textfield.
+     */
+    /* package */ void requestFormData(String name, int nodePointer,
+            boolean autoFillable, boolean autoComplete) {
+        if (mWebViewCore.getSettings().getSaveFormData()) {
+            Message update = mPrivateHandler.obtainMessage(REQUEST_FORM_DATA);
+            update.arg1 = nodePointer;
+            RequestFormData updater = new RequestFormData(name, getUrl(),
+                    update, autoFillable, autoComplete);
+            Thread t = new Thread(updater);
+            t.start();
+        }
+    }
+
+    /*
+     * This class requests an Adapter for the AutoCompletePopup which shows past
+     * entries stored in the database.  It is a Runnable so that it can be done
+     * in its own thread, without slowing down the UI.
+     */
+    private class RequestFormData implements Runnable {
+        private String mName;
+        private String mUrl;
+        private Message mUpdateMessage;
+        private boolean mAutoFillable;
+        private boolean mAutoComplete;
+        private WebSettingsClassic mWebSettings;
+
+        public RequestFormData(String name, String url, Message msg,
+                boolean autoFillable, boolean autoComplete) {
+            mName = name;
+            mUrl = WebTextView.urlForAutoCompleteData(url);
+            mUpdateMessage = msg;
+            mAutoFillable = autoFillable;
+            mAutoComplete = autoComplete;
+            mWebSettings = getSettings();
+        }
+
+        @Override
+        public void run() {
+            ArrayList<String> pastEntries = new ArrayList<String>();
+
+            if (mAutoFillable) {
+                // Note that code inside the adapter click handler in AutoCompletePopup depends
+                // on the AutoFill item being at the top of the drop down list. If you change
+                // the order, make sure to do it there too!
+                if (mWebSettings != null && mWebSettings.getAutoFillProfile() != null) {
+                    pastEntries.add(mWebView.getResources().getText(
+                            com.android.internal.R.string.autofill_this_form).toString() +
+                            " " +
+                    mAutoFillData.getPreviewString());
+                    mAutoCompletePopup.setIsAutoFillProfileSet(true);
+                } else {
+                    // There is no autofill profile set up yet, so add an option that
+                    // will invite the user to set their profile up.
+                    pastEntries.add(mWebView.getResources().getText(
+                            com.android.internal.R.string.setup_autofill).toString());
+                    mAutoCompletePopup.setIsAutoFillProfileSet(false);
+                }
+            }
+
+            if (mAutoComplete) {
+                pastEntries.addAll(mDatabase.getFormData(mUrl, mName));
+            }
+
+            if (pastEntries.size() > 0) {
+                ArrayAdapter<String> adapter = new ArrayAdapter<String>(
+                        mContext,
+                        com.android.internal.R.layout.web_text_view_dropdown,
+                        pastEntries);
+                mUpdateMessage.obj = adapter;
+                mUpdateMessage.sendToTarget();
+            }
+        }
+    }
+
+    /**
      * Dump the display tree to "/sdcard/displayTree.txt"
      *
      * @hide debug only
@@ -4990,6 +5129,13 @@
                 || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER;
     }
 
+    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
+        if (mAutoCompletePopup != null) {
+            return mAutoCompletePopup.onKeyPreIme(keyCode, event);
+        }
+        return false;
+    }
+
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (DebugFlags.WEB_VIEW) {
@@ -5593,6 +5739,7 @@
             // However, do not update the base layer as that hasn't changed
             setNewPicture(mLoadedPicture, false);
         }
+        relocateAutoCompletePopup();
     }
 
     @Override
@@ -7239,7 +7386,6 @@
                 viewToContentX(getScrollX() + getWidth()
                 - mWebView.getVerticalScrollbarWidth()),
                 viewToContentY(getScrollY() + getViewHeightWithTitle()));
-        content = nativeSubtractLayers(content);
         int screenTop = contentToViewY(content.top);
         int screenBottom = contentToViewY(content.bottom);
         int height = screenBottom - screenTop;
@@ -8021,6 +8167,12 @@
                     }
                     break;
                 }
+                case REQUEST_FORM_DATA:
+                    if (mFieldPointer == msg.arg1) {
+                        ArrayAdapter<String> adapter = (ArrayAdapter<String>)msg.obj;
+                        mAutoCompletePopup.setAdapter(adapter);
+                    }
+                    break;
 
                 case LONG_PRESS_CENTER:
                     // as this is shared by keydown and trackballdown, reset all
@@ -8175,6 +8327,11 @@
                     }
                     break;
 
+                case FOCUS_NODE_CHANGED:
+                    if (mAutoCompletePopup != null) {
+                        mAutoCompletePopup.setFocused(msg.arg1 == mFieldPointer);
+                    }
+                    // fall through to HIT_TEST_RESULT
                 case HIT_TEST_RESULT:
                     WebKitHitTest hit = (WebKitHitTest) msg.obj;
                     mFocusedNode = hit;
@@ -8191,11 +8348,20 @@
 
                 case SET_AUTOFILLABLE:
                     mAutoFillData = (WebViewCore.AutoFillData) msg.obj;
-                    // TODO: Support (b/6083041)
+                    if (mInputConnection != null) {
+                        mInputConnection.setAutoFillable(mAutoFillData.getQueryId());
+                        mAutoCompletePopup.setAutoFillQueryId(mAutoFillData.getQueryId());
+                    }
                     break;
 
                 case AUTOFILL_COMPLETE:
-                    // TODO: Support (b/6083041)
+                    if (mAutoCompletePopup != null) {
+                        ArrayList<String> pastEntries = new ArrayList<String>();
+                        mAutoCompletePopup.setAdapter(new ArrayAdapter<String>(
+                                mContext,
+                                com.android.internal.R.layout.web_text_view_dropdown,
+                                pastEntries));
+                    }
                     break;
 
                 case COPY_TO_CLIPBOARD:
@@ -8209,6 +8375,11 @@
                         mFieldPointer = initData.mFieldPointer;
                         mInputConnection.initEditorInfo(initData);
                         mInputConnection.setTextAndKeepSelection(initData.mText);
+                        nativeMapLayerRect(mNativeClass, initData.mNodeLayerId,
+                                initData.mNodeBounds);
+                        mAutoCompletePopup.setNodeBounds(initData.mNodeBounds,
+                                initData.mNodeLayerId);
+                        mAutoCompletePopup.setText(mInputConnection.getEditable());
                     }
                     break;
 
@@ -8237,6 +8408,15 @@
                     mWebViewCore.sendMessage(EventHub.KEY_PRESS, msg.arg1);
                     break;
 
+                case RELOCATE_AUTO_COMPLETE_POPUP:
+                    relocateAutoCompletePopup();
+                    break;
+
+                case AUTOFILL_FORM:
+                    mWebViewCore.sendMessage(EventHub.AUTOFILL_FORM,
+                            msg.arg1, /* unused */0);
+                    break;
+
                 default:
                     super.handleMessage(msg);
                     break;
@@ -9020,7 +9200,8 @@
     }
 
     /*package*/ void autoFillForm(int autoFillQueryId) {
-        mWebViewCore.sendMessage(EventHub.AUTOFILL_FORM, autoFillQueryId, /* unused */0);
+        mPrivateHandler.obtainMessage(AUTOFILL_FORM, autoFillQueryId, 0)
+            .sendToTarget();
     }
 
     /* package */ ViewManager getViewManager() {
@@ -9135,7 +9316,6 @@
     private native void     nativeCopyBaseContentToPicture(Picture pict);
     private native boolean  nativeHasContent();
     private native void     nativeStopGL();
-    private native Rect     nativeSubtractLayers(Rect content);
     private native void     nativeDiscardAllTextures();
     private native void     nativeTileProfilingStart();
     private native float    nativeTileProfilingStop();
@@ -9171,4 +9351,6 @@
     private static native int nativeGetHandleLayerId(int instance, int handle,
             Rect cursorLocation);
     private static native boolean nativeIsBaseFirst(int instance);
+    private static native void nativeMapLayerRect(int instance, int layerId,
+            Rect rect);
 }
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 81de356..0c34037 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -204,7 +204,7 @@
 
     /**
      * Notify the host application that an SSL error occurred while loading a
-     * resource, but the WebView but chose to proceed anyway based on a
+     * resource, but the WebView chose to proceed anyway based on a
      * decision retained from a previous response to onReceivedSslError().
      * @hide
      */
@@ -220,7 +220,7 @@
      * default behavior is to cancel, returning no client certificate.
      *
      * @param view The WebView that is initiating the callback.
-     * @param handler An ClientCertRequestHandler object that will
+     * @param handler A ClientCertRequestHandler object that will
      *            handle the user's response.
      * @param host_and_port The host and port of the requesting server.
      *
@@ -266,7 +266,7 @@
      * Notify the host application that a key was not handled by the WebView.
      * Except system keys, WebView always consumes the keys in the normal flow
      * or if shouldOverrideKeyEvent returns true. This is called asynchronously
-     * from where the key is dispatched. It gives the host application an chance
+     * from where the key is dispatched. It gives the host application a chance
      * to handle the unhandled key events.
      *
      * @param view The WebView that is initiating the callback.
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index de30755..77d2641 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -339,10 +339,10 @@
     /**
      * Called by JNI when the focus node changed.
      */
-    private void focusNodeChanged(WebKitHitTest hitTest) {
+    private void focusNodeChanged(int nodePointer, WebKitHitTest hitTest) {
         if (mWebView == null) return;
-        mWebView.mPrivateHandler.obtainMessage(WebViewClassic.HIT_TEST_RESULT, hitTest)
-                .sendToTarget();
+        mWebView.mPrivateHandler.obtainMessage(WebViewClassic.FOCUS_NODE_CHANGED,
+                nodePointer, 0, hitTest).sendToTarget();
     }
 
     /**
@@ -953,22 +953,34 @@
     static class TextFieldInitData {
         public TextFieldInitData(int fieldPointer,
                 String text, int type, boolean isSpellCheckEnabled,
-                boolean isTextFieldNext, String label, int maxLength) {
+                boolean autoComplete, boolean isTextFieldNext,
+                boolean isTextFieldPrev, String name, String label,
+                int maxLength, Rect nodeBounds, int nodeLayerId) {
             mFieldPointer = fieldPointer;
             mText = text;
             mType = type;
+            mIsAutoCompleteEnabled = autoComplete;
             mIsSpellCheckEnabled = isSpellCheckEnabled;
             mIsTextFieldNext = isTextFieldNext;
+            mIsTextFieldPrev = isTextFieldPrev;
+            mName = name;
             mLabel = label;
             mMaxLength = maxLength;
+            mNodeBounds = nodeBounds;
+            mNodeLayerId = nodeLayerId;
         }
         int mFieldPointer;
         String mText;
         int mType;
         boolean mIsSpellCheckEnabled;
         boolean mIsTextFieldNext;
+        boolean mIsTextFieldPrev;
+        boolean mIsAutoCompleteEnabled;
+        String mName;
         String mLabel;
         int mMaxLength;
+        Rect mNodeBounds;
+        int mNodeLayerId;
     }
 
     // mAction of TouchEventData can be MotionEvent.getAction() which uses the
@@ -2787,14 +2799,17 @@
 
     // called by JNI
     private void initEditField(int pointer, String text, int inputType,
-            boolean isSpellCheckEnabled, boolean nextFieldIsText,
-            String label, int start, int end, int selectionPtr, int maxLength) {
+            boolean isSpellCheckEnabled, boolean isAutoCompleteEnabled,
+            boolean nextFieldIsText, boolean prevFieldIsText, String name,
+            String label, int start, int end, int selectionPtr, int maxLength,
+            Rect nodeRect, int nodeLayer) {
         if (mWebView == null) {
             return;
         }
         TextFieldInitData initData = new TextFieldInitData(pointer,
-                text, inputType, isSpellCheckEnabled, nextFieldIsText, label,
-                maxLength);
+                text, inputType, isSpellCheckEnabled, isAutoCompleteEnabled,
+                nextFieldIsText, prevFieldIsText, name, label, maxLength,
+                nodeRect, nodeLayer);
         Message.obtain(mWebView.mPrivateHandler,
                 WebViewClassic.INIT_EDIT_FIELD, initData).sendToTarget();
         Message.obtain(mWebView.mPrivateHandler,
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index badfaa7..c2d8bda 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -740,7 +740,7 @@
     
     /**
      * Converts a flat list position (the raw position of an item (child or group)
-     * in the list) to an group and/or child position (represented in a
+     * in the list) to a group and/or child position (represented in a
      * packed position). This is useful in situations where the caller needs to
      * use the underlying {@link ListView}'s methods. Use
      * {@link ExpandableListView#getPackedPositionType} ,
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 0dedf8b..739bcce 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -99,7 +99,7 @@
     private final Rect mTempRect = new Rect();
 
     public GridView(Context context) {
-        super(context);
+        this(context, null);
     }
 
     public GridView(Context context, AttributeSet attrs) {
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 0b4ebf4..0db6ef2 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -1389,7 +1389,7 @@
         }
         mChildToScrollTo = null;
 
-        // Calling this with the present values causes it to re-clam them
+        // Calling this with the present values causes it to re-claim them
         scrollTo(mScrollX, mScrollY);
     }
 
@@ -1412,7 +1412,7 @@
     }
 
     /**
-     * Return true if child is an descendant of parent, (or equal to the parent).
+     * Return true if child is a descendant of parent, (or equal to the parent).
      */
     private boolean isViewDescendantOf(View child, View parent) {
         if (child == parent) {
@@ -1427,7 +1427,7 @@
      * Fling the scroll view
      *
      * @param velocityX The initial velocity in the X direction. Positive
-     *                  numbers mean that the finger/curor is moving down the screen,
+     *                  numbers mean that the finger/cursor is moving down the screen,
      *                  which means we want to scroll towards the left.
      */
     public void fling(int velocityX) {
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 07ae93b..3001ea1 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -193,9 +193,6 @@
         }
     }
 
-    /**
-     * @hide
-     */
     @Override
     public int getResolvedLayoutDirection(Drawable dr) {
         return (dr == mDrawable) ?
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index f4d5d74..1d966b3 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1017,7 +1017,7 @@
 
             View hintView = mPromptView;
             if (hintView != null) {
-                // if an hint has been specified, we accomodate more space for it and
+                // if a hint has been specified, we accomodate more space for it and
                 // add a text view in the drop down menu, at the bottom of the list
                 LinearLayout hintContainer = new LinearLayout(context);
                 hintContainer.setOrientation(LinearLayout.VERTICAL);
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index e298acb..3bc4f7f 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -910,9 +910,6 @@
         }
     }
 
-    /**
-     * @hide
-     */
     @Override
     public int getResolvedLayoutDirection(Drawable who) {
         return (who == mProgressDrawable || who == mIndeterminateDrawable) ?
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 3ffc0fe..25dd438 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -1412,7 +1412,7 @@
         }
         mChildToScrollTo = null;
 
-        // Calling this with the present values causes it to re-clam them
+        // Calling this with the present values causes it to re-claim them
         scrollTo(mScrollX, mScrollY);
     }
 
@@ -1436,7 +1436,7 @@
     }
 
     /**
-     * Return true if child is an descendant of parent, (or equal to the parent).
+     * Return true if child is a descendant of parent, (or equal to the parent).
      */
     private boolean isViewDescendantOf(View child, View parent) {
         if (child == parent) {
diff --git a/core/java/android/widget/SimpleAdapter.java b/core/java/android/widget/SimpleAdapter.java
index 4b17a92..98bcfff 100644
--- a/core/java/android/widget/SimpleAdapter.java
+++ b/core/java/android/widget/SimpleAdapter.java
@@ -268,7 +268,7 @@
     /**
      * Called by bindView() to set the text for a TextView but only if
      * there is no existing ViewBinder or if the existing ViewBinder cannot
-     * handle binding to an TextView.
+     * handle binding to a TextView.
      *
      * @param v TextView to receive text
      * @param text the text to be set for the TextView
diff --git a/core/java/android/widget/SimpleCursorAdapter.java b/core/java/android/widget/SimpleCursorAdapter.java
index c5c6c69..f74a314 100644
--- a/core/java/android/widget/SimpleCursorAdapter.java
+++ b/core/java/android/widget/SimpleCursorAdapter.java
@@ -216,7 +216,7 @@
     /**
      * Called by bindView() to set the text for a TextView but only if
      * there is no existing ViewBinder or if the existing ViewBinder cannot
-     * handle binding to an TextView.
+     * handle binding to a TextView.
      *
      * Intended to be overridden by Adapters that need to filter strings
      * retrieved from the database.
diff --git a/core/java/android/widget/SimpleCursorTreeAdapter.java b/core/java/android/widget/SimpleCursorTreeAdapter.java
index a033542..6babf3e 100644
--- a/core/java/android/widget/SimpleCursorTreeAdapter.java
+++ b/core/java/android/widget/SimpleCursorTreeAdapter.java
@@ -283,7 +283,7 @@
     /**
      * Called by bindView() to set the text for a TextView but only if
      * there is no existing ViewBinder or if the existing ViewBinder cannot
-     * handle binding to an TextView.
+     * handle binding to a TextView.
      *
      * Intended to be overridden by Adapters that need to filter strings
      * retrieved from the database.
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 4c89218..e535170 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -1214,7 +1214,7 @@
             if (imm != null) imm.restartInput(this);
         }
 
-        if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+        if (mEditor != null) getEditor().invalidateTextDisplayList();
         prepareCursorControllers();
 
         // start or stop the cursor blinking as appropriate
@@ -2328,7 +2328,7 @@
     public void setHighlightColor(int color) {
         if (mHighlightColor != color) {
             mHighlightColor = color;
-            if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+            if (mEditor != null) getEditor().invalidateTextDisplayList();
             invalidate();
         }
     }
@@ -2349,7 +2349,7 @@
         mShadowDx = dx;
         mShadowDy = dy;
 
-        if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+        if (mEditor != null) getEditor().invalidateTextDisplayList();
         invalidate();
     }
 
@@ -2841,7 +2841,7 @@
             }
         }
         if (inval) {
-            if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+            if (mEditor != null) getEditor().invalidateTextDisplayList();
             invalidate();
         }
     }
@@ -3334,7 +3334,7 @@
 
         // Invalidate display list if hint will be used
         if (mEditor != null && mText.length() == 0 && mHint != null) {
-            getEditor().mTextDisplayListIsValid = false;
+            getEditor().invalidateTextDisplayList();
         }
     }
 
@@ -4396,9 +4396,6 @@
         }
     }
 
-    /**
-     * @hide
-     */
     @Override
     public int getResolvedLayoutDirection(Drawable who) {
         if (who == null) return View.LAYOUT_DIRECTION_LTR;
@@ -4429,13 +4426,13 @@
                     if (dr.mDrawableStart != null) dr.mDrawableStart.mutate().setAlpha(alpha);
                     if (dr.mDrawableEnd != null) dr.mDrawableEnd.mutate().setAlpha(alpha);
                 }
-                if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+                if (mEditor != null) getEditor().invalidateTextDisplayList();
             }
             return true;
         }
 
         if (mCurrentAlpha != 255) {
-            if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+            if (mEditor != null) getEditor().invalidateTextDisplayList();
         }
         mCurrentAlpha = 255;
         return false;
@@ -6292,7 +6289,7 @@
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
-        if (changed && mEditor != null) getEditor().mTextDisplayListIsValid = false;
+        if (changed && mEditor != null) getEditor().invalidateTextDisplayList();
     }
 
     private boolean isShowingHint() {
@@ -7130,7 +7127,7 @@
             } else {
                 ims.mContentChanged = true;
             }
-            if (mEditor != null) getEditor().mTextDisplayListIsValid = false;
+            if (mEditor != null) getEditor().invalidateTextDisplayList();
         }
 
         if (MetaKeyKeyListener.isMetaTracker(buf, what)) {
@@ -8277,7 +8274,7 @@
             if (getEditor().mPositionListener != null) {
                 getEditor().mPositionListener.onScrollChanged();
             }
-            getEditor().mTextDisplayListIsValid = false;
+            getEditor().invalidateTextDisplayList();
         }
     }
 
@@ -11303,7 +11300,6 @@
         InputMethodState mInputMethodState;
 
         DisplayList mTextDisplayList;
-        boolean mTextDisplayListIsValid;
 
         boolean mFrozenWithFocus;
         boolean mSelectionMoved;
@@ -11392,9 +11388,7 @@
                 removeCallbacks(mShowSuggestionRunnable);
             }
 
-            if (mTextDisplayList != null) {
-                mTextDisplayList.invalidate();
-            }
+            invalidateTextDisplayList();
 
             if (mSpellChecker != null) {
                 mSpellChecker.closeSession();
@@ -11551,7 +11545,7 @@
 
         void sendOnTextChanged(int start, int after) {
             updateSpellCheckSpans(start, start + after, false);
-            mTextDisplayListIsValid = false;
+            invalidateTextDisplayList();
 
             // Hide the controllers as soon as text is modified (typing, procedural...)
             // We do not hide the span controllers, since they can be added when a new text is
@@ -11708,10 +11702,11 @@
             layout.drawBackground(canvas, highlight, mHighlightPaint, cursorOffsetVertical,
                     firstLine, lastLine);
 
-            if (mTextDisplayList == null || !mTextDisplayList.isValid() ||
-                    !mTextDisplayListIsValid) {
+            if (mTextDisplayList == null || !mTextDisplayList.isValid()) {
+                boolean displayListCreated = false;
                 if (mTextDisplayList == null) {
                     mTextDisplayList = getHardwareRenderer().createDisplayList("Text");
+                    displayListCreated = true;
                 }
 
                 final HardwareCanvas hardwareCanvas = mTextDisplayList.start();
@@ -11726,7 +11721,9 @@
                 } finally {
                     hardwareCanvas.onPostDraw();
                     mTextDisplayList.end();
-                    mTextDisplayListIsValid = true;
+                    if (displayListCreated && USE_DISPLAY_LIST_PROPERTIES) {
+                        mTextDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+                    }
                 }
             }
             canvas.translate(mScrollX, mScrollY);
@@ -11744,6 +11741,10 @@
             if (translate) canvas.translate(0, -cursorOffsetVertical);
         }
 
+        private void invalidateTextDisplayList() {
+            if (mTextDisplayList != null) mTextDisplayList.invalidate();
+        }
+
         private void updateCursorsPositions() {
             if (mCursorDrawableRes == 0) {
                 mCursorCount = 0;
diff --git a/core/java/com/android/internal/util/AsyncService.java b/core/java/com/android/internal/util/AsyncService.java
index 54d3c42..e39a2bf 100644
--- a/core/java/com/android/internal/util/AsyncService.java
+++ b/core/java/com/android/internal/util/AsyncService.java
@@ -106,7 +106,7 @@
 
     /**
      * Called when service is destroyed. After returning the
-     * service is dead an no more processing should be expected
+     * service is dead and no more processing should be expected
      * to occur.
      */
     @Override
diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java
index 61c0c8e..da189f1 100644
--- a/core/java/com/android/internal/util/StateMachine.java
+++ b/core/java/com/android/internal/util/StateMachine.java
@@ -1195,7 +1195,7 @@
     }
 
     /**
-     * Constructor creates an StateMachine using the looper.
+     * Constructor creates a StateMachine using the looper.
      *
      * @param name of the state machine
      */
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java
index 3865510..f535a08 100644
--- a/core/java/com/android/internal/widget/SlidingTab.java
+++ b/core/java/com/android/internal/widget/SlidingTab.java
@@ -416,7 +416,7 @@
         }
 
         /**
-         * Start animating the slider. Note we need two animations since an ValueAnimator
+         * Start animating the slider. Note we need two animations since a ValueAnimator
          * keeps internal state of the invalidation region which is just the view being animated.
          *
          * @param anim1
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 642988b..92b07b3 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -53,6 +53,7 @@
 	android_view_KeyEvent.cpp \
 	android_view_KeyCharacterMap.cpp \
 	android_view_HardwareRenderer.cpp \
+	android_view_GLES20DisplayList.cpp \
 	android_view_GLES20Canvas.cpp \
 	android_view_MotionEvent.cpp \
 	android_view_PointerIcon.cpp \
@@ -69,6 +70,7 @@
 	android_os_StatFs.cpp \
 	android_os_SystemClock.cpp \
 	android_os_SystemProperties.cpp \
+	android_os_Trace.cpp \
 	android_os_UEventObserver.cpp \
 	android_net_LocalSocketImpl.cpp \
 	android_net_NetUtils.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index de9fd33..92ff8da 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -117,6 +117,7 @@
 extern int register_android_graphics_PixelFormat(JNIEnv* env);
 extern int register_android_view_Display(JNIEnv* env);
 extern int register_android_view_DisplayEventReceiver(JNIEnv* env);
+extern int register_android_view_GLES20DisplayList(JNIEnv* env);
 extern int register_android_view_GLES20Canvas(JNIEnv* env);
 extern int register_android_view_HardwareRenderer(JNIEnv* env);
 extern int register_android_view_Surface(JNIEnv* env);
@@ -136,6 +137,7 @@
 extern int register_android_os_StatFs(JNIEnv *env);
 extern int register_android_os_SystemProperties(JNIEnv *env);
 extern int register_android_os_SystemClock(JNIEnv* env);
+extern int register_android_os_Trace(JNIEnv* env);
 extern int register_android_os_FileObserver(JNIEnv *env);
 extern int register_android_os_FileUtils(JNIEnv *env);
 extern int register_android_os_UEventObserver(JNIEnv* env);
@@ -1101,6 +1103,7 @@
     REG_JNI(register_android_nio_utils),
     REG_JNI(register_android_graphics_PixelFormat),
     REG_JNI(register_android_graphics_Graphics),
+    REG_JNI(register_android_view_GLES20DisplayList),
     REG_JNI(register_android_view_GLES20Canvas),
     REG_JNI(register_android_view_HardwareRenderer),
     REG_JNI(register_android_view_Surface),
@@ -1151,6 +1154,7 @@
     REG_JNI(register_android_os_ParcelFileDescriptor),
     REG_JNI(register_android_os_Power),
     REG_JNI(register_android_os_StatFs),
+    REG_JNI(register_android_os_Trace),
     REG_JNI(register_android_os_UEventObserver),
     REG_JNI(register_android_net_LocalSocketImpl),
     REG_JNI(register_android_net_NetworkUtils),
diff --git a/core/jni/android/graphics/Camera.cpp b/core/jni/android/graphics/Camera.cpp
index 76d415a..5176d9a 100644
--- a/core/jni/android/graphics/Camera.cpp
+++ b/core/jni/android/graphics/Camera.cpp
@@ -57,6 +57,21 @@
     v->setCameraLocation(SkFloatToScalar(x), SkFloatToScalar(y), SkFloatToScalar(z));
 }
 
+static jfloat Camera_getLocationX(JNIEnv* env, jobject obj) {
+    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    return SkScalarToFloat(v->getCameraLocationX());
+}
+
+static jfloat Camera_getLocationY(JNIEnv* env, jobject obj) {
+    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    return SkScalarToFloat(v->getCameraLocationY());
+}
+
+static jfloat Camera_getLocationZ(JNIEnv* env, jobject obj) {
+    Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+    return SkScalarToFloat(v->getCameraLocationZ());
+}
+
 static void Camera_getMatrix(JNIEnv* env, jobject obj, int native_matrix) {
     Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
     v->getMatrix((SkMatrix*)native_matrix);
@@ -93,6 +108,9 @@
     { "rotateZ",             "(F)V",   (void*)Camera_rotateZ       },
     { "rotate",              "(FFF)V", (void*)Camera_rotate        },
     { "setLocation",         "(FFF)V", (void*)Camera_setLocation   },
+    { "getLocationX",        "()F",    (void*)Camera_getLocationX  },
+    { "getLocationY",        "()F",    (void*)Camera_getLocationY  },
+    { "getLocationZ",        "()F",    (void*)Camera_getLocationZ  },
     { "nativeGetMatrix",     "(I)V",   (void*)Camera_getMatrix     },
     { "nativeApplyToCanvas", "(I)V",   (void*)Camera_applyToCanvas },
     { "dotWithNormal",       "(FFF)F", (void*)Camera_dotWithNormal }
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 929df540..634efa6 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -556,6 +556,12 @@
     nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
 }
 
+extern void setGLDebugLevel(int level);
+void nativeEnableTracing(JNIEnv *env, jclass clazz)
+{
+    setGLDebugLevel(1);
+}
+
 static int checkFormat(SkBitmap::Config config, int format, int type)
 {
     switch(config) {
@@ -1026,6 +1032,7 @@
     { "native_getType", "(Landroid/graphics/Bitmap;)I", (void*) util_getType },
     { "native_texImage2D", "(IIILandroid/graphics/Bitmap;II)I", (void*)util_texImage2D },
     { "native_texSubImage2D", "(IIIILandroid/graphics/Bitmap;II)I", (void*)util_texSubImage2D },
+    { "native_enableTracing", "()V",                    (void*)nativeEnableTracing },
 };
 
 static JNINativeMethod gEtc1Methods[] = {
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index 68a8de8..7984b9c 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -72,7 +72,7 @@
 #define AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED    -20
 
 jint android_media_translateRecorderErrorCode(int code) {
-    switch(code) {
+    switch (code) {
     case NO_ERROR:
         return AUDIORECORD_SUCCESS;
     case BAD_VALUE:
@@ -81,7 +81,7 @@
         return AUDIORECORD_ERROR_INVALID_OPERATION;
     default:
         return AUDIORECORD_ERROR;
-    }   
+    }
 }
 
 
@@ -90,14 +90,14 @@
     if (event == AudioRecord::EVENT_MORE_DATA) {
         // set size to 0 to signal we're not using the callback to read more data
         AudioRecord::Buffer* pBuff = (AudioRecord::Buffer*)info;
-        pBuff->size = 0;  
-    
+        pBuff->size = 0;
+
     } else if (event == AudioRecord::EVENT_MARKER) {
         audiorecord_callback_cookie *callbackInfo = (audiorecord_callback_cookie *)user;
         JNIEnv *env = AndroidRuntime::getJNIEnv();
         if (user && env) {
             env->CallStaticVoidMethod(
-                callbackInfo->audioRecord_class, 
+                callbackInfo->audioRecord_class,
                 javaAudioRecordFields.postNativeEventInJava,
                 callbackInfo->audioRecord_ref, event, 0,0, NULL);
             if (env->ExceptionCheck()) {
@@ -111,7 +111,7 @@
         JNIEnv *env = AndroidRuntime::getJNIEnv();
         if (user && env) {
             env->CallStaticVoidMethod(
-                callbackInfo->audioRecord_class, 
+                callbackInfo->audioRecord_class,
                 javaAudioRecordFields.postNativeEventInJava,
                 callbackInfo->audioRecord_ref, event, 0,0, NULL);
             if (env->ExceptionCheck()) {
@@ -140,7 +140,7 @@
     uint32_t nbChannels = popcount(channels);
 
     // compare the format against the Java constants
-    if ((audioFormat != javaAudioRecordFields.PCM16) 
+    if ((audioFormat != javaAudioRecordFields.PCM16)
         && (audioFormat != javaAudioRecordFields.PCM8)) {
         ALOGE("Error creating AudioRecord: unsupported audio format.");
         return AUDIORECORD_ERROR_SETUP_INVALIDFORMAT;
@@ -156,7 +156,7 @@
     }
     int frameSize = nbChannels * bytesPerSample;
     size_t frameCount = buffSizeInBytes / frameSize;
-    
+
     if (uint32_t(source) >= AUDIO_SOURCE_CNT) {
         ALOGE("Error creating AudioRecord: unknown source.");
         return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE;
@@ -181,11 +181,11 @@
 
     // create an uninitialized AudioRecord object
     lpRecorder = new AudioRecord();
-        if(lpRecorder == NULL) {
+        if (lpRecorder == NULL) {
         ALOGE("Error creating AudioRecord instance.");
         return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
     }
-    
+
     // create the callback information:
     // this data will be passed with every AudioRecord callback
     jclass clazz = env->GetObjectClass(thiz);
@@ -197,20 +197,20 @@
     lpCallbackData->audioRecord_class = (jclass)env->NewGlobalRef(clazz);
     // we use a weak reference so the AudioRecord object can be garbage collected.
     lpCallbackData->audioRecord_ref = env->NewGlobalRef(weak_this);
-    
+
     lpRecorder->set((audio_source_t) source,
         sampleRateInHertz,
         format,        // word length, PCM
         channels,
         frameCount,
-        0,             // flags
+        (AudioRecord::record_flags) 0,  // flags
         recorderCallback,// callback_t
         lpCallbackData,// void* user
         0,             // notificationFrames,
         true,          // threadCanCallJava)
         sessionId);
 
-    if(lpRecorder->initCheck() != NO_ERROR) {
+    if (lpRecorder->initCheck() != NO_ERROR) {
         ALOGE("Error creating AudioRecord instance: initialization check failed.");
         goto native_init_failure;
     }
@@ -225,16 +225,16 @@
     env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
     nSession = NULL;
 
-    // save our newly created C++ AudioRecord in the "nativeRecorderInJavaObj" field 
+    // save our newly created C++ AudioRecord in the "nativeRecorderInJavaObj" field
     // of the Java object
     env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, (int)lpRecorder);
-    
+
     // save our newly created callback information in the "nativeCallbackCookie" field
     // of the Java object (in mNativeCallbackCookie) so we can free the memory in finalize()
     env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, (int)lpCallbackData);
-    
+
     return AUDIORECORD_SUCCESS;
-    
+
     // failure:
 native_init_failure:
     env->DeleteGlobalRef(lpCallbackData->audioRecord_class);
@@ -246,7 +246,7 @@
 
     env->SetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj, 0);
     env->SetIntField(thiz, javaAudioRecordFields.nativeCallbackCookie, 0);
-    
+
     return AUDIORECORD_ERROR_SETUP_NATIVEINITFAILED;
 }
 
@@ -256,13 +256,13 @@
 static int
 android_media_AudioRecord_start(JNIEnv *env, jobject thiz)
 {
-    AudioRecord *lpRecorder = 
+    AudioRecord *lpRecorder =
             (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     if (lpRecorder == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
         return AUDIORECORD_ERROR;
     }
-    
+
     return android_media_translateRecorderErrorCode(lpRecorder->start());
 }
 
@@ -271,7 +271,7 @@
 static void
 android_media_AudioRecord_stop(JNIEnv *env, jobject thiz)
 {
-    AudioRecord *lpRecorder = 
+    AudioRecord *lpRecorder =
             (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     if (lpRecorder == NULL ) {
         jniThrowException(env, "java/lang/IllegalStateException", NULL);
@@ -288,7 +288,7 @@
 
     // serialize access. Ugly, but functional.
     Mutex::Autolock lock(&sLock);
-    AudioRecord *lpRecorder = 
+    AudioRecord *lpRecorder =
             (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     audiorecord_callback_cookie *lpCookie = (audiorecord_callback_cookie *)env->GetIntField(
         thiz, javaAudioRecordFields.nativeCallbackCookie);
@@ -304,7 +304,7 @@
         lpRecorder->stop();
         delete lpRecorder;
     }
-    
+
     // delete the callback information
     if (lpCookie) {
         ALOGV("deleting lpCookie: %x\n", (int)lpCookie);
@@ -329,7 +329,7 @@
     AudioRecord *lpRecorder = NULL;
 
     // get the audio recorder from which we'll read new audio samples
-    lpRecorder = 
+    lpRecorder =
             (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     if (lpRecorder == NULL) {
         ALOGE("Unable to retrieve AudioRecord object, can't record");
@@ -355,8 +355,8 @@
 
     // read the new audio data from the native AudioRecord object
     ssize_t recorderBuffSize = lpRecorder->frameCount()*lpRecorder->frameSize();
-    ssize_t readSize = lpRecorder->read(recordBuff + offsetInBytes, 
-                                        sizeInBytes > (jint)recorderBuffSize ? 
+    ssize_t readSize = lpRecorder->read(recordBuff + offsetInBytes,
+                                        sizeInBytes > (jint)recorderBuffSize ?
                                             (jint)recorderBuffSize : sizeInBytes );
     env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0);
 
@@ -381,41 +381,41 @@
     //ALOGV("Entering android_media_AudioRecord_readInBuffer");
 
     // get the audio recorder from which we'll read new audio samples
-    lpRecorder = 
+    lpRecorder =
         (AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
-    if(lpRecorder==NULL)
+    if (lpRecorder==NULL)
         return 0;
 
     // direct buffer and direct access supported?
     long capacity = env->GetDirectBufferCapacity(jBuffer);
-    if(capacity == -1) {
+    if (capacity == -1) {
         // buffer direct access is not supported
         ALOGE("Buffer direct access is not supported, can't record");
         return 0;
     }
     //ALOGV("capacity = %ld", capacity);
     jbyte* nativeFromJavaBuf = (jbyte*) env->GetDirectBufferAddress(jBuffer);
-    if(nativeFromJavaBuf==NULL) {
+    if (nativeFromJavaBuf==NULL) {
         ALOGE("Buffer direct access is not supported, can't record");
         return 0;
-    } 
+    }
 
     // read new data from the recorder
-    return (jint) lpRecorder->read(nativeFromJavaBuf, 
+    return (jint) lpRecorder->read(nativeFromJavaBuf,
                                    capacity < sizeInBytes ? capacity : sizeInBytes);
 }
 
 
 // ----------------------------------------------------------------------------
-static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env,  jobject thiz, 
+static jint android_media_AudioRecord_set_marker_pos(JNIEnv *env,  jobject thiz,
         jint markerPos) {
-            
+
     AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
                 thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
-                
+
     if (lpRecorder) {
-        return 
-            android_media_translateRecorderErrorCode( lpRecorder->setMarkerPosition(markerPos) );   
+        return
+            android_media_translateRecorderErrorCode( lpRecorder->setMarkerPosition(markerPos) );
     } else {
         jniThrowException(env, "java/lang/IllegalStateException",
             "Unable to retrieve AudioRecord pointer for setMarkerPosition()");
@@ -426,11 +426,11 @@
 
 // ----------------------------------------------------------------------------
 static jint android_media_AudioRecord_get_marker_pos(JNIEnv *env,  jobject thiz) {
-    
+
     AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
                 thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     uint32_t markerPos = 0;
-                
+
     if (lpRecorder) {
         lpRecorder->getMarkerPosition(&markerPos);
         return (jint)markerPos;
@@ -445,28 +445,28 @@
 // ----------------------------------------------------------------------------
 static jint android_media_AudioRecord_set_pos_update_period(JNIEnv *env,  jobject thiz,
         jint period) {
-            
+
     AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
                 thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
-                
+
     if (lpRecorder) {
-        return 
-            android_media_translateRecorderErrorCode( lpRecorder->setPositionUpdatePeriod(period) );   
+        return
+            android_media_translateRecorderErrorCode( lpRecorder->setPositionUpdatePeriod(period) );
     } else {
         jniThrowException(env, "java/lang/IllegalStateException",
             "Unable to retrieve AudioRecord pointer for setPositionUpdatePeriod()");
         return AUDIORECORD_ERROR;
-    }            
+    }
 }
 
 
 // ----------------------------------------------------------------------------
 static jint android_media_AudioRecord_get_pos_update_period(JNIEnv *env,  jobject thiz) {
-    
+
     AudioRecord *lpRecorder = (AudioRecord *)env->GetIntField(
                 thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
     uint32_t period = 0;
-                
+
     if (lpRecorder) {
         lpRecorder->getPositionUpdatePeriod(&period);
         return (jint)period;
@@ -514,7 +514,7 @@
                                        (void *)android_media_AudioRecord_setup},
     {"native_finalize",      "()V",    (void *)android_media_AudioRecord_finalize},
     {"native_release",       "()V",    (void *)android_media_AudioRecord_release},
-    {"native_read_in_byte_array", 
+    {"native_read_in_byte_array",
                              "([BII)I", (void *)android_media_AudioRecord_readInByteArray},
     {"native_read_in_short_array",
                              "([SII)I", (void *)android_media_AudioRecord_readInShortArray},
@@ -541,7 +541,7 @@
 
 // ----------------------------------------------------------------------------
 
-extern bool android_media_getIntConstantFromClass(JNIEnv* pEnv, 
+extern bool android_media_getIntConstantFromClass(JNIEnv* pEnv,
                 jclass theClass, const char* className, const char* constName, int* constVal);
 
 // ----------------------------------------------------------------------------
@@ -550,7 +550,7 @@
     javaAudioRecordFields.postNativeEventInJava = NULL;
     javaAudioRecordFields.nativeRecorderInJavaObj = NULL;
     javaAudioRecordFields.nativeCallbackCookie = NULL;
-    
+
 
     // Get the AudioRecord class
     jclass audioRecordClass = env->FindClass(kClassPathName);
@@ -569,7 +569,7 @@
 
     // Get the variables
     //    mNativeRecorderInJavaObj
-    javaAudioRecordFields.nativeRecorderInJavaObj = 
+    javaAudioRecordFields.nativeRecorderInJavaObj =
         env->GetFieldID(audioRecordClass,
                         JAVA_NATIVERECORDERINJAVAOBJ_FIELD_NAME, "I");
     if (javaAudioRecordFields.nativeRecorderInJavaObj == NULL) {
@@ -592,13 +592,13 @@
         ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
         return -1;
     }
-    if ( !android_media_getIntConstantFromClass(env, audioFormatClass, 
-                JAVA_AUDIOFORMAT_CLASS_NAME, 
+    if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
+                JAVA_AUDIOFORMAT_CLASS_NAME,
                 JAVA_CONST_PCM16_NAME, &(javaAudioRecordFields.PCM16))
-           || !android_media_getIntConstantFromClass(env, audioFormatClass, 
-                JAVA_AUDIOFORMAT_CLASS_NAME, 
+           || !android_media_getIntConstantFromClass(env, audioFormatClass,
+                JAVA_AUDIOFORMAT_CLASS_NAME,
                 JAVA_CONST_PCM8_NAME, &(javaAudioRecordFields.PCM8)) ) {
-        // error log performed in getIntConstantFromClass() 
+        // error log performed in getIntConstantFromClass()
         return -1;
     }
 
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index ee5eb7e..bff5994 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -268,7 +268,7 @@
 int register_android_media_AudioSystem(JNIEnv *env)
 {
     AudioSystem::setErrorCallback(android_media_AudioSystem_error_callback);
-    
+
     return AndroidRuntime::registerNativeMethods(env,
                 kClassPathName, gMethods, NELEM(gMethods));
 }
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 26c9435..d4ed06c 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -105,7 +105,7 @@
 
 
 jint android_media_translateErrorCode(int code) {
-    switch(code) {
+    switch (code) {
     case NO_ERROR:
         return AUDIOTRACK_SUCCESS;
     case BAD_VALUE:
@@ -114,7 +114,7 @@
         return AUDIOTRACK_ERROR_INVALID_OPERATION;
     default:
         return AUDIOTRACK_ERROR;
-    }   
+    }
 }
 
 
@@ -123,14 +123,14 @@
     if (event == AudioTrack::EVENT_MORE_DATA) {
         // set size to 0 to signal we're not using the callback to write more data
         AudioTrack::Buffer* pBuff = (AudioTrack::Buffer*)info;
-        pBuff->size = 0;  
-    
+        pBuff->size = 0;
+
     } else if (event == AudioTrack::EVENT_MARKER) {
         audiotrack_callback_cookie *callbackInfo = (audiotrack_callback_cookie *)user;
         JNIEnv *env = AndroidRuntime::getJNIEnv();
         if (user && env) {
             env->CallStaticVoidMethod(
-                callbackInfo->audioTrack_class, 
+                callbackInfo->audioTrack_class,
                 javaAudioTrackFields.postNativeEventInJava,
                 callbackInfo->audioTrack_ref, event, 0,0, NULL);
             if (env->ExceptionCheck()) {
@@ -144,7 +144,7 @@
         JNIEnv *env = AndroidRuntime::getJNIEnv();
         if (user && env) {
             env->CallStaticVoidMethod(
-                callbackInfo->audioTrack_class, 
+                callbackInfo->audioTrack_class,
                 javaAudioTrackFields.postNativeEventInJava,
                 callbackInfo->audioTrack_ref, event, 0,0, NULL);
             if (env->ExceptionCheck()) {
@@ -186,7 +186,7 @@
     }
 
     int nbChannels = popcount(nativeChannelMask);
-    
+
     // check the stream type
     audio_stream_type_t atStreamType;
     switch (streamType) {
@@ -215,7 +215,7 @@
     // for the moment 8bitPCM in MODE_STATIC is not supported natively in the AudioTrack C++ class
     // so we declare everything as 16bitPCM, the 8->16bit conversion for MODE_STATIC will be handled
     // in android_media_AudioTrack_native_write_byte()
-    if ((audioFormat == javaAudioTrackFields.PCM8) 
+    if ((audioFormat == javaAudioTrackFields.PCM8)
         && (memoryMode == javaAudioTrackFields.MODE_STATIC)) {
         ALOGV("android_media_AudioTrack_native_setup(): requesting MODE_STATIC for 8bit \
             buff size of %dbytes, switching to 16bit, buff size of %dbytes",
@@ -230,9 +230,9 @@
     audio_format_t format = audioFormat == javaAudioTrackFields.PCM16 ?
             AUDIO_FORMAT_PCM_16_BIT : AUDIO_FORMAT_PCM_8_BIT;
     int frameCount = buffSizeInBytes / (nbChannels * bytesPerSample);
-    
+
     AudioTrackJniStorage* lpJniStorage = new AudioTrackJniStorage();
-    
+
     // initialize the callback information:
     // this data will be passed with every AudioTrack callback
     jclass clazz = env->GetObjectClass(thiz);
@@ -244,7 +244,7 @@
     lpJniStorage->mCallbackData.audioTrack_class = (jclass)env->NewGlobalRef(clazz);
     // we use a weak reference so the AudioTrack object can be garbage collected.
     lpJniStorage->mCallbackData.audioTrack_ref = env->NewGlobalRef(weak_this);
-    
+
     lpJniStorage->mStreamType = atStreamType;
 
     if (jSession == NULL) {
@@ -269,7 +269,7 @@
         ALOGE("Error creating uninitialized AudioTrack");
         goto native_track_failure;
     }
-    
+
     // initialize the native AudioTrack object
     if (memoryMode == javaAudioTrackFields.MODE_STREAM) {
 
@@ -279,30 +279,30 @@
             format,// word length, PCM
             nativeChannelMask,
             frameCount,
-            0,// flags
+            AUDIO_POLICY_OUTPUT_FLAG_NONE,
             audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user)
             0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
             0,// shared mem
             true,// thread can call Java
             sessionId);// audio session ID
-            
+
     } else if (memoryMode == javaAudioTrackFields.MODE_STATIC) {
         // AudioTrack is using shared memory
-        
+
         if (!lpJniStorage->allocSharedMem(buffSizeInBytes)) {
             ALOGE("Error creating AudioTrack in static mode: error creating mem heap base");
             goto native_init_failure;
         }
-        
+
         lpTrack->set(
             atStreamType,// stream type
             sampleRateInHertz,
             format,// word length, PCM
             nativeChannelMask,
             frameCount,
-            0,// flags
+            AUDIO_POLICY_OUTPUT_FLAG_NONE,
             audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user));
-            0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack 
+            0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
             lpJniStorage->mMemBase,// shared mem
             true,// thread can call Java
             sessionId);// audio session ID
@@ -323,21 +323,21 @@
     env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
     nSession = NULL;
 
-    // save our newly created C++ AudioTrack in the "nativeTrackInJavaObj" field 
+    // save our newly created C++ AudioTrack in the "nativeTrackInJavaObj" field
     // of the Java object (in mNativeTrackInJavaObj)
     env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, (int)lpTrack);
-    
+
     // save the JNI resources so we can free them later
     //ALOGV("storing lpJniStorage: %x\n", (int)lpJniStorage);
     env->SetIntField(thiz, javaAudioTrackFields.jniData, (int)lpJniStorage);
 
     return AUDIOTRACK_SUCCESS;
-    
+
     // failures:
 native_init_failure:
     delete lpTrack;
     env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, 0);
-    
+
 native_track_failure:
     if (nSession != NULL) {
         env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
@@ -347,7 +347,7 @@
     delete lpJniStorage;
     env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
     return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
-    
+
 }
 
 
@@ -432,7 +432,7 @@
 // ----------------------------------------------------------------------------
 static void android_media_AudioTrack_native_finalize(JNIEnv *env,  jobject thiz) {
     //ALOGV("android_media_AudioTrack_native_finalize jobject: %x\n", (int)thiz);
-       
+
     // delete the AudioTrack object
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
         thiz, javaAudioTrackFields.nativeTrackInJavaObj);
@@ -441,7 +441,7 @@
         lpTrack->stop();
         delete lpTrack;
     }
-    
+
     // delete the JNI data
     AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetIntField(
         thiz, javaAudioTrackFields.jniData);
@@ -456,7 +456,7 @@
 
 // ----------------------------------------------------------------------------
 static void android_media_AudioTrack_native_release(JNIEnv *env,  jobject thiz) {
-       
+
     // do everything a call to finalize would
     android_media_AudioTrack_native_finalize(env, thiz);
     // + reset the native resources in the Java object so any attempt to access
@@ -493,7 +493,7 @@
             int count = sizeInBytes;
             int16_t *dst = (int16_t *)pTrack->sharedBuffer()->pointer();
             const int8_t *src = (const int8_t *)(data + offsetInBytes);
-            while(count--) {
+            while (count--) {
                 *dst++ = (int16_t)(*src++^0x80) << 8;
             }
             // even though we wrote 2*sizeInBytes, we only report sizeInBytes as written to hide
@@ -514,7 +514,7 @@
     AudioTrack *lpTrack = NULL;
     //ALOGV("android_media_AudioTrack_native_write_byte(offset=%d, sizeInBytes=%d) called",
     //    offsetInBytes, sizeInBytes);
-    
+
     // get the audio track to load with samples
     lpTrack = (AudioTrack *)env->GetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj);
     if (lpTrack == NULL) {
@@ -599,7 +599,7 @@
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
 
     if (lpTrack) {
-        return (jint) lpTrack->getSampleRate();   
+        return (jint) lpTrack->getSampleRate();
     } else {
         jniThrowException(env, "java/lang/IllegalStateException",
             "Unable to retrieve AudioTrack pointer for getSampleRate()");
@@ -609,14 +609,14 @@
 
 
 // ----------------------------------------------------------------------------
-static jint android_media_AudioTrack_set_marker_pos(JNIEnv *env,  jobject thiz, 
+static jint android_media_AudioTrack_set_marker_pos(JNIEnv *env,  jobject thiz,
         jint markerPos) {
-            
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-                
+
     if (lpTrack) {
-        return android_media_translateErrorCode( lpTrack->setMarkerPosition(markerPos) );   
+        return android_media_translateErrorCode( lpTrack->setMarkerPosition(markerPos) );
     } else {
         jniThrowException(env, "java/lang/IllegalStateException",
             "Unable to retrieve AudioTrack pointer for setMarkerPosition()");
@@ -627,11 +627,11 @@
 
 // ----------------------------------------------------------------------------
 static jint android_media_AudioTrack_get_marker_pos(JNIEnv *env,  jobject thiz) {
-    
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
     uint32_t markerPos = 0;
-                
+
     if (lpTrack) {
         lpTrack->getMarkerPosition(&markerPos);
         return (jint)markerPos;
@@ -646,27 +646,27 @@
 // ----------------------------------------------------------------------------
 static jint android_media_AudioTrack_set_pos_update_period(JNIEnv *env,  jobject thiz,
         jint period) {
-            
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-                
+
     if (lpTrack) {
-        return android_media_translateErrorCode( lpTrack->setPositionUpdatePeriod(period) );   
+        return android_media_translateErrorCode( lpTrack->setPositionUpdatePeriod(period) );
     } else {
         jniThrowException(env, "java/lang/IllegalStateException",
             "Unable to retrieve AudioTrack pointer for setPositionUpdatePeriod()");
         return AUDIOTRACK_ERROR;
-    }            
+    }
 }
 
 
 // ----------------------------------------------------------------------------
 static jint android_media_AudioTrack_get_pos_update_period(JNIEnv *env,  jobject thiz) {
-    
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
     uint32_t period = 0;
-                
+
     if (lpTrack) {
         lpTrack->getPositionUpdatePeriod(&period);
         return (jint)period;
@@ -679,12 +679,12 @@
 
 
 // ----------------------------------------------------------------------------
-static jint android_media_AudioTrack_set_position(JNIEnv *env,  jobject thiz, 
+static jint android_media_AudioTrack_set_position(JNIEnv *env,  jobject thiz,
         jint position) {
-            
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
-                
+
     if (lpTrack) {
         return android_media_translateErrorCode( lpTrack->setPosition(position) );
     } else {
@@ -697,11 +697,11 @@
 
 // ----------------------------------------------------------------------------
 static jint android_media_AudioTrack_get_position(JNIEnv *env,  jobject thiz) {
-    
+
     AudioTrack *lpTrack = (AudioTrack *)env->GetIntField(
                 thiz, javaAudioTrackFields.nativeTrackInJavaObj);
     uint32_t position = 0;
-                
+
     if (lpTrack) {
         lpTrack->getPosition(&position);
         return (jint)position;
@@ -944,12 +944,12 @@
 
     // Get the memory mode constants
     if ( !android_media_getIntConstantFromClass(env, audioTrackClass,
-               kClassPathName, 
+               kClassPathName,
                JAVA_CONST_MODE_STATIC_NAME, &(javaAudioTrackFields.MODE_STATIC))
          || !android_media_getIntConstantFromClass(env, audioTrackClass,
-               kClassPathName, 
+               kClassPathName,
                JAVA_CONST_MODE_STREAM_NAME, &(javaAudioTrackFields.MODE_STREAM)) ) {
-        // error log performed in android_media_getIntConstantFromClass() 
+        // error log performed in android_media_getIntConstantFromClass()
         return -1;
     }
 
@@ -960,16 +960,16 @@
         ALOGE("Can't find %s", JAVA_AUDIOFORMAT_CLASS_NAME);
         return -1;
     }
-    if ( !android_media_getIntConstantFromClass(env, audioFormatClass, 
-                JAVA_AUDIOFORMAT_CLASS_NAME, 
+    if ( !android_media_getIntConstantFromClass(env, audioFormatClass,
+                JAVA_AUDIOFORMAT_CLASS_NAME,
                 JAVA_CONST_PCM16_NAME, &(javaAudioTrackFields.PCM16))
-           || !android_media_getIntConstantFromClass(env, audioFormatClass, 
-                JAVA_AUDIOFORMAT_CLASS_NAME, 
+           || !android_media_getIntConstantFromClass(env, audioFormatClass,
+                JAVA_AUDIOFORMAT_CLASS_NAME,
                 JAVA_CONST_PCM8_NAME, &(javaAudioTrackFields.PCM8)) ) {
-        // error log performed in android_media_getIntConstantFromClass() 
+        // error log performed in android_media_getIntConstantFromClass()
         return -1;
     }
- 
+
     return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
 }
 
diff --git a/core/jni/android_media_JetPlayer.cpp b/core/jni/android_media_JetPlayer.cpp
index 9f9bedb..6fedc6b 100644
--- a/core/jni/android_media_JetPlayer.cpp
+++ b/core/jni/android_media_JetPlayer.cpp
@@ -56,7 +56,7 @@
 jetPlayerEventCallback(int what, int arg1=0, int arg2=0, void* javaTarget = NULL)
 {
     JNIEnv *env = AndroidRuntime::getJNIEnv();
-    if(env) {
+    if (env) {
         env->CallStaticVoidMethod(
             javaJetPlayerFields.jetClass, javaJetPlayerFields.postNativeEventInJava,
             javaTarget,
@@ -84,7 +84,7 @@
 
     EAS_RESULT result = lpJet->init();
 
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         // save our newly created C++ JetPlayer in the "nativePlayerInJavaObj" field
         // of the Java object (in mNativePlayerInJavaObj)
         env->SetIntField(thiz, javaJetPlayerFields.nativePlayerInJavaObj, (int)lpJet);
@@ -105,7 +105,7 @@
     ALOGV("android_media_JetPlayer_finalize(): entering.");
     JetPlayer *lpJet = (JetPlayer *)env->GetIntField(
         thiz, javaJetPlayerFields.nativePlayerInJavaObj);
-    if(lpJet != NULL) {
+    if (lpJet != NULL) {
         lpJet->release();
         delete lpJet;
     }
@@ -148,7 +148,7 @@
     EAS_RESULT result = lpJet->loadFromFile(pathStr);
     env->ReleaseStringUTFChars(path, pathStr);
 
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_openFile(): file successfully opened");
         return JNI_TRUE;
     } else {
@@ -178,7 +178,7 @@
     EAS_RESULT result = lpJet->loadFromFD(jniGetFDFromFileDescriptor(env, fileDescriptor),
         (long long)offset, (long long)length); // cast params to types used by EAS_FILE
 
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         ALOGV("android_media_JetPlayer_openFileDescr(): file successfully opened");
         return JNI_TRUE;
     } else {
@@ -200,7 +200,7 @@
             "Unable to retrieve JetPlayer pointer for closeFile()");
     }
 
-    if( lpJet->closeFile()==EAS_SUCCESS) {
+    if (lpJet->closeFile()==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_closeFile(): file successfully closed");
         return JNI_TRUE;
     } else {
@@ -222,7 +222,7 @@
     }
 
     EAS_RESULT result = lpJet->play();
-    if( result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_play(): play successful");
         return JNI_TRUE;
     } else {
@@ -245,11 +245,11 @@
     }
 
     EAS_RESULT result = lpJet->pause();
-    if( result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_pause(): pause successful");
         return JNI_TRUE;
     } else {
-        if(result==EAS_ERROR_QUEUE_IS_EMPTY) {
+        if (result==EAS_ERROR_QUEUE_IS_EMPTY) {
             ALOGV("android_media_JetPlayer_pause(): paused with an empty queue");
             return JNI_TRUE;
         } else
@@ -275,7 +275,7 @@
 
     EAS_RESULT result
         = lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteFlags, userID);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_queueSegment(): segment successfully queued");
         return JNI_TRUE;
     } else {
@@ -311,7 +311,7 @@
     EAS_U32 muteMask=0;
     int maxTracks = lpJet->getMaxTracks();
     for (jint trackIndex=0; trackIndex<maxTracks; trackIndex++) {
-        if(muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
+        if (muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
             muteMask = (muteMask << 1) | 0x00000001;
         else
             muteMask = muteMask << 1;
@@ -321,7 +321,7 @@
     result = lpJet->queueSegment(segmentNum, libNum, repeatCount, transpose, muteMask, userID);
 
     env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_queueSegmentMuteArray(): segment successfully queued");
         return JNI_TRUE;
     } else {
@@ -346,7 +346,7 @@
 
     EAS_RESULT result;
     result = lpJet->setMuteFlags(muteFlags, bSync==JNI_TRUE ? true : false);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_setMuteFlags(): mute flags successfully updated");
         return JNI_TRUE;
     } else {
@@ -380,7 +380,7 @@
     EAS_U32 muteMask=0;
     int maxTracks = lpJet->getMaxTracks();
     for (jint trackIndex=0; trackIndex<maxTracks; trackIndex++) {
-        if(muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
+        if (muteTracks[maxTracks-1-trackIndex]==JNI_TRUE)
             muteMask = (muteMask << 1) | 0x00000001;
         else
             muteMask = muteMask << 1;
@@ -390,7 +390,7 @@
     result = lpJet->setMuteFlags(muteMask, bSync==JNI_TRUE ? true : false);
 
     env->ReleaseBooleanArrayElements(muteArray, muteTracks, 0);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_setMuteArray(): mute flags successfully updated");
         return JNI_TRUE;
     } else {
@@ -416,7 +416,7 @@
     EAS_RESULT result;
     result = lpJet->setMuteFlag(trackId,
         muteFlag==JNI_TRUE ? true : false, bSync==JNI_TRUE ? true : false);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_setMuteFlag(): mute flag successfully updated for track %d", trackId);
         return JNI_TRUE;
     } else {
@@ -440,7 +440,7 @@
 
     EAS_RESULT result;
     result = lpJet->triggerClip(clipId);
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_triggerClip(): triggerClip successful for clip %d", clipId);
         return JNI_TRUE;
     } else {
@@ -463,7 +463,7 @@
     }
 
     EAS_RESULT result = lpJet->clearQueue();
-    if(result==EAS_SUCCESS) {
+    if (result==EAS_SUCCESS) {
         //ALOGV("android_media_JetPlayer_clearQueue(): clearQueue successful");
         return JNI_TRUE;
     } else {
diff --git a/core/jni/android_os_Trace.cpp b/core/jni/android_os_Trace.cpp
new file mode 100644
index 0000000..af8edae
--- /dev/null
+++ b/core/jni/android_os_Trace.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Trace"
+
+#include <JNIHelp.h>
+#include <ScopedUtfChars.h>
+
+#include <utils/Trace.h>
+#include <cutils/log.h>
+
+namespace android {
+
+static jlong android_os_Trace_nativeGetEnabledTags(JNIEnv* env, jclass clazz) {
+    return Tracer::getEnabledTags();
+}
+
+static void android_os_Trace_nativeTraceCounter(JNIEnv* env, jclass clazz,
+        jlong tag, jstring nameStr, jint value) {
+    ScopedUtfChars name(env, nameStr);
+    Tracer::traceCounter(tag, name.c_str(), value);
+}
+
+static void android_os_Trace_nativeTraceBegin(JNIEnv* env, jclass clazz,
+        jlong tag, jstring nameStr) {
+    ScopedUtfChars name(env, nameStr);
+    Tracer::traceBegin(tag, name.c_str());
+}
+
+static void android_os_Trace_nativeTraceEnd(JNIEnv* env, jclass clazz,
+        jlong tag) {
+    Tracer::traceEnd(tag);
+}
+
+static JNINativeMethod gTraceMethods[] = {
+    /* name, signature, funcPtr */
+    { "nativeGetEnabledTags",
+            "()J",
+            (void*)android_os_Trace_nativeGetEnabledTags },
+    { "nativeTraceCounter",
+            "(JLjava/lang/String;I)V",
+            (void*)android_os_Trace_nativeTraceCounter },
+    { "nativeTraceBegin",
+            "(JLjava/lang/String;)V",
+            (void*)android_os_Trace_nativeTraceBegin },
+    { "nativeTraceEnd",
+            "(J)V",
+            (void*)android_os_Trace_nativeTraceEnd },
+};
+
+int register_android_os_Trace(JNIEnv* env) {
+    int res = jniRegisterNativeMethods(env, "android/os/Trace",
+            gTraceMethods, NELEM(gTraceMethods));
+    LOG_FATAL_IF(res < 0, "Unable to register native methods.");
+
+    return 0;
+}
+
+} // namespace android
diff --git a/core/jni/android_view_GLES20DisplayList.cpp b/core/jni/android_view_GLES20DisplayList.cpp
new file mode 100644
index 0000000..407c196
--- /dev/null
+++ b/core/jni/android_view_GLES20DisplayList.cpp
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "OpenGLRenderer"
+
+#include <EGL/egl.h>
+
+#include "jni.h"
+#include "GraphicsJNI.h"
+#include <nativehelper/JNIHelp.h>
+#include <android_runtime/AndroidRuntime.h>
+
+#include <DisplayListRenderer.h>
+
+namespace android {
+
+using namespace uirenderer;
+
+/**
+ * Note: OpenGLRenderer JNI layer is generated and compiled only on supported
+ *       devices. This means all the logic must be compiled only when the
+ *       preprocessor variable USE_OPENGL_RENDERER is defined.
+ */
+#ifdef USE_OPENGL_RENDERER
+
+// ----------------------------------------------------------------------------
+// DisplayList view properties
+// ----------------------------------------------------------------------------
+
+static void android_view_GLES20DisplayList_setCaching(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, jboolean caching) {
+    displayList->setCaching(caching);
+}
+
+static void android_view_GLES20DisplayList_setApplicationScale(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float scale) {
+    displayList->setApplicationScale(scale);
+}
+
+static void android_view_GLES20DisplayList_setClipChildren(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, jboolean clipChildren) {
+    displayList->setClipChildren(clipChildren);
+}
+
+static void android_view_GLES20DisplayList_setAlpha(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float alpha) {
+    displayList->setAlpha(alpha);
+}
+
+static void android_view_GLES20DisplayList_setTranslationX(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float tx) {
+    displayList->setTranslationX(tx);
+}
+
+static void android_view_GLES20DisplayList_setTranslationY(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float ty) {
+    displayList->setTranslationY(ty);
+}
+
+static void android_view_GLES20DisplayList_setRotation(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float rotation) {
+    displayList->setRotation(rotation);
+}
+
+static void android_view_GLES20DisplayList_setRotationX(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float rx) {
+    displayList->setRotationX(rx);
+}
+
+static void android_view_GLES20DisplayList_setRotationY(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float ry) {
+    displayList->setRotationY(ry);
+}
+
+static void android_view_GLES20DisplayList_setScaleX(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float sx) {
+    displayList->setScaleX(sx);
+}
+
+static void android_view_GLES20DisplayList_setScaleY(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float sy) {
+    displayList->setScaleY(sy);
+}
+
+static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float alpha,
+        float translationX, float translationY, float rotation, float rotationX, float rotationY,
+        float scaleX, float scaleY) {
+    displayList->setAlpha(alpha);
+    displayList->setTranslationX(translationX);
+    displayList->setTranslationY(translationY);
+    displayList->setRotation(rotation);
+    displayList->setRotationX(rotationX);
+    displayList->setRotationY(rotationY);
+    displayList->setScaleX(scaleX);
+    displayList->setScaleY(scaleY);
+}
+
+static void android_view_GLES20DisplayList_setPivotX(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float px) {
+    displayList->setPivotX(px);
+}
+
+static void android_view_GLES20DisplayList_setPivotY(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float py) {
+    displayList->setPivotY(py);
+}
+
+static void android_view_GLES20DisplayList_setCameraDistance(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, float distance) {
+    displayList->setCameraDistance(distance);
+}
+
+static void android_view_GLES20DisplayList_setLeft(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int left) {
+    displayList->setLeft(left);
+}
+
+static void android_view_GLES20DisplayList_setTop(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int top) {
+    displayList->setTop(top);
+}
+
+static void android_view_GLES20DisplayList_setRight(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int right) {
+    displayList->setRight(right);
+}
+
+static void android_view_GLES20DisplayList_setBottom(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int bottom) {
+    displayList->setBottom(bottom);
+}
+
+static void android_view_GLES20DisplayList_setLeftTop(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int left, int top) {
+    displayList->setLeftTop(left, top);
+}
+
+static void android_view_GLES20DisplayList_setLeftTopRightBottom(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int left, int top,
+        int right, int bottom) {
+    displayList->setLeftTopRightBottom(left, top, right, bottom);
+}
+
+static void android_view_GLES20DisplayList_offsetLeftRight(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int offset) {
+    displayList->offsetLeftRight(offset);
+}
+
+static void android_view_GLES20DisplayList_offsetTopBottom(JNIEnv* env,
+        jobject clazz, DisplayList* displayList, int offset) {
+    displayList->offsetTopBottom(offset);
+}
+
+#endif // USE_OPENGL_RENDERER
+
+// ----------------------------------------------------------------------------
+// JNI Glue
+// ----------------------------------------------------------------------------
+
+const char* const kClassPathName = "android/view/GLES20DisplayList";
+
+static JNINativeMethod gMethods[] = {
+#ifdef USE_OPENGL_RENDERER
+    { "nSetCaching",             "(IZ)V",       (void*) android_view_GLES20DisplayList_setCaching },
+    { "nSetApplicationScale",    "(IF)V",
+            (void*) android_view_GLES20DisplayList_setApplicationScale },
+    { "nSetClipChildren",        "(IZ)V",      (void*) android_view_GLES20DisplayList_setClipChildren },
+    { "nSetAlpha",               "(IF)V",      (void*) android_view_GLES20DisplayList_setAlpha },
+    { "nSetTranslationX",        "(IF)V",      (void*) android_view_GLES20DisplayList_setTranslationX },
+    { "nSetTranslationY",        "(IF)V",      (void*) android_view_GLES20DisplayList_setTranslationY },
+    { "nSetRotation",            "(IF)V",      (void*) android_view_GLES20DisplayList_setRotation },
+    { "nSetRotationX",           "(IF)V",      (void*) android_view_GLES20DisplayList_setRotationX },
+    { "nSetRotationY",           "(IF)V",      (void*) android_view_GLES20DisplayList_setRotationY },
+    { "nSetScaleX",              "(IF)V",      (void*) android_view_GLES20DisplayList_setScaleX },
+    { "nSetScaleY",              "(IF)V",      (void*) android_view_GLES20DisplayList_setScaleY },
+    { "nSetTransformationInfo",  "(IFFFFFFFF)V",
+            (void*) android_view_GLES20DisplayList_setTransformationInfo },
+    { "nSetPivotX",              "(IF)V",      (void*) android_view_GLES20DisplayList_setPivotX },
+    { "nSetPivotY",              "(IF)V",      (void*) android_view_GLES20DisplayList_setPivotY },
+    { "nSetCameraDistance",      "(IF)V",
+            (void*) android_view_GLES20DisplayList_setCameraDistance },
+    { "nSetLeft",                "(II)V",      (void*) android_view_GLES20DisplayList_setLeft },
+    { "nSetTop",                 "(II)V",      (void*) android_view_GLES20DisplayList_setTop },
+    { "nSetRight",               "(II)V",      (void*) android_view_GLES20DisplayList_setRight },
+    { "nSetBottom",              "(II)V",      (void*) android_view_GLES20DisplayList_setBottom },
+    { "nSetLeftTop",             "(III)V",     (void*) android_view_GLES20DisplayList_setLeftTop },
+    { "nSetLeftTopRightBottom",  "(IIIII)V",
+            (void*) android_view_GLES20DisplayList_setLeftTopRightBottom },
+    { "nOffsetLeftRight",        "(II)V",      (void*) android_view_GLES20DisplayList_offsetLeftRight },
+    { "nOffsetTopBottom",        "(II)V",      (void*) android_view_GLES20DisplayList_offsetTopBottom },
+
+#endif
+};
+
+#ifdef USE_OPENGL_RENDERER
+    #define FIND_CLASS(var, className) \
+            var = env->FindClass(className); \
+            LOG_FATAL_IF(! var, "Unable to find class " className);
+
+    #define GET_METHOD_ID(var, clazz, methodName, methodDescriptor) \
+            var = env->GetMethodID(clazz, methodName, methodDescriptor); \
+            LOG_FATAL_IF(! var, "Unable to find method " methodName);
+#else
+    #define FIND_CLASS(var, className)
+    #define GET_METHOD_ID(var, clazz, methodName, methodDescriptor)
+#endif
+
+int register_android_view_GLES20DisplayList(JNIEnv* env) {
+    return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
+}
+
+};
+
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 17d2212..d1e3642 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -248,6 +248,21 @@
         android:label="@string/permlab_writeContacts"
         android:description="@string/permdesc_writeContacts" />
 
+    <!-- Allows an application to read the user's call log. -->
+    <permission android:name="android.permission.READ_CALL_LOG"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_readCallLog"
+        android:description="@string/permdesc_readCallLog" />
+
+    <!-- Allows an application to write (but not read) the user's
+         contacts data. -->
+    <permission android:name="android.permission.WRITE_CALL_LOG"
+        android:permissionGroup="android.permission-group.PERSONAL_INFO"
+        android:protectionLevel="dangerous"
+        android:label="@string/permlab_writeCallLog"
+        android:description="@string/permdesc_writeCallLog" />
+
 
     <!-- Allows an application to read the user's personal profile data. -->
     <permission android:name="android.permission.READ_PROFILE"
@@ -639,6 +654,13 @@
         android:label="@string/permgrouplab_storage"
         android:description="@string/permgroupdesc_storage" />
 
+    <!-- Allows an application to read from external storage -->
+    <permission android:name="android.permission.READ_EXTERNAL_STORAGE"
+        android:permissionGroup="android.permission-group.STORAGE"
+        android:label="@string/permlab_sdcardRead"
+        android:description="@string/permdesc_sdcardRead"
+        android:protectionLevel="dangerous" />
+
     <!-- Allows an application to write to external storage -->
     <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
         android:permissionGroup="android.permission-group.STORAGE"
diff --git a/core/res/res/layout/dialog_custom_title.xml b/core/res/res/layout/dialog_custom_title.xml
index e52fba6..3784c59 100644
--- a/core/res/res/layout/dialog_custom_title.xml
+++ b/core/res/res/layout/dialog_custom_title.xml
@@ -15,7 +15,7 @@
 -->
 
 <!--
-This is an custom layout for a dialog.
+This is a custom layout for a dialog.
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
diff --git a/core/res/res/layout/dialog_custom_title_holo.xml b/core/res/res/layout/dialog_custom_title_holo.xml
index e2335a7..cf71197 100644
--- a/core/res/res/layout/dialog_custom_title_holo.xml
+++ b/core/res/res/layout/dialog_custom_title_holo.xml
@@ -15,7 +15,7 @@
 -->
 
 <!--
-This is an custom layout for a dialog.
+This is a custom layout for a dialog.
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/core/res/res/layout/screen_custom_title.xml b/core/res/res/layout/screen_custom_title.xml
index c62a06a..e3364d1 100644
--- a/core/res/res/layout/screen_custom_title.xml
+++ b/core/res/res/layout/screen_custom_title.xml
@@ -15,7 +15,7 @@
 -->
 
 <!--
-This is an custom layout for a screen.
+This is a custom layout for a screen.
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 6eb4b93..48f4606 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Trek \'n dag af."</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tel \'n jaar by"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Trek \'n jaar af"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"gekontroleer"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nie gekontroleer nie"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"gekies"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nie gekies nie"</string>
+    <string name="switch_on" msgid="551417728476977311">"aan"</string>
+    <string name="switch_off" msgid="7249798614327155088">"af"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"gedruk"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nie gedruk nie"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Kanselleer"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Vee uit"</string>
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index 1d1af5f..b055634 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -1086,8 +1086,8 @@
     <string name="ime_action_done" msgid="8971516117910934605">"ተከናውኗል"</string>
     <string name="ime_action_previous" msgid="1443550039250105948">"ያለፈው"</string>
     <string name="ime_action_default" msgid="2840921885558045721">"አከናውን"</string>
-    <string name="dial_number_using" msgid="5789176425167573586">"የደወሉት ቁጥር"\n"<xliff:g id="NUMBER">%s</xliff:g>በመጠቀም ላይ"</string>
-    <string name="create_contact_using" msgid="4947405226788104538">\n"በመጠቀም<xliff:g id="NUMBER">%s</xliff:g>ዕውቂያ ፍጠር"</string>
+    <string name="dial_number_using" msgid="5789176425167573586">"<xliff:g id="NUMBER">%s</xliff:g>ን በመጠቀም "\n" ደውል"</string>
+    <string name="create_contact_using" msgid="4947405226788104538">"<xliff:g id="NUMBER">%s</xliff:g>ን በመጠቀም "\n" ዕውቂያ ፍጠር"</string>
     <string name="grant_credentials_permission_message_header" msgid="2106103817937859662">"የሚከተለው ወይም ተጨማሪ መተግበሪያዎች ወደ መለያህ ለመድረስ አሁን እና ወደፊት ፈቃድ ትጠይቃለህ።"</string>
     <string name="grant_credentials_permission_message_footer" msgid="3125211343379376561">"ይህን ጥየቃ መፍቀድ ይፈልጋሉ?"</string>
     <string name="grant_permissions_header_text" msgid="6874497408201826708">"የመድረሻ ጥያቄ"</string>
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"ቀን ቀንስ"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"አመት ጨምር"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"አመት ቀንስ"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"ታይቷል"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"አልተፈተሸም"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"የተመረጠ"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"አልተመረጠም"</string>
+    <string name="switch_on" msgid="551417728476977311">"በ:"</string>
+    <string name="switch_off" msgid="7249798614327155088">"ውጪ"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"ተጭኗል"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"አልተጫነም።"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"ተወው"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"ሰርዝ"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 83c6f26..193157b 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"إنقاص يوم"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"زيادة عام"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"إنقاص عام"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"تم التحديد"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"لم يتم التحديد"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"محدد"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"غير محدد"</string>
+    <string name="switch_on" msgid="551417728476977311">"تشغيل"</string>
+    <string name="switch_off" msgid="7249798614327155088">"إيقاف"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"مضغوط"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"غير مضغوط"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"إلغاء"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"حذف"</string>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index fced14a..a37e231 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"На дзень менш."</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"На год больш"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"На год менш"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"пастаўлены"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"не пастаўлены"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"абрана"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"не абрана"</string>
+    <string name="switch_on" msgid="551417728476977311">"укл."</string>
+    <string name="switch_off" msgid="7249798614327155088">"адключаны"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"націснутая"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"не націснутая"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Адмена"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Выдаліць"</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index 65fec6f..c277ee9 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Намаляване на деня"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Увеличаване на годината"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Намаляване на годината"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"отметнато"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"не е отметнато"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"избрано"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"не е избрано"</string>
+    <string name="switch_on" msgid="551417728476977311">"включено"</string>
+    <string name="switch_off" msgid="7249798614327155088">"изключено"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"натиснато"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"не е натиснато"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Отказ"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Изтриване"</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 779de15..189225e 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminueix els dies"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Incrementa l\'any"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminueix l\'any"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"marcat"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"no marcat"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionat"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"no seleccionat"</string>
+    <string name="switch_on" msgid="551417728476977311">"activat"</string>
+    <string name="switch_off" msgid="7249798614327155088">"desactivat"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"premut"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"no premut"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancel·la"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Suprimeix"</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index cc8278d..389a672 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Odečíst den"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Přičíst rok"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Odečíst rok"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"zaškrtnuto"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nezaškrtnuto"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"Vybráno"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"Nevybráno"</string>
+    <string name="switch_on" msgid="551417728476977311">"zapnuto"</string>
+    <string name="switch_off" msgid="7249798614327155088">"vypnuto"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"stisknuto"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nestisknuto"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Zrušit"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Smazat"</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 067b813..3ca0534 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Fjern dag"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tilføj år"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Fjern år"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"markeret"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"ikke markeret"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"udvalgt"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ikke valgt"</string>
+    <string name="switch_on" msgid="551417728476977311">"tændt"</string>
+    <string name="switch_off" msgid="7249798614327155088">"slukket"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"trykket på"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"ikke trykket på"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Annuller"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Slet"</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 5c46e662..72ac55f 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -1173,6 +1173,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Tag zurückstellen"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Jahr vorstellen"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Jahr zurückstellen"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"Aktiviert"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"Nicht aktiviert"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"Ausgewählt"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"Nicht ausgewählt"</string>
+    <string name="switch_on" msgid="551417728476977311">"An"</string>
+    <string name="switch_off" msgid="7249798614327155088">"Aus"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"Gedrückt"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"Nicht gedrückt"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Abbrechen"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Löschen"</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 75f0b51..0e5dd10 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Προηγούμενη μέρα"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Αύξηση έτους"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Προηγούμενο έτος"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"ελέγχθηκε"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"δεν επιλέχθηκε"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"επιλεγμένο"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"δεν έχει επιλεγεί"</string>
+    <string name="switch_on" msgid="551417728476977311">"ενεργοποίηση"</string>
+    <string name="switch_off" msgid="7249798614327155088">"απενεργοποιημένη"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"πατήθηκε"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"δεν πατήθηκε"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Ακύρωση"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Διαγραφή"</string>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index c7364e8..e7ff973 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Decrement day"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Increment year"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Decrement year"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"ticked"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"not ticked"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"selected"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"not selected"</string>
+    <string name="switch_on" msgid="551417728476977311">"on"</string>
+    <string name="switch_off" msgid="7249798614327155088">"off"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"pressed"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"not pressed"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancel"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 6cedde4..8e36948 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminuir día"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar año"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminuir año"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"marcado"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"no marcado"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionado"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"No se ha seleccionado."</string>
+    <string name="switch_on" msgid="551417728476977311">"Activado"</string>
+    <string name="switch_off" msgid="7249798614327155088">"Desactivado"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"presionado"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"sin presionar"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancelar"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Eliminar"</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 7f64b0c..a4638fa 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminuir día"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar año"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminuir año"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"seleccionado"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"no seleccionado"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionado"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"no seleccionado"</string>
+    <string name="switch_on" msgid="551417728476977311">"activado"</string>
+    <string name="switch_off" msgid="7249798614327155088">"desactivado"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"pulsado"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"sin pulsar"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancelar"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Eliminar"</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index fd24d763..697c8f1 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Eelmine päev"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aastaarvu suurendamine"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Aastaarvu vähendamine"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"märgitud"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"pole märgitud"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"valitud"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"pole valitud"</string>
+    <string name="switch_on" msgid="551417728476977311">"sees"</string>
+    <string name="switch_off" msgid="7249798614327155088">"väljas"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"vajutatud"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"pole vajutatud"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Tühista"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Kustuta"</string>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index f135ec8..a4a9bff 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"کاهش روز"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"افزایش سال"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"کاهش سال"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"علامت زده"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"بدون علامت"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"انتخاب شد"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"انتخاب نشده"</string>
+    <string name="switch_on" msgid="551417728476977311">"روشن"</string>
+    <string name="switch_off" msgid="7249798614327155088">"خاموش"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"فشرده شد"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"فشرده نشد"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"لغو"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 8c8b057..1b8b18a 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Pienennä päivää"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Kasvata vuotta"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Pienennä vuotta"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"valittu"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"ei valittu"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"valittu"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ei valittu"</string>
+    <string name="switch_on" msgid="551417728476977311">"käytössä"</string>
+    <string name="switch_off" msgid="7249798614327155088">"pois käytöstä"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"painettu"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"ei painettu"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Peruuta"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Poista"</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index d748a26..b19a7de 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Jour précédent"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Année suivante"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Année précédente"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"coché"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"non coché"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"sélectionné"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"non sélectionné"</string>
+    <string name="switch_on" msgid="551417728476977311">"activé"</string>
+    <string name="switch_off" msgid="7249798614327155088">"désactivé"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"sélectionné"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"non sélectionné"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Annuler"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Supprimer"</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index 66d71c2..d4b921f 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"घटते क्रम में दिन"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"बढ़ते क्रम में वर्ष"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"घटते क्रम में वर्ष"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"चेक किया गया"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"चेक नहीं किया गया"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"चयनित"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"चयनित नहीं"</string>
+    <string name="switch_on" msgid="551417728476977311">"चालू"</string>
+    <string name="switch_off" msgid="7249798614327155088">"बंद"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"दबाया गया"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"दबाया नहीं गया."</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"रद्द करें"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"हटाएं"</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index a726037..fbd3a3d 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Pomak unatrag za jedan dan"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Pomak unaprijed za jednu godinu"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Pomak unatrag za jednu godinu"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"označeno"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nije označeno"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"odabran"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nije odabrano"</string>
+    <string name="switch_on" msgid="551417728476977311">"uključeno"</string>
+    <string name="switch_off" msgid="7249798614327155088">"isključeno"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"pritisnut"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nije pritisnut"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Odustani"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Izbriši"</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index 8b06ee7..c6190fd 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Napok csökkentése"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Évek növelése"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Évek csökkentése"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"bejelölve"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nincs bejelölve"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"bejelölve"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nincs kiválasztva"</string>
+    <string name="switch_on" msgid="551417728476977311">"be"</string>
+    <string name="switch_off" msgid="7249798614327155088">"kikapcsolva"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"megnyomva"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nincs megnyomva"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Mégse"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 1b436e6..d2d4ece 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -68,7 +68,7 @@
     <string name="CLIRDefaultOffNextCallOn" msgid="6179425182856418465">"Nomor penelepon bawaan tidak dibatasi. Panggilan selanjutnya: Dibatasi"</string>
     <string name="CLIRDefaultOffNextCallOff" msgid="2567998633124408552">"Nomor penelepon bawaan tidak dibatasi. Panggilan selanjutnya: Tidak dibatasi"</string>
     <string name="serviceNotProvisioned" msgid="8614830180508686666">"Layanan tidak diperlengkapi."</string>
-    <string name="CLIRPermanent" msgid="3377371145926835671">"Anda tidak dapat mengubah pengaturan nomor penelepon."</string>
+    <string name="CLIRPermanent" msgid="3377371145926835671">"Anda tidak dapat mengubah setelan nomor penelepon."</string>
     <string name="RestrictedChangedTitle" msgid="5592189398956187498">"Akses terbatas berubah"</string>
     <string name="RestrictedOnData" msgid="8653794784690065540">"Layanan data dicekal."</string>
     <string name="RestrictedOnEmergency" msgid="6581163779072833665">"Layanan darurat dicekal."</string>
@@ -219,7 +219,7 @@
     <string name="permdesc_setScreenCompatibility" msgid="692043618693917374">"Memungkinkan apl mengontrol mode kompatibilitas layar aplikasi lain. Aplikasi berbahaya dapat merusak perilaku aplikasi lain."</string>
     <string name="permlab_setDebugApp" msgid="3022107198686584052">"mengaktifkan debugging apl"</string>
     <string name="permdesc_setDebugApp" msgid="4474512416299013256">"Mengizinkan apl mengaktifkan debugging untuk apl lain. Apl berbahaya dapat menggunakan cara ini untuk menutup apl lain."</string>
-    <string name="permlab_changeConfiguration" msgid="8214475779521218295">"ubah pengaturan UI Anda"</string>
+    <string name="permlab_changeConfiguration" msgid="8214475779521218295">"ubah setelan UI Anda"</string>
     <string name="permdesc_changeConfiguration" msgid="4372223873154296076">"Mengizinkan apl mengubah konfigurasi saat ini, misalnya lokal atau ukuran fon keseluruhan."</string>
     <string name="permlab_enableCarMode" msgid="5684504058192921098">"aktifkan mode mobil"</string>
     <string name="permdesc_enableCarMode" msgid="4853187425751419467">"Mengizinkan apl mengaktifkan mode mobil."</string>
@@ -317,10 +317,10 @@
     <string name="permdesc_grantRevokePermissions" msgid="4088642654085850662">"Memungkinkan aplikasi memberikan atau mencabut izin khusus untuk aplikasi tersebut atau aplikasi lainnya. Aplikasi berbahaya dapat menggunakannya untuk mengakses fitur yang tidak Anda beri izin."</string>
     <string name="permlab_setPreferredApplications" msgid="8463181628695396391">"menyetel apl yang disukai"</string>
     <string name="permdesc_setPreferredApplications" msgid="4973986762241783712">"Mengizinkan apl memodifikasi apl pilihan Anda. Apl berbahaya dapat diam-diam mengubah apl yang berjalan, menipu apl yang ada untuk mengumpulkan data pribadi dari Anda."</string>
-    <string name="permlab_writeSettings" msgid="1365523497395143704">"ubah pengaturan sistem global"</string>
-    <string name="permdesc_writeSettings" msgid="7775723441558907181">"Mengizinkan apl memodifikasi data pengaturan sistem. Apl berbahaya dapat merusak konfigurasi sistem anda."</string>
-    <string name="permlab_writeSecureSettings" msgid="204676251876718288">"ubah pengaturan sistem aman"</string>
-    <string name="permdesc_writeSecureSettings" msgid="8159535613020137391">"Mengizinkan apl memodifikasi data pengaturan aman sistem. Tidak untuk digunakan oleh apl normal."</string>
+    <string name="permlab_writeSettings" msgid="1365523497395143704">"ubah setelan sistem global"</string>
+    <string name="permdesc_writeSettings" msgid="7775723441558907181">"Mengizinkan apl memodifikasi data setelan sistem. Apl berbahaya dapat merusak konfigurasi sistem anda."</string>
+    <string name="permlab_writeSecureSettings" msgid="204676251876718288">"ubah setelan sistem aman"</string>
+    <string name="permdesc_writeSecureSettings" msgid="8159535613020137391">"Mengizinkan apl memodifikasi data setelan aman sistem. Tidak untuk digunakan oleh apl normal."</string>
     <string name="permlab_writeGservices" msgid="2149426664226152185">"ubah peta layanan Google"</string>
     <string name="permdesc_writeGservices" msgid="1287309437638380229">"Mengizinkan apl memodifikasi peta layanan Google. Tidak untuk digunakan oleh apl normal."</string>
     <string name="permlab_receiveBootCompleted" msgid="7776779842866993377">"mulai secara otomatis pada saat boot"</string>
@@ -364,8 +364,8 @@
     <string name="permdesc_accessSurfaceFlinger" msgid="1041619516733293551">"Mengizinkan apl menggunakan fitur tingkat rendah SurfaceFlinger."</string>
     <string name="permlab_readFrameBuffer" msgid="6690504248178498136">"baca buffer frame"</string>
     <string name="permdesc_readFrameBuffer" msgid="4937405521809454680">"Mengizinkan apl membaca konten penyangga frame."</string>
-    <string name="permlab_modifyAudioSettings" msgid="6095859937069146086">"ubah pengaturan audio Anda"</string>
-    <string name="permdesc_modifyAudioSettings" msgid="7343951185408396919">"Mengizinkan apl memodifikasi pengaturan audio global, misalnya volume dan perutean."</string>
+    <string name="permlab_modifyAudioSettings" msgid="6095859937069146086">"ubah setelan audio Anda"</string>
+    <string name="permdesc_modifyAudioSettings" msgid="7343951185408396919">"Mengizinkan apl memodifikasi setelan audio global, misalnya volume dan perutean."</string>
     <string name="permlab_recordAudio" msgid="3876049771427466323">"rekam audio"</string>
     <string name="permdesc_recordAudio" msgid="2387462233976248635">"Mengizinkan apl mengakses jalur rekaman audio."</string>
     <string name="permlab_camera" msgid="3616391919559751192">"ambil gambar dan video"</string>
@@ -434,8 +434,8 @@
     <string name="permdesc_setWallpaper" msgid="7373447920977624745">"Mengizinkan apl menyetel wallpaper sistem."</string>
     <string name="permlab_setWallpaperHints" msgid="3600721069353106851">"atur petunjuk ukuran wallpaper"</string>
     <string name="permdesc_setWallpaperHints" msgid="8235784384223730091">"Mengizinkan apl menyetel petunjuk ukuran wallpaper sistem."</string>
-    <string name="permlab_masterClear" msgid="2315750423139697397">"setel ulang sistem ke pengaturan bawaan pabrik"</string>
-    <string name="permdesc_masterClear" msgid="3665380492633910226">"Mengizinkan apl menyetel ulang sistem ke pengaturan pabrik sepenuhnya, menghapus semua data, konfigurasi, dan apl yang terpasang."</string>
+    <string name="permlab_masterClear" msgid="2315750423139697397">"setel ulang sistem ke setelan bawaan pabrik"</string>
+    <string name="permdesc_masterClear" msgid="3665380492633910226">"Mengizinkan apl menyetel ulang sistem ke setelan pabrik sepenuhnya, menghapus semua data, konfigurasi, dan apl yang terpasang."</string>
     <string name="permlab_setTime" msgid="2021614829591775646">"atur waktu"</string>
     <string name="permdesc_setTime" product="tablet" msgid="1896341438151152881">"Mengizinkan apl mengubah waktu pada jam tablet."</string>
     <string name="permdesc_setTime" product="default" msgid="1855702730738020">"Mengizinkan apl mengubah waktu pada jam ponsel."</string>
@@ -457,14 +457,14 @@
     <string name="permdesc_accessNetworkState" msgid="479772796952547198">"Mengizinkan apl melihat keadaan semua jaringan."</string>
     <string name="permlab_createNetworkSockets" msgid="9121633680349549585">"akses internet penuh"</string>
     <string name="permdesc_createNetworkSockets" msgid="5963922297444265950">"Mengizinkan apl membuat soket jaringan."</string>
-    <string name="permlab_writeApnSettings" msgid="505660159675751896">"mengubah/mencegat lalu lintas dan pengaturan jaringan"</string>
-    <string name="permdesc_writeApnSettings" msgid="5333798886412714193">"Mengizinkan apl mengubah pengaturan jaringan dan mencegat serta memeriksa semua lalu lintas jaringan, misalnya mengubah proxy dan port APN apa saja. Apl berbahaya dapat memantau, mengalihkan, atau mengubah paket jaringan tanpa sepengetahuan Anda."</string>
+    <string name="permlab_writeApnSettings" msgid="505660159675751896">"mengubah/mencegat lalu lintas dan setelan jaringan"</string>
+    <string name="permdesc_writeApnSettings" msgid="5333798886412714193">"Mengizinkan apl mengubah setelan jaringan dan mencegat serta memeriksa semua lalu lintas jaringan, misalnya mengubah proxy dan port APN apa saja. Apl berbahaya dapat memantau, mengalihkan, atau mengubah paket jaringan tanpa sepengetahuan Anda."</string>
     <string name="permlab_changeNetworkState" msgid="958884291454327309">"ubah konektivitas jaringan"</string>
     <string name="permdesc_changeNetworkState" msgid="6789123912476416214">"Mengizinkan apl mengubah keadaan konektivitas jaringan."</string>
     <string name="permlab_changeTetherState" msgid="5952584964373017960">"mengubah konektivitas yang tertambat"</string>
     <string name="permdesc_changeTetherState" msgid="1524441344412319780">"Mengizinkan apl mengubah status konektivitas jaringan yang tertambat."</string>
-    <string name="permlab_changeBackgroundDataSetting" msgid="1400666012671648741">"mengubah pengaturan penggunaan data latar belakang"</string>
-    <string name="permdesc_changeBackgroundDataSetting" msgid="5347729578468744379">"Mengizinkan apl mengubah pengaturan penggunaan data latar belakang."</string>
+    <string name="permlab_changeBackgroundDataSetting" msgid="1400666012671648741">"mengubah setelan penggunaan data latar belakang"</string>
+    <string name="permdesc_changeBackgroundDataSetting" msgid="5347729578468744379">"Mengizinkan apl mengubah setelan penggunaan data latar belakang."</string>
     <string name="permlab_accessWifiState" msgid="8100926650211034400">"lihat kondisi Wi-Fi"</string>
     <string name="permdesc_accessWifiState" msgid="7770452658226256831">"Mengizinkan apl melihat informasi tentang keadaan Wi-Fi."</string>
     <string name="permlab_changeWifiState" msgid="7280632711057112137">"ubah status Wi-Fi"</string>
@@ -485,10 +485,10 @@
     <string name="permdesc_nfc" msgid="7120611819401789907">"Mengizinkan apl berkomunikasi dengan tag, kartu, dan alat pembaca Komunikasi Nirkabel Jarak Dekat (NFC)."</string>
     <string name="permlab_disableKeyguard" msgid="4977406164311535092">"nonaktifkan kunci tombol"</string>
     <string name="permdesc_disableKeyguard" msgid="6231611286892232626">"Mengizinkan apl menonaktifkan kunci tombol dan segala keamanan sandi yang terkait. Contoh nyata dari hal ini adalah ponsel menonaktifkan kunci tombol saat menerima panggilan telepon masuk, kemudian mengaktifkan kembali kunci tombol ketika panggilan selesai."</string>
-    <string name="permlab_readSyncSettings" msgid="6201810008230503052">"baca pengaturan sinkron"</string>
-    <string name="permdesc_readSyncSettings" msgid="5464056785274229278">"Mengizinkan apl membaca pengaturan sinkronisasi, misalnya apakah sinkronisasi untuk apl Orang diaktifkan atau tidak."</string>
-    <string name="permlab_writeSyncSettings" msgid="6297138566442486462">"tuliskan pengaturan sinkronisasi"</string>
-    <string name="permdesc_writeSyncSettings" msgid="1466056564502117130">"Mengizinkan apl memodifikasi pengaturan sinkronisasi, seperti apakah sinkronisasi untuk apl Orang diaktifkan atau tidak."</string>
+    <string name="permlab_readSyncSettings" msgid="6201810008230503052">"baca setelan sinkron"</string>
+    <string name="permdesc_readSyncSettings" msgid="5464056785274229278">"Mengizinkan apl membaca setelan sinkronisasi, misalnya apakah sinkronisasi untuk apl Orang diaktifkan atau tidak."</string>
+    <string name="permlab_writeSyncSettings" msgid="6297138566442486462">"tuliskan setelan sinkronisasi"</string>
+    <string name="permdesc_writeSyncSettings" msgid="1466056564502117130">"Mengizinkan apl memodifikasi setelan sinkronisasi, seperti apakah sinkronisasi untuk apl Orang diaktifkan atau tidak."</string>
     <string name="permlab_readSyncStats" msgid="7396577451360202448">"statistika baca sinkron"</string>
     <string name="permdesc_readSyncStats" msgid="3801971839939951678">"Mengizinkan apl membaca statistik sinkronisasi; mis., riwayat sinkronisasi yang telah terjadi."</string>
     <string name="permlab_subscribedFeedsRead" msgid="4756609637053353318">"baca umpan langganan"</string>
@@ -695,10 +695,10 @@
     <string name="lockscreen_too_many_failed_pin_attempts_dialog_message" msgid="6216672706545696955">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah mengetik PIN. "\n\n"Coba lagi dalam <xliff:g id="NUMBER_1">%d</xliff:g> detik."</string>
     <string name="lockscreen_failed_attempts_almost_glogin" product="tablet" msgid="9191611984625460820">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah menggambar pola pembuka kunci. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> lagi upaya gagal, Anda akan diminta membuka kunci tablet menggunakan info masuk Google."\n\n"Coba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> detik."</string>
     <string name="lockscreen_failed_attempts_almost_glogin" product="default" msgid="2590227559763762751">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah menggambar pola pembuka kunci. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> lagi upaya gagal, Anda akan diminta membuka kunci ponsel menggunakan info masuk Google."\n\n"Coba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> detik."</string>
-    <string name="lockscreen_failed_attempts_almost_at_wipe" product="tablet" msgid="6128106399745755604">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, tablet akan disetel ulang ke pengaturan bawaan pabrik dan semua data pengguna hilang."</string>
-    <string name="lockscreen_failed_attempts_almost_at_wipe" product="default" msgid="8603565142156826565">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, ponsel akan disetel ulang ke pengaturan bawaan pabrik dan semua data pengguna hilang."</string>
-    <string name="lockscreen_failed_attempts_now_wiping" product="tablet" msgid="280873516493934365">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini tablet akan disetel ulang ke pengaturan bawaan pabrik."</string>
-    <string name="lockscreen_failed_attempts_now_wiping" product="default" msgid="3025504721764922246">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini ponsel akan disetel ulang ke pengaturan bawaan pabrik."</string>
+    <string name="lockscreen_failed_attempts_almost_at_wipe" product="tablet" msgid="6128106399745755604">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, tablet akan disetel ulang ke setelan bawaan pabrik dan semua data pengguna hilang."</string>
+    <string name="lockscreen_failed_attempts_almost_at_wipe" product="default" msgid="8603565142156826565">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> upaya gagal lagi, ponsel akan disetel ulang ke setelan bawaan pabrik dan semua data pengguna hilang."</string>
+    <string name="lockscreen_failed_attempts_now_wiping" product="tablet" msgid="280873516493934365">"Anda telah gagal mencoba membuka gembok tablet sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini tablet akan disetel ulang ke setelan bawaan pabrik."</string>
+    <string name="lockscreen_failed_attempts_now_wiping" product="default" msgid="3025504721764922246">"Anda telah gagal mencoba membuka gembok ponsel sebanyak <xliff:g id="NUMBER">%d</xliff:g> kali. Kini ponsel akan disetel ulang ke setelan bawaan pabrik."</string>
     <string name="lockscreen_too_many_failed_attempts_countdown" msgid="6251480343394389665">"Coba lagi dalam <xliff:g id="NUMBER">%d</xliff:g> detik."</string>
     <string name="lockscreen_forgot_pattern_button_text" msgid="2626999449610695930">"Lupa pola?"</string>
     <string name="lockscreen_glogin_forgot_pattern" msgid="2588521501166032747">"Pembuka kunci akun"</string>
@@ -910,7 +910,7 @@
     <string name="capital_off" msgid="6815870386972805832">"MATI"</string>
     <string name="whichApplication" msgid="4533185947064773386">"Tindakan lengkap menggunakan"</string>
     <string name="alwaysUse" msgid="4583018368000610438">"Gunakan secara bawaan untuk tindakan ini."</string>
-    <string name="clearDefaultHintMsg" msgid="3252584689512077257">"Menghapus bawaan di Pengaturan sistem &gt; Apl &gt; Terunduh."</string>
+    <string name="clearDefaultHintMsg" msgid="3252584689512077257">"Menghapus bawaan di Setelan sistem &gt; Apl &gt; Terunduh."</string>
     <string name="chooseActivity" msgid="7486876147751803333">"Pilih tindakan"</string>
     <string name="chooseUsbActivity" msgid="6894748416073583509">"Pilih apl untuk perangkat USB"</string>
     <string name="noApplications" msgid="2991814273936504689">"Tidak ada apl yang dapat melakukan tindakan ini."</string>
@@ -931,7 +931,7 @@
     <string name="launch_warning_original" msgid="188102023021668683">"<xliff:g id="APP_NAME">%1$s</xliff:g> telah diluncurkan aslinya."</string>
     <string name="screen_compat_mode_scale" msgid="3202955667675944499">"Skala"</string>
     <string name="screen_compat_mode_show" msgid="4013878876486655892">"Selalu tampilkan"</string>
-    <string name="screen_compat_mode_hint" msgid="1064524084543304459">"Aktifkan kembali dialog ini di Pengaturan sistem &gt; Apl &gt; Terunduh."</string>
+    <string name="screen_compat_mode_hint" msgid="1064524084543304459">"Aktifkan kembali dialog ini di Setelan sistem &gt; Apl &gt; Terunduh."</string>
     <string name="smv_application" msgid="3307209192155442829">"Apl <xliff:g id="APPLICATION">%1$s</xliff:g> (proses <xliff:g id="PROCESS">%2$s</xliff:g>) telah melanggar kebijakan StrictMode yang diberlakukannya sendiri."</string>
     <string name="smv_process" msgid="5120397012047462446">"Proses <xliff:g id="PROCESS">%1$s</xliff:g> telah melanggar kebijakan StrictMode yang diberlakukan secara otomatis."</string>
     <string name="android_upgrading_title" msgid="1584192285441405746">"Android sedang meningkatkan versi..."</string>
@@ -983,7 +983,7 @@
     <string name="wifi_p2p_turnon_message" msgid="2909250942299627244">"Memulai Wi-Fi Langsung. Opsi ini akan mematikan hotspot/klien Wi-Fi."</string>
     <string name="wifi_p2p_failed_message" msgid="3763669677935623084">"Tidak dapat memulai Wi-Fi Langsung."</string>
     <string name="wifi_p2p_enabled_notification_title" msgid="2068321881673734886">"Wi-Fi Langsung aktif"</string>
-    <string name="wifi_p2p_enabled_notification_message" msgid="1638949953993894335">"Sentuh untuk pengaturan"</string>
+    <string name="wifi_p2p_enabled_notification_message" msgid="1638949953993894335">"Sentuh untuk setelan"</string>
     <string name="accept" msgid="1645267259272829559">"Terima"</string>
     <string name="decline" msgid="2112225451706137894">"Tolak"</string>
     <string name="wifi_p2p_invitation_sent_title" msgid="1318975185112070734">"Undangan terkirim"</string>
@@ -1027,7 +1027,7 @@
     <string name="usb_storage_stop_message" product="nosdcard" msgid="4264025280777219521">"Sebelum mematikan penyimpanan USB, lepaskan (\"keluarkan\") penyimpanan USB Anda dari komputer."</string>
     <string name="usb_storage_stop_message" product="default" msgid="8043969782460613114">"Sebelum mematikan penyimpanan USB, lepaskan (\"keluarkan\") kartu SD Android dari komputer."</string>
     <string name="usb_storage_stop_button_mount" msgid="7060218034900696029">"Matikan penyimpanan USB"</string>
-    <string name="usb_storage_stop_error_message" msgid="1970374898263063836">"Terjadi masalah saat mematikan penyimpanan USB. Periksa apakah Anda telah melepaskan inang USB, lalu coba sekali lagi."</string>
+    <string name="usb_storage_stop_error_message" msgid="1970374898263063836">"Terjadi masalah saat mematikan penyimpanan USB. Periksa apakah Anda telah melepaskan host USB, lalu coba sekali lagi."</string>
     <string name="dlg_confirm_kill_storage_users_title" msgid="963039033470478697">"Hidupkan penyimpanan USB"</string>
     <string name="dlg_confirm_kill_storage_users_text" msgid="5100428757107469454">"Jika Anda menyalakan penyimpanan USB, beberapa apl yang Anda gunakan akan berhenti dan mungkin tidak dapat dibuka hingga penyimpanan USB dimatikan."</string>
     <string name="dlg_error_title" msgid="7323658469626514207">"Operasi USB gagal"</string>
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Hari pengurangan"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tahun penambahan"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Tahun pengurangan"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"dicentang"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"tidak diperiksa"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"dipilih"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"tidak dipilih"</string>
+    <string name="switch_on" msgid="551417728476977311">"nyala"</string>
+    <string name="switch_off" msgid="7249798614327155088">"mati"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"ditekan"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"tidak ditekan"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Batal"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Hapus"</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 97bb399..96c6709 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Diminuisci giorno"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumenta anno"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuisci anno"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"selezionata"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"non selezionato"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"selezionato"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"non selezionato"</string>
+    <string name="switch_on" msgid="551417728476977311">"attivo"</string>
+    <string name="switch_off" msgid="7249798614327155088">"disattivo"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"premuto"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"non premuto"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Annulla"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Canc"</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 0a7320a..485e0b0 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"הפחת יום."</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"הוסף שנה"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"הפחת שנה"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"מסומן"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"לא מסומן"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"נבחר"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"לא נבחר"</string>
+    <string name="switch_on" msgid="551417728476977311">"מופעל"</string>
+    <string name="switch_off" msgid="7249798614327155088">"כבוי"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"לחוץ"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"לא לחוץ"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"ביטול"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"מחק"</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 08ef8ce..bc9840d 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"1日戻す"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"1年進める"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"1年戻す"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"ON"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"OFF"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"ON"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"選択されていません"</string>
+    <string name="switch_on" msgid="551417728476977311">"ON"</string>
+    <string name="switch_off" msgid="7249798614327155088">"OFF"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"ON"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"OFF"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"キャンセル"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"削除"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index ef673d2..c9801a3 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"\'날짜\'를 줄입니다."</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"\'연도\'를 올립니다."</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"\'연도\'를 줄입니다."</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"확인"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"선택 안함"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"선택됨"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"선택 안함"</string>
+    <string name="switch_on" msgid="551417728476977311">"켜짐"</string>
+    <string name="switch_off" msgid="7249798614327155088">"꺼짐"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"누름"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"누르지 않음"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt 키"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"취소"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete 키"</string>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index 744df41..4424ad5 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Sumažėjimo diena"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Padidėjimo metai"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Sumažėjimo metai"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"pažymėtas"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nepatikrinta"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"pasirinkta"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nepasirinkta"</string>
+    <string name="switch_on" msgid="551417728476977311">"įjungta"</string>
+    <string name="switch_off" msgid="7249798614327155088">"išjungta"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"paspausta"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nepaspausta"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Atšaukti"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Ištrinti"</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index 4e7d63f..89baaaa 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Samazināt datuma vērtību"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Palielināt gada vērtību"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Samazināt gada vērtību"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"atzīmēta"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nav atzīmēta"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"atlasīta"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nav atlasīta"</string>
+    <string name="switch_on" msgid="551417728476977311">"ieslēgts"</string>
+    <string name="switch_off" msgid="7249798614327155088">"izslēgts"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"nospiesta"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nav nospiesta"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alternēšanas taustiņš"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Atcelt"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Dzēšanas taustiņš"</string>
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index 0b7973b..385bebb 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Hari penyusutan"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tahun kenaikan"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Tahun penyusutan"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"ditandakan"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"tidak ditandakan"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"dipilih"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"tidak dipilih"</string>
+    <string name="switch_on" msgid="551417728476977311">"hidup"</string>
+    <string name="switch_off" msgid="7249798614327155088">"mati"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"ditekan."</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"tidak ditekan"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Batal"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Padam"</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index dbe87e7..e70a664 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Endre dag (bakover)"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Endre år (fremover)"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Endre år (bakover)"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"valgt"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"ikke valgt"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"valgt"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ikke valgt"</string>
+    <string name="switch_on" msgid="551417728476977311">"på"</string>
+    <string name="switch_off" msgid="7249798614327155088">"av"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"trykket"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"ikke trykket"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Avbryt"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Slett"</string>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index f2ea779..6876c63 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Dag verlagen"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Jaar verhogen"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Jaar verlagen"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"aangevinkt"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"niet aangevinkt"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"geselecteerd"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"niet geselecteerd"</string>
+    <string name="switch_on" msgid="551417728476977311">"aan"</string>
+    <string name="switch_off" msgid="7249798614327155088">"uit"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"ingedrukt"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"niet ingedrukt"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Annuleren"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index a2c525c..96dcfa0 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Poprzedni dzień"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Następny rok"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Poprzedni rok"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"zaznaczono"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nie zaznaczono"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"wybrano"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nie wybrano"</string>
+    <string name="switch_on" msgid="551417728476977311">"włączono"</string>
+    <string name="switch_off" msgid="7249798614327155088">"wyłączono"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"naciśnięto"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nie naciśnięto"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Anuluj"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 8f7e767..7f031fd 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Diminuir dia"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar ano"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuir ano"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"marcado"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"desmarcado"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"selecionado"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"não selecionado"</string>
+    <string name="switch_on" msgid="551417728476977311">"ativado"</string>
+    <string name="switch_off" msgid="7249798614327155088">"desativado"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"premido"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"não premido"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancelar"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index e5d68f3..fbfe88f 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Reduzir dia"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar ano"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuir ano"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"verificado"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"não selecionado"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"selecionado"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"Não selecionado"</string>
+    <string name="switch_on" msgid="551417728476977311">"ativado"</string>
+    <string name="switch_off" msgid="7249798614327155088">"desativado"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"pressionado"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"não pressionado"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Cancelar"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Excluir"</string>
diff --git a/core/res/res/values-rm/strings.xml b/core/res/res/values-rm/strings.xml
index e03a7c3..ff76f74 100644
--- a/core/res/res/values-rm/strings.xml
+++ b/core/res/res/values-rm/strings.xml
@@ -1754,6 +1754,22 @@
     <skip />
     <!-- no translation found for date_picker_decrement_year_button (5193062846559743823) -->
     <skip />
+    <!-- no translation found for checkbox_checked (7222044992652711167) -->
+    <skip />
+    <!-- no translation found for checkbox_not_checked (5174639551134444056) -->
+    <skip />
+    <!-- no translation found for radiobutton_selected (8603599808486581511) -->
+    <skip />
+    <!-- no translation found for radiobutton_not_selected (2908760184307722393) -->
+    <skip />
+    <!-- no translation found for switch_on (551417728476977311) -->
+    <skip />
+    <!-- no translation found for switch_off (7249798614327155088) -->
+    <skip />
+    <!-- no translation found for togglebutton_pressed (4180411746647422233) -->
+    <skip />
+    <!-- no translation found for togglebutton_not_pressed (4495147725636134425) -->
+    <skip />
     <!-- no translation found for keyboardview_keycode_alt (4856868820040051939) -->
     <skip />
     <!-- no translation found for keyboardview_keycode_cancel (1203984017245783244) -->
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index ed95f36..cac586e 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Decrementaţi valoarea pentru zi"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Incrementaţi valoarea pentru an"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Decrementaţi valoarea pentru an"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"bifată"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nebifată"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"selectat"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"neselectat"</string>
+    <string name="switch_on" msgid="551417728476977311">"activat"</string>
+    <string name="switch_off" msgid="7249798614327155088">"dezactivat"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"apăsat"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"neapăsat"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Anulaţi"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Ştergeţi"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index e753531..3a554d6 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"На день назад"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"На год вперед"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"На год назад"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"установлено"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"не установлено"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"выбрано"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"не выбрано"</string>
+    <string name="switch_on" msgid="551417728476977311">"Включено"</string>
+    <string name="switch_off" msgid="7249798614327155088">"Выкл."</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"нажато"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"не нажато"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Клавиша ALT"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Отмена"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Клавиша удаления"</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 246abcc..daa321d 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Odpočítať deň"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Pripočítať rok"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Odpočítať rok"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"začiarknuté"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"nezačiarknuté"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"vybratý"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"nie je vybraté"</string>
+    <string name="switch_on" msgid="551417728476977311">"zapnuté"</string>
+    <string name="switch_off" msgid="7249798614327155088">"vypnuté"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"stlačené"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"nestlačené"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Zrušiť"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Odstrániť"</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index 84e011e..20ad59b 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Prejšnji dan"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Naslednje leto"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Prejšnje leto"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"potrjeno"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"ni odkljukano"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"izbrano"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ni izbrano"</string>
+    <string name="switch_on" msgid="551417728476977311">"vklopljeno"</string>
+    <string name="switch_off" msgid="7249798614327155088">"izklopljeno"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"vklopljen"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"izklopljen"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Tipka Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Prekliči"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Tipka Delete"</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index faf73dc..9fb8abf 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Смањи дане"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Повећај године"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Смањи године"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"изабрано"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"није потврђено"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"изабрано"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"није изабрано"</string>
+    <string name="switch_on" msgid="551417728476977311">"укључено"</string>
+    <string name="switch_off" msgid="7249798614327155088">"искључено"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"притиснуто"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"није притиснуто"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Откажи"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Избриши"</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index b48f9d5..2c4189b 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -1173,6 +1173,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Minska dag"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Öka år"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Minska år"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"markerat"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"inte markerat"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"markerade"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ej vald"</string>
+    <string name="switch_on" msgid="551417728476977311">"på"</string>
+    <string name="switch_off" msgid="7249798614327155088">"av"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"intryckt"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"inte intryckt"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Avbryt"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 376ec28..13053ab 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Siku pungufu"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Mwaka wa nyongeza"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Mwaka pungufu"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"imeangaliwa"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"haijakaguliwa"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"Iliyochaguliwa"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"Haijachaguliwa"</string>
+    <string name="switch_on" msgid="551417728476977311">"Washa"</string>
+    <string name="switch_off" msgid="7249798614327155088">"zima"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"iliyobonyezwa"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"Haijabonyezwa"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Ghairi"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Futa"</string>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index 7464aea..a9a196c 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"ลดวัน"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"เพิ่มปี"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"ลดปี"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"เลือกไว้"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"ไม่ได้ตรวจสอบ"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"เลือกแล้ว"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"ไม่ได้เลือก"</string>
+    <string name="switch_on" msgid="551417728476977311">"เปิด"</string>
+    <string name="switch_off" msgid="7249798614327155088">"ปิด"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"กดแล้ว"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"ไม่ได้กด"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"ยกเลิก"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"ลบ"</string>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index ff62ab8..2672083 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Araw ng pagbawas"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Taon ng pagdaragdag"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Taon ng pagbawas"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"nilagyan ng check"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"hindi nilagyan ng check"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"pinili"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"Hindi pinili"</string>
+    <string name="switch_on" msgid="551417728476977311">"naka-on"</string>
+    <string name="switch_off" msgid="7249798614327155088">"naka-off"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"pinindot"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"hindi pinindot"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Kanselahin"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Tanggalin"</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 0d89db1..059ccea 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Gün değerini azalt"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Yıl değerini artır"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Yıl değerini azalt"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"işaretli"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"işaretlenmedi"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"seçili"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"seçili değil"</string>
+    <string name="switch_on" msgid="551417728476977311">"açık"</string>
+    <string name="switch_off" msgid="7249798614327155088">"kapalı"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"basıldı"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"basılmadı"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"İptal"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Sil"</string>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index d85bed8..42929ec 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Відняти день"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Додати рік"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Відняти рік"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"перевірено"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"не перевірено"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"вибрано"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"не вибрано"</string>
+    <string name="switch_on" msgid="551417728476977311">"увімк."</string>
+    <string name="switch_off" msgid="7249798614327155088">"вимкн."</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"натиснуто"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"не натиснуто"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Скасувати"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index c75bed2..64469ab 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Ngày giảm dần"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Năm tăng dần"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Năm giảm dần."</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"đã kiểm tra"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"chưa chọn"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"đã chọn"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"chưa được chọn"</string>
+    <string name="switch_on" msgid="551417728476977311">"bật"</string>
+    <string name="switch_off" msgid="7249798614327155088">"tắt"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"đã bấm"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"chưa được bấm"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Hủy"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Xóa"</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index a9f14a7..2664ad3 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"减少天数"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"增加年数"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"减少年份值"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"已选中"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"未选中"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"已选择"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"未选择"</string>
+    <string name="switch_on" msgid="551417728476977311">"已打开"</string>
+    <string name="switch_off" msgid="7249798614327155088">"已关闭"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"已按下"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"未按下"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"取消"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index 746f410..7c8617e 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -1173,6 +1173,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"減少天數"</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"增加年份"</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"減少年份"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"已勾選"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"尚未勾選"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"已選取"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"未選取"</string>
+    <string name="switch_on" msgid="551417728476977311">"開啟"</string>
+    <string name="switch_off" msgid="7249798614327155088">"關閉"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"已按下"</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"未按下"</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"Alt 鍵"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"取消"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Delete 鍵"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 1b30035f..09777ab 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -1172,6 +1172,14 @@
     <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Usuku lokwehlisa."</string>
     <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Unyaka wokwenyusa."</string>
     <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Unyaka wokwehlisa"</string>
+    <string name="checkbox_checked" msgid="7222044992652711167">"kuhloliwe"</string>
+    <string name="checkbox_not_checked" msgid="5174639551134444056">"akuhloliwe"</string>
+    <string name="radiobutton_selected" msgid="8603599808486581511">"Okukhethiwe"</string>
+    <string name="radiobutton_not_selected" msgid="2908760184307722393">"akukhethiwe"</string>
+    <string name="switch_on" msgid="551417728476977311">"vuliwe"</string>
+    <string name="switch_off" msgid="7249798614327155088">"valiwe"</string>
+    <string name="togglebutton_pressed" msgid="4180411746647422233">"kucindezelwe."</string>
+    <string name="togglebutton_not_pressed" msgid="4495147725636134425">"akucindezelwe."</string>
     <string name="keyboardview_keycode_alt" msgid="4856868820040051939">"i-ALT"</string>
     <string name="keyboardview_keycode_cancel" msgid="1203984017245783244">"Khansela"</string>
     <string name="keyboardview_keycode_delete" msgid="3337914833206635744">"Susa"</string>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 49f2823..4d9b043a 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -77,7 +77,7 @@
     </integer-array>
 
     <!-- Flag indicating whether the AUDIO_BECOMING_NOISY notification should
-         be sent during an change to the audio output device. -->
+         be sent during a change to the audio output device. -->
     <bool name="config_sendAudioBecomingNoisy">true</bool>
 
     <!-- The duration (in milliseconds) of a short animation. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index c8df649..7799f74 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -942,6 +942,26 @@
         contact (address) data stored on your phone. Malicious
         apps may use this to erase or modify your contact data.</string>
 
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_readCallLog">read call log</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_readCallLog" product="tablet">Allows the app to read your tablet\'s call log, including data about incoming and outgoing calls.
+        Malicious apps may use this to send your data to other people.</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_readCallLog" product="default">Allows the app to read your phone\'s call log, including data about incoming and outgoing calls.
+        Malicious apps may use this to send your data to other people.</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_writeCallLog">write call log</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_writeCallLog" product="tablet">Allows the app to modify your tablet\'s call log, including data about incoming and outgoing calls.
+        Malicious apps may use this to erase or modify your call log.</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_writeCallLog" product="default">Allows the app to modify your phone\'s call log, including data about incoming and outgoing calls.
+        Malicious apps may use this to erase or modify your call log.</string>
+
+
     <!-- Title of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=30] -->
     <string name="permlab_readProfile">read your profile data</string>
     <!-- Description of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=NONE] -->
@@ -1429,6 +1449,15 @@
       user dictionary.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
+    <string name="permlab_sdcardRead" product="nosdcard">read USB storage contents</string>
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_sdcardRead" product="default">read SD card contents</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
+    <string name="permdesc_sdcardRead" product="nosdcard">Allows the app to read contents of USB storage.</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_sdcardRead" product="default">Allows the app to read contents of SD card.</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
     <string name="permlab_sdcardWrite" product="nosdcard">modify/delete USB storage contents</string>
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_sdcardWrite" product="default">modify/delete SD card contents</string>
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
index 7233e7f..3ec9031 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
@@ -42,17 +42,13 @@
     public int mSleepTime = 2 * 60 * 1000;
     public String mReconnectSsid = "securenetdhcp";
     public String mReconnectPassword = "androidwifi";
+    public boolean mWifiOnlyFlag = false;
 
     @Override
     public TestSuite getAllTests() {
         TestSuite suite = new InstrumentationTestSuite(this);
-        if (!UtilHelper.isWifiOnly(getContext())) {
-            suite.addTestSuite(WifiApStress.class);
-            suite.addTestSuite(WifiStressTest.class);
-        } else {
-            // only the wifi stress tests
-            suite.addTestSuite(WifiStressTest.class);
-        }
+        suite.addTestSuite(WifiApStress.class);
+        suite.addTestSuite(WifiStressTest.class);
         return suite;
     }
 
@@ -64,13 +60,11 @@
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        if (!UtilHelper.isWifiOnly(getContext())) {
-            String valueStr = (String) icicle.get("softap_iterations");
-            if (valueStr != null) {
-                int iteration = Integer.parseInt(valueStr);
-                if (iteration > 0) {
-                    mSoftapIterations = iteration;
-                }
+        String valueStr = (String) icicle.get("softap_iterations");
+        if (valueStr != null) {
+            int iteration = Integer.parseInt(valueStr);
+            if (iteration > 0) {
+                mSoftapIterations = iteration;
             }
         }
 
@@ -107,5 +101,10 @@
                 mSleepTime = 1000 * sleepTime;
             }
         }
+
+        String wifiOnlyFlag = (String) icicle.get("wifi-only");
+        if (wifiOnlyFlag != null) {
+            mWifiOnlyFlag = true;
+        }
     }
 }
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
index 9c1922f..b94306a 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
@@ -35,23 +35,13 @@
  */
 
 public class ConnectivityManagerTestRunner extends InstrumentationTestRunner {
-    public String TEST_SSID = null;
+    public boolean mWifiOnlyFlag = false;
+    public String mTestSsid = null;
 
     @Override
     public TestSuite getAllTests() {
         TestSuite suite = new InstrumentationTestSuite(this);
-        if (!UtilHelper.isWifiOnly(getContext())) {
-            suite.addTestSuite(ConnectivityManagerMobileTest.class);
-        } else {
-            // create a new test suite
-            suite.setName("ConnectivityManagerWifiOnlyFunctionalTests");
-            String[] methodNames = {"testConnectToWifi", "testConnectToWifWithKnownAP",
-                    "testDisconnectWifi", "testWifiStateChange"};
-            Class<ConnectivityManagerMobileTest> testClass = ConnectivityManagerMobileTest.class;
-            for (String method: methodNames) {
-                suite.addTest(TestSuite.createTest(testClass, method));
-            }
-        }
+        suite.addTestSuite(ConnectivityManagerMobileTest.class);
         suite.addTestSuite(WifiConnectionTest.class);
         return suite;
     }
@@ -66,7 +56,11 @@
         super.onCreate(icicle);
         String testSSID = (String) icicle.get("ssid");
         if (testSSID != null) {
-            TEST_SSID = testSSID;
+            mTestSsid = testSSID;
+        }
+        String wifiOnlyFlag = (String) icicle.get("wifi-only");
+        if (wifiOnlyFlag != null) {
+            mWifiOnlyFlag = true;
         }
     }
 }
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java
deleted file mode 100644
index b9fe6ed..0000000
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.connectivitymanagertest;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.util.Log;
-
-public class UtilHelper {
-
-    private static Boolean mIsWifiOnly = null;
-    private static final Object sLock = new Object();
-
-    /**
-     * Return true if device is a wifi only device.
-     */
-    public static boolean isWifiOnly(Context context) {
-        synchronized (sLock) {
-            // cache the result from pkgMgr statically. It will never change, since its a
-            // device configuration setting
-            if (mIsWifiOnly == null) {
-                PackageManager pkgMgr = context.getPackageManager();
-                mIsWifiOnly = Boolean.valueOf(!pkgMgr
-                        .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
-                        && pkgMgr.hasSystemFeature(PackageManager.FEATURE_WIFI));
-                String deviceType = mIsWifiOnly ? "wifi-only" : "telephony";
-                Log.d("ConnectivityManagerTest", String.format("detected a %s device", deviceType));
-            }
-        }
-        return mIsWifiOnly;
-    }
-}
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
index 52326d5..bf188d3 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
@@ -31,16 +31,15 @@
 import com.android.connectivitymanagertest.ConnectivityManagerTestActivity;
 import com.android.connectivitymanagertest.ConnectivityManagerTestRunner;
 import com.android.connectivitymanagertest.NetworkState;
-import com.android.connectivitymanagertest.UtilHelper;
 
 public class ConnectivityManagerMobileTest extends
         ActivityInstrumentationTestCase2<ConnectivityManagerTestActivity> {
     private static final String LOG_TAG = "ConnectivityManagerMobileTest";
 
-    private String TEST_ACCESS_POINT;
+    private String mTestAccessPoint;
     private ConnectivityManagerTestActivity cmActivity;
     private WakeLock wl;
-    private boolean mIsWifiOnlyDevice;
+    private boolean mWifiOnlyFlag;
 
     public ConnectivityManagerMobileTest() {
         super(ConnectivityManagerTestActivity.class);
@@ -52,7 +51,9 @@
         cmActivity = getActivity();
         ConnectivityManagerTestRunner mRunner =
                 (ConnectivityManagerTestRunner)getInstrumentation();
-        TEST_ACCESS_POINT = mRunner.TEST_SSID;
+        mTestAccessPoint = mRunner.mTestSsid;
+        mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
+
         PowerManager pm = (PowerManager)getInstrumentation().
                 getContext().getSystemService(Context.POWER_SERVICE);
         wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "CMWakeLock");
@@ -63,8 +64,8 @@
             log("airplane is not disabled, disable it.");
             cmActivity.setAirplaneMode(getInstrumentation().getContext(), false);
         }
-        mIsWifiOnlyDevice = UtilHelper.isWifiOnly(mRunner.getTargetContext());
-        if (!mIsWifiOnlyDevice) {
+
+        if (!mWifiOnlyFlag) {
             if (!cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
                     ConnectivityManagerTestActivity.LONG_TIMEOUT)) {
                 // Note: When the test fails in setUp(), tearDown is not called. In that case,
@@ -113,6 +114,10 @@
     //              event should be expected.
     @LargeTest
     public void test3GToWifiNotification() {
+        if (mWifiOnlyFlag) {
+            Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+            return;
+        }
         // Enable Wi-Fi to avoid initial UNKNOWN state
         cmActivity.enableWifi();
         sleep(2 * ConnectivityManagerTestActivity.SHORT_TIMEOUT);
@@ -159,9 +164,9 @@
     // Test case 2: test connection to a given AP
     @LargeTest
     public void testConnectToWifi() {
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
+        assertNotNull("SSID is null", mTestAccessPoint);
         NetworkInfo networkInfo;
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             //Prepare for connectivity verification
             networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
             cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -172,15 +177,15 @@
                 NetworkState.TO_CONNECTION, State.CONNECTED);
 
         // Enable Wifi and connect to a test access point
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                cmActivity.connectToWifi(mTestAccessPoint));
 
         assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
         log("wifi state is enabled");
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         }
@@ -192,7 +197,7 @@
                     cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
             assertTrue(false);
         }
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
                 log("Mobile state transition validation failed.");
                 log("reason: " +
@@ -205,10 +210,10 @@
     // Test case 3: connect to Wifi with known AP
     @LargeTest
     public void testConnectToWifWithKnownAP() {
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
-        // Connect to TEST_ACCESS_POINT
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertNotNull("SSID is null", mTestAccessPoint);
+        // Connect to mTestAccessPoint
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                cmActivity.connectToWifi(mTestAccessPoint));
         assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
@@ -227,13 +232,13 @@
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI,
                 State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.CONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         }
 
         NetworkInfo networkInfo;
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             //Prepare for connectivity state verification
             networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
             cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -253,7 +258,7 @@
         // Wait for Wifi to be connected and mobile to be disconnected
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         }
@@ -270,11 +275,11 @@
     // Test case 4:  test disconnect Wifi
     @LargeTest
     public void testDisconnectWifi() {
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
+        assertNotNull("SSID is null", mTestAccessPoint);
 
         // connect to Wifi
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                   cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                   cmActivity.connectToWifi(mTestAccessPoint));
 
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
             ConnectivityManagerTestActivity.LONG_TIMEOUT));
@@ -283,7 +288,7 @@
         sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT);
 
         NetworkInfo networkInfo;
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
             cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
                                                   networkInfo.getState(),
@@ -299,7 +304,7 @@
 
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.CONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         }
@@ -311,7 +316,7 @@
                     cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
             assertTrue(false);
         }
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
                 log("Mobile state transition validation failed.");
                 log("reason: " +
@@ -324,6 +329,10 @@
     // Test case 5: test connectivity from 3G to airplane mode, then to 3G again
     @LargeTest
     public void testDataConnectionWith3GToAmTo3G() {
+        if (mWifiOnlyFlag) {
+            Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+            return;
+        }
         //Prepare for state verification
         NetworkInfo networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
         cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -340,7 +349,9 @@
 
         networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
         assertEquals(State.DISCONNECTED, networkInfo.getState());
-
+        // wait until mobile is turn off
+        assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
+                State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
             log("Mobile state transition validation failed.");
             log("reason: " +
@@ -382,13 +393,17 @@
     // Test case 6: test connectivity with airplane mode Wifi connected
     @LargeTest
     public void testDataConnectionOverAMWithWifi() {
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
+        if (mWifiOnlyFlag) {
+            Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+            return;
+        }
+        assertNotNull("SSID is null", mTestAccessPoint);
         // Eanble airplane mode
         log("Enable airplane mode");
         cmActivity.setAirplaneMode(getInstrumentation().getContext(), true);
 
         NetworkInfo networkInfo;
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
             networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
@@ -402,8 +417,8 @@
                                               NetworkState.TO_CONNECTION, State.CONNECTED);
 
         // Connect to Wifi
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                   cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                   cmActivity.connectToWifi(mTestAccessPoint));
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
                             ConnectivityManagerTestActivity.LONG_TIMEOUT));
 
@@ -414,7 +429,7 @@
                     cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
             assertTrue("State validation failed", false);
         }
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
                 log("state validation for Mobile failed");
                 log("reason: " +
@@ -428,11 +443,15 @@
     // Test case 7: test connectivity while transit from Wifi->AM->Wifi
     @LargeTest
     public void testDataConnectionWithWifiToAMToWifi () {
-        // Connect to TEST_ACCESS_POINT
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
+        if (mWifiOnlyFlag) {
+            Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+            return;
+        }
+        // Connect to mTestAccessPoint
+        assertNotNull("SSID is null", mTestAccessPoint);
         // Connect to Wifi
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                cmActivity.connectToWifi(mTestAccessPoint));
 
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
@@ -466,7 +485,7 @@
 
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
                             ConnectivityManagerTestActivity.LONG_TIMEOUT));
-        if (!mIsWifiOnlyDevice) {
+        if (!mWifiOnlyFlag) {
             assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
                     State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
         }
@@ -483,10 +502,10 @@
     // Test case 8: test wifi state change while connecting/disconnecting to/from an AP
     @LargeTest
     public void testWifiStateChange () {
-        assertNotNull("SSID is null", TEST_ACCESS_POINT);
-        //Connect to TEST_ACCESS_POINT
-        assertTrue("failed to connect to " + TEST_ACCESS_POINT,
-                   cmActivity.connectToWifi(TEST_ACCESS_POINT));
+        assertNotNull("SSID is null", mTestAccessPoint);
+        //Connect to mTestAccessPoint
+        assertTrue("failed to connect to " + mTestAccessPoint,
+                   cmActivity.connectToWifi(mTestAccessPoint));
         assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
                 ConnectivityManagerTestActivity.LONG_TIMEOUT));
         assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
@@ -503,7 +522,7 @@
         // Disconnect from the current AP
         log("disconnect from the AP");
         if (!cmActivity.disconnectAP()) {
-            log("failed to disconnect from " + TEST_ACCESS_POINT);
+            log("failed to disconnect from " + mTestAccessPoint);
         }
 
         // Verify the connectivity state for Wifi is DISCONNECTED
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
index 41104fe..7e136be 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
@@ -51,6 +51,7 @@
     private int iterations;
     private BufferedWriter mOutputWriter = null;
     private int mLastIteration = 0;
+    private boolean mWifiOnlyFlag;
 
     public WifiApStress() {
         super(ConnectivityManagerTestActivity.class);
@@ -63,6 +64,7 @@
         ConnectivityManagerStressTestRunner mRunner =
             (ConnectivityManagerStressTestRunner)getInstrumentation();
         iterations = mRunner.mSoftapIterations;
+        mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
         mAct.turnScreenOn();
     }
 
@@ -79,6 +81,10 @@
 
     @LargeTest
     public void testWifiHotSpot() {
+        if (mWifiOnlyFlag) {
+            Log.v(TAG, this.getName() + " is excluded for wi-fi only test");
+            return;
+        }
         WifiConfiguration config = new WifiConfiguration();
         config.SSID = NETWORK_ID;
         config.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
index feb63cd..649ec3e 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
@@ -34,7 +34,6 @@
 
 import com.android.connectivitymanagertest.ConnectivityManagerStressTestRunner;
 import com.android.connectivitymanagertest.ConnectivityManagerTestActivity;
-import com.android.connectivitymanagertest.UtilHelper;
 
 import java.io.BufferedWriter;
 import java.io.File;
@@ -75,7 +74,7 @@
     private String mPassword;
     private ConnectivityManagerStressTestRunner mRunner;
     private BufferedWriter mOutputWriter = null;
-    private boolean mIsWifiOnlyDevice;
+    private boolean mWifiOnlyFlag;
 
     public WifiStressTest() {
         super(ConnectivityManagerTestActivity.class);
@@ -91,13 +90,18 @@
         mPassword = mRunner.mReconnectPassword;
         mScanIterations = mRunner.mScanIterations;
         mWifiSleepTime = mRunner.mSleepTime;
+        mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
         log(String.format("mReconnectIterations(%d), mSsid(%s), mPassword(%s),"
             + "mScanIterations(%d), mWifiSleepTime(%d)", mReconnectIterations, mSsid,
             mPassword, mScanIterations, mWifiSleepTime));
         mOutputWriter = new BufferedWriter(new FileWriter(new File(
                 Environment.getExternalStorageDirectory(), OUTPUT_FILE), true));
         mAct.turnScreenOn();
-        mIsWifiOnlyDevice = UtilHelper.isWifiOnly(mRunner.getTargetContext());
+        if (mAct.mWifiManager.isWifiApEnabled()) {
+            // if soft AP is enabled, disable it
+            assertTrue(mAct.mWifiManager.setWifiApEnabled(null, false));
+            Log.v(TAG, "disable soft ap");
+        }
         if (!mAct.mWifiManager.isWifiEnabled()) {
             log("Enable wi-fi before stress tests.");
             if (!mAct.enableWifi()) {
@@ -269,7 +273,7 @@
             assertTrue("Wait for Wi-Fi to idle timeout",
                     mAct.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
                     6 * ConnectivityManagerTestActivity.SHORT_TIMEOUT));
-            if (!mIsWifiOnlyDevice) {
+            if (!mWifiOnlyFlag) {
                 // use long timeout as the pppd startup may take several retries.
                 assertTrue("Wait for cellular connection timeout",
                         mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
@@ -280,7 +284,7 @@
             assertEquals("Wi-Fi is reconnected", State.DISCONNECTED,
                     mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState());
 
-            if (!mIsWifiOnlyDevice) {
+            if (!mWifiOnlyFlag) {
                 assertEquals("Cellular connection is down", State.CONNECTED,
                              mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState());
                 assertTrue("Mobile is connected, but no data connection.", mAct.pingTest(null));
diff --git a/core/tests/coretests/src/android/util/ListScenario.java b/core/tests/coretests/src/android/util/ListScenario.java
index 22be4e7..fa088a3 100644
--- a/core/tests/coretests/src/android/util/ListScenario.java
+++ b/core/tests/coretests/src/android/util/ListScenario.java
@@ -590,7 +590,7 @@
     }
 
     /**
-     * Return an the number of types created by the adapter. Override if your
+     * Return the number of types created by the adapter. Override if your
      * adapter creates more than one type.
      */
     public int getViewTypeCount() {
diff --git a/core/tests/coretests/src/android/util/LocaleUtilTest.java b/core/tests/coretests/src/android/util/LocaleUtilTest.java
deleted file mode 100644
index 0ca6043..0000000
--- a/core/tests/coretests/src/android/util/LocaleUtilTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2007 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.util;
-
-import java.util.Locale;
-
-import android.test.AndroidTestCase;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-
-import static android.view.View.LAYOUT_DIRECTION_LTR;
-import static android.view.View.LAYOUT_DIRECTION_RTL;
-
-public class LocaleUtilTest extends AndroidTestCase {
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "getLayoutDirectionFromLocale",
-        args = {Locale.class}
-    )
-    public void testGetLayoutDirectionFromLocale() {
-        assertEquals(LAYOUT_DIRECTION_LTR,
-                LocaleUtil.getLayoutDirectionFromLocale(null));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.UK));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.US));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT));
-
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN));
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE));
-
-        Locale locale = new Locale("ar");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "AE");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "BH");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "DZ");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "EG");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "IQ");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "JO");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "KW");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "LB");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "LY");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "MA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "OM");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "QA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SA");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SD");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "SY");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "TN");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ar", "YE");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("fa");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("fa", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("fa", "IR");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("iw");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("iw", "IL");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("he");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("he", "IL");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("pa_Arab");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("pa_Arab", "PK");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("ps");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ps", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("ur");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ur", "IN");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("ur", "PK");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        locale = new Locale("uz_Arab");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-        locale = new Locale("uz_Arab", "AF");
-        assertEquals(LAYOUT_DIRECTION_RTL,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-
-        // Locale without a real language
-        locale = new Locale("zz");
-        assertEquals(LAYOUT_DIRECTION_LTR,
-            LocaleUtil.getLayoutDirectionFromLocale(locale));
-    }
-}
diff --git a/core/tests/coretests/src/android/view/GravityTest.java b/core/tests/coretests/src/android/view/GravityTest.java
deleted file mode 100644
index d8ef650..0000000
--- a/core/tests/coretests/src/android/view/GravityTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.view;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class GravityTest extends AndroidTestCase {
-
-    @SmallTest
-    public void testGetAbsoluteGravity() throws Exception {
-        assertOneGravity(Gravity.LEFT, Gravity.LEFT, false);
-        assertOneGravity(Gravity.LEFT, Gravity.LEFT, true);
-
-        assertOneGravity(Gravity.RIGHT, Gravity.RIGHT, false);
-        assertOneGravity(Gravity.RIGHT, Gravity.RIGHT, true);
-
-        assertOneGravity(Gravity.TOP, Gravity.TOP, false);
-        assertOneGravity(Gravity.TOP, Gravity.TOP, true);
-
-        assertOneGravity(Gravity.BOTTOM, Gravity.BOTTOM, false);
-        assertOneGravity(Gravity.BOTTOM, Gravity.BOTTOM, true);
-
-        assertOneGravity(Gravity.CENTER_VERTICAL, Gravity.CENTER_VERTICAL, false);
-        assertOneGravity(Gravity.CENTER_VERTICAL, Gravity.CENTER_VERTICAL, true);
-
-        assertOneGravity(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_HORIZONTAL, false);
-        assertOneGravity(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_HORIZONTAL, true);
-
-        assertOneGravity(Gravity.CENTER, Gravity.CENTER, false);
-        assertOneGravity(Gravity.CENTER, Gravity.CENTER, true);
-
-        assertOneGravity(Gravity.FILL_VERTICAL, Gravity.FILL_VERTICAL, false);
-        assertOneGravity(Gravity.FILL_VERTICAL, Gravity.FILL_VERTICAL, true);
-
-        assertOneGravity(Gravity.FILL_HORIZONTAL, Gravity.FILL_HORIZONTAL, false);
-        assertOneGravity(Gravity.FILL_HORIZONTAL, Gravity.FILL_HORIZONTAL, true);
-
-        assertOneGravity(Gravity.FILL, Gravity.FILL, false);
-        assertOneGravity(Gravity.FILL, Gravity.FILL, true);
-
-        assertOneGravity(Gravity.CLIP_HORIZONTAL, Gravity.CLIP_HORIZONTAL, false);
-        assertOneGravity(Gravity.CLIP_HORIZONTAL, Gravity.CLIP_HORIZONTAL, true);
-
-        assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, false);
-        assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, true);
-
-        assertOneGravity(Gravity.LEFT, Gravity.START, false);
-        assertOneGravity(Gravity.RIGHT, Gravity.START, true);
-
-        assertOneGravity(Gravity.RIGHT, Gravity.END, false);
-        assertOneGravity(Gravity.LEFT, Gravity.END, true);
-    }
-
-    private void assertOneGravity(int expected, int initial, boolean isRtl) {
-        final int layoutDirection = isRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR;
-
-        assertEquals(expected, Gravity.getAbsoluteGravity(initial, layoutDirection));
-    }
-}
diff --git a/core/tests/coretests/src/android/view/ViewAttachTest.java b/core/tests/coretests/src/android/view/ViewAttachTest.java
index cff66e4..a73f5a6 100644
--- a/core/tests/coretests/src/android/view/ViewAttachTest.java
+++ b/core/tests/coretests/src/android/view/ViewAttachTest.java
@@ -29,12 +29,12 @@
 
     /**
      * Make sure that onAttachedToWindow and onDetachedToWindow is called in the
-     * correct order The ViewAttachTestActivity contains a view that will throw
-     * an RuntimeException if onDetachedToWindow and onAttachedToWindow is
+     * correct order. The ViewAttachTestActivity contains a view that will throw
+     * a RuntimeException if onDetachedToWindow and onAttachedToWindow are
      * called in the wrong order.
      *
      * 1. Initiate the activity 2. Perform a series of orientation changes to
-     * the activity (this will force the View hierarchy to be rebuild,
+     * the activity (this will force the View hierarchy to be rebuilt,
      * generating onAttachedToWindow and onDetachedToWindow)
      *
      * Expected result: No RuntimeException is thrown from the TestView in
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 8be1db2..4b93e74 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -54,6 +54,10 @@
         <group gid="log" />
     </permission>
 
+    <permission name="android.permission.READ_EXTERNAL_STORAGE" >
+        <group gid="sdcard_r" />
+    </permission>
+
     <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
         <group gid="sdcard_rw" />
     </permission>
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
index 34804cf..c0e408e 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
@@ -499,6 +499,14 @@
 
 private:
 
+    static const String8 Description;
+    static const String8 FileSuffixes[];
+    static const String8 MimeTypes[];
+    static bool IsFileSuffixSupported(const String8& suffix);
+    static bool IsMimeTypeSupported(const String8& mime);
+    static void AddSupportedMimeTypes(DrmSupportInfo *info);
+    static void AddSupportedFileSuffixes(DrmSupportInfo *info);
+
 /**
  * Session Class for Forward Lock Conversion. An object of this class is created
  * for every conversion.
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngineConst.h b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngineConst.h
deleted file mode 100644
index da95d60..0000000
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngineConst.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FWDLOCKENGINECONST_H__
-#define __FWDLOCKENGINECONST_H__
-
-namespace android {
-
-/**
- * Constants for forward Lock Engine used for exposing engine's capabilities.
- */
-#define FWDLOCK_EXTENSION_FL           ("FL")
-#define FWDLOCK_DOTEXTENSION_FL        (".fl")
-#define FWDLOCK_MIMETYPE_FL            ("application/x-android-drm-fl")
-
-#define FWDLOCK_EXTENSION_DM           ("DM")
-#define FWDLOCK_DOTEXTENSION_DM        (".dm")
-#define FWDLOCK_MIMETYPE_DM            ("application/vnd.oma.drm.message")
-
-#define FWDLOCK_DESCRIPTION            ("OMA V1 Forward Lock")
-
-};
-
-#endif /* __FWDLOCKENGINECONST_H__ */
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index 0273a4b..5ee41e6 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -35,7 +35,6 @@
 #include "FwdLockConv.h"
 #include "FwdLockFile.h"
 #include "FwdLockGlue.h"
-#include "FwdLockEngineConst.h"
 #include "MimeTypeUtil.h"
 
 #undef LOG_TAG
@@ -160,6 +159,48 @@
     return DRM_NO_ERROR;
 }
 
+const String8 FwdLockEngine::FileSuffixes[] = {
+    String8(".fl"),
+    String8(".dm"),
+};
+
+const String8 FwdLockEngine::MimeTypes[] = {
+    String8("application/x-android-drm-fl"),
+    String8("application/vnd.oma.drm.message"),
+};
+
+const String8 FwdLockEngine::Description("OMA V1 Forward Lock");
+
+void FwdLockEngine::AddSupportedMimeTypes(DrmSupportInfo *info) {
+    for (size_t i = 0, n = sizeof(MimeTypes)/sizeof(MimeTypes[0]); i < n; ++i) {
+        info->addMimeType(MimeTypes[i]);
+    }
+}
+
+void FwdLockEngine::AddSupportedFileSuffixes(DrmSupportInfo *info) {
+    for (size_t i = 0, n = sizeof(FileSuffixes)/sizeof(FileSuffixes[0]); i < n; ++i) {
+        info->addFileSuffix(FileSuffixes[i]);
+    }
+}
+
+bool FwdLockEngine::IsMimeTypeSupported(const String8& mime) {
+    for (size_t i = 0, n = sizeof(MimeTypes)/sizeof(MimeTypes[0]); i < n; ++i) {
+        if (mime == MimeTypes[i]) {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool FwdLockEngine::IsFileSuffixSupported(const String8& suffix) {
+    for (size_t i = 0, n = sizeof(FileSuffixes)/sizeof(FileSuffixes[0]); i < n; ++i) {
+        if (suffix == FileSuffixes[i]) {
+            return true;
+        }
+    }
+    return false;
+}
+
 DrmSupportInfo* FwdLockEngine::onGetSupportInfo(int uniqueId) {
     DrmSupportInfo* pSupportInfo = new DrmSupportInfo();
 
@@ -167,12 +208,9 @@
 
     // fill all Forward Lock mimetypes and extensions
     if (NULL != pSupportInfo) {
-        pSupportInfo->addMimeType(String8(FWDLOCK_MIMETYPE_FL));
-        pSupportInfo->addFileSuffix(String8(FWDLOCK_DOTEXTENSION_FL));
-        pSupportInfo->addMimeType(String8(FWDLOCK_MIMETYPE_DM));
-        pSupportInfo->addFileSuffix(String8(FWDLOCK_DOTEXTENSION_DM));
-
-        pSupportInfo->setDescription(String8(FWDLOCK_DESCRIPTION));
+        AddSupportedMimeTypes(pSupportInfo);
+        AddSupportedFileSuffixes(pSupportInfo);
+        pSupportInfo->setDescription(Description);
     }
 
     return pSupportInfo;
@@ -182,14 +220,8 @@
     bool result = false;
 
     String8 extString = path.getPathExtension();
-
     extString.toLower();
-
-    if ((extString == String8(FWDLOCK_DOTEXTENSION_FL)) ||
-        (extString == String8(FWDLOCK_DOTEXTENSION_DM))) {
-        result = true;
-    }
-    return result;
+    return IsFileSuffixSupported(extString);
 }
 
 DrmInfoStatus* FwdLockEngine::onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
@@ -308,8 +340,7 @@
     *    (regardless of the relation between them to make it compatible with other DRM Engines)
     */
     if (((0 == path.length()) || onCanHandle(uniqueId, path)) &&
-        ((0 == mimeType.length()) || ((mimeStr == String8(FWDLOCK_MIMETYPE_FL)) ||
-        (mimeStr == String8(FWDLOCK_MIMETYPE_DM)))) && (mimeType != path) ) {
+        ((0 == mimeType.length()) || IsMimeTypeSupported(mimeType)) && (mimeType != path) ) {
             return DrmObjectType::CONTENT;
     }
 
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
index dacf00e..365bdec 100644
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/FwdLockFile.c
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <utils/Log.h>
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -107,6 +108,7 @@
         }
         pthread_mutex_unlock(&sessionAcquisitionMutex);
         if (i == MAX_NUM_SESSIONS) {
+            ALOGE("Too many sessions opened at the same time");
             errno = ENFILE;
         }
     }
@@ -293,7 +295,12 @@
 
 int FwdLockFile_open(const char *pFilename) {
     int fileDesc = open(pFilename, O_RDONLY);
-    if (fileDesc >= 0 && FwdLockFile_attach(fileDesc) < 0) {
+    if (fileDesc < 0) {
+        ALOGE("failed to open file '%s': %s", pFilename, strerror(errno));
+        return fileDesc;
+    }
+
+    if (FwdLockFile_attach(fileDesc) < 0) {
         (void)close(fileDesc);
         fileDesc = -1;
     }
diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java
index 7ef35a9..6f71a2b 100644
--- a/graphics/java/android/graphics/Camera.java
+++ b/graphics/java/android/graphics/Camera.java
@@ -100,6 +100,27 @@
     public native void rotate(float x, float y, float z);
 
     /**
+     * Gets the x location of the camera.
+     *
+     * @see #setLocation(float, float, float)
+     */
+    public native float getLocationX();
+
+    /**
+     * Gets the y location of the camera.
+     *
+     * @see #setLocation(float, float, float)
+     */
+    public native float getLocationY();
+
+    /**
+     * Gets the z location of the camera.
+     *
+     * @see #setLocation(float, float, float)
+     */
+    public native float getLocationZ();
+
+    /**
      * Sets the location of the camera. The default location is set at
      * 0, 0, -8.
      * 
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index ed6fa08..4487a3c 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -17,6 +17,7 @@
 package android.graphics;
 
 import android.content.res.AssetManager;
+import android.util.SparseArray;
 
 import java.io.File;
 
@@ -43,9 +44,11 @@
     /** The NORMAL style of the default monospace typeface. */
     public static final Typeface MONOSPACE;
 
-    /* package */ static Typeface[] sDefaults;
-    
-    /* package */ int native_instance;
+    static Typeface[] sDefaults;
+    private static final SparseArray<SparseArray<Typeface>> sTypefaceCache =
+            new SparseArray<SparseArray<Typeface>>(3);
+
+    int native_instance;
 
     // Style
     public static final int NORMAL = 0;
@@ -53,19 +56,21 @@
     public static final int ITALIC = 2;
     public static final int BOLD_ITALIC = 3;
 
+    private int mStyle = 0;
+
     /** Returns the typeface's intrinsic style attributes */
     public int getStyle() {
-        return nativeGetStyle(native_instance);
+        return mStyle;
     }
 
     /** Returns true if getStyle() has the BOLD bit set. */
     public final boolean isBold() {
-        return (getStyle() & BOLD) != 0;
+        return (mStyle & BOLD) != 0;
     }
 
     /** Returns true if getStyle() has the ITALIC bit set. */
     public final boolean isItalic() {
-        return (getStyle() & ITALIC) != 0;
+        return (mStyle & ITALIC) != 0;
     }
 
     /**
@@ -97,9 +102,32 @@
     public static Typeface create(Typeface family, int style) {
         int ni = 0;        
         if (family != null) {
+            // Return early if we're asked for the same face/style
+            if (family.mStyle == style) {
+                return family;
+            }
+
             ni = family.native_instance;
         }
-        return new Typeface(nativeCreateFromTypeface(ni, style));
+
+        Typeface typeface;
+        SparseArray<Typeface> styles = sTypefaceCache.get(ni);
+
+        if (styles != null) {
+            typeface = styles.get(style);
+            if (typeface != null) {
+                return typeface;
+            }
+        }
+
+        typeface = new Typeface(nativeCreateFromTypeface(ni, style));
+        if (styles == null) {
+            styles = new SparseArray<Typeface>(4);
+            sTypefaceCache.put(ni, styles);
+        }
+        styles.put(style, typeface);
+
+        return typeface;
     }
 
     /**
@@ -143,15 +171,17 @@
 
     // don't allow clients to call this directly
     private Typeface(int ni) {
-        if (0 == ni) {
+        if (ni == 0) {
             throw new RuntimeException("native typeface cannot be made");
         }
+
         native_instance = ni;
+        mStyle = nativeGetStyle(ni);
     }
     
     static {
-        DEFAULT         = create((String)null, 0);
-        DEFAULT_BOLD    = create((String)null, Typeface.BOLD);
+        DEFAULT         = create((String) null, 0);
+        DEFAULT_BOLD    = create((String) null, Typeface.BOLD);
         SANS_SERIF      = create("sans-serif", 0);
         SERIF           = create("serif", 0);
         MONOSPACE       = create("monospace", 0);
@@ -159,14 +189,34 @@
         sDefaults = new Typeface[] {
             DEFAULT,
             DEFAULT_BOLD,
-            create((String)null, Typeface.ITALIC),
-            create((String)null, Typeface.BOLD_ITALIC),
+            create((String) null, Typeface.ITALIC),
+            create((String) null, Typeface.BOLD_ITALIC),
         };
     }
 
     protected void finalize() throws Throwable {
-        super.finalize();
-        nativeUnref(native_instance);
+        try {
+            nativeUnref(native_instance);
+        } finally {
+            super.finalize();
+        }
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Typeface typeface = (Typeface) o;
+
+        return mStyle == typeface.mStyle && native_instance == typeface.native_instance;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = native_instance;
+        result = 31 * result + mStyle;
+        return result;
     }
 
     private static native int  nativeCreate(String familyName, int style);
diff --git a/graphics/java/android/graphics/drawable/ClipDrawable.java b/graphics/java/android/graphics/drawable/ClipDrawable.java
index 29edc04..c41dd07 100644
--- a/graphics/java/android/graphics/drawable/ClipDrawable.java
+++ b/graphics/java/android/graphics/drawable/ClipDrawable.java
@@ -24,7 +24,6 @@
 import android.graphics.*;
 import android.view.Gravity;
 import android.util.AttributeSet;
-import android.view.View;
 
 import java.io.IOException;
 
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 4b9c98f..043adae 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -296,8 +296,6 @@
 
     /**
      * Implement this interface if you want to create an drawable that is RTL aware
-     *
-     * @hide
      */
     public static interface Callback2 extends Callback {
         /**
@@ -387,8 +385,6 @@
     /**
      * Use the current {@link android.graphics.drawable.Drawable.Callback2} implementation to get
      * the resolved layout direction of this Drawable.
-     *
-     * @hide
      */
     public int getResolvedLayoutDirectionSelf() {
         final Callback callback = getCallback();
diff --git a/graphics/java/android/graphics/drawable/ScaleDrawable.java b/graphics/java/android/graphics/drawable/ScaleDrawable.java
index 5fd5a16..ccad250 100644
--- a/graphics/java/android/graphics/drawable/ScaleDrawable.java
+++ b/graphics/java/android/graphics/drawable/ScaleDrawable.java
@@ -24,7 +24,6 @@
 import android.graphics.*;
 import android.view.Gravity;
 import android.util.AttributeSet;
-import android.view.View;
 
 import java.io.IOException;
 
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 4fbeb38..7df6668 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -143,6 +143,8 @@
      * user                Context for use by the callback receiver.
      */
 
+     // FIXME consider removing this alias and replacing it by audio_in_acoustics_t
+     //       or removing the parameter entirely if it is unused
      enum record_flags {
          RECORD_AGC_ENABLE = AUDIO_IN_ACOUSTICS_AGC_ENABLE,
          RECORD_NS_ENABLE  = AUDIO_IN_ACOUSTICS_NS_ENABLE,
@@ -154,7 +156,7 @@
                                     audio_format_t format = AUDIO_FORMAT_DEFAULT,
                                     uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
                                     int frameCount      = 0,
-                                    uint32_t flags      = 0,
+                                    record_flags flags  = (record_flags) 0,
                                     callback_t cbf = NULL,
                                     void* user = NULL,
                                     int notificationFrames = 0,
@@ -180,7 +182,7 @@
                             audio_format_t format = AUDIO_FORMAT_DEFAULT,
                             uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
                             int frameCount      = 0,
-                            uint32_t flags      = 0,
+                            record_flags flags  = (record_flags) 0,
                             callback_t cbf = NULL,
                             void* user = NULL,
                             int notificationFrames = 0,
@@ -383,7 +385,7 @@
     bool                    mMarkerReached;
     uint32_t                mNewPosition;
     uint32_t                mUpdatePeriod;
-    uint32_t                mFlags;
+    record_flags            mFlags;
     uint32_t                mChannelMask;
     audio_io_handle_t       mInput;
     int                     mSessionId;
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 95b9d86..552e829 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -153,7 +153,7 @@
                                     audio_format_t format = AUDIO_FORMAT_DEFAULT,
                                     int channelMask      = 0,
                                     int frameCount       = 0,
-                                    uint32_t flags       = 0,
+                                    audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
                                     callback_t cbf       = NULL,
                                     void* user           = NULL,
                                     int notificationFrames = 0,
@@ -165,7 +165,7 @@
                                     int format = AUDIO_FORMAT_DEFAULT,
                                     int channelMask      = 0,
                                     int frameCount       = 0,
-                                    uint32_t flags       = 0,
+                                    uint32_t flags       = (uint32_t) AUDIO_POLICY_OUTPUT_FLAG_NONE,
                                     callback_t cbf       = 0,
                                     void* user           = 0,
                                     int notificationFrames = 0,
@@ -185,7 +185,7 @@
                                     audio_format_t format = AUDIO_FORMAT_DEFAULT,
                                     int channelMask     = 0,
                                     const sp<IMemory>& sharedBuffer = 0,
-                                    uint32_t flags      = 0,
+                                    audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
                                     callback_t cbf      = NULL,
                                     void* user          = NULL,
                                     int notificationFrames = 0,
@@ -209,7 +209,7 @@
                             audio_format_t format = AUDIO_FORMAT_DEFAULT,
                             int channelMask     = 0,
                             int frameCount      = 0,
-                            uint32_t flags      = 0,
+                            audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_NONE,
                             callback_t cbf      = NULL,
                             void* user          = NULL,
                             int notificationFrames = 0,
@@ -473,7 +473,7 @@
                                  audio_format_t format,
                                  uint32_t channelMask,
                                  int frameCount,
-                                 uint32_t flags,
+                                 audio_policy_output_flags_t flags,
                                  const sp<IMemory>& sharedBuffer,
                                  audio_io_handle_t output,
                                  bool enforceFrameCount);
@@ -515,7 +515,7 @@
     uint32_t                mNewPosition;
     uint32_t                mUpdatePeriod;
     bool                    mFlushed; // FIXME will be made obsolete by making flush() synchronous
-    uint32_t                mFlags;
+    audio_policy_output_flags_t mFlags;
     int                     mSessionId;
     int                     mAuxEffectId;
     mutable Mutex           mLock;
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 7a2ada0..0f39cf3 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -28,6 +28,7 @@
 #include <media/IAudioRecord.h>
 #include <media/IAudioFlingerClient.h>
 #include <system/audio.h>
+#include <system/audio_policy.h>
 #include <hardware/audio_effect.h>
 #include <media/IEffect.h>
 #include <media/IEffectClient.h>
@@ -77,6 +78,8 @@
     virtual     int         channelCount(audio_io_handle_t output) const = 0;
     virtual     audio_format_t format(audio_io_handle_t output) const = 0;
     virtual     size_t      frameCount(audio_io_handle_t output) const = 0;
+
+    // return estimated latency in milliseconds
     virtual     uint32_t    latency(audio_io_handle_t output) const = 0;
 
     /* set/get the audio hardware state. This will probably be used by
@@ -121,7 +124,7 @@
                                     audio_format_t *pFormat,
                                     uint32_t *pChannels,
                                     uint32_t *pLatencyMs,
-                                    uint32_t flags) = 0;
+                                    audio_policy_output_flags_t flags) = 0;
     virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1,
                                     audio_io_handle_t output2) = 0;
     virtual status_t closeOutput(audio_io_handle_t output) = 0;
diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h
index 7869020..089be3b 100644
--- a/include/media/IAudioRecord.h
+++ b/include/media/IAudioRecord.h
@@ -32,7 +32,7 @@
 
 class IAudioRecord : public IInterface
 {
-public: 
+public:
     DECLARE_META_INTERFACE(AudioRecord);
 
     /* After it's created the track is not active. Call start() to
@@ -42,13 +42,13 @@
     virtual status_t    start(pid_t tid) = 0;
 
     /* Stop a track. If set, the callback will cease being called and
-     * obtainBuffer will return an error. Buffers that are already released 
+     * obtainBuffer will return an error. Buffers that are already released
      * will be processed, unless flush() is called.
      */
     virtual void        stop() = 0;
 
     /* get this tracks control block */
-    virtual sp<IMemory> getCblk() const = 0;    
+    virtual sp<IMemory> getCblk() const = 0;
 };
 
 // ----------------------------------------------------------------------------
diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h
index 77f3e21..577b095 100644
--- a/include/media/IAudioTrack.h
+++ b/include/media/IAudioTrack.h
@@ -32,7 +32,7 @@
 
 class IAudioTrack : public IInterface
 {
-public: 
+public:
     DECLARE_META_INTERFACE(AudioTrack);
 
     /* Get this track's control block */
@@ -45,7 +45,7 @@
     virtual status_t    start(pid_t tid) = 0;
 
     /* Stop a track. If set, the callback will cease being called and
-     * obtainBuffer will return an error. Buffers that are already released 
+     * obtainBuffer will return an error. Buffers that are already released
      * will continue to be processed, unless/until flush() is called.
      */
     virtual void        stop() = 0;
@@ -59,9 +59,9 @@
      * While muted, the callback, if set, is still called.
      */
     virtual void        mute(bool) = 0;
-    
+
     /* Pause a track. If set, the callback will cease being called and
-     * obtainBuffer will return an error. Buffers that are already released 
+     * obtainBuffer will return an error. Buffers that are already released
      * will continue to be processed, unless/until flush() is called.
      */
     virtual void        pause() = 0;
diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h
index 1c1c268..6dbb2d7 100644
--- a/include/media/IMediaMetadataRetriever.h
+++ b/include/media/IMediaMetadataRetriever.h
@@ -56,4 +56,3 @@
 }; // namespace android
 
 #endif // ANDROID_IMEDIAMETADATARETRIEVER_H
-
diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h
index 39d58ab..00facc5 100644
--- a/include/media/IMediaPlayer.h
+++ b/include/media/IMediaPlayer.h
@@ -64,6 +64,7 @@
     virtual status_t        setParameter(int key, const Parcel& request) = 0;
     virtual status_t        getParameter(int key, Parcel* reply) = 0;
     virtual status_t        setRetransmitEndpoint(const struct sockaddr_in* endpoint) = 0;
+    virtual status_t        setNextPlayer(const sp<IMediaPlayer>& next) = 0;
 
     // Invoke a generic method on the player by using opaque parcels
     // for the request and reply.
diff --git a/include/media/IMediaPlayerClient.h b/include/media/IMediaPlayerClient.h
index daec1c7..8f1843e 100644
--- a/include/media/IMediaPlayerClient.h
+++ b/include/media/IMediaPlayerClient.h
@@ -45,4 +45,3 @@
 }; // namespace android
 
 #endif // ANDROID_IMEDIAPLAYERCLIENT_H
-
diff --git a/include/media/IMediaRecorderClient.h b/include/media/IMediaRecorderClient.h
index 0058ef2..e7d0229 100644
--- a/include/media/IMediaRecorderClient.h
+++ b/include/media/IMediaRecorderClient.h
@@ -45,4 +45,3 @@
 }; // namespace android
 
 #endif // ANDROID_IMEDIARECORDERCLIENT_H
-
diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h
index 491a950..9f6ff4c 100644
--- a/include/media/JetPlayer.h
+++ b/include/media/JetPlayer.h
@@ -40,13 +40,13 @@
     static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3;
     static const int JET_PAUSE_UPDATE            = 4;
 
-    JetPlayer(jobject javaJetPlayer, 
-            int maxTracks = 32, 
+    JetPlayer(jobject javaJetPlayer,
+            int maxTracks = 32,
             int trackBufferSize = 1200);
     ~JetPlayer();
     int init();
     int release();
-    
+
     int loadFromFile(const char* url);
     int loadFromFD(const int fd, const long long offset, const long long length);
     int closeFile();
@@ -60,7 +60,7 @@
     int clearQueue();
 
     void setEventCallback(jetevent_callback callback);
-    
+
     int getMaxTracks() { return mMaxTracks; };
 
 
@@ -88,7 +88,7 @@
     int                 mMaxTracks; // max number of MIDI tracks, usually 32
     EAS_DATA_HANDLE     mEasData;
     EAS_FILE_LOCATOR    mEasJetFileLoc;
-    EAS_PCM*            mAudioBuffer;// EAS renders the MIDI data into this buffer, 
+    EAS_PCM*            mAudioBuffer;// EAS renders the MIDI data into this buffer,
     AudioTrack*         mAudioTrack; // and we play it in this audio track
     int                 mTrackBufferSize;
     S_JET_STATUS        mJetStatus;
diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h
index 27b7e4d..ecc3b65 100644
--- a/include/media/MediaMetadataRetrieverInterface.h
+++ b/include/media/MediaMetadataRetrieverInterface.h
@@ -1,6 +1,6 @@
 /*
 **
-** Copyright (C) 2008 The Android Open Source Project 
+** Copyright (C) 2008 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.
@@ -56,4 +56,3 @@
 }; // namespace android
 
 #endif // ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H
-
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 8168dff..d4aa233 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -107,6 +107,7 @@
         virtual void        close() = 0;
 
         virtual status_t    setPlaybackRatePermille(int32_t rate) { return INVALID_OPERATION; }
+        virtual bool        needsTrailingPadding() { return true; }
     };
 
                         MediaPlayerBase() : mCookie(0), mNotify(0) {}
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
index 250f267..9fc962c 100644
--- a/include/media/MediaProfiles.h
+++ b/include/media/MediaProfiles.h
@@ -516,4 +516,3 @@
 }; // namespace android
 
 #endif // ANDROID_MEDIAPROFILES_H
-
diff --git a/include/media/MemoryLeakTrackUtil.h b/include/media/MemoryLeakTrackUtil.h
index ac0f6b2..d2618aa 100644
--- a/include/media/MemoryLeakTrackUtil.h
+++ b/include/media/MemoryLeakTrackUtil.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011, The Android Open Source Project
  *
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index 9cd5f9f..662dd13 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -96,6 +96,9 @@
 enum media_info_type {
     // 0xx
     MEDIA_INFO_UNKNOWN = 1,
+    // The player was started because it was used as the next player for another
+    // player, which just completed playback
+    MEDIA_INFO_STARTED_AS_NEXT = 2,
     // 7xx
     // The video is too complex for the decoder: it can't decode frames fast
     // enough. Possibly only the audio plays fine at this stage.
@@ -207,6 +210,7 @@
             status_t        setParameter(int key, const Parcel& request);
             status_t        getParameter(int key, Parcel* reply);
             status_t        setRetransmitEndpoint(const char* addrString, uint16_t port);
+            status_t        setNextMediaPlayer(const sp<MediaPlayer>& player);
 
 private:
             void            clear_l();
diff --git a/include/media/stagefright/HardwareAPI.h b/include/media/stagefright/HardwareAPI.h
deleted file mode 100644
index 17efd35..0000000
--- a/include/media/stagefright/HardwareAPI.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef HARDWARE_API_H_
-
-#define HARDWARE_API_H_
-
-#include <media/stagefright/OMXPluginBase.h>
-#include <system/window.h>
-#include <utils/RefBase.h>
-
-#include <OMX_Component.h>
-
-namespace android {
-
-// A pointer to this struct is passed to the OMX_SetParameter when the extension
-// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
-// is given.
-//
-// When Android native buffer use is disabled for a port (the default state),
-// the OMX node should operate as normal, and expect UseBuffer calls to set its
-// buffers.  This is the mode that will be used when CPU access to the buffer is
-// required.
-//
-// When Android native buffer use has been enabled for a given port, the video
-// color format for the port is to be interpreted as an Android pixel format
-// rather than an OMX color format.  The node should then expect to receive
-// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer
-// calls for that port.
-struct EnableAndroidNativeBuffersParams {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL enable;
-};
-
-// A pointer to this struct is passed to OMX_SetParameter() when the extension
-// index "OMX.google.android.index.storeMetaDataInBuffers"
-// is given.
-//
-// When meta data is stored in the video buffers passed between OMX clients
-// and OMX components, interpretation of the buffer data is up to the
-// buffer receiver, and the data may or may not be the actual video data, but
-// some information helpful for the receiver to locate the actual data.
-// The buffer receiver thus needs to know how to interpret what is stored
-// in these buffers, with mechanisms pre-determined externally. How to
-// interpret the meta data is outside of the scope of this method.
-//
-// Currently, this is specifically used to pass meta data from video source
-// (camera component, for instance) to video encoder to avoid memcpying of
-// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE.
-// If bStoreMetaData is set to false, real YUV frame data will be stored
-// in the buffers. In addition, if no OMX_SetParameter() call is made
-// with the corresponding extension index, real YUV data is stored
-// in the buffers.
-struct StoreMetaDataInBuffersParams {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bStoreMetaData;
-};
-
-// A pointer to this struct is passed to OMX_SetParameter when the extension
-// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is
-// given.  This call will only be performed if a prior call was made with the
-// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index,
-// enabling use of Android native buffers.
-struct UseAndroidNativeBufferParams {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_PTR pAppPrivate;
-    OMX_BUFFERHEADERTYPE **bufferHeader;
-    const sp<ANativeWindowBuffer>& nativeBuffer;
-};
-
-// A pointer to this struct is passed to OMX_GetParameter when the extension
-// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage'
-// extension is given.  The usage bits returned from this query will be used to
-// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer
-// command.
-struct GetAndroidNativeBufferUsageParams {
-    OMX_U32 nSize;              // IN
-    OMX_VERSIONTYPE nVersion;   // IN
-    OMX_U32 nPortIndex;         // IN
-    OMX_U32 nUsage;             // OUT
-};
-
-// An enum OMX_COLOR_FormatAndroidOpaque to indicate an opaque colorformat
-// is declared in media/stagefright/openmax/OMX_IVCommon.h
-// This will inform the encoder that the actual
-// colorformat will be relayed by the GRalloc Buffers.
-// OMX_COLOR_FormatAndroidOpaque  = 0x7F000001,
-
-
-}  // namespace android
-
-extern android::OMXPluginBase *createOMXPlugin();
-
-#endif  // HARDWARE_API_H_
diff --git a/include/media/stagefright/MetadataBufferType.h b/include/media/stagefright/MetadataBufferType.h
deleted file mode 100644
index 4eaf8ac..0000000
--- a/include/media/stagefright/MetadataBufferType.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef METADATA_BUFFER_TYPE_H
-#define METADATA_BUFFER_TYPE_H
-
-#ifdef __cplusplus
-extern "C" {
-namespace android {
-#endif
-
-/*
- * MetadataBufferType defines the type of the metadata buffers that
- * can be passed to video encoder component for encoding, via Stagefright
- * media recording framework. To see how to work with the metadata buffers
- * in media recording framework, please consult HardwareAPI.h
- *
- * The creator of metadata buffers and video encoder share common knowledge
- * on what is actually being stored in these metadata buffers, and
- * how the information can be used by the video encoder component
- * to locate the actual pixel data as the source input for video
- * encoder, plus whatever other information that is necessary. Stagefright
- * media recording framework does not need to know anything specific about the
- * metadata buffers, except for receving each individual metadata buffer
- * as the source input, making a copy of the metadata buffer, and passing the
- * copy via OpenMAX API to the video encoder component.
- *
- * The creator of the metadata buffers must ensure that the first
- * 4 bytes in every metadata buffer indicates its buffer type,
- * and the rest of the metadata buffer contains the
- * actual metadata information. When a video encoder component receives
- * a metadata buffer, it uses the first 4 bytes in that buffer to find
- * out the type of the metadata buffer, and takes action appropriate
- * to that type of metadata buffers (for instance, locate the actual
- * pixel data input and then encoding the input data to produce a
- * compressed output buffer).
- *
- * The following shows the layout of a metadata buffer,
- * where buffer type is a 4-byte field of MetadataBufferType,
- * and the payload is the metadata information.
- *
- * --------------------------------------------------------------
- * |  buffer type  |          payload                           |
- * --------------------------------------------------------------
- *
- */
-typedef enum {
-
-    /*
-     * kMetadataBufferTypeCameraSource is used to indicate that
-     * the source of the metadata buffer is the camera component.
-     */
-    kMetadataBufferTypeCameraSource  = 0,
-
-    /*
-     * kMetadataBufferTypeGrallocSource is used to indicate that
-     * the payload of the metadata buffers can be interpreted as
-     * a buffer_handle_t.
-     * So in this case,the metadata that the encoder receives
-     * will have a byte stream that consists of two parts:
-     * 1. First, there is an integer indicating that it is a GRAlloc
-     * source (kMetadataBufferTypeGrallocSource)
-     * 2. This is followed by the buffer_handle_t that is a handle to the
-     * GRalloc buffer. The encoder needs to interpret this GRalloc handle
-     * and encode the frames.
-     * --------------------------------------------------------------
-     * |  kMetadataBufferTypeGrallocSource | sizeof(buffer_handle_t) |
-     * --------------------------------------------------------------
-     */
-    kMetadataBufferTypeGrallocSource = 1,
-
-    // Add more here...
-
-} MetadataBufferType;
-
-#ifdef __cplusplus
-}  // namespace android
-}
-#endif
-
-#endif  // METADATA_BUFFER_TYPE_H
diff --git a/include/media/stagefright/OMXPluginBase.h b/include/media/stagefright/OMXPluginBase.h
deleted file mode 100644
index 2fd8e12..0000000
--- a/include/media/stagefright/OMXPluginBase.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OMX_PLUGIN_BASE_H_
-
-#define OMX_PLUGIN_BASE_H_
-
-#include <sys/types.h>
-
-#include <OMX_Component.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct OMXComponentBase;
-
-struct OMXPluginBase {
-    OMXPluginBase() {}
-    virtual ~OMXPluginBase() {}
-
-    virtual OMX_ERRORTYPE makeComponentInstance(
-            const char *name,
-            const OMX_CALLBACKTYPE *callbacks,
-            OMX_PTR appData,
-            OMX_COMPONENTTYPE **component) = 0;
-
-    virtual OMX_ERRORTYPE destroyComponentInstance(
-            OMX_COMPONENTTYPE *component) = 0;
-
-    virtual OMX_ERRORTYPE enumerateComponents(
-            OMX_STRING name,
-            size_t size,
-            OMX_U32 index) = 0;
-
-    virtual OMX_ERRORTYPE getRolesOfComponent(
-            const char *name,
-            Vector<String8> *roles) = 0;
-
-private:
-    OMXPluginBase(const OMXPluginBase &);
-    OMXPluginBase &operator=(const OMXPluginBase &);
-};
-
-}  // namespace android
-
-#endif  // OMX_PLUGIN_BASE_H_
diff --git a/include/media/stagefright/openmax/OMX_Audio.h b/include/media/stagefright/openmax/OMX_Audio.h
deleted file mode 100644
index 3482841..0000000
--- a/include/media/stagefright/openmax/OMX_Audio.h
+++ /dev/null
@@ -1,1328 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** @file OMX_Audio.h - OpenMax IL version 1.1.2
- *  The structures needed by Audio components to exchange
- *  parameters and configuration data with the componenmilts.
- */
-
-#ifndef OMX_Audio_h
-#define OMX_Audio_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- *  header to compile without errors.  The includes below are required
- *  for this header file to compile successfully 
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup midi MIDI
- * @ingroup audio
- */
- 
-/** @defgroup effects Audio effects
- * @ingroup audio
- */
-
-/** @defgroup audio OpenMAX IL Audio Domain
- * Structures for OpenMAX IL Audio domain
- * @{
- */
-
-/** Enumeration used to define the possible audio codings.  
- *  If "OMX_AUDIO_CodingUnused" is selected, the coding selection must 
- *  be done in a vendor specific way.  Since this is for an audio 
- *  processing element this enum is relevant.  However, for another 
- *  type of component other enums would be in this area.
- */
-typedef enum OMX_AUDIO_CODINGTYPE {
-    OMX_AUDIO_CodingUnused = 0,  /**< Placeholder value when coding is N/A  */
-    OMX_AUDIO_CodingAutoDetect,  /**< auto detection of audio format */
-    OMX_AUDIO_CodingPCM,         /**< Any variant of PCM coding */
-    OMX_AUDIO_CodingADPCM,       /**< Any variant of ADPCM encoded data */
-    OMX_AUDIO_CodingAMR,         /**< Any variant of AMR encoded data */
-    OMX_AUDIO_CodingGSMFR,       /**< Any variant of GSM fullrate (i.e. GSM610) */
-    OMX_AUDIO_CodingGSMEFR,      /**< Any variant of GSM Enhanced Fullrate encoded data*/
-    OMX_AUDIO_CodingGSMHR,       /**< Any variant of GSM Halfrate encoded data */
-    OMX_AUDIO_CodingPDCFR,       /**< Any variant of PDC Fullrate encoded data */
-    OMX_AUDIO_CodingPDCEFR,      /**< Any variant of PDC Enhanced Fullrate encoded data */
-    OMX_AUDIO_CodingPDCHR,       /**< Any variant of PDC Halfrate encoded data */
-    OMX_AUDIO_CodingTDMAFR,      /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */
-    OMX_AUDIO_CodingTDMAEFR,     /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */
-    OMX_AUDIO_CodingQCELP8,      /**< Any variant of QCELP 8kbps encoded data */
-    OMX_AUDIO_CodingQCELP13,     /**< Any variant of QCELP 13kbps encoded data */
-    OMX_AUDIO_CodingEVRC,        /**< Any variant of EVRC encoded data */
-    OMX_AUDIO_CodingSMV,         /**< Any variant of SMV encoded data */
-    OMX_AUDIO_CodingG711,        /**< Any variant of G.711 encoded data */
-    OMX_AUDIO_CodingG723,        /**< Any variant of G.723 dot 1 encoded data */
-    OMX_AUDIO_CodingG726,        /**< Any variant of G.726 encoded data */
-    OMX_AUDIO_CodingG729,        /**< Any variant of G.729 encoded data */
-    OMX_AUDIO_CodingAAC,         /**< Any variant of AAC encoded data */
-    OMX_AUDIO_CodingMP3,         /**< Any variant of MP3 encoded data */
-    OMX_AUDIO_CodingSBC,         /**< Any variant of SBC encoded data */
-    OMX_AUDIO_CodingVORBIS,      /**< Any variant of VORBIS encoded data */
-    OMX_AUDIO_CodingWMA,         /**< Any variant of WMA encoded data */
-    OMX_AUDIO_CodingRA,          /**< Any variant of RA encoded data */
-    OMX_AUDIO_CodingMIDI,        /**< Any variant of MIDI encoded data */
-    OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_CodingMax = 0x7FFFFFFF
-} OMX_AUDIO_CODINGTYPE;
-
-
-/** The PortDefinition structure is used to define all of the parameters 
- *  necessary for the compliant component to setup an input or an output audio 
- *  path.  If additional information is needed to define the parameters of the
- *  port (such as frequency), additional structures must be sent such as the
- *  OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port.
- */
-typedef struct OMX_AUDIO_PORTDEFINITIONTYPE {
-    OMX_STRING cMIMEType;            /**< MIME type of data for the port */
-    OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference
-                                               for an output device, 
-                                               otherwise this field is 0 */
-    OMX_BOOL bFlagErrorConcealment;  /**< Turns on error concealment if it is 
-                                          supported by the OMX component */
-    OMX_AUDIO_CODINGTYPE eEncoding;  /**< Type of data expected for this 
-                                          port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PORTDEFINITIONTYPE;
-
-
-/**  Port format parameter.  This structure is used to enumerate
-  *  the various data input/output format supported by the port.
-  */
-typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE {
-    OMX_U32 nSize;                  /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
-    OMX_U32 nPortIndex;             /**< Indicates which port to set */
-    OMX_U32 nIndex;                 /**< Indicates the enumeration index for the format from 0x0 to N-1 */
-    OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PARAM_PORTFORMATTYPE;
-
-
-/** PCM mode type  */ 
-typedef enum OMX_AUDIO_PCMMODETYPE { 
-    OMX_AUDIO_PCMModeLinear = 0,  /**< Linear PCM encoded data */ 
-    OMX_AUDIO_PCMModeALaw,        /**< A law PCM encoded data (G.711) */ 
-    OMX_AUDIO_PCMModeMULaw,       /**< Mu law PCM encoded data (G.711)  */ 
-    OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_PCMModeMax = 0x7FFFFFFF 
-} OMX_AUDIO_PCMMODETYPE; 
-
-
-typedef enum OMX_AUDIO_CHANNELTYPE {
-    OMX_AUDIO_ChannelNone = 0x0,    /**< Unused or empty */
-    OMX_AUDIO_ChannelLF   = 0x1,    /**< Left front */
-    OMX_AUDIO_ChannelRF   = 0x2,    /**< Right front */
-    OMX_AUDIO_ChannelCF   = 0x3,    /**< Center front */
-    OMX_AUDIO_ChannelLS   = 0x4,    /**< Left surround */
-    OMX_AUDIO_ChannelRS   = 0x5,    /**< Right surround */
-    OMX_AUDIO_ChannelLFE  = 0x6,    /**< Low frequency effects */
-    OMX_AUDIO_ChannelCS   = 0x7,    /**< Back surround */
-    OMX_AUDIO_ChannelLR   = 0x8,    /**< Left rear. */
-    OMX_AUDIO_ChannelRR   = 0x9,    /**< Right rear. */
-    OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_ChannelMax  = 0x7FFFFFFF 
-} OMX_AUDIO_CHANNELTYPE;
-
-#define OMX_AUDIO_MAXCHANNELS 16  /**< maximum number distinct audio channels that a buffer may contain */
-#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */
-
-/** PCM format description */ 
-typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { 
-    OMX_U32 nSize;                    /**< Size of this structure, in Bytes */ 
-    OMX_VERSIONTYPE nVersion;         /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;               /**< port that this structure applies to */ 
-    OMX_U32 nChannels;                /**< Number of channels (e.g. 2 for stereo) */ 
-    OMX_NUMERICALDATATYPE eNumData;   /**< indicates PCM data as signed or unsigned */ 
-    OMX_ENDIANTYPE eEndian;           /**< indicates PCM data as little or big endian */ 
-    OMX_BOOL bInterleaved;            /**< True for normal interleaved data; false for 
-                                           non-interleaved data (e.g. block data) */ 
-    OMX_U32 nBitPerSample;            /**< Bit per sample */ 
-    OMX_U32 nSamplingRate;            /**< Sampling rate of the source data.  Use 0 for 
-                                           variable or unknown sampling rate. */ 
-    OMX_AUDIO_PCMMODETYPE ePCMMode;   /**< PCM mode enumeration */ 
-    OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */
-
-} OMX_AUDIO_PARAM_PCMMODETYPE; 
-
-
-/** Audio channel mode.  This is used by both AAC and MP3, although the names are more appropriate
- * for the MP3.  For example, JointStereo for MP3 is CouplingChannels for AAC. 
- */
-typedef enum OMX_AUDIO_CHANNELMODETYPE {
-    OMX_AUDIO_ChannelModeStereo = 0,  /**< 2 channels, the bitrate allocation between those 
-                                          two channels changes accordingly to each channel information */
-    OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between 
-                                           2 channels for higher compression gain */
-    OMX_AUDIO_ChannelModeDual,        /**< 2 mono-channels, each channel is encoded with half 
-                                           the bitrate of the overall bitrate */
-    OMX_AUDIO_ChannelModeMono,        /**< Mono channel mode */
-    OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF
-} OMX_AUDIO_CHANNELMODETYPE;
-
-
-typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE {
-    OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */
-    OMX_AUDIO_MP3StreamFormatMP2Layer3,     /**< MP3 Audio MPEG 2 Layer 3 Stream format */
-    OMX_AUDIO_MP3StreamFormatMP2_5Layer3,   /**< MP3 Audio MPEG2.5 Layer 3 Stream format */
-    OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MP3STREAMFORMATTYPE;
-
-/** MP3 params */
-typedef struct OMX_AUDIO_PARAM_MP3TYPE {
-    OMX_U32 nSize;                 /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
-    OMX_U32 nPortIndex;            /**< port that this structure applies to */
-    OMX_U32 nChannels;             /**< Number of channels */
-    OMX_U32 nBitRate;              /**< Bit rate of the input data.  Use 0 for variable
-                                        rate or unknown bit rates */
-    OMX_U32 nSampleRate;           /**< Sampling rate of the source data.  Use 0 for
-                                        variable or unknown sampling rate. */
-    OMX_U32 nAudioBandWidth;       /**< Audio band width (in Hz) to which an encoder should
-                                        limit the audio signal. Use 0 to let encoder decide */
-    OMX_AUDIO_CHANNELMODETYPE eChannelMode;   /**< Channel mode enumeration */
-    OMX_AUDIO_MP3STREAMFORMATTYPE eFormat;  /**< MP3 stream format */
-} OMX_AUDIO_PARAM_MP3TYPE;
-
-
-typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE {
-    OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */
-    OMX_AUDIO_AACStreamFormatMP4ADTS,     /**< AAC Audio Data Transport Stream 4 format */
-    OMX_AUDIO_AACStreamFormatMP4LOAS,     /**< AAC Low Overhead Audio Stream format */
-    OMX_AUDIO_AACStreamFormatMP4LATM,     /**< AAC Low overhead Audio Transport Multiplex */
-    OMX_AUDIO_AACStreamFormatADIF,        /**< AAC Audio Data Interchange Format */
-    OMX_AUDIO_AACStreamFormatMP4FF,       /**< AAC inside MPEG-4/ISO File Format */
-    OMX_AUDIO_AACStreamFormatRAW,         /**< AAC Raw Format */
-    OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_AACSTREAMFORMATTYPE;
-
-
-/** AAC mode type.  Note that the term profile is used with the MPEG-2
- * standard and the term object type and profile is used with MPEG-4 */
-typedef enum OMX_AUDIO_AACPROFILETYPE{
-  OMX_AUDIO_AACObjectNull = 0,      /**< Null, not used */
-  OMX_AUDIO_AACObjectMain = 1,      /**< AAC Main object */
-  OMX_AUDIO_AACObjectLC,            /**< AAC Low Complexity object (AAC profile) */
-  OMX_AUDIO_AACObjectSSR,           /**< AAC Scalable Sample Rate object */
-  OMX_AUDIO_AACObjectLTP,           /**< AAC Long Term Prediction object */
-  OMX_AUDIO_AACObjectHE,            /**< AAC High Efficiency (object type SBR, HE-AAC profile) */
-  OMX_AUDIO_AACObjectScalable,      /**< AAC Scalable object */
-  OMX_AUDIO_AACObjectERLC = 17,     /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */
-  OMX_AUDIO_AACObjectLD = 23,       /**< AAC Low Delay object (Error Resilient) */
-  OMX_AUDIO_AACObjectHE_PS = 29,    /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */
-  OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_AUDIO_AACObjectMax = 0x7FFFFFFF
-} OMX_AUDIO_AACPROFILETYPE;
-
-
-/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for encoder configuration and optional as decoder info output.
- * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */
-#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */
-#define OMX_AUDIO_AACToolMS   0x00000001 /**< MS: Mid/side joint coding tool allowed or active */
-#define OMX_AUDIO_AACToolIS   0x00000002 /**< IS: Intensity stereo tool allowed or active */
-#define OMX_AUDIO_AACToolTNS  0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */
-#define OMX_AUDIO_AACToolPNS  0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */
-#define OMX_AUDIO_AACToolLTP  0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */
-#define OMX_AUDIO_AACToolAll  0x7FFFFFFF /**< all AAC tools allowed or active (*/
-
-/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for ER encoder configuration and optional as decoder info output */
-#define OMX_AUDIO_AACERNone  0x00000000  /**< no AAC ER tools allowed/used */
-#define OMX_AUDIO_AACERVCB11 0x00000001  /**< VCB11: Virtual Code Books for AAC section data */
-#define OMX_AUDIO_AACERRVLC  0x00000002  /**< RVLC: Reversible Variable Length Coding */
-#define OMX_AUDIO_AACERHCR   0x00000004  /**< HCR: Huffman Codeword Reordering */
-#define OMX_AUDIO_AACERAll   0x7FFFFFFF  /**< all AAC ER tools allowed/used */
-
-
-/** AAC params */
-typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE {
-    OMX_U32 nSize;                 /**< Size of this structure, in Bytes */
-    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
-    OMX_U32 nPortIndex;            /**< Port that this structure applies to */
-    OMX_U32 nChannels;             /**< Number of channels */
-    OMX_U32 nSampleRate;           /**< Sampling rate of the source data.  Use 0 for
-                                        variable or unknown sampling rate. */
-    OMX_U32 nBitRate;              /**< Bit rate of the input data.  Use 0 for variable
-                                        rate or unknown bit rates */
-    OMX_U32 nAudioBandWidth;       /**< Audio band width (in Hz) to which an encoder should
-                                        limit the audio signal. Use 0 to let encoder decide */
-    OMX_U32 nFrameLength;          /**< Frame length (in audio samples per channel) of the codec.
-                                        Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD).
-                                        Use 0 to let encoder decide */
-    OMX_U32 nAACtools;             /**< AAC tool usage */
-    OMX_U32 nAACERtools;           /**< MPEG-4 AAC error resilience tool usage */
-    OMX_AUDIO_AACPROFILETYPE eAACProfile;   /**< AAC profile enumeration */
-    OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */
-    OMX_AUDIO_CHANNELMODETYPE eChannelMode;   /**< Channel mode enumeration */
-} OMX_AUDIO_PARAM_AACPROFILETYPE;
-
-
-/** VORBIS params */
-typedef struct OMX_AUDIO_PARAM_VORBISTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_U32 nChannels;        /**< Number of channels */
-    OMX_U32 nBitRate;         /**< Bit rate of the encoded data data.  Use 0 for variable
-                                   rate or unknown bit rates. Encoding is set to the
-                                   bitrate closest to specified  value (in bps) */
-    OMX_U32 nMinBitRate;      /**< Sets minimum bitrate (in bps). */
-    OMX_U32 nMaxBitRate;      /**< Sets maximum bitrate (in bps). */
-
-    OMX_U32 nSampleRate;      /**< Sampling rate of the source data.  Use 0 for
-                                   variable or unknown sampling rate. */
-    OMX_U32 nAudioBandWidth;  /**< Audio band width (in Hz) to which an encoder should
-                                   limit the audio signal. Use 0 to let encoder decide */
-    OMX_S32 nQuality;		  /**< Sets encoding quality to n, between -1 (low) and 10 (high).
-                                   In the default mode of operation, teh quality level is 3.
-                                   Normal quality range is 0 - 10. */
-    OMX_BOOL bManaged;		  /**< Set  bitrate  management  mode. This turns off the
-                                   normal VBR encoding, but allows hard or soft bitrate
-                                   constraints to be enforced by the encoder. This mode can
-                                   be slower, and may also be lower quality. It is
-                                   primarily useful for streaming. */
-    OMX_BOOL bDownmix;		  /**< Downmix input from stereo to mono (has no effect on 
-                                   non-stereo streams). Useful for lower-bitrate encoding. */     
-} OMX_AUDIO_PARAM_VORBISTYPE;
-
-
-/** WMA Version */
-typedef enum OMX_AUDIO_WMAFORMATTYPE {
-  OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */
-  OMX_AUDIO_WMAFormat7,          /**< Windows Media Audio format 7 */
-  OMX_AUDIO_WMAFormat8,          /**< Windows Media Audio format 8 */
-  OMX_AUDIO_WMAFormat9,          /**< Windows Media Audio format 9 */
-  OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAFORMATTYPE;
-
-
-/** WMA Profile */
-typedef enum OMX_AUDIO_WMAPROFILETYPE {
-  OMX_AUDIO_WMAProfileUnused = 0,  /**< profile unused or unknown */
-  OMX_AUDIO_WMAProfileL1,          /**< Windows Media audio version 9 profile L1 */
-  OMX_AUDIO_WMAProfileL2,          /**< Windows Media audio version 9 profile L2 */
-  OMX_AUDIO_WMAProfileL3,          /**< Windows Media audio version 9 profile L3 */
-  OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAPROFILETYPE;
-
-
-/** WMA params */
-typedef struct OMX_AUDIO_PARAM_WMATYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_U16 nChannels;        /**< Number of channels */
-    OMX_U32 nBitRate;         /**< Bit rate of the input data.  Use 0 for variable
-                                   rate or unknown bit rates */
-    OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */
-	OMX_AUDIO_WMAPROFILETYPE eProfile;  /**< Profile of WMA stream / data */
-    OMX_U32 nSamplingRate;    /**< Sampling rate of the source data */
-    OMX_U16 nBlockAlign;      /**< is the block alignment, or block size, in bytes of the audio codec */
-    OMX_U16 nEncodeOptions;   /**< WMA Type-specific data */
-    OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */
-} OMX_AUDIO_PARAM_WMATYPE;
-
-/** 
- * RealAudio format
- */
-typedef enum OMX_AUDIO_RAFORMATTYPE {
-    OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */
-    OMX_AUDIO_RA8,                /**< RealAudio 8 codec */
-    OMX_AUDIO_RA9,                /**< RealAudio 9 codec */
-    OMX_AUDIO_RA10_AAC,           /**< MPEG-4 AAC codec for bitrates of more than 128kbps */
-    OMX_AUDIO_RA10_CODEC,         /**< RealAudio codec for bitrates less than 128 kbps */
-    OMX_AUDIO_RA10_LOSSLESS,      /**< RealAudio Lossless */
-    OMX_AUDIO_RA10_MULTICHANNEL,  /**< RealAudio Multichannel */
-    OMX_AUDIO_RA10_VOICE,         /**< RealAudio Voice for bitrates below 15 kbps */
-    OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_RAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_RAFORMATTYPE;
-
-/** RA (Real Audio) params */ 
-typedef struct OMX_AUDIO_PARAM_RATYPE { 
-    OMX_U32 nSize;              /**< Size of this structure, in Bytes */ 
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;         /**< Port that this structure applies to */ 
-    OMX_U32 nChannels;          /**< Number of channels */ 
-    OMX_U32 nSamplingRate;      /**< is the sampling rate of the source data */ 
-    OMX_U32 nBitsPerFrame;      /**< is the value for bits per frame  */ 
-    OMX_U32 nSamplePerFrame;    /**< is the value for samples per frame */ 
-    OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ 
-    OMX_U32 nCouplingStartRegion;   /**< is the coupling start region in the stream  */ 
-    OMX_U32 nNumRegions;        /**< is the number of regions value */ 
-    OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */
-} OMX_AUDIO_PARAM_RATYPE; 
-
-
-/** SBC Allocation Method Type */
-typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE {
-  OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */
-  OMX_AUDIO_SBCAllocMethodSNR,      /**< SNR allocation method */
-  OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF
-} OMX_AUDIO_SBCALLOCMETHODTYPE;
-
-
-/** SBC params */
-typedef struct OMX_AUDIO_PARAM_SBCTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_U32 nChannels;         /**< Number of channels */
-    OMX_U32 nBitRate;          /**< Bit rate of the input data.  Use 0 for variable
-                                    rate or unknown bit rates */
-    OMX_U32 nSampleRate;       /**< Sampling rate of the source data.  Use 0 for
-                                    variable or unknown sampling rate. */
-    OMX_U32 nBlocks;           /**< Number of blocks */
-    OMX_U32 nSubbands;         /**< Number of subbands */
-    OMX_U32 nBitPool;          /**< Bitpool value */
-    OMX_BOOL bEnableBitrate;   /**< Use bitrate value instead of bitpool */
-    OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
-    OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType;   /**< SBC Allocation method type */
-} OMX_AUDIO_PARAM_SBCTYPE;
-
-
-/** ADPCM stream format parameters */ 
-typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { 
-    OMX_U32 nSize;              /**< size of the structure in bytes */ 
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;         /**< port that this structure applies to */ 
-    OMX_U32 nChannels;          /**< Number of channels in the data stream (not 
-                                     necessarily the same as the number of channels 
-                                     to be rendered. */ 
-    OMX_U32 nBitsPerSample;     /**< Number of bits in each sample */ 
-    OMX_U32 nSampleRate;        /**< Sampling rate of the source data.  Use 0 for 
-                                    variable or unknown sampling rate. */ 
-} OMX_AUDIO_PARAM_ADPCMTYPE; 
-
-
-/** G723 rate */
-typedef enum OMX_AUDIO_G723RATE {
-    OMX_AUDIO_G723ModeUnused = 0,  /**< AMRNB Mode unused / unknown */
-    OMX_AUDIO_G723ModeLow,         /**< 5300 bps */
-    OMX_AUDIO_G723ModeHigh,        /**< 6300 bps */
-    OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_G723ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G723RATE;
-
-
-/** G723 - Sample rate must be 8 KHz */
-typedef struct OMX_AUDIO_PARAM_G723TYPE { 
-    OMX_U32 nSize;                /**< size of the structure in bytes */ 
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */ 
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not 
-                                       necessarily the same as the number of channels 
-                                       to be rendered. */ 
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */ 
-    OMX_AUDIO_G723RATE eBitRate;  /**< todo: Should this be moved to a config? */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */ 
-    OMX_BOOL bPostFilter;         /**< Enable Post Filter */ 
-} OMX_AUDIO_PARAM_G723TYPE; 
-
-
-/** ITU G726 (ADPCM) rate */
-typedef enum OMX_AUDIO_G726MODE {
-    OMX_AUDIO_G726ModeUnused = 0,  /**< G726 Mode unused / unknown */
-    OMX_AUDIO_G726Mode16,          /**< 16 kbps */
-    OMX_AUDIO_G726Mode24,          /**< 24 kbps */
-    OMX_AUDIO_G726Mode32,          /**< 32 kbps, most common rate, also G721 */
-    OMX_AUDIO_G726Mode40,          /**< 40 kbps */
-    OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_G726ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G726MODE;
-
-
-/** G.726 stream format parameters - must be at 8KHz */ 
-typedef struct OMX_AUDIO_PARAM_G726TYPE { 
-    OMX_U32 nSize;              /**< size of the structure in bytes */ 
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;         /**< port that this structure applies to */ 
-    OMX_U32 nChannels;          /**< Number of channels in the data stream (not 
-                                     necessarily the same as the number of channels 
-                                     to be rendered. */ 
-     OMX_AUDIO_G726MODE eG726Mode;
-} OMX_AUDIO_PARAM_G726TYPE; 
-
-
-/** G729 coder type */
-typedef enum OMX_AUDIO_G729TYPE {
-    OMX_AUDIO_G729 = 0,           /**< ITU G.729  encoded data */
-    OMX_AUDIO_G729A,              /**< ITU G.729 annex A  encoded data */
-    OMX_AUDIO_G729B,              /**< ITU G.729 with annex B encoded data */
-    OMX_AUDIO_G729AB,             /**< ITU G.729 annexes A and B encoded data */
-    OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_G729Max = 0x7FFFFFFF
-} OMX_AUDIO_G729TYPE;
-
-
-/** G729 stream format parameters - fixed 6KHz sample rate */
-typedef struct OMX_AUDIO_PARAM_G729TYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_U32 nChannels;        /**< Number of channels in the data stream (not
-                                   necessarily the same as the number of channels
-                                   to be rendered. */
-    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
-    OMX_AUDIO_G729TYPE eBitType;
-} OMX_AUDIO_PARAM_G729TYPE;
-
-
-/** AMR Frame format */ 
-typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { 
-    OMX_AUDIO_AMRFrameFormatConformance = 0,  /**< Frame Format is AMR Conformance 
-                                                   (Standard) Format */ 
-    OMX_AUDIO_AMRFrameFormatIF1,              /**< Frame Format is AMR Interface 
-                                                   Format 1 */ 
-    OMX_AUDIO_AMRFrameFormatIF2,              /**< Frame Format is AMR Interface 
-                                                   Format 2*/ 
-    OMX_AUDIO_AMRFrameFormatFSF,              /**< Frame Format is AMR File Storage 
-                                                   Format */ 
-    OMX_AUDIO_AMRFrameFormatRTPPayload,       /**< Frame Format is AMR Real-Time 
-                                                   Transport Protocol Payload Format */ 
-    OMX_AUDIO_AMRFrameFormatITU,              /**< Frame Format is ITU Format (added at Motorola request) */ 
-    OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF 
-} OMX_AUDIO_AMRFRAMEFORMATTYPE; 
-
-
-/** AMR band mode */
-typedef enum OMX_AUDIO_AMRBANDMODETYPE {
-    OMX_AUDIO_AMRBandModeUnused = 0,          /**< AMRNB Mode unused / unknown */
-    OMX_AUDIO_AMRBandModeNB0,                 /**< AMRNB Mode 0 =  4750 bps */
-    OMX_AUDIO_AMRBandModeNB1,                 /**< AMRNB Mode 1 =  5150 bps */
-    OMX_AUDIO_AMRBandModeNB2,                 /**< AMRNB Mode 2 =  5900 bps */ 
-    OMX_AUDIO_AMRBandModeNB3,                 /**< AMRNB Mode 3 =  6700 bps */
-    OMX_AUDIO_AMRBandModeNB4,                 /**< AMRNB Mode 4 =  7400 bps */
-    OMX_AUDIO_AMRBandModeNB5,                 /**< AMRNB Mode 5 =  7950 bps */
-    OMX_AUDIO_AMRBandModeNB6,                 /**< AMRNB Mode 6 = 10200 bps */
-    OMX_AUDIO_AMRBandModeNB7,                 /**< AMRNB Mode 7 = 12200 bps */
-    OMX_AUDIO_AMRBandModeWB0,                 /**< AMRWB Mode 0 =  6600 bps */
-    OMX_AUDIO_AMRBandModeWB1,                 /**< AMRWB Mode 1 =  8850 bps */
-    OMX_AUDIO_AMRBandModeWB2,                 /**< AMRWB Mode 2 = 12650 bps */ 
-    OMX_AUDIO_AMRBandModeWB3,                 /**< AMRWB Mode 3 = 14250 bps */ 
-    OMX_AUDIO_AMRBandModeWB4,                 /**< AMRWB Mode 4 = 15850 bps */
-    OMX_AUDIO_AMRBandModeWB5,                 /**< AMRWB Mode 5 = 18250 bps */
-    OMX_AUDIO_AMRBandModeWB6,                 /**< AMRWB Mode 6 = 19850 bps */
-    OMX_AUDIO_AMRBandModeWB7,                 /**< AMRWB Mode 7 = 23050 bps */
-    OMX_AUDIO_AMRBandModeWB8,                 /**< AMRWB Mode 8 = 23850 bps */      
-    OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRBANDMODETYPE;
-     
-
-/** AMR Discontinuous Transmission mode */ 
-typedef enum OMX_AUDIO_AMRDTXMODETYPE { 
-    OMX_AUDIO_AMRDTXModeOff = 0,        /**< AMR Discontinuous Transmission Mode is disabled */ 
-    OMX_AUDIO_AMRDTXModeOnVAD1,         /**< AMR Discontinuous Transmission Mode using 
-                                             Voice Activity Detector 1 (VAD1) is enabled */ 
-    OMX_AUDIO_AMRDTXModeOnVAD2,         /**< AMR Discontinuous Transmission Mode using 
-                                             Voice Activity Detector 2 (VAD2) is enabled */       
-    OMX_AUDIO_AMRDTXModeOnAuto,         /**< The codec will automatically select between 
-                                             Off, VAD1 or VAD2 modes */ 
-
-    OMX_AUDIO_AMRDTXasEFR,             /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */
-
-    OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF 
-} OMX_AUDIO_AMRDTXMODETYPE; 
- 
-
-/** AMR params */
-typedef struct OMX_AUDIO_PARAM_AMRTYPE {
-    OMX_U32 nSize;                          /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;               /**< OMX specification version information */
-    OMX_U32 nPortIndex;                     /**< port that this structure applies to */
-    OMX_U32 nChannels;                      /**< Number of channels */
-    OMX_U32 nBitRate;                       /**< Bit rate read only field */
-    OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ 
-    OMX_AUDIO_AMRDTXMODETYPE  eAMRDTXMode;  /**< AMR DTX Mode enumeration */
-    OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */
-} OMX_AUDIO_PARAM_AMRTYPE;
-
-
-/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMFRTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMFRTYPE;
-
-
-/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMHRTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMHRTYPE;
-
-
-/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMEFRTYPE;
-
-
-/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAFRTYPE;
-
-
-/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAEFRTYPE;
-
-
-/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCFRTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCFRTYPE;
-
-
-/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCEFRTYPE;
-
-/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCHRTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
-    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCHRTYPE;
-
-
-/** CDMA Rate types */
-typedef enum OMX_AUDIO_CDMARATETYPE {
-    OMX_AUDIO_CDMARateBlank = 0,          /**< CDMA encoded frame is blank */
-    OMX_AUDIO_CDMARateFull,               /**< CDMA encoded frame in full rate */
-    OMX_AUDIO_CDMARateHalf,               /**< CDMA encoded frame in half rate */
-    OMX_AUDIO_CDMARateQuarter,            /**< CDMA encoded frame in quarter rate */
-    OMX_AUDIO_CDMARateEighth,             /**< CDMA encoded frame in eighth rate (DTX)*/
-    OMX_AUDIO_CDMARateErasure,            /**< CDMA erasure frame */
-    OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_CDMARateMax = 0x7FFFFFFF
-} OMX_AUDIO_CDMARATETYPE;
-
-
-/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP8TYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_U32 nBitRate;             /**< Bit rate of the input data.  Use 0 for variable
-                                       rate or unknown bit rates */
-    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
-    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
-    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP8TYPE;
-
-
-/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP13TYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
-    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
-    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP13TYPE;
-
-
-/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_EVRCTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */
-    OMX_BOOL bRATE_REDUCon;       /**< RATE_REDUCtion is requested for this frame */
-    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
-    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-    OMX_BOOL bHiPassFilter;       /**< Enable encoder's High Pass Filter */
-    OMX_BOOL bNoiseSuppressor;    /**< Enable encoder's noise suppressor pre-processing */
-    OMX_BOOL bPostFilter;         /**< Enable decoder's post Filter */
-} OMX_AUDIO_PARAM_EVRCTYPE;
-
-
-/** SMV ( up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_SMVTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
-                                       necessarily the same as the number of channels
-                                       to be rendered. */
-    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
-    OMX_BOOL bRATE_REDUCon;           /**< RATE_REDUCtion is requested for this frame */
-    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/
-    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/
-    OMX_BOOL bHiPassFilter;       /**< Enable encoder's High Pass Filter ??*/
-    OMX_BOOL bNoiseSuppressor;    /**< Enable encoder's noise suppressor pre-processing */
-    OMX_BOOL bPostFilter;         /**< Enable decoder's post Filter ??*/
-} OMX_AUDIO_PARAM_SMVTYPE;
-
-
-/** MIDI Format 
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIFORMATTYPE
-{
-    OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */
-    OMX_AUDIO_MIDIFormatSMF0,        /**< Standard MIDI File Type 0 */
-    OMX_AUDIO_MIDIFormatSMF1,        /**< Standard MIDI File Type 1 */
-    OMX_AUDIO_MIDIFormatSMF2,        /**< Standard MIDI File Type 2 */
-    OMX_AUDIO_MIDIFormatSPMIDI,      /**< SP-MIDI */
-    OMX_AUDIO_MIDIFormatXMF0,        /**< eXtensible Music Format type 0 */
-    OMX_AUDIO_MIDIFormatXMF1,        /**< eXtensible Music Format type 1 */
-    OMX_AUDIO_MIDIFormatMobileXMF,   /**< Mobile XMF (eXtensible Music Format type 2) */
-    OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIFORMATTYPE;
-
-
-/** MIDI params 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDITYPE {
-    OMX_U32 nSize;                 /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
-    OMX_U32 nPortIndex;            /**< port that this structure applies to */
-    OMX_U32 nFileSize;             /**< size of the MIDI file in bytes, where the entire 
-                                        MIDI file passed in, otherwise if 0x0, the MIDI data 
-                                        is merged and streamed (instead of passed as an 
-                                        entire MIDI file) */
-    OMX_BU32 sMaxPolyphony;        /**< Specifies the maximum simultaneous polyphonic 
-                                        voices. A value of zero indicates that the default 
-                                        polyphony of the device is used  */                                    
-    OMX_BOOL bLoadDefaultSound;    /**< Whether to load default sound 
-                                        bank at initialization */
-    OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */                                                                           
-} OMX_AUDIO_PARAM_MIDITYPE;
-
-
-/** Type of the MIDI sound bank 
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE {
-    OMX_AUDIO_MIDISoundBankUnused = 0,           /**< unused/unknown soundbank type */
-    OMX_AUDIO_MIDISoundBankDLS1,                 /**< DLS version 1 */
-    OMX_AUDIO_MIDISoundBankDLS2,                 /**< DLS version 2 */
-    OMX_AUDIO_MIDISoundBankMobileDLSBase,        /**< Mobile DLS, using the base functionality */
-    OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */
-    OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKTYPE;
-
-
-/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank 
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE {
-   OMX_AUDIO_MIDISoundBankLayoutUnused = 0,   /**< unused/unknown soundbank type */
-   OMX_AUDIO_MIDISoundBankLayoutGM,           /**< GS layout (based on bank MSB 0x00) */
-   OMX_AUDIO_MIDISoundBankLayoutGM2,          /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */
-   OMX_AUDIO_MIDISoundBankLayoutUser,         /**< Does not conform to any bank numbering standards */
-   OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-   OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-   OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE;
-
-
-/** MIDI params to load/unload user soundbank 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */
-    OMX_U32 nDLSIndex;        /**< DLS file index to be loaded */
-    OMX_U32 nDLSSize;         /**< Size in bytes */
-    OMX_PTR pDLSData;         /**< Pointer to DLS file data */
-    OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank;   /**< Midi sound bank type enumeration */
-    OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */
-} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE;
-
-
-/** Structure for Live MIDI events and MIP messages. 
- * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
-    OMX_U32 nMidiEventSize;   /**< Size of immediate MIDI events or MIP message in bytes  */
-    OMX_U8 nMidiEvents[1];    /**< MIDI event array to be rendered immediately, or an
-                                   array for the MIP message buffer, where the size is 
-                                   indicated by nMidiEventSize */
-} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE;
-
-
-/** MIDI sound bank/ program pair in a given channel 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< Port that this structure applies to */
-    OMX_U32 nChannel;           /**< Valid channel values range from 1 to 16 */
-    OMX_U16 nIDProgram;         /**< Valid program ID range is 1 to 128 */
-    OMX_U16 nIDSoundBank;       /**< Sound bank ID */
-    OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks 
-                                     by index if multiple banks are present */
-} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE;
-
-
-/** MIDI control 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 
-                                       format based on JAVA MMAPI (JSR-135) requirement */
-    OMX_BU32 sPlayBackRate;       /**< Relative playback rate, stored as Q14.17 fixed-point
-                                       number based on JSR-135 requirement */
-    OMX_BU32 sTempo ;             /**< Tempo in beats per minute (BPM), stored as Q22.10 
-                                       fixed-point number based on JSR-135 requirement */
-    OMX_U32 nMaxPolyphony;        /**< Specifies the maximum simultaneous polyphonic 
-                                       voices. A value of zero indicates that the default 
-                                       polyphony of the device is used  */
-    OMX_U32 nNumRepeat;           /**< Number of times to repeat playback */
-    OMX_U32 nStopTime;            /**< Time in milliseconds to indicate when playback 
-                                       will stop automatically.  Set to zero if not used */
-    OMX_U16 nChannelMuteMask;     /**< 16 bit mask for channel mute status */
-    OMX_U16 nChannelSoloMask;     /**< 16 bit mask for channel solo status */
-    OMX_U32 nTrack0031MuteMask;   /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */
-    OMX_U32 nTrack3263MuteMask;   /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */
-    OMX_U32 nTrack0031SoloMask;   /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */
-    OMX_U32 nTrack3263SoloMask;   /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */
-
-} OMX_AUDIO_CONFIG_MIDICONTROLTYPE;
-
-
-/** MIDI Playback States 
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE {
-  OMX_AUDIO_MIDIPlayBackStateUnknown = 0,      /**< Unknown state or state does not map to 
-  													other defined states */
-  OMX_AUDIO_MIDIPlayBackStateClosedEngaged,    /**< No MIDI resource is currently open. 
-                                                    The MIDI engine is currently processing 
-                                                    MIDI events. */
-  OMX_AUDIO_MIDIPlayBackStateParsing,          /**< A MIDI resource is open and is being 
-                                                    primed. The MIDI engine is currently 
-                                                    processing MIDI events. */
-  OMX_AUDIO_MIDIPlayBackStateOpenEngaged,      /**< A MIDI resource is open and primed but 
-                                                    not playing. The MIDI engine is currently
-                                                    processing MIDI events. The transition to
-                                                    this state is only possible from the 
-                                                    OMX_AUDIO_MIDIPlayBackStatePlaying state,
-                                                    when the 'playback head' reaches the end
-                                                    of media data or the playback stops due
-                                                    to stop time set.*/
-  OMX_AUDIO_MIDIPlayBackStatePlaying,          /**< A MIDI resource is open and currently
-                                                    playing. The MIDI engine is currently
-                                                    processing MIDI events.*/
-  OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS
-                                                    resource constraints */
-  OMX_AUDIO_MIDIPlayBackStatePlayingSilently,  /**< Due to system resource constraints and
-                                                    SP-MIDI content constraints, there is
-                                                    no audible MIDI content during playback
-                                                    currently. The situation may change if
-                                                    resources are freed later.*/
-  OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIPLAYBACKSTATETYPE;
-
-
-/** MIDI status 
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< port that this structure applies to */
-    OMX_U16 nNumTracks;         /**< Number of MIDI tracks in the file, read only field. 
-                                     NOTE: May not return a meaningful value until the entire 
-                                     file is parsed and buffered.  */
-    OMX_U32 nDuration;          /**< The length of the currently open MIDI resource 
-                                     in milliseconds. NOTE: May not return a meaningful value 
-                                     until the entire file is parsed and buffered.  */  
-    OMX_U32 nPosition;          /**< Current Position of the MIDI resource being played 
-                                     in milliseconds */
-    OMX_BOOL bVibra;            /**< Does Vibra track exist? NOTE: May not return a meaningful 
-                                     value until the entire file is parsed and buffered. */
-    OMX_U32 nNumMetaEvents;     /**< Total number of MIDI Meta Events in the currently 
-                                     open MIDI resource. NOTE: May not return a meaningful value 
-                                     until the entire file is parsed and buffered.  */
-    OMX_U32 nNumActiveVoices;   /**< Number of active voices in the currently playing 
-                                     MIDI resource. NOTE: May not return a meaningful value until 
-                                     the entire file is parsed and buffered. */
-    OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState;  /**< MIDI playback state enumeration, read only field */
-} OMX_AUDIO_CONFIG_MIDISTATUSTYPE;
-
-
-/** MIDI Meta Event structure one per Meta Event.
- *  MIDI Meta Events are like audio metadata, except that they are interspersed 
- *  with the MIDI content throughout the file and are not localized in the header. 
- *  As such, it is necessary to retrieve information about these Meta Events from 
- *  the engine, as it encounters these Meta Events within the MIDI content. 
- *  For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, 
- *  author, default tempo, etc.) scattered throughout the file. 
- *  @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ 
-    OMX_U32 nSize;            /**< size of the structure in bytes */ 
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */ 
-    OMX_U32 nIndex;           /**< Index of Meta Event */ 
-    OMX_U8 nMetaEventType;    /**< Meta Event Type, 7bits (i.e. 0 - 127) */ 
-    OMX_U32 nMetaEventSize;   /**< size of the Meta Event in bytes */ 
-    OMX_U32 nTrack;           /**< track number for the meta event */
-    OMX_U32 nPosition;        /**< Position of the meta-event in milliseconds */
-} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; 
-
-
-/** MIDI Meta Event Data structure - one per Meta Event. 
- * @ingroup midi
- */ 
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ 
-    OMX_U32 nSize;            /**< size of the structure in bytes */ 
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;       /**< port that this structure applies to */ 
-    OMX_U32 nIndex;           /**< Index of Meta Event */ 
-    OMX_U32 nMetaEventSize;   /**< size of the Meta Event in bytes */ 
-    OMX_U8 nData[1];          /**< array of one or more bytes of meta data 
-                                   as indicated by the nMetaEventSize field */ 
-} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; 
-
-
-/** Audio Volume adjustment for a port */
-typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
-                                     set.  Select the input port to set 
-                                     just that port's volume.  Select the 
-                                     output port to adjust the master 
-                                     volume. */
-    OMX_BOOL bLinear;           /**< Is the volume to be set in linear (0.100) 
-                                     or logarithmic scale (mB) */
-    OMX_BS32 sVolume;           /**< Volume linear setting in the 0..100 range, OR
-                                     Volume logarithmic setting for this port.  The values
-                                     for volume are in mB (millibels = 1/100 dB) relative
-                                     to a gain of 1 (e.g. the output is the same as the 
-                                     input level).  Values are in mB from nMax 
-                                     (maximum volume) to nMin mB (typically negative).
-                                     Since the volume is "voltage"
-                                     and not a "power", it takes a setting of
-                                     -600 mB to decrease the volume by 1/2.  If
-                                     a component cannot accurately set the 
-                                     volume to the requested value, it must
-                                     set the volume to the closest value BELOW
-                                     the requested value.  When getting the
-                                     volume setting, the current actual volume
-                                     must be returned. */
-} OMX_AUDIO_CONFIG_VOLUMETYPE;
-
-
-/** Audio Volume adjustment for a channel */
-typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
-                                     set.  Select the input port to set 
-                                     just that port's volume.  Select the 
-                                     output port to adjust the master 
-                                     volume. */
-    OMX_U32 nChannel;           /**< channel to select from 0 to N-1, 
-                                     using OMX_ALL to apply volume settings
-                                     to all channels */
-    OMX_BOOL bLinear;           /**< Is the volume to be set in linear (0.100) or 
-                                     logarithmic scale (mB) */
-    OMX_BS32 sVolume;           /**< Volume linear setting in the 0..100 range, OR
-                                     Volume logarithmic setting for this port.  
-                                     The values for volume are in mB 
-                                     (millibels = 1/100 dB) relative to a gain
-                                     of 1 (e.g. the output is the same as the 
-                                     input level).  Values are in mB from nMax 
-                                     (maximum volume) to nMin mB (typically negative).  
-                                     Since the volume is "voltage"
-                                     and not a "power", it takes a setting of
-                                     -600 mB to decrease the volume by 1/2.  If
-                                     a component cannot accurately set the 
-                                     volume to the requested value, it must
-                                     set the volume to the closest value BELOW
-                                     the requested value.  When getting the
-                                     volume setting, the current actual volume
-                                     must be returned. */
-    OMX_BOOL bIsMIDI;           /**< TRUE if nChannel refers to a MIDI channel,
-                                     FALSE otherwise */
-} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE;
-
-
-/** Audio balance setting */
-typedef struct OMX_AUDIO_CONFIG_BALANCETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
-                                     set.  Select the input port to set 
-                                     just that port's balance.  Select the 
-                                     output port to adjust the master 
-                                     balance. */
-    OMX_S32 nBalance;           /**< balance setting for this port 
-                                     (-100 to 100, where -100 indicates
-                                     all left, and no right */
-} OMX_AUDIO_CONFIG_BALANCETYPE;
-
-
-/** Audio Port mute */
-typedef struct OMX_AUDIO_CONFIG_MUTETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
-                                     set.  Select the input port to set 
-                                     just that port's mute.  Select the 
-                                     output port to adjust the master 
-                                     mute. */
-    OMX_BOOL bMute;             /**< Mute setting for this port */
-} OMX_AUDIO_CONFIG_MUTETYPE;
-
-
-/** Audio Channel mute */
-typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< port that this structure applies to */
-    OMX_U32 nChannel;           /**< channel to select from 0 to N-1, 
-                                     using OMX_ALL to apply mute settings
-                                     to all channels */
-    OMX_BOOL bMute;             /**< Mute setting for this channel */
-    OMX_BOOL bIsMIDI;           /**< TRUE if nChannel refers to a MIDI channel,
-                                     FALSE otherwise */ 
-} OMX_AUDIO_CONFIG_CHANNELMUTETYPE;
-
-
-
-/** Enable / Disable for loudness control, which boosts bass and to a 
- *  smaller extent high end frequencies to compensate for hearing
- *  ability at the extreme ends of the audio spectrum
- */ 
-typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bLoudness;        /**< Enable/disable for loudness */
-} OMX_AUDIO_CONFIG_LOUDNESSTYPE;
-
-
-/** Enable / Disable for bass, which controls low frequencies
- */ 
-typedef struct OMX_AUDIO_CONFIG_BASSTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bEnable;          /**< Enable/disable for bass control */
-    OMX_S32 nBass;             /**< bass setting for the port, as a 
-                                    continuous value from -100 to 100  
-                                    (0 means no change in bass level)*/
-} OMX_AUDIO_CONFIG_BASSTYPE;
-
-
-/** Enable / Disable for treble, which controls high frequencies tones
- */ 
-typedef struct OMX_AUDIO_CONFIG_TREBLETYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bEnable;          /**< Enable/disable for treble control */
-    OMX_S32  nTreble;          /**< treble setting for the port, as a
-                                    continuous value from -100 to 100  
-                                    (0 means no change in treble level) */
-} OMX_AUDIO_CONFIG_TREBLETYPE;
-
-
-/** An equalizer is typically used for two reasons: to compensate for an 
- *  sub-optimal frequency response of a system to make it sound more natural 
- *  or to create intentionally some unnatural coloring to the sound to create
- *  an effect.
- *  @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bEnable;          /**< Enable/disable for equalizer */
-    OMX_BU32 sBandIndex;       /**< Band number to be set.  Upper Limit is 
-                                    N-1, where N is the number of bands, lower limit is 0 */
-    OMX_BU32 sCenterFreq;      /**< Center frequecies in Hz.  This is a
-                                    read only element and is used to determine 
-                                    the lower, center and upper frequency of 
-                                    this band.  */
-    OMX_BS32 sBandLevel;       /**< band level in millibels */
-} OMX_AUDIO_CONFIG_EQUALIZERTYPE;
-
-
-/** Stereo widening mode type 
- * @ingroup effects
- */ 
-typedef enum OMX_AUDIO_STEREOWIDENINGTYPE {
-    OMX_AUDIO_StereoWideningHeadphones,    /**< Stereo widening for loudspeakers */
-    OMX_AUDIO_StereoWideningLoudspeakers,  /**< Stereo widening for closely spaced loudspeakers */
-    OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF
-} OMX_AUDIO_STEREOWIDENINGTYPE;
-
-
-/** Control for stereo widening, which is a special 2-channel
- *  case of the audio virtualizer effect. For example, for 5.1-channel 
- *  output, it translates to virtual surround sound. 
- * @ingroup effects
- */ 
-typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bEnable;          /**< Enable/disable for stereo widening control */
-    OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */
-    OMX_U32  nStereoWidening;  /**< stereo widening setting for the port,
-                                    as a continuous value from 0 to 100  */
-} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE;
-
-
-/** The chorus effect (or ``choralizer'') is any signal processor which makes
- *  one sound source (such as a voice) sound like many such sources singing 
- *  (or playing) in unison. Since performance in unison is never exact, chorus 
- *  effects simulate this by making independently modified copies of the input 
- *  signal. Modifications may include (1) delay, (2) frequency shift, and 
- *  (3) amplitude modulation.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bEnable;          /**< Enable/disable for chorus */
-    OMX_BU32 sDelay;           /**< average delay in milliseconds */
-    OMX_BU32 sModulationRate;  /**< rate of modulation in millihertz */
-    OMX_U32 nModulationDepth;  /**< depth of modulation as a percentage of 
-                                    delay (i.e. 0 to 100) */
-    OMX_BU32 nFeedback;        /**< Feedback from chorus output to input in percentage */
-} OMX_AUDIO_CONFIG_CHORUSTYPE;
-
-
-/** Reverberation is part of the reflected sound that follows the early 
- *  reflections. In a typical room, this consists of a dense succession of 
- *  echoes whose energy decays exponentially. The reverberation effect structure 
- *  as defined here includes both (early) reflections as well as (late) reverberations. 
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE {
-    OMX_U32 nSize;                /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
-    OMX_U32 nPortIndex;           /**< port that this structure applies to */
-    OMX_BOOL bEnable;             /**< Enable/disable for reverberation control */
-    OMX_BS32 sRoomLevel;          /**< Intensity level for the whole room effect 
-                                       (i.e. both early reflections and late 
-                                       reverberation) in millibels */
-    OMX_BS32 sRoomHighFreqLevel;  /**< Attenuation at high frequencies
-                                       relative to the intensity at low
-                                       frequencies in millibels */
-    OMX_BS32 sReflectionsLevel;   /**< Intensity level of early reflections
-                                       (relative to room value), in millibels */
-    OMX_BU32 sReflectionsDelay;   /**< Delay time of the first reflection relative 
-                                       to the direct path, in milliseconds */
-    OMX_BS32 sReverbLevel;        /**< Intensity level of late reverberation
-                                       relative to room level, in millibels */
-    OMX_BU32 sReverbDelay;        /**< Time delay from the first early reflection 
-                                       to the beginning of the late reverberation 
-                                       section, in milliseconds */
-    OMX_BU32 sDecayTime;          /**< Late reverberation decay time at low
-                                       frequencies, in milliseconds */
-    OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative 
-                                       to low frequency decay time in percent  */
-    OMX_U32 nDensity;             /**< Modal density in the late reverberation decay,
-                                       in percent (i.e. 0 - 100) */
-    OMX_U32 nDiffusion;           /**< Echo density in the late reverberation decay,
-                                       in percent (i.e. 0 - 100) */
-    OMX_BU32 sReferenceHighFreq;  /**< Reference high frequency in Hertz. This is 
-                                       the frequency used as the reference for all 
-                                       the high-frequency settings above */
-
-} OMX_AUDIO_CONFIG_REVERBERATIONTYPE;
-
-
-/** Possible settings for the Echo Cancelation structure to use 
- * @ingroup effects
- */
-typedef enum OMX_AUDIO_ECHOCANTYPE {
-   OMX_AUDIO_EchoCanOff = 0,    /**< Echo Cancellation is disabled */
-   OMX_AUDIO_EchoCanNormal,     /**< Echo Cancellation normal operation - 
-                                     echo from plastics and face */
-   OMX_AUDIO_EchoCanHFree,      /**< Echo Cancellation optimized for 
-                                     Hands Free operation */
-   OMX_AUDIO_EchoCanCarKit,    /**< Echo Cancellation optimized for 
-                                     Car Kit (longer echo) */
-   OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-   OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-   OMX_AUDIO_EchoCanMax = 0x7FFFFFFF
-} OMX_AUDIO_ECHOCANTYPE;
-
-
-/** Enable / Disable for echo cancelation, which removes undesired echo's
- *  from the audio
- * @ingroup effects
- */ 
-typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */
-} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE;
-
-
-/** Enable / Disable for noise reduction, which undesired noise from
- * the audio
- * @ingroup effects
- */ 
-typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_U32 nPortIndex;        /**< port that this structure applies to */
-    OMX_BOOL bNoiseReduction;  /**< Enable/disable for noise reduction */
-} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/media/stagefright/openmax/OMX_Component.h b/include/media/stagefright/openmax/OMX_Component.h
deleted file mode 100644
index b5b784ea..0000000
--- a/include/media/stagefright/openmax/OMX_Component.h
+++ /dev/null
@@ -1,596 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** OMX_Component.h - OpenMax IL version 1.1.2
- *  The OMX_Component header file contains the definitions used to define
- *  the public interface of a component.  This header file is intended to
- *  be used by both the application and the component.
- */
-
-#ifndef OMX_Component_h
-#define OMX_Component_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-/* Each OMX header must include all required header files to allow the
- *  header to compile without errors.  The includes below are required
- *  for this header file to compile successfully 
- */
-
-#include <OMX_Audio.h>
-#include <OMX_Video.h>
-#include <OMX_Image.h>
-#include <OMX_Other.h>
-
-/** @ingroup comp */
-typedef enum OMX_PORTDOMAINTYPE { 
-    OMX_PortDomainAudio, 
-    OMX_PortDomainVideo, 
-    OMX_PortDomainImage, 
-    OMX_PortDomainOther,
-    OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_PortDomainMax = 0x7ffffff
-} OMX_PORTDOMAINTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
-    OMX_U32 nSize;                 /**< Size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
-    OMX_U32 nPortIndex;            /**< Port number the structure applies to */
-    OMX_DIRTYPE eDir;              /**< Direction (input or output) of this port */
-    OMX_U32 nBufferCountActual;    /**< The actual number of buffers allocated on this port */
-    OMX_U32 nBufferCountMin;       /**< The minimum number of buffers this port requires */
-    OMX_U32 nBufferSize;           /**< Size, in bytes, for buffers to be used for this channel */
-    OMX_BOOL bEnabled;             /**< Ports default to enabled and are enabled/disabled by
-                                        OMX_CommandPortEnable/OMX_CommandPortDisable.
-                                        When disabled a port is unpopulated. A disabled port
-                                        is not populated with buffers on a transition to IDLE. */
-    OMX_BOOL bPopulated;           /**< Port is populated with all of its buffers as indicated by
-                                        nBufferCountActual. A disabled port is always unpopulated. 
-                                        An enabled port is populated on a transition to OMX_StateIdle
-                                        and unpopulated on a transition to loaded. */
-    OMX_PORTDOMAINTYPE eDomain;    /**< Domain of the port. Determines the contents of metadata below. */
-    union {
-        OMX_AUDIO_PORTDEFINITIONTYPE audio;
-        OMX_VIDEO_PORTDEFINITIONTYPE video;
-        OMX_IMAGE_PORTDEFINITIONTYPE image;
-        OMX_OTHER_PORTDEFINITIONTYPE other;
-    } format;
-    OMX_BOOL bBuffersContiguous;
-    OMX_U32 nBufferAlignment;
-} OMX_PARAM_PORTDEFINITIONTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_U32TYPE { 
-    OMX_U32 nSize;                    /**< Size of this structure, in Bytes */ 
-    OMX_VERSIONTYPE nVersion;         /**< OMX specification version information */ 
-    OMX_U32 nPortIndex;               /**< port that this structure applies to */ 
-    OMX_U32 nU32;                     /**< U32 value */
-} OMX_PARAM_U32TYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONPOLICYTYPE {
-    OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
-    OMX_SuspensionEnabled,  /**< Suspension allowed */   
-    OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_SuspensionPolicyMax = 0x7fffffff
-} OMX_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
-    OMX_U32 nSize;                  
-    OMX_VERSIONTYPE nVersion;        
-    OMX_SUSPENSIONPOLICYTYPE ePolicy;
-} OMX_PARAM_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONTYPE {
-    OMX_NotSuspended, /**< component is not suspended */
-    OMX_Suspended,    /**< component is suspended */
-    OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_SuspendMax = 0x7FFFFFFF
-} OMX_SUSPENSIONTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONTYPE {
-    OMX_U32 nSize;                  
-    OMX_VERSIONTYPE nVersion;       
-    OMX_SUSPENSIONTYPE eType;             
-} OMX_PARAM_SUSPENSIONTYPE ;
-
-typedef struct OMX_CONFIG_BOOLEANTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_BOOL bEnabled;    
-} OMX_CONFIG_BOOLEANTYPE;
-
-/* Parameter specifying the content uri to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTURITYPE
-{
-    OMX_U32 nSize;                      /**< size of the structure in bytes, including
-                                             actual URI name */
-    OMX_VERSIONTYPE nVersion;           /**< OMX specification version information */
-    OMX_U8 contentURI[1];               /**< The URI name */
-} OMX_PARAM_CONTENTURITYPE;
-
-/* Parameter specifying the pipe to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTPIPETYPE
-{
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_HANDLETYPE hPipe;       /**< The pipe handle*/
-} OMX_PARAM_CONTENTPIPETYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_RESOURCECONCEALMENTTYPE {
-    OMX_U32 nSize;             /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
-    OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment 
-                                            methods (like degrading algorithm quality to 
-                                            lower resource consumption or functional bypass) 
-                                            on a component as a resolution to resource conflicts. */
-} OMX_RESOURCECONCEALMENTTYPE;
-
-
-/** @ingroup metadata */
-typedef enum OMX_METADATACHARSETTYPE {
-    OMX_MetadataCharsetUnknown = 0,
-    OMX_MetadataCharsetASCII,
-    OMX_MetadataCharsetBinary,
-    OMX_MetadataCharsetCodePage1252,
-    OMX_MetadataCharsetUTF8,
-    OMX_MetadataCharsetJavaConformantUTF8,
-    OMX_MetadataCharsetUTF7,
-    OMX_MetadataCharsetImapUTF7,
-    OMX_MetadataCharsetUTF16LE, 
-    OMX_MetadataCharsetUTF16BE,
-    OMX_MetadataCharsetGB12345,
-    OMX_MetadataCharsetHZGB2312,
-    OMX_MetadataCharsetGB2312,
-    OMX_MetadataCharsetGB18030,
-    OMX_MetadataCharsetGBK,
-    OMX_MetadataCharsetBig5,
-    OMX_MetadataCharsetISO88591,
-    OMX_MetadataCharsetISO88592,
-    OMX_MetadataCharsetISO88593,
-    OMX_MetadataCharsetISO88594,
-    OMX_MetadataCharsetISO88595,
-    OMX_MetadataCharsetISO88596,
-    OMX_MetadataCharsetISO88597,
-    OMX_MetadataCharsetISO88598,
-    OMX_MetadataCharsetISO88599,
-    OMX_MetadataCharsetISO885910,
-    OMX_MetadataCharsetISO885913,
-    OMX_MetadataCharsetISO885914,
-    OMX_MetadataCharsetISO885915,
-    OMX_MetadataCharsetShiftJIS,
-    OMX_MetadataCharsetISO2022JP,
-    OMX_MetadataCharsetISO2022JP1,
-    OMX_MetadataCharsetISOEUCJP,
-    OMX_MetadataCharsetSMS7Bit,
-    OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
-} OMX_METADATACHARSETTYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASCOPETYPE
-{
-    OMX_MetadataScopeAllLevels,
-    OMX_MetadataScopeTopLevel,
-    OMX_MetadataScopePortLevel,
-    OMX_MetadataScopeNodeLevel,
-    OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_MetadataScopeTypeMax = 0x7fffffff
-} OMX_METADATASCOPETYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASEARCHMODETYPE
-{
-    OMX_MetadataSearchValueSizeByIndex,
-    OMX_MetadataSearchItemByIndex,
-    OMX_MetadataSearchNextItemByKey,
-    OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_MetadataSearchTypeMax = 0x7fffffff
-} OMX_METADATASEARCHMODETYPE;
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
-{
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_METADATASCOPETYPE eScopeMode;
-    OMX_U32 nScopeSpecifier;
-    OMX_U32 nMetadataItemCount;
-} OMX_CONFIG_METADATAITEMCOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMTYPE
-{
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_METADATASCOPETYPE eScopeMode;
-    OMX_U32 nScopeSpecifier;
-    OMX_U32 nMetadataItemIndex;  
-    OMX_METADATASEARCHMODETYPE eSearchMode;
-    OMX_METADATACHARSETTYPE eKeyCharset;
-    OMX_U8 nKeySizeUsed;
-    OMX_U8 nKey[128];
-    OMX_METADATACHARSETTYPE eValueCharset;
-    OMX_STRING sLanguageCountry;
-    OMX_U32 nValueMaxSize;
-    OMX_U32 nValueSizeUsed;
-    OMX_U8 nValue[1];
-} OMX_CONFIG_METADATAITEMTYPE;
-
-/* @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
-{
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_BOOL bAllKeys;
-    OMX_U32 nParentNodeID;
-    OMX_U32 nNumNodes;
-} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
-{
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_BOOL bAllKeys;
-    OMX_U32 nParentNodeID;
-    OMX_U32 nNodeIndex; 
-    OMX_U32 nNodeID; 
-    OMX_STRING cNodeName;
-    OMX_BOOL bIsLeafType;
-} OMX_CONFIG_CONTAINERNODEIDTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_PARAM_METADATAFILTERTYPE 
-{ 
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion; 
-    OMX_BOOL bAllKeys;	/* if true then this structure refers to all keys and 
-                         * the three key fields below are ignored */
-    OMX_METADATACHARSETTYPE eKeyCharset;
-    OMX_U32 nKeySizeUsed; 
-    OMX_U8   nKey [128]; 
-    OMX_U32 nLanguageCountrySizeUsed;
-    OMX_U8 nLanguageCountry[128];
-    OMX_BOOL bEnabled;	/* if true then key is part of filter (e.g. 
-                         * retained for query later). If false then
-                         * key is not part of filter */
-} OMX_PARAM_METADATAFILTERTYPE; 
-
-/** The OMX_HANDLETYPE structure defines the component handle.  The component 
- *  handle is used to access all of the component's public methods and also
- *  contains pointers to the component's private data area.  The component
- *  handle is initialized by the OMX core (with help from the component)
- *  during the process of loading the component.  After the component is
- *  successfully loaded, the application can safely access any of the
- *  component's public functions (although some may return an error because
- *  the state is inappropriate for the access).
- * 
- *  @ingroup comp
- */
-typedef struct OMX_COMPONENTTYPE
-{
-    /** The size of this structure, in bytes.  It is the responsibility
-        of the allocator of this structure to fill in this value.  Since
-        this structure is allocated by the GetHandle function, this
-        function will fill in this value. */
-    OMX_U32 nSize;
-
-    /** nVersion is the version of the OMX specification that the structure 
-        is built against.  It is the responsibility of the creator of this 
-        structure to initialize this value and every user of this structure 
-        should verify that it knows how to use the exact version of 
-        this structure found herein. */
-    OMX_VERSIONTYPE nVersion;
-
-    /** pComponentPrivate is a pointer to the component private data area.  
-        This member is allocated and initialized by the component when the 
-        component is first loaded.  The application should not access this 
-        data area. */
-    OMX_PTR pComponentPrivate;
-
-    /** pApplicationPrivate is a pointer that is a parameter to the 
-        OMX_GetHandle method, and contains an application private value 
-        provided by the IL client.  This application private data is 
-        returned to the IL Client by OMX in all callbacks */
-    OMX_PTR pApplicationPrivate;
-
-    /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL 
-        specification for details on the GetComponentVersion method.
-     */
-    OMX_ERRORTYPE (*GetComponentVersion)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_OUT OMX_STRING pComponentName,
-            OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
-            OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
-            OMX_OUT OMX_UUIDTYPE* pComponentUUID);
-
-    /** refer to OMX_SendCommand in OMX_core.h or the OMX IL 
-        specification for details on the SendCommand method.
-     */
-    OMX_ERRORTYPE (*SendCommand)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_COMMANDTYPE Cmd,
-            OMX_IN  OMX_U32 nParam1,
-            OMX_IN  OMX_PTR pCmdData);
-
-    /** refer to OMX_GetParameter in OMX_core.h or the OMX IL 
-        specification for details on the GetParameter method.
-     */
-    OMX_ERRORTYPE (*GetParameter)(
-            OMX_IN  OMX_HANDLETYPE hComponent, 
-            OMX_IN  OMX_INDEXTYPE nParamIndex,  
-            OMX_INOUT OMX_PTR pComponentParameterStructure);
-
-
-    /** refer to OMX_SetParameter in OMX_core.h or the OMX IL 
-        specification for details on the SetParameter method.
-     */
-    OMX_ERRORTYPE (*SetParameter)(
-            OMX_IN  OMX_HANDLETYPE hComponent, 
-            OMX_IN  OMX_INDEXTYPE nIndex,
-            OMX_IN  OMX_PTR pComponentParameterStructure);
-
-
-    /** refer to OMX_GetConfig in OMX_core.h or the OMX IL 
-        specification for details on the GetConfig method.
-     */
-    OMX_ERRORTYPE (*GetConfig)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_INDEXTYPE nIndex, 
-            OMX_INOUT OMX_PTR pComponentConfigStructure);
-
-
-    /** refer to OMX_SetConfig in OMX_core.h or the OMX IL 
-        specification for details on the SetConfig method.
-     */
-    OMX_ERRORTYPE (*SetConfig)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_INDEXTYPE nIndex, 
-            OMX_IN  OMX_PTR pComponentConfigStructure);
-
-
-    /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL 
-        specification for details on the GetExtensionIndex method.
-     */
-    OMX_ERRORTYPE (*GetExtensionIndex)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_STRING cParameterName,
-            OMX_OUT OMX_INDEXTYPE* pIndexType);
-
-
-    /** refer to OMX_GetState in OMX_core.h or the OMX IL 
-        specification for details on the GetState method.
-     */
-    OMX_ERRORTYPE (*GetState)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_OUT OMX_STATETYPE* pState);
-
-    
-    /** The ComponentTunnelRequest method will interact with another OMX
-        component to determine if tunneling is possible and to setup the
-        tunneling.  The return codes for this method can be used to 
-        determine if tunneling is not possible, or if tunneling is not
-        supported.  
-        
-        Base profile components (i.e. non-interop) do not support this
-        method and should return OMX_ErrorNotImplemented 
-
-        The interop profile component MUST support tunneling to another 
-        interop profile component with a compatible port parameters.  
-        A component may also support proprietary communication.
-        
-        If proprietary communication is supported the negotiation of 
-        proprietary communication is done outside of OMX in a vendor 
-        specific way. It is only required that the proper result be 
-        returned and the details of how the setup is done is left 
-        to the component implementation.  
-    
-        When this method is invoked when nPort in an output port, the
-        component will:
-        1.  Populate the pTunnelSetup structure with the output port's 
-            requirements and constraints for the tunnel.
-
-        When this method is invoked when nPort in an input port, the
-        component will:
-        1.  Query the necessary parameters from the output port to 
-            determine if the ports are compatible for tunneling
-        2.  If the ports are compatible, the component should store
-            the tunnel step provided by the output port
-        3.  Determine which port (either input or output) is the buffer
-            supplier, and call OMX_SetParameter on the output port to
-            indicate this selection.
-        
-        The component will return from this call within 5 msec.
-    
-        @param [in] hComp
-            Handle of the component to be accessed.  This is the component
-            handle returned by the call to the OMX_GetHandle method.
-        @param [in] nPort
-            nPort is used to select the port on the component to be used
-            for tunneling.
-        @param [in] hTunneledComp
-            Handle of the component to tunnel with.  This is the component 
-            handle returned by the call to the OMX_GetHandle method.  When
-            this parameter is 0x0 the component should setup the port for
-            communication with the application / IL Client.
-        @param [in] nPortOutput
-            nPortOutput is used indicate the port the component should
-            tunnel with.
-        @param [in] pTunnelSetup
-            Pointer to the tunnel setup structure.  When nPort is an output port
-            the component should populate the fields of this structure.  When
-            When nPort is an input port the component should review the setup
-            provided by the component with the output port.
-        @return OMX_ERRORTYPE
-            If the command successfully executes, the return code will be
-            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-        @ingroup tun
-    */
-
-    OMX_ERRORTYPE (*ComponentTunnelRequest)(
-        OMX_IN  OMX_HANDLETYPE hComp,
-        OMX_IN  OMX_U32 nPort,
-        OMX_IN  OMX_HANDLETYPE hTunneledComp,
-        OMX_IN  OMX_U32 nTunneledPort,
-        OMX_INOUT  OMX_TUNNELSETUPTYPE* pTunnelSetup); 
-
-    /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL 
-        specification for details on the UseBuffer method.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*UseBuffer)(
-            OMX_IN OMX_HANDLETYPE hComponent,
-            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
-            OMX_IN OMX_U32 nPortIndex,
-            OMX_IN OMX_PTR pAppPrivate,
-            OMX_IN OMX_U32 nSizeBytes,
-            OMX_IN OMX_U8* pBuffer);
-
-    /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL 
-        specification for details on the AllocateBuffer method.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*AllocateBuffer)(
-            OMX_IN OMX_HANDLETYPE hComponent,
-            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
-            OMX_IN OMX_U32 nPortIndex,
-            OMX_IN OMX_PTR pAppPrivate,
-            OMX_IN OMX_U32 nSizeBytes);
-
-    /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL 
-        specification for details on the FreeBuffer method.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*FreeBuffer)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_U32 nPortIndex,
-            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
-
-    /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL 
-        specification for details on the EmptyThisBuffer method.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*EmptyThisBuffer)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
-
-    /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL 
-        specification for details on the FillThisBuffer method.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*FillThisBuffer)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
-
-    /** The SetCallbacks method is used by the core to specify the callback
-        structure from the application to the component.  This is a blocking
-        call.  The component will return from this call within 5 msec.
-        @param [in] hComponent
-            Handle of the component to be accessed.  This is the component
-            handle returned by the call to the GetHandle function.
-        @param [in] pCallbacks
-            pointer to an OMX_CALLBACKTYPE structure used to provide the 
-            callback information to the component
-        @param [in] pAppData
-            pointer to an application defined value.  It is anticipated that 
-            the application will pass a pointer to a data structure or a "this
-            pointer" in this area to allow the callback (in the application)
-            to determine the context of the call
-        @return OMX_ERRORTYPE
-            If the command successfully executes, the return code will be
-            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-     */
-    OMX_ERRORTYPE (*SetCallbacks)(
-            OMX_IN  OMX_HANDLETYPE hComponent,
-            OMX_IN  OMX_CALLBACKTYPE* pCallbacks, 
-            OMX_IN  OMX_PTR pAppData);
-
-    /** ComponentDeInit method is used to deinitialize the component
-        providing a means to free any resources allocated at component
-        initialization.  NOTE:  After this call the component handle is
-        not valid for further use.
-        @param [in] hComponent
-            Handle of the component to be accessed.  This is the component
-            handle returned by the call to the GetHandle function.
-        @return OMX_ERRORTYPE
-            If the command successfully executes, the return code will be
-            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-     */
-    OMX_ERRORTYPE (*ComponentDeInit)(
-            OMX_IN  OMX_HANDLETYPE hComponent);
-
-    /** @ingroup buf */
-    OMX_ERRORTYPE (*UseEGLImage)(
-            OMX_IN OMX_HANDLETYPE hComponent,
-            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
-            OMX_IN OMX_U32 nPortIndex,
-            OMX_IN OMX_PTR pAppPrivate,
-            OMX_IN void* eglImage);
-
-    OMX_ERRORTYPE (*ComponentRoleEnum)(
-        OMX_IN OMX_HANDLETYPE hComponent,
-		OMX_OUT OMX_U8 *cRole,
-		OMX_IN OMX_U32 nIndex);
-
-} OMX_COMPONENTTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_ContentPipe.h b/include/media/stagefright/openmax/OMX_ContentPipe.h
deleted file mode 100644
index ee9e4db..0000000
--- a/include/media/stagefright/openmax/OMX_ContentPipe.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
- *  The OMX_ContentPipe header file contains the definitions used to define
- *  the public interface for content piples.  This header file is intended to
- *  be used by the component.
- */
-
-#ifndef OMX_CONTENTPIPE_H
-#define OMX_CONTENTPIPE_H
-
-#ifndef KD_EACCES
-/* OpenKODE error codes. CPResult values may be zero (indicating success
-   or one of the following values) */
-#define KD_EACCES (1)
-#define KD_EADDRINUSE (2)
-#define KD_EAGAIN (5)
-#define KD_EBADF (7)
-#define KD_EBUSY (8)
-#define KD_ECONNREFUSED (9)
-#define KD_ECONNRESET (10)
-#define KD_EDEADLK (11)
-#define KD_EDESTADDRREQ (12)
-#define KD_ERANGE (35)
-#define KD_EEXIST (13)
-#define KD_EFBIG (14)
-#define KD_EHOSTUNREACH (15)
-#define KD_EINVAL (17)
-#define KD_EIO (18)
-#define KD_EISCONN (20)
-#define KD_EISDIR (21)
-#define KD_EMFILE (22)
-#define KD_ENAMETOOLONG (23)
-#define KD_ENOENT (24)
-#define KD_ENOMEM (25)
-#define KD_ENOSPC (26)
-#define KD_ENOSYS (27)
-#define KD_ENOTCONN (28)
-#define KD_EPERM (33)
-#define KD_ETIMEDOUT (36)
-#define KD_EILSEQ (19)
-#endif
-
-/** Map types from OMX standard types only here so interface is as generic as possible. */
-typedef OMX_U32    CPresult;
-typedef char *     CPstring;  
-typedef void *     CPhandle;
-typedef OMX_U32    CPuint;
-typedef OMX_S32    CPint;  
-typedef char       CPbyte;  
-typedef OMX_BOOL   CPbool;
-
-/** enumeration of origin types used in the CP_PIPETYPE's Seek function 
- * @ingroup cp
- */
-typedef enum CP_ORIGINTYPE {
-    CP_OriginBegin,      
-    CP_OriginCur,      
-    CP_OriginEnd,      
-    CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    CP_OriginMax = 0X7FFFFFFF
-} CP_ORIGINTYPE;
-
-/** enumeration of contact access types used in the CP_PIPETYPE's Open function 
- * @ingroup cp
- */
-typedef enum CP_ACCESSTYPE {
-    CP_AccessRead,      
-    CP_AccessWrite,  
-    CP_AccessReadWrite ,  
-    CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    CP_AccessMax = 0X7FFFFFFF
-} CP_ACCESSTYPE;
-
-/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function 
- * @ingroup cp
- */
-typedef enum CP_CHECKBYTESRESULTTYPE
-{
-    CP_CheckBytesOk,                    /**< There are at least the request number 
-                                              of bytes available */
-    CP_CheckBytesNotReady,              /**< The pipe is still retrieving bytes 
-                                              and presently lacks sufficient bytes. 
-                                              Client will be called when they are 
-                                              sufficient bytes are available. */
-    CP_CheckBytesInsufficientBytes  ,     /**< The pipe has retrieved all bytes 
-                                              but those available are less than those 
-                                              requested */
-    CP_CheckBytesAtEndOfStream,         /**< The pipe has reached the end of stream
-                                              and no more bytes are available. */
-    CP_CheckBytesOutOfBuffers,          /**< All read/write buffers are currently in use. */
-    CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    CP_CheckBytesMax = 0X7FFFFFFF
-} CP_CHECKBYTESRESULTTYPE;
-
-/** enumeration of content pipe events sent to the client callback. 
- * @ingroup cp
- */
-typedef enum CP_EVENTTYPE{
-    CP_BytesAvailable,      	    /** bytes requested in a CheckAvailableBytes call are now available*/
-    CP_Overflow,  		           /** enumeration of content pipe events sent to the client callback*/
-    CP_PipeDisconnected  ,  		    /** enumeration of content pipe events sent to the client callback*/
-    CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    CP_EventMax = 0X7FFFFFFF
-} CP_EVENTTYPE;
-
-/** content pipe definition 
- * @ingroup cp
- */
-typedef struct CP_PIPETYPE
-{
-    /** Open a content stream for reading or writing. */ 
-    CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
-
-    /** Close a content stream. */ 
-    CPresult (*Close)( CPhandle hContent );
-
-    /** Create a content source and open it for writing. */ 
-    CPresult (*Create)( CPhandle *hContent, CPstring szURI );
-
-    /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
-    CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
-
-    /** Seek to certain position in the content relative to the specified origin. */
-    CPresult (*SetPosition)( CPhandle  hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
-
-    /** Retrieve the current position relative to the start of the content. */
-    CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
-
-    /** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
-       Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
-    CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); 
-
-    /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. 
-       Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
-       returns the size of the block actually read. Content pointer advances the by the returned size. 
-       Note: pipe provides pointer. This function is appropriate for large reads. The client must call 
-       ReleaseReadBuffer when done with buffer. 
-
-       In some cases the requested block may not reside in contiguous memory within the
-       pipe implementation. For instance if the pipe leverages a circular buffer then the requested 
-       block may straddle the boundary of the circular buffer. By default a pipe implementation 
-       performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
-       If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory 
-       boundary. Here the client may retrieve the data in segments over successive calls. */
-    CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
-
-    /** Release a buffer obtained by ReadBuffer back to the pipe. */
-    CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
-
-    /** Write data of the specified size to the content (advance content pointer by size of data).
-       Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
-    CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); 
-
-    /** Retrieve a buffer allocated by the pipe used to write data to the content. 
-       Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
-       for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
-    CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
-
-    /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the 
-       the contents of the buffer to content and advance content pointer by the size of the buffer */
-    CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
-
-    /** Register a per-handle client callback with the content pipe. */
-    CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
-
-} CP_PIPETYPE;
-
-#endif
-
diff --git a/include/media/stagefright/openmax/OMX_Core.h b/include/media/stagefright/openmax/OMX_Core.h
deleted file mode 100644
index 9fb0f6f..0000000
--- a/include/media/stagefright/openmax/OMX_Core.h
+++ /dev/null
@@ -1,1448 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** OMX_Core.h - OpenMax IL version 1.1.2
- *  The OMX_Core header file contains the definitions used by both the
- *  application and the component to access common items.
- */
-
-#ifndef OMX_Core_h
-#define OMX_Core_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header shall include all required header files to allow the
- *  header to compile without errors.  The includes below are required
- *  for this header file to compile successfully 
- */
-
-#include <OMX_Index.h>
-
-
-/** The OMX_COMMANDTYPE enumeration is used to specify the action in the
- *  OMX_SendCommand macro.  
- *  @ingroup core
- */
-typedef enum OMX_COMMANDTYPE
-{
-    OMX_CommandStateSet,    /**< Change the component state */
-    OMX_CommandFlush,       /**< Flush the data queue(s) of a component */
-    OMX_CommandPortDisable, /**< Disable a port on a component. */
-    OMX_CommandPortEnable,  /**< Enable a port on a component. */
-    OMX_CommandMarkBuffer,  /**< Mark a component/buffer for observation */
-    OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_CommandMax = 0X7FFFFFFF
-} OMX_COMMANDTYPE;
-
-
-
-/** The OMX_STATETYPE enumeration is used to indicate or change the component
- *  state.  This enumeration reflects the current state of the component when
- *  used with the OMX_GetState macro or becomes the parameter in a state change
- *  command when used with the OMX_SendCommand macro.
- *
- *  The component will be in the Loaded state after the component is initially
- *  loaded into memory.  In the Loaded state, the component is not allowed to
- *  allocate or hold resources other than to build it's internal parameter
- *  and configuration tables.  The application will send one or more
- *  SetParameters/GetParameters and SetConfig/GetConfig commands to the
- *  component and the component will record each of these parameter and
- *  configuration changes for use later.  When the application sends the
- *  Idle command, the component will acquire the resources needed for the
- *  specified configuration and will transition to the idle state if the
- *  allocation is successful.  If the component cannot successfully
- *  transition to the idle state for any reason, the state of the component
- *  shall be fully rolled back to the Loaded state (e.g. all allocated 
- *  resources shall be released).  When the component receives the command
- *  to go to the Executing state, it shall begin processing buffers by
- *  sending all input buffers it holds to the application.  While
- *  the component is in the Idle state, the application may also send the
- *  Pause command.  If the component receives the pause command while in the
- *  Idle state, the component shall send all input buffers it holds to the 
- *  application, but shall not begin processing buffers.  This will allow the
- *  application to prefill buffers.
- * 
- *  @ingroup comp
- */
-
-typedef enum OMX_STATETYPE
-{
-    OMX_StateInvalid,      /**< component has detected that it's internal data 
-                                structures are corrupted to the point that
-                                it cannot determine it's state properly */
-    OMX_StateLoaded,      /**< component has been loaded but has not completed
-                                initialization.  The OMX_SetParameter macro
-                                and the OMX_GetParameter macro are the only 
-                                valid macros allowed to be sent to the 
-                                component in this state. */
-    OMX_StateIdle,        /**< component initialization has been completed
-                                successfully and the component is ready to
-                                to start. */
-    OMX_StateExecuting,   /**< component has accepted the start command and
-                                is processing data (if data is available) */
-    OMX_StatePause,       /**< component has received pause command */
-    OMX_StateWaitForResources, /**< component is waiting for resources, either after 
-                                preemption or before it gets the resources requested.
-                                See specification for complete details. */
-    OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_StateMax = 0X7FFFFFFF
-} OMX_STATETYPE;
-
-/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors.  These 
- *  errors should cover most of the common failure cases.  However, 
- *  vendors are free to add additional error messages of their own as 
- *  long as they follow these rules:
- *  1.  Vendor error messages shall be in the range of 0x90000000 to
- *      0x9000FFFF.
- *  2.  Vendor error messages shall be defined in a header file provided
- *      with the component.  No error messages are allowed that are
- *      not defined.
- */
-typedef enum OMX_ERRORTYPE
-{
-  OMX_ErrorNone = 0,
-
-  /** There were insufficient resources to perform the requested operation */
-  OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000,
-
-  /** There was an error, but the cause of the error could not be determined */
-  OMX_ErrorUndefined = (OMX_S32) 0x80001001,
-
-  /** The component name string was not valid */
-  OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002,
-
-  /** No component with the specified name string was found */
-  OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003,
-
-  /** The component specified did not have a "OMX_ComponentInit" or
-      "OMX_ComponentDeInit entry point */
-  OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004,
-
-  /** One or more parameters were not valid */
-  OMX_ErrorBadParameter = (OMX_S32) 0x80001005,
-
-  /** The requested function is not implemented */
-  OMX_ErrorNotImplemented = (OMX_S32) 0x80001006,
-
-  /** The buffer was emptied before the next buffer was ready */
-  OMX_ErrorUnderflow = (OMX_S32) 0x80001007,
-
-  /** The buffer was not available when it was needed */
-  OMX_ErrorOverflow = (OMX_S32) 0x80001008,
-
-  /** The hardware failed to respond as expected */
-  OMX_ErrorHardware = (OMX_S32) 0x80001009,
-
-  /** The component is in the state OMX_StateInvalid */
-  OMX_ErrorInvalidState = (OMX_S32) 0x8000100A,
-
-  /** Stream is found to be corrupt */
-  OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B,
-
-  /** Ports being connected are not compatible */
-  OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C,
-
-  /** Resources allocated to an idle component have been
-      lost resulting in the component returning to the loaded state */
-  OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D,
-
-  /** No more indicies can be enumerated */
-  OMX_ErrorNoMore = (OMX_S32) 0x8000100E,
-
-  /** The component detected a version mismatch */
-  OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F,
-
-  /** The component is not ready to return data at this time */
-  OMX_ErrorNotReady = (OMX_S32) 0x80001010,
-
-  /** There was a timeout that occurred */
-  OMX_ErrorTimeout = (OMX_S32) 0x80001011,
-
-  /** This error occurs when trying to transition into the state you are already in */
-  OMX_ErrorSameState = (OMX_S32) 0x80001012,
-
-  /** Resources allocated to an executing or paused component have been 
-      preempted, causing the component to return to the idle state */
-  OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, 
-
-  /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 
-      during the allocation of buffers (on a transition from the LOADED to the IDLE state or
-      on a port restart) when it deems that it has waited an unusually long time for the supplier 
-      to send it an allocated buffer via a UseBuffer call. */
-  OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014,
-
-  /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 
-      during the deallocation of buffers (on a transition from the IDLE to LOADED state or 
-      on a port stop) when it deems that it has waited an unusually long time for the supplier 
-      to request the deallocation of a buffer header via a FreeBuffer call. */
-  OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015,
-
-  /** A supplier port sends this error to the IL client (via the EventHandler callback) 
-      during the stopping of a port (either on a transition from the IDLE to LOADED 
-      state or a port stop) when it deems that it has waited an unusually long time for 
-      the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */
-  OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016,
-
-  /** Attempting a state transtion that is not allowed */
-  OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017,
-
-  /* Attempting a command that is not allowed during the present state. */
-  OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, 
-
-  /** The values encapsulated in the parameter or config structure are not supported. */
-  OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019,
-
-  /** The parameter or config indicated by the given index is not supported. */
-  OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
-
-  /** The port index supplied is incorrect. */
-  OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B,
-
-  /** The port has lost one or more of its buffers and it thus unpopulated. */
-  OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C,
-
-  /** Component suspended due to temporary loss of resources */
-  OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D,
-
-  /** Component suspended due to an inability to acquire dynamic resources */
-  OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E,
-
-  /** When the macroblock error reporting is enabled the component returns new error 
-  for every frame that has errors */
-  OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F,
-
-  /** A component reports this error when it cannot parse or determine the format of an input stream. */
-  OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, 
-
-  /** The content open operation failed. */
-  OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021,
-
-  /** The content creation operation failed. */
-  OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022,
-
-  /** Separate table information is being used */
-  OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023,
-
-  /** Tunneling is unsupported by the component*/
-  OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024,
-
-  OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-  OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */
-  OMX_ErrorMax = 0x7FFFFFFF
-} OMX_ERRORTYPE;
-
-/** @ingroup core */
-typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN  OMX_HANDLETYPE hComponent);
-
-/** @ingroup core */
-typedef struct OMX_COMPONENTREGISTERTYPE
-{
-  const char          * pName;       /* Component name, 128 byte limit (including '\0') applies */
-  OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */
-} OMX_COMPONENTREGISTERTYPE;
-
-/** @ingroup core */
-extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[];
-
-/** @ingroup rpm */
-typedef struct OMX_PRIORITYMGMTTYPE {
- OMX_U32 nSize;             /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
- OMX_U32 nGroupPriority;            /**< Priority of the component group */
- OMX_U32 nGroupID;                  /**< ID of the component group */
-} OMX_PRIORITYMGMTTYPE;
-
-/* Component name and Role names are limited to 128 characters including the terminating '\0'. */
-#define OMX_MAX_STRINGNAME_SIZE 128
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_COMPONENTROLETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE];  /**< name of standard component which defines component role */
-} OMX_PARAM_COMPONENTROLETYPE;
-
-/** End of Stream Buffer Flag: 
-  *
-  * A component sets EOS when it has no more data to emit on a particular 
-  * output port. Thus an output port shall set EOS on the last buffer it 
-  * emits. A component's determination of when an output port should 
-  * cease sending data is implemenation specific.
-  * @ingroup buf
-  */
-
-#define OMX_BUFFERFLAG_EOS 0x00000001 
-
-/** Start Time Buffer Flag: 
- *
- * The source of a stream (e.g. a demux component) sets the STARTTIME
- * flag on the buffer that contains the starting timestamp for the
- * stream. The starting timestamp corresponds to the first data that
- * should be displayed at startup or after a seek.
- * The first timestamp of the stream is not necessarily the start time.
- * For instance, in the case of a seek to a particular video frame, 
- * the target frame may be an interframe. Thus the first buffer of 
- * the stream will be the intra-frame preceding the target frame and
- * the starttime will occur with the target frame (with any other
- * required frames required to reconstruct the target intervening).
- *
- * The STARTTIME flag is directly associated with the buffer's 
- * timestamp ' thus its association to buffer data and its 
- * propagation is identical to the timestamp's.
- *
- * When a Sync Component client receives a buffer with the 
- * STARTTIME flag it shall perform a SetConfig on its sync port 
- * using OMX_ConfigTimeClientStartTime and passing the buffer's
- * timestamp.
- * 
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_STARTTIME 0x00000002
-
- 
-
-/** Decode Only Buffer Flag: 
- *
- * The source of a stream (e.g. a demux component) sets the DECODEONLY
- * flag on any buffer that should shall be decoded but should not be
- * displayed. This flag is used, for instance, when a source seeks to 
- * a target interframe that requires the decode of frames preceding the 
- * target to facilitate the target's reconstruction. In this case the 
- * source would emit the frames preceding the target downstream 
- * but mark them as decode only.
- *
- * The DECODEONLY is associated with buffer data and propagated in a 
- * manner identical to the buffer timestamp.
- *
- * A component that renders data should ignore all buffers with 
- * the DECODEONLY flag set.
- * 
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DECODEONLY 0x00000004
-
-
-/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt 
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008
-
-/* End of Frame: The buffer contains exactly one end of frame and no data
- *  occurs after the end of frame. This flag is an optional hint. The absence
- *  of this flag does not imply the absence of an end of frame within the buffer. 
- * @ingroup buf
-*/
-#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010
-
-/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' 
- *  a frame that has no dependency on any other frame information 
- *  @ingroup buf
- */
-#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020
-
-/* Extra data present flag: there is extra data appended to the data stream
- * residing in the buffer 
- * @ingroup buf  
- */
-#define OMX_BUFFERFLAG_EXTRADATA 0x00000040
-
-/** Codec Config Buffer Flag: 
-* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an
-* output port when all bytes in the buffer form part or all of a set of
-* codec specific configuration data.  Examples include SPS/PPS nal units
-* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for
-* OMX_AUDIO_CodingAAC.  Any component that for a given stream sets 
-* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes
-* with frame data in the same buffer, and shall send all buffers
-* containing codec configuration bytes before any buffers containing
-* frame data that those configurations bytes describe.
-* If the stream format for a particular codec has a frame specific
-* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or
-* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as
-* normal without setting OMX_BUFFERFLAG_CODECCONFIG.
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080
-
-
-
-/** @ingroup buf */
-typedef struct OMX_BUFFERHEADERTYPE
-{
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U8* pBuffer;            /**< Pointer to actual block of memory 
-                                     that is acting as the buffer */
-    OMX_U32 nAllocLen;          /**< size of the buffer allocated, in bytes */
-    OMX_U32 nFilledLen;         /**< number of bytes currently in the 
-                                     buffer */
-    OMX_U32 nOffset;            /**< start offset of valid data in bytes from
-                                     the start of the buffer */
-    OMX_PTR pAppPrivate;        /**< pointer to any data the application
-                                     wants to associate with this buffer */
-    OMX_PTR pPlatformPrivate;   /**< pointer to any data the platform
-                                     wants to associate with this buffer */ 
-    OMX_PTR pInputPortPrivate;  /**< pointer to any data the input port
-                                     wants to associate with this buffer */
-    OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port
-                                     wants to associate with this buffer */
-    OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a 
-                                              mark event upon processing this buffer. */
-    OMX_PTR pMarkData;          /**< Application specific data associated with 
-                                     the mark sent on a mark event to disambiguate 
-                                     this mark from others. */
-    OMX_U32 nTickCount;         /**< Optional entry that the component and
-                                     application can update with a tick count
-                                     when they access the component.  This
-                                     value should be in microseconds.  Since
-                                     this is a value relative to an arbitrary
-                                     starting point, this value cannot be used 
-                                     to determine absolute time.  This is an
-                                     optional entry and not all components
-                                     will update it.*/
- OMX_TICKS nTimeStamp;          /**< Timestamp corresponding to the sample 
-                                     starting at the first logical sample 
-                                     boundary in the buffer. Timestamps of 
-                                     successive samples within the buffer may
-                                     be inferred by adding the duration of the 
-                                     of the preceding buffer to the timestamp
-                                     of the preceding buffer.*/
-  OMX_U32     nFlags;           /**< buffer specific flags */
-  OMX_U32 nOutputPortIndex;     /**< The index of the output port (if any) using 
-                                     this buffer */
-  OMX_U32 nInputPortIndex;      /**< The index of the input port (if any) using
-                                     this buffer */
-} OMX_BUFFERHEADERTYPE;
-
-/** The OMX_EXTRADATATYPE enumeration is used to define the 
- * possible extra data payload types.
- * NB: this enum is binary backwards compatible with the previous
- * OMX_EXTRADATA_QUANT define.  This should be replaced with
- * OMX_ExtraDataQuantization.
- */
-typedef enum OMX_EXTRADATATYPE
-{
-   OMX_ExtraDataNone = 0,                       /**< Indicates that no more extra data sections follow */        
-   OMX_ExtraDataQuantization,                   /**< The data payload contains quantization data */
-   OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-   OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-   OMX_ExtraDataMax = 0x7FFFFFFF
-} OMX_EXTRADATATYPE;
-
-
-typedef struct OMX_OTHER_EXTRADATATYPE  {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;               
-    OMX_U32 nPortIndex;
-    OMX_EXTRADATATYPE eType;       /* Extra Data type */
-    OMX_U32 nDataSize;   /* Size of the supporting data to follow */
-    OMX_U8  data[1];     /* Supporting data hint  */
-} OMX_OTHER_EXTRADATATYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PORT_PARAM_TYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPorts;             /**< The number of ports for this component */
-    OMX_U32 nStartPortNumber;   /** first port number for this type of port */
-} OMX_PORT_PARAM_TYPE; 
-
-/** @ingroup comp */
-typedef enum OMX_EVENTTYPE
-{
-    OMX_EventCmdComplete,         /**< component has sucessfully completed a command */
-    OMX_EventError,               /**< component has detected an error condition */
-    OMX_EventMark,                /**< component has detected a buffer mark */
-    OMX_EventPortSettingsChanged, /**< component is reported a port settings change */
-    OMX_EventBufferFlag,          /**< component has detected an EOS */ 
-    OMX_EventResourcesAcquired,   /**< component has been granted resources and is
-                                       automatically starting the state change from
-                                       OMX_StateWaitForResources to OMX_StateIdle. */
-   OMX_EventComponentResumed,     /**< Component resumed due to reacquisition of resources */
-   OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */
-   OMX_EventPortFormatDetected,      /**< Component has detected a supported format. */
-   OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-   OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-   OMX_EventMax = 0x7FFFFFFF
-} OMX_EVENTTYPE;
-
-typedef struct OMX_CALLBACKTYPE
-{
-    /** The EventHandler method is used to notify the application when an
-        event of interest occurs.  Events are defined in the OMX_EVENTTYPE
-        enumeration.  Please see that enumeration for details of what will
-        be returned for each type of event. Callbacks should not return
-        an error to the component, so if an error occurs, the application 
-        shall handle it internally.  This is a blocking call.
-
-        The application should return from this call within 5 msec to avoid
-        blocking the component for an excessively long period of time.
-
-        @param hComponent
-            handle of the component to access.  This is the component
-            handle returned by the call to the GetHandle function.
-        @param pAppData
-            pointer to an application defined value that was provided in the 
-            pAppData parameter to the OMX_GetHandle method for the component.
-            This application defined value is provided so that the application 
-            can have a component specific context when receiving the callback.
-        @param eEvent
-            Event that the component wants to notify the application about.
-        @param nData1
-            nData will be the OMX_ERRORTYPE for an error event and will be 
-            an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
-         @param nData2
-            nData2 will hold further information related to the event. Can be OMX_STATETYPE for
-            a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
-            Default value is 0 if not used. )
-        @param pEventData
-            Pointer to additional event-specific data (see spec for meaning).
-      */
-
-   OMX_ERRORTYPE (*EventHandler)(
-        OMX_IN OMX_HANDLETYPE hComponent,
-        OMX_IN OMX_PTR pAppData,
-        OMX_IN OMX_EVENTTYPE eEvent,
-        OMX_IN OMX_U32 nData1,
-        OMX_IN OMX_U32 nData2,
-        OMX_IN OMX_PTR pEventData);
-
-    /** The EmptyBufferDone method is used to return emptied buffers from an
-        input port back to the application for reuse.  This is a blocking call 
-        so the application should not attempt to refill the buffers during this
-        call, but should queue them and refill them in another thread.  There
-        is no error return, so the application shall handle any errors generated
-        internally.  
-        
-        The application should return from this call within 5 msec.
-        
-        @param hComponent
-            handle of the component to access.  This is the component
-            handle returned by the call to the GetHandle function.
-        @param pAppData
-            pointer to an application defined value that was provided in the 
-            pAppData parameter to the OMX_GetHandle method for the component.
-            This application defined value is provided so that the application 
-            can have a component specific context when receiving the callback.
-        @param pBuffer
-            pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
-            or AllocateBuffer indicating the buffer that was emptied.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*EmptyBufferDone)(
-        OMX_IN OMX_HANDLETYPE hComponent,
-        OMX_IN OMX_PTR pAppData,
-        OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-    /** The FillBufferDone method is used to return filled buffers from an
-        output port back to the application for emptying and then reuse.  
-        This is a blocking call so the application should not attempt to 
-        empty the buffers during this call, but should queue the buffers 
-        and empty them in another thread.  There is no error return, so 
-        the application shall handle any errors generated internally.  The 
-        application shall also update the buffer header to indicate the
-        number of bytes placed into the buffer.  
-
-        The application should return from this call within 5 msec.
-        
-        @param hComponent
-            handle of the component to access.  This is the component
-            handle returned by the call to the GetHandle function.
-        @param pAppData
-            pointer to an application defined value that was provided in the 
-            pAppData parameter to the OMX_GetHandle method for the component.
-            This application defined value is provided so that the application 
-            can have a component specific context when receiving the callback.
-        @param pBuffer
-            pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
-            or AllocateBuffer indicating the buffer that was filled.
-        @ingroup buf
-     */
-    OMX_ERRORTYPE (*FillBufferDone)(
-        OMX_OUT OMX_HANDLETYPE hComponent,
-        OMX_OUT OMX_PTR pAppData,
-        OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
-
-} OMX_CALLBACKTYPE;
-
-/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
-    preference when tunneling between two ports.
-    @ingroup tun buf
-*/
-typedef enum OMX_BUFFERSUPPLIERTYPE
-{
-    OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
-                                              or don't care */
-    OMX_BufferSupplyInput,             /**< input port supplies the buffers */
-    OMX_BufferSupplyOutput,            /**< output port supplies the buffers */
-    OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_BufferSupplyMax = 0x7FFFFFFF
-} OMX_BUFFERSUPPLIERTYPE;
-
-
-/** buffer supplier parameter 
- * @ingroup tun
- */
-typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
-    OMX_U32 nSize; /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex; /**< port that this structure applies to */
-    OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
-} OMX_PARAM_BUFFERSUPPLIERTYPE;
-
-
-/**< indicates that buffers received by an input port of a tunnel 
-     may not modify the data in the buffers 
-     @ingroup tun
- */
-#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 
-
-
-/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
-    port to an input port as part the two ComponentTunnelRequest calls
-    resulting from a OMX_SetupTunnel call from the IL Client. 
-    @ingroup tun
- */   
-typedef struct OMX_TUNNELSETUPTYPE
-{
-    OMX_U32 nTunnelFlags;             /**< bit flags for tunneling */
-    OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
-} OMX_TUNNELSETUPTYPE; 
-
-/* OMX Component headers is included to enable the core to use
-   macros for functions into the component for OMX release 1.0.  
-   Developers should not access any structures or data from within
-   the component header directly */
-/* TO BE REMOVED - #include <OMX_Component.h> */
-
-/** GetComponentVersion will return information about the component.  
-    This is a blocking call.  This macro will go directly from the
-    application to the component (via a core macro).  The
-    component will return from this call within 5 msec.
-    @param [in] hComponent
-        handle of component to execute the command
-    @param [out] pComponentName
-        pointer to an empty string of length 128 bytes.  The component 
-        will write its name into this string.  The name will be 
-        terminated by a single zero byte.  The name of a component will 
-        be 127 bytes or less to leave room for the trailing zero byte.  
-        An example of a valid component name is "OMX.ABC.ChannelMixer\0".
-    @param [out] pComponentVersion
-        pointer to an OMX Version structure that the component will fill 
-        in.  The component will fill in a value that indicates the 
-        component version.  NOTE: the component version is NOT the same 
-        as the OMX Specification version (found in all structures).  The 
-        component version is defined by the vendor of the component and 
-        its value is entirely up to the component vendor.
-    @param [out] pSpecVersion
-        pointer to an OMX Version structure that the component will fill 
-        in.  The SpecVersion is the version of the specification that the 
-        component was built against.  Please note that this value may or 
-        may not match the structure's version.  For example, if the 
-        component was built against the 2.0 specification, but the 
-        application (which creates the structure is built against the 
-        1.0 specification the versions would be different.
-    @param [out] pComponentUUID
-        pointer to the UUID of the component which will be filled in by 
-        the component.  The UUID is a unique identifier that is set at 
-        RUN time for the component and is unique to each instantion of 
-        the component.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_GetComponentVersion(                            \
-        hComponent,                                         \
-        pComponentName,                                     \
-        pComponentVersion,                                  \
-        pSpecVersion,                                       \
-        pComponentUUID)                                     \
-    ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion(  \
-        hComponent,                                         \
-        pComponentName,                                     \
-        pComponentVersion,                                  \
-        pSpecVersion,                                       \
-        pComponentUUID)                 /* Macro End */
-
-
-/** Send a command to the component.  This call is a non-blocking call.
-    The component should check the parameters and then queue the command
-    to the component thread to be executed.  The component thread shall 
-    send the EventHandler() callback at the conclusion of the command. 
-    This macro will go directly from the application to the component (via
-    a core macro).  The component will return from this call within 5 msec.
-    
-    When the command is "OMX_CommandStateSet" the component will queue a
-    state transition to the new state idenfied in nParam.
-    
-    When the command is "OMX_CommandFlush", to flush a port's buffer queues,
-    the command will force the component to return all buffers NOT CURRENTLY 
-    BEING PROCESSED to the application, in the order in which the buffers 
-    were received.
-    
-    When the command is "OMX_CommandPortDisable" or 
-    "OMX_CommandPortEnable", the component's port (given by the value of
-    nParam) will be stopped or restarted. 
-    
-    When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
-    pCmdData will point to a OMX_MARKTYPE structure containing the component
-    handle of the component to examine the buffer chain for the mark.  nParam1
-    contains the index of the port on which the buffer mark is applied.
-
-    Specification text for more details. 
-    
-    @param [in] hComponent
-        handle of component to execute the command
-    @param [in] Cmd
-        Command for the component to execute
-    @param [in] nParam
-        Parameter for the command to be executed.  When Cmd has the value 
-        OMX_CommandStateSet, value is a member of OMX_STATETYPE.  When Cmd has 
-        the value OMX_CommandFlush, value of nParam indicates which port(s) 
-        to flush. -1 is used to flush all ports a single port index will 
-        only flush that port.  When Cmd has the value "OMX_CommandPortDisable"
-        or "OMX_CommandPortEnable", the component's port is given by 
-        the value of nParam.  When Cmd has the value "OMX_CommandMarkBuffer"
-        the components pot is given by the value of nParam.
-    @param [in] pCmdData
-        Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
-        "OMX_CommandMarkBuffer".     
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_SendCommand(                                    \
-         hComponent,                                        \
-         Cmd,                                               \
-         nParam,                                            \
-         pCmdData)                                          \
-     ((OMX_COMPONENTTYPE*)hComponent)->SendCommand(         \
-         hComponent,                                        \
-         Cmd,                                               \
-         nParam,                                            \
-         pCmdData)                          /* Macro End */
-
-
-/** The OMX_GetParameter macro will get one of the current parameter 
-    settings from the component.  This macro cannot only be invoked when 
-    the component is in the OMX_StateInvalid state.  The nParamIndex
-    parameter is used to indicate which structure is being requested from
-    the component.  The application shall allocate the correct structure 
-    and shall fill in the structure size and version information before 
-    invoking this macro.  When the parameter applies to a port, the
-    caller shall fill in the appropriate nPortIndex value indicating the
-    port on which the parameter applies. If the component has not had 
-    any settings changed, then the component should return a set of 
-    valid DEFAULT  parameters for the component.  This is a blocking 
-    call.  
-    
-    The component should return from this call within 20 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] nParamIndex
-        Index of the structure to be filled.  This value is from the
-        OMX_INDEXTYPE enumeration.
-    @param [in,out] pComponentParameterStructure
-        Pointer to application allocated structure to be filled by the 
-        component.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_GetParameter(                                   \
-        hComponent,                                         \
-        nParamIndex,                                        \
-        pComponentParameterStructure)                        \
-    ((OMX_COMPONENTTYPE*)hComponent)->GetParameter(         \
-        hComponent,                                         \
-        nParamIndex,                                        \
-        pComponentParameterStructure)    /* Macro End */
-
-
-/** The OMX_SetParameter macro will send an initialization parameter
-    structure to a component.  Each structure shall be sent one at a time,
-    in a separate invocation of the macro.  This macro can only be
-    invoked when the component is in the OMX_StateLoaded state, or the
-    port is disabled (when the parameter applies to a port). The 
-    nParamIndex parameter is used to indicate which structure is being
-    passed to the component.  The application shall allocate the 
-    correct structure and shall fill in the structure size and version 
-    information (as well as the actual data) before invoking this macro.
-    The application is free to dispose of this structure after the call
-    as the component is required to copy any data it shall retain.  This 
-    is a blocking call.  
-    
-    The component should return from this call within 20 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] nIndex
-        Index of the structure to be sent.  This value is from the
-        OMX_INDEXTYPE enumeration.
-    @param [in] pComponentParameterStructure
-        pointer to application allocated structure to be used for
-        initialization by the component.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_SetParameter(                                   \
-        hComponent,                                         \
-        nParamIndex,                                        \
-        pComponentParameterStructure)                        \
-    ((OMX_COMPONENTTYPE*)hComponent)->SetParameter(         \
-        hComponent,                                         \
-        nParamIndex,                                        \
-        pComponentParameterStructure)    /* Macro End */
-
-
-/** The OMX_GetConfig macro will get one of the configuration structures 
-    from a component.  This macro can be invoked anytime after the 
-    component has been loaded.  The nParamIndex call parameter is used to 
-    indicate which structure is being requested from the component.  The 
-    application shall allocate the correct structure and shall fill in the 
-    structure size and version information before invoking this macro.  
-    If the component has not had this configuration parameter sent before, 
-    then the component should return a set of valid DEFAULT values for the 
-    component.  This is a blocking call.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] nIndex
-        Index of the structure to be filled.  This value is from the
-        OMX_INDEXTYPE enumeration.
-    @param [in,out] pComponentConfigStructure
-        pointer to application allocated structure to be filled by the 
-        component.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
-*/        
-#define OMX_GetConfig(                                      \
-        hComponent,                                         \
-        nConfigIndex,                                       \
-        pComponentConfigStructure)                           \
-    ((OMX_COMPONENTTYPE*)hComponent)->GetConfig(            \
-        hComponent,                                         \
-        nConfigIndex,                                       \
-        pComponentConfigStructure)       /* Macro End */
-
-
-/** The OMX_SetConfig macro will send one of the configuration 
-    structures to a component.  Each structure shall be sent one at a time,
-    each in a separate invocation of the macro.  This macro can be invoked 
-    anytime after the component has been loaded.  The application shall 
-    allocate the correct structure and shall fill in the structure size 
-    and version information (as well as the actual data) before invoking 
-    this macro.  The application is free to dispose of this structure after 
-    the call as the component is required to copy any data it shall retain.  
-    This is a blocking call.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] nConfigIndex
-        Index of the structure to be sent.  This value is from the
-        OMX_INDEXTYPE enumeration above.
-    @param [in] pComponentConfigStructure
-        pointer to application allocated structure to be used for
-        initialization by the component.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_SetConfig(                                      \
-        hComponent,                                         \
-        nConfigIndex,                                       \
-        pComponentConfigStructure)                           \
-    ((OMX_COMPONENTTYPE*)hComponent)->SetConfig(            \
-        hComponent,                                         \
-        nConfigIndex,                                       \
-        pComponentConfigStructure)       /* Macro End */
-
-
-/** The OMX_GetExtensionIndex macro will invoke a component to translate 
-    a vendor specific configuration or parameter string into an OMX 
-    structure index.  There is no requirement for the vendor to support 
-    this command for the indexes already found in the OMX_INDEXTYPE 
-    enumeration (this is done to save space in small components).  The 
-    component shall support all vendor supplied extension indexes not found
-    in the master OMX_INDEXTYPE enumeration.  This is a blocking call.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the GetHandle function.
-    @param [in] cParameterName
-        OMX_STRING that shall be less than 128 characters long including
-        the trailing null byte.  This is the string that will get 
-        translated by the component into a configuration index.
-    @param [out] pIndexType
-        a pointer to a OMX_INDEXTYPE to receive the index value.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_GetExtensionIndex(                              \
-        hComponent,                                         \
-        cParameterName,                                     \
-        pIndexType)                                         \
-    ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex(    \
-        hComponent,                                         \
-        cParameterName,                                     \
-        pIndexType)                     /* Macro End */
-
-
-/** The OMX_GetState macro will invoke the component to get the current 
-    state of the component and place the state value into the location
-    pointed to by pState.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [out] pState
-        pointer to the location to receive the state.  The value returned
-        is one of the OMX_STATETYPE members 
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp
- */
-#define OMX_GetState(                                       \
-        hComponent,                                         \
-        pState)                                             \
-    ((OMX_COMPONENTTYPE*)hComponent)->GetState(             \
-        hComponent,                                         \
-        pState)                         /* Macro End */
-
-
-/** The OMX_UseBuffer macro will request that the component use
-    a buffer (and allocate its own buffer header) already allocated 
-    by another component, or by the IL Client. This is a blocking 
-    call.
-    
-    The component should return from this call within 20 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [out] ppBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 
-        pointer to the buffer header
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */
-
-#define OMX_UseBuffer(                                      \
-           hComponent,                                      \
-           ppBufferHdr,                                     \
-           nPortIndex,                                      \
-           pAppPrivate,                                     \
-           nSizeBytes,                                      \
-           pBuffer)                                         \
-    ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer(            \
-           hComponent,                                      \
-           ppBufferHdr,                                     \
-           nPortIndex,                                      \
-           pAppPrivate,                                     \
-           nSizeBytes,                                      \
-           pBuffer)
-
-
-/** The OMX_AllocateBuffer macro will request that the component allocate 
-    a new buffer and buffer header.  The component will allocate the 
-    buffer and the buffer header and return a pointer to the buffer 
-    header.  This is a blocking call.
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [out] ppBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure used to receive 
-        the pointer to the buffer header
-    @param [in] nPortIndex
-        nPortIndex is used to select the port on the component the buffer will
-        be used with.  The port can be found by using the nPortIndex
-        value as an index into the Port Definition array of the component.
-    @param [in] pAppPrivate
-        pAppPrivate is used to initialize the pAppPrivate member of the 
-        buffer header structure.
-    @param [in] nSizeBytes
-        size of the buffer to allocate.  Used when bAllocateNew is true.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */    
-#define OMX_AllocateBuffer(                                 \
-        hComponent,                                         \
-        ppBuffer,                                           \
-        nPortIndex,                                         \
-        pAppPrivate,                                        \
-        nSizeBytes)                                         \
-    ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer(       \
-        hComponent,                                         \
-        ppBuffer,                                           \
-        nPortIndex,                                         \
-        pAppPrivate,                                        \
-        nSizeBytes)                     /* Macro End */
-
-
-/** The OMX_FreeBuffer macro will release a buffer header from the component
-    which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If  
-    the component allocated the buffer (see the OMX_UseBuffer macro) then 
-    the component shall free the buffer and buffer header. This is a 
-    blocking call. 
-    
-    The component should return from this call within 20 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] nPortIndex
-        nPortIndex is used to select the port on the component the buffer will
-        be used with.
-    @param [in] pBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
-        or AllocateBuffer.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */
-#define OMX_FreeBuffer(                                     \
-        hComponent,                                         \
-        nPortIndex,                                         \
-        pBuffer)                                            \
-    ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer(           \
-        hComponent,                                         \
-        nPortIndex,                                         \
-        pBuffer)                        /* Macro End */
-
-
-/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an 
-    input port of a component.  The buffer will be emptied by the component
-    and returned to the application via the EmptyBufferDone call back.
-    This is a non-blocking call in that the component will record the buffer
-    and return immediately and then empty the buffer, later, at the proper 
-    time.  As expected, this macro may be invoked only while the component 
-    is in the OMX_StateExecuting.  If nPortIndex does not specify an input
-    port, the component shall return an error.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] pBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
-        or AllocateBuffer.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */
-#define OMX_EmptyThisBuffer(                                \
-        hComponent,                                         \
-        pBuffer)                                            \
-    ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer(      \
-        hComponent,                                         \
-        pBuffer)                        /* Macro End */
-
-
-/** The OMX_FillThisBuffer macro will send an empty buffer to an 
-    output port of a component.  The buffer will be filled by the component
-    and returned to the application via the FillBufferDone call back.
-    This is a non-blocking call in that the component will record the buffer
-    and return immediately and then fill the buffer, later, at the proper 
-    time.  As expected, this macro may be invoked only while the component 
-    is in the OMX_ExecutingState.  If nPortIndex does not specify an output
-    port, the component shall return an error.  
-    
-    The component should return from this call within 5 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [in] pBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
-        or AllocateBuffer.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */
-#define OMX_FillThisBuffer(                                 \
-        hComponent,                                         \
-        pBuffer)                                            \
-    ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer(       \
-        hComponent,                                         \
-        pBuffer)                        /* Macro End */
-
-
-
-/** The OMX_UseEGLImage macro will request that the component use
-    a EGLImage provided by EGL (and allocate its own buffer header)
-    This is a blocking call.
-    
-    The component should return from this call within 20 msec.
-    
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the OMX_GetHandle function.
-    @param [out] ppBuffer
-        pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 
-        pointer to the buffer header.  Note that the memory location used
-        for this buffer is NOT visible to the IL Client.
-    @param [in] nPortIndex
-        nPortIndex is used to select the port on the component the buffer will
-        be used with.  The port can be found by using the nPortIndex
-        value as an index into the Port Definition array of the component.
-    @param [in] pAppPrivate
-        pAppPrivate is used to initialize the pAppPrivate member of the 
-        buffer header structure.
-    @param [in] eglImage
-        eglImage contains the handle of the EGLImage to use as a buffer on the
-        specified port.  The component is expected to validate properties of 
-        the EGLImage against the configuration of the port to ensure the component
-        can use the EGLImage as a buffer.          
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup comp buf
- */
-#define OMX_UseEGLImage(                                    \
-           hComponent,                                      \
-           ppBufferHdr,                                     \
-           nPortIndex,                                      \
-           pAppPrivate,                                     \
-           eglImage)                                        \
-    ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage(          \
-           hComponent,                                      \
-           ppBufferHdr,                                     \
-           nPortIndex,                                      \
-           pAppPrivate,                                     \
-           eglImage)
-
-/** The OMX_Init method is used to initialize the OMX core.  It shall be the
-    first call made into OMX and it should only be executed one time without
-    an interviening OMX_Deinit call.  
-    
-    The core should return from this call within 20 msec.
-
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
-
-
-/** The OMX_Deinit method is used to deinitialize the OMX core.  It shall be 
-    the last call made into OMX. In the event that the core determines that 
-    thare are components loaded when this call is made, the core may return 
-    with an error rather than try to unload the components.
-        
-    The core should return from this call within 20 msec.
-    
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
-
-
-/** The OMX_ComponentNameEnum method will enumerate through all the names of
-    recognised valid components in the system. This function is provided
-    as a means to detect all the components in the system run-time. There is
-    no strict ordering to the enumeration order of component names, although
-    each name will only be enumerated once.  If the OMX core supports run-time
-    installation of new components, it is only requried to detect newly
-    installed components when the first call to enumerate component names
-    is made (i.e. when nIndex is 0x0).
-    
-    The core should return from this call in 20 msec.
-    
-    @param [out] cComponentName
-        pointer to a null terminated string with the component name.  The
-        names of the components are strings less than 127 bytes in length
-        plus the trailing null for a maximum size of 128 bytes.  An example 
-        of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are 
-        assigned by the vendor, but shall start with "OMX." and then have 
-        the Vendor designation next.
-    @param [in] nNameLength
-        number of characters in the cComponentName string.  With all 
-        component name strings restricted to less than 128 characters 
-        (including the trailing null) it is recomended that the caller
-        provide a input string for the cComponentName of 128 characters.
-    @param [in] nIndex
-        number containing the enumeration index for the component. 
-        Multiple calls to OMX_ComponentNameEnum with increasing values
-        of nIndex will enumerate through the component names in the
-        system until OMX_ErrorNoMore is returned.  The value of nIndex
-        is 0 to (N-1), where N is the number of valid installed components
-        in the system.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  When the value of nIndex exceeds the number of 
-        components in the system minus 1, OMX_ErrorNoMore will be
-        returned. Otherwise the appropriate OMX error will be returned.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
-    OMX_OUT OMX_STRING cComponentName,
-    OMX_IN  OMX_U32 nNameLength,
-    OMX_IN  OMX_U32 nIndex);
-
-
-/** The OMX_GetHandle method will locate the component specified by the
-    component name given, load that component into memory and then invoke
-    the component's methods to create an instance of the component.  
-    
-    The core should return from this call within 20 msec.
-    
-    @param [out] pHandle
-        pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
-    @param [in] cComponentName
-        pointer to a null terminated string with the component name.  The
-        names of the components are strings less than 127 bytes in length
-        plus the trailing null for a maximum size of 128 bytes.  An example 
-        of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are 
-        assigned by the vendor, but shall start with "OMX." and then have 
-        the Vendor designation next.
-    @param [in] pAppData
-        pointer to an application defined value that will be returned
-        during callbacks so that the application can identify the source
-        of the callback.
-    @param [in] pCallBacks
-        pointer to a OMX_CALLBACKTYPE structure that will be passed to the
-        component to initialize it with.  
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
-    OMX_OUT OMX_HANDLETYPE* pHandle, 
-    OMX_IN  OMX_STRING cComponentName,
-    OMX_IN  OMX_PTR pAppData,
-    OMX_IN  OMX_CALLBACKTYPE* pCallBacks);
-
-
-/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle 
-    method.  If the component reference count goes to zero, the component will
-    be unloaded from memory.  
-    
-    The core should return from this call within 20 msec when the component is 
-    in the OMX_StateLoaded state.
-
-    @param [in] hComponent
-        Handle of the component to be accessed.  This is the component
-        handle returned by the call to the GetHandle function.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
-    OMX_IN  OMX_HANDLETYPE hComponent);
-
-
-
-/** The OMX_SetupTunnel method will handle the necessary calls to the components
-    to setup the specified tunnel the two components.  NOTE: This is
-    an actual method (not a #define macro).  This method will make calls into
-    the component ComponentTunnelRequest method to do the actual tunnel 
-    connection.  
-
-    The ComponentTunnelRequest method on both components will be called. 
-    This method shall not be called unless the component is in the 
-    OMX_StateLoaded state except when the ports used for the tunnel are
-    disabled. In this case, the component may be in the OMX_StateExecuting,
-    OMX_StatePause, or OMX_StateIdle states. 
-
-    The core should return from this call within 20 msec.
-    
-    @param [in] hOutput
-        Handle of the component to be accessed.  Also this is the handle
-        of the component whose port, specified in the nPortOutput parameter
-        will be used the source for the tunnel. This is the component handle
-        returned by the call to the OMX_GetHandle function.  There is a 
-        requirement that hOutput be the source for the data when
-        tunelling (i.e. nPortOutput is an output port).  If 0x0, the component
-        specified in hInput will have it's port specified in nPortInput
-        setup for communication with the application / IL client.
-    @param [in] nPortOutput
-        nPortOutput is used to select the source port on component to be
-        used in the tunnel. 
-    @param [in] hInput
-        This is the component to setup the tunnel with. This is the handle
-        of the component whose port, specified in the nPortInput parameter
-        will be used the destination for the tunnel. This is the component handle
-        returned by the call to the OMX_GetHandle function.  There is a 
-        requirement that hInput be the destination for the data when
-        tunelling (i.e. nPortInut is an input port).   If 0x0, the component
-        specified in hOutput will have it's port specified in nPortPOutput
-        setup for communication with the application / IL client.
-    @param [in] nPortInput
-        nPortInput is used to select the destination port on component to be
-        used in the tunnel.
-    @return OMX_ERRORTYPE
-        If the command successfully executes, the return code will be
-        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
-        When OMX_ErrorNotImplemented is returned, one or both components is 
-        a non-interop component and does not support tunneling.
-        
-        On failure, the ports of both components are setup for communication
-        with the application / IL Client.
-    @ingroup core tun
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
-    OMX_IN  OMX_HANDLETYPE hOutput,
-    OMX_IN  OMX_U32 nPortOutput,
-    OMX_IN  OMX_HANDLETYPE hInput,
-    OMX_IN  OMX_U32 nPortInput);
-    
-/** @ingroup cp */
-OMX_API OMX_ERRORTYPE   OMX_GetContentPipe(
-    OMX_OUT OMX_HANDLETYPE *hPipe,
-    OMX_IN OMX_STRING szURI);
-
-/** The OMX_GetComponentsOfRole method will return the number of components that support the given
-    role and (if the compNames field is non-NULL) the names of those components. The call will fail if 
-    an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
-    client should:
-        * first call this function with the compNames field NULL to determine the number of component names
-        * second call this function with the compNames field pointing to an array of names allocated 
-          according to the number returned by the first call.
-
-    The core should return from this call within 5 msec.
-    
-    @param [in] role
-        This is generic standard component name consisting only of component class 
-        name and the type within that class (e.g. 'audio_decoder.aac').
-    @param [inout] pNumComps
-        This is used both as input and output. 
- 
-        If compNames is NULL, the input is ignored and the output specifies how many components support
-        the given role.
-     
-        If compNames is not NULL, on input it bounds the size of the input structure and 
-        on output, it specifies the number of components string names listed within the compNames parameter.
-    @param [inout] compNames
-        If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts 
-        a list of the names of all physical components that implement the specified standard component name. 
-        Each name is NULL terminated. numComps indicates the number of names.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( 
-	OMX_IN      OMX_STRING role,
-    OMX_INOUT   OMX_U32 *pNumComps,
-    OMX_INOUT   OMX_U8  **compNames);
-
-/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
-    component and (if the roles field is non-NULL) the names of those roles. The call will fail if 
-    an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
-    client should:
-        * first call this function with the roles field NULL to determine the number of role names
-        * second call this function with the roles field pointing to an array of names allocated 
-          according to the number returned by the first call.
-
-    The core should return from this call within 5 msec.
-
-    @param [in] compName
-        This is the name of the component being queried about.
-    @param [inout] pNumRoles
-        This is used both as input and output. 
- 
-        If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
-     
-        If compNames is not NULL, on input it bounds the size of the input structure and 
-        on output, it specifies the number of roles string names listed within the roles parameter.
-    @param [out] roles
-        If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings 
-        which accepts a list of the names of all standard components roles implemented on the 
-        specified component name. numComps indicates the number of names.
-    @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( 
-	OMX_IN      OMX_STRING compName, 
-    OMX_INOUT   OMX_U32 *pNumRoles,
-    OMX_OUT     OMX_U8 **roles);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/media/stagefright/openmax/OMX_IVCommon.h b/include/media/stagefright/openmax/OMX_IVCommon.h
deleted file mode 100644
index 8bb4ded..0000000
--- a/include/media/stagefright/openmax/OMX_IVCommon.h
+++ /dev/null
@@ -1,947 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * @file OMX_IVCommon.h - OpenMax IL version 1.1.2
- *  The structures needed by Video and Image components to exchange
- *  parameters and configuration data with the components.
- */
-#ifndef OMX_IVCommon_h
-#define OMX_IVCommon_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * Each OMX header must include all required header files to allow the header
- * to compile without errors.  The includes below are required for this header
- * file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup iv OpenMAX IL Imaging and Video Domain
- * Common structures for OpenMAX IL Imaging and Video domains
- * @{
- */
-
-
-/**
- * Enumeration defining possible uncompressed image/video formats.
- *
- * ENUMS:
- *  Unused                 : Placeholder value when format is N/A
- *  Monochrome             : black and white
- *  8bitRGB332             : Red 7:5, Green 4:2, Blue 1:0
- *  12bitRGB444            : Red 11:8, Green 7:4, Blue 3:0
- *  16bitARGB4444          : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
- *  16bitARGB1555          : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
- *  16bitRGB565            : Red 15:11, Green 10:5, Blue 4:0
- *  16bitBGR565            : Blue 15:11, Green 10:5, Red 4:0
- *  18bitRGB666            : Red 17:12, Green 11:6, Blue 5:0
- *  18bitARGB1665          : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
- *  19bitARGB1666          : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
- *  24bitRGB888            : Red 24:16, Green 15:8, Blue 7:0
- *  24bitBGR888            : Blue 24:16, Green 15:8, Red 7:0
- *  24bitARGB1887          : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
- *  25bitARGB1888          : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
- *  32bitBGRA8888          : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
- *  32bitARGB8888          : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
- *  YUV411Planar           : U,Y are subsampled by a factor of 4 horizontally
- *  YUV411PackedPlanar     : packed per payload in planar slices
- *  YUV420Planar           : Three arrays Y,U,V.
- *  YUV420PackedPlanar     : packed per payload in planar slices
- *  YUV420SemiPlanar       : Two arrays, one is all Y, the other is U and V
- *  YUV422Planar           : Three arrays Y,U,V.
- *  YUV422PackedPlanar     : packed per payload in planar slices
- *  YUV422SemiPlanar       : Two arrays, one is all Y, the other is U and V
- *  YCbYCr                 : Organized as 16bit YUYV (i.e. YCbYCr)
- *  YCrYCb                 : Organized as 16bit YVYU (i.e. YCrYCb)
- *  CbYCrY                 : Organized as 16bit UYVY (i.e. CbYCrY)
- *  CrYCbY                 : Organized as 16bit VYUY (i.e. CrYCbY)
- *  YUV444Interleaved      : Each pixel contains equal parts YUV
- *  RawBayer8bit           : SMIA camera output format
- *  RawBayer10bit          : SMIA camera output format
- *  RawBayer8bitcompressed : SMIA camera output format
- */
-typedef enum OMX_COLOR_FORMATTYPE {
-    OMX_COLOR_FormatUnused,
-    OMX_COLOR_FormatMonochrome,
-    OMX_COLOR_Format8bitRGB332,
-    OMX_COLOR_Format12bitRGB444,
-    OMX_COLOR_Format16bitARGB4444,
-    OMX_COLOR_Format16bitARGB1555,
-    OMX_COLOR_Format16bitRGB565,
-    OMX_COLOR_Format16bitBGR565,
-    OMX_COLOR_Format18bitRGB666,
-    OMX_COLOR_Format18bitARGB1665,
-    OMX_COLOR_Format19bitARGB1666,
-    OMX_COLOR_Format24bitRGB888,
-    OMX_COLOR_Format24bitBGR888,
-    OMX_COLOR_Format24bitARGB1887,
-    OMX_COLOR_Format25bitARGB1888,
-    OMX_COLOR_Format32bitBGRA8888,
-    OMX_COLOR_Format32bitARGB8888,
-    OMX_COLOR_FormatYUV411Planar,
-    OMX_COLOR_FormatYUV411PackedPlanar,
-    OMX_COLOR_FormatYUV420Planar,
-    OMX_COLOR_FormatYUV420PackedPlanar,
-    OMX_COLOR_FormatYUV420SemiPlanar,
-    OMX_COLOR_FormatYUV422Planar,
-    OMX_COLOR_FormatYUV422PackedPlanar,
-    OMX_COLOR_FormatYUV422SemiPlanar,
-    OMX_COLOR_FormatYCbYCr,
-    OMX_COLOR_FormatYCrYCb,
-    OMX_COLOR_FormatCbYCrY,
-    OMX_COLOR_FormatCrYCbY,
-    OMX_COLOR_FormatYUV444Interleaved,
-    OMX_COLOR_FormatRawBayer8bit,
-    OMX_COLOR_FormatRawBayer10bit,
-    OMX_COLOR_FormatRawBayer8bitcompressed,
-    OMX_COLOR_FormatL2,
-    OMX_COLOR_FormatL4,
-    OMX_COLOR_FormatL8,
-    OMX_COLOR_FormatL16,
-    OMX_COLOR_FormatL24,
-    OMX_COLOR_FormatL32,
-    OMX_COLOR_FormatYUV420PackedSemiPlanar,
-    OMX_COLOR_FormatYUV422PackedSemiPlanar,
-    OMX_COLOR_Format18BitBGR666,
-    OMX_COLOR_Format24BitARGB6666,
-    OMX_COLOR_Format24BitABGR6666,
-    OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    /**<Reserved android opaque colorformat. Tells the encoder that
-     * the actual colorformat will be  relayed by the
-     * Gralloc Buffers.
-     * FIXME: In the process of reserving some enum values for
-     * Android-specific OMX IL colorformats. Change this enum to
-     * an acceptable range once that is done.
-     * */
-    OMX_COLOR_FormatAndroidOpaque = 0x7F000789,
-    OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
-    OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
-    OMX_COLOR_FormatMax = 0x7FFFFFFF
-} OMX_COLOR_FORMATTYPE;
-
-
-/**
- * Defines the matrix for conversion from RGB to YUV or vice versa.
- * iColorMatrix should be initialized with the fixed point values
- * used in converting between formats.
- */
-typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
-    OMX_U32 nSize;              /**< Size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version info */
-    OMX_U32 nPortIndex;         /**< Port that this struct applies to */
-    OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
-    OMX_S32 xColorOffset[4];    /**< Stored in signed Q16 format */
-}OMX_CONFIG_COLORCONVERSIONTYPE;
-
-
-/**
- * Structure defining percent to scale each frame dimension.  For example:
- * To make the width 50% larger, use fWidth = 1.5 and to make the width
- * 1/2 the original size, use fWidth = 0.5
- */
-typedef struct OMX_CONFIG_SCALEFACTORTYPE {
-    OMX_U32 nSize;            /**< Size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
-    OMX_U32 nPortIndex;       /**< Port that this struct applies to */
-    OMX_S32 xWidth;           /**< Fixed point value stored as Q16 */
-    OMX_S32 xHeight;          /**< Fixed point value stored as Q16 */
-}OMX_CONFIG_SCALEFACTORTYPE;
-
-
-/**
- * Enumeration of possible image filter types
- */
-typedef enum OMX_IMAGEFILTERTYPE {
-    OMX_ImageFilterNone,
-    OMX_ImageFilterNoise,
-    OMX_ImageFilterEmboss,
-    OMX_ImageFilterNegative,
-    OMX_ImageFilterSketch,
-    OMX_ImageFilterOilPaint,
-    OMX_ImageFilterHatch,
-    OMX_ImageFilterGpen,
-    OMX_ImageFilterAntialias,
-    OMX_ImageFilterDeRing,
-    OMX_ImageFilterSolarize,
-    OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_ImageFilterMax = 0x7FFFFFFF
-} OMX_IMAGEFILTERTYPE;
-
-
-/**
- * Image filter configuration
- *
- * STRUCT MEMBERS:
- *  nSize        : Size of the structure in bytes
- *  nVersion     : OMX specification version information
- *  nPortIndex   : Port that this structure applies to
- *  eImageFilter : Image filter type enumeration
- */
-typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_IMAGEFILTERTYPE eImageFilter;
-} OMX_CONFIG_IMAGEFILTERTYPE;
-
-
-/**
- * Customized U and V for color enhancement
- *
- * STRUCT MEMBERS:
- *  nSize             : Size of the structure in bytes
- *  nVersion          : OMX specification version information
- *  nPortIndex        : Port that this structure applies to
- *  bColorEnhancement : Enable/disable color enhancement
- *  nCustomizedU      : Practical values: 16-240, range: 0-255, value set for
- *                      U component
- *  nCustomizedV      : Practical values: 16-240, range: 0-255, value set for
- *                      V component
- */
-typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bColorEnhancement;
-    OMX_U8 nCustomizedU;
-    OMX_U8 nCustomizedV;
-} OMX_CONFIG_COLORENHANCEMENTTYPE;
-
-
-/**
- * Define color key and color key mask
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nARGBColor : 32bit Alpha, Red, Green, Blue Color
- *  nARGBMask  : 32bit Mask for Alpha, Red, Green, Blue channels
- */
-typedef struct OMX_CONFIG_COLORKEYTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nARGBColor;
-    OMX_U32 nARGBMask;
-} OMX_CONFIG_COLORKEYTYPE;
-
-
-/**
- * List of color blend types for pre/post processing
- *
- * ENUMS:
- *  None          : No color blending present
- *  AlphaConstant : Function is (alpha_constant * src) +
- *                  (1 - alpha_constant) * dst)
- *  AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
- *  Alternate     : Function is alternating pixels from src and dst
- *  And           : Function is (src & dst)
- *  Or            : Function is (src | dst)
- *  Invert        : Function is ~src
- */
-typedef enum OMX_COLORBLENDTYPE {
-    OMX_ColorBlendNone,
-    OMX_ColorBlendAlphaConstant,
-    OMX_ColorBlendAlphaPerPixel,
-    OMX_ColorBlendAlternate,
-    OMX_ColorBlendAnd,
-    OMX_ColorBlendOr,
-    OMX_ColorBlendInvert,
-    OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_ColorBlendMax = 0x7FFFFFFF
-} OMX_COLORBLENDTYPE;
-
-
-/**
- * Color blend configuration
- *
- * STRUCT MEMBERS:
- *  nSize             : Size of the structure in bytes
- *  nVersion          : OMX specification version information
- *  nPortIndex        : Port that this structure applies to
- *  nRGBAlphaConstant : Constant global alpha values when global alpha is used
- *  eColorBlend       : Color blend type enumeration
- */
-typedef struct OMX_CONFIG_COLORBLENDTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nRGBAlphaConstant;
-    OMX_COLORBLENDTYPE  eColorBlend;
-} OMX_CONFIG_COLORBLENDTYPE;
-
-
-/**
- * Hold frame dimension
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nWidth     : Frame width in pixels
- *  nHeight    : Frame height in pixels
- */
-typedef struct OMX_FRAMESIZETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nWidth;
-    OMX_U32 nHeight;
-} OMX_FRAMESIZETYPE;
-
-
-/**
- * Rotation configuration
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nRotation  : +/- integer rotation value
- */
-typedef struct OMX_CONFIG_ROTATIONTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nRotation;
-} OMX_CONFIG_ROTATIONTYPE;
-
-
-/**
- * Possible mirroring directions for pre/post processing
- *
- * ENUMS:
- *  None       : No mirroring
- *  Vertical   : Vertical mirroring, flip on X axis
- *  Horizontal : Horizontal mirroring, flip on Y axis
- *  Both       : Both vertical and horizontal mirroring
- */
-typedef enum OMX_MIRRORTYPE {
-    OMX_MirrorNone = 0,
-    OMX_MirrorVertical,
-    OMX_MirrorHorizontal,
-    OMX_MirrorBoth,
-    OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_MirrorMax = 0x7FFFFFFF
-} OMX_MIRRORTYPE;
-
-
-/**
- * Mirroring configuration
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  eMirror    : Mirror type enumeration
- */
-typedef struct OMX_CONFIG_MIRRORTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_MIRRORTYPE  eMirror;
-} OMX_CONFIG_MIRRORTYPE;
-
-
-/**
- * Position information only
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nX         : X coordinate for the point
- *  nY         : Y coordinate for the point
- */
-typedef struct OMX_CONFIG_POINTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nX;
-    OMX_S32 nY;
-} OMX_CONFIG_POINTTYPE;
-
-
-/**
- * Frame size plus position
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nLeft      : X Coordinate of the top left corner of the rectangle
- *  nTop       : Y Coordinate of the top left corner of the rectangle
- *  nWidth     : Width of the rectangle
- *  nHeight    : Height of the rectangle
- */
-typedef struct OMX_CONFIG_RECTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nLeft;
-    OMX_S32 nTop;
-    OMX_U32 nWidth;
-    OMX_U32 nHeight;
-} OMX_CONFIG_RECTTYPE;
-
-
-/**
- * Deblocking state; it is required to be set up before starting the codec
- *
- * STRUCT MEMBERS:
- *  nSize       : Size of the structure in bytes
- *  nVersion    : OMX specification version information
- *  nPortIndex  : Port that this structure applies to
- *  bDeblocking : Enable/disable deblocking mode
- */
-typedef struct OMX_PARAM_DEBLOCKINGTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bDeblocking;
-} OMX_PARAM_DEBLOCKINGTYPE;
-
-
-/**
- * Stabilization state
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  bStab      : Enable/disable frame stabilization state
- */
-typedef struct OMX_CONFIG_FRAMESTABTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bStab;
-} OMX_CONFIG_FRAMESTABTYPE;
-
-
-/**
- * White Balance control type
- *
- * STRUCT MEMBERS:
- *  SunLight : Referenced in JSR-234
- *  Flash    : Optimal for device's integrated flash
- */
-typedef enum OMX_WHITEBALCONTROLTYPE {
-    OMX_WhiteBalControlOff = 0,
-    OMX_WhiteBalControlAuto,
-    OMX_WhiteBalControlSunLight,
-    OMX_WhiteBalControlCloudy,
-    OMX_WhiteBalControlShade,
-    OMX_WhiteBalControlTungsten,
-    OMX_WhiteBalControlFluorescent,
-    OMX_WhiteBalControlIncandescent,
-    OMX_WhiteBalControlFlash,
-    OMX_WhiteBalControlHorizon,
-    OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_WhiteBalControlMax = 0x7FFFFFFF
-} OMX_WHITEBALCONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- *  nSize            : Size of the structure in bytes
- *  nVersion         : OMX specification version information
- *  nPortIndex       : Port that this structure applies to
- *  eWhiteBalControl : White balance enumeration
- */
-typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
-} OMX_CONFIG_WHITEBALCONTROLTYPE;
-
-
-/**
- * Exposure control type
- */
-typedef enum OMX_EXPOSURECONTROLTYPE {
-    OMX_ExposureControlOff = 0,
-    OMX_ExposureControlAuto,
-    OMX_ExposureControlNight,
-    OMX_ExposureControlBackLight,
-    OMX_ExposureControlSpotLight,
-    OMX_ExposureControlSports,
-    OMX_ExposureControlSnow,
-    OMX_ExposureControlBeach,
-    OMX_ExposureControlLargeAperture,
-    OMX_ExposureControlSmallApperture,
-    OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_ExposureControlMax = 0x7FFFFFFF
-} OMX_EXPOSURECONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- *  nSize            : Size of the structure in bytes
- *  nVersion         : OMX specification version information
- *  nPortIndex       : Port that this structure applies to
- *  eExposureControl : Exposure control enumeration
- */
-typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_EXPOSURECONTROLTYPE eExposureControl;
-} OMX_CONFIG_EXPOSURECONTROLTYPE;
-
-
-/**
- * Defines sensor supported mode.
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nFrameRate : Single shot mode is indicated by a 0
- *  bOneShot   : Enable for single shot, disable for streaming
- *  sFrameSize : Framesize
- */
-typedef struct OMX_PARAM_SENSORMODETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nFrameRate;
-    OMX_BOOL bOneShot;
-    OMX_FRAMESIZETYPE sFrameSize;
-} OMX_PARAM_SENSORMODETYPE;
-
-
-/**
- * Defines contrast level
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nContrast  : Values allowed for contrast -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_CONTRASTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nContrast;
-} OMX_CONFIG_CONTRASTTYPE;
-
-
-/**
- * Defines brightness level
- *
- * STRUCT MEMBERS:
- *  nSize       : Size of the structure in bytes
- *  nVersion    : OMX specification version information
- *  nPortIndex  : Port that this structure applies to
- *  nBrightness : 0-100%
- */
-typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nBrightness;
-} OMX_CONFIG_BRIGHTNESSTYPE;
-
-
-/**
- * Defines backlight level configuration for a video sink, e.g. LCD panel
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nBacklight : Values allowed for backlight 0-100%
- *  nTimeout   : Number of milliseconds before backlight automatically turns
- *               off.  A value of 0x0 disables backight timeout
- */
-typedef struct OMX_CONFIG_BACKLIGHTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nBacklight;
-    OMX_U32 nTimeout;
-} OMX_CONFIG_BACKLIGHTTYPE;
-
-
-/**
- * Defines setting for Gamma
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nGamma     : Values allowed for gamma -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_GAMMATYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nGamma;
-} OMX_CONFIG_GAMMATYPE;
-
-
-/**
- * Define for setting saturation
- *
- * STRUCT MEMBERS:
- *  nSize       : Size of the structure in bytes
- *  nVersion    : OMX specification version information
- *  nPortIndex  : Port that this structure applies to
- *  nSaturation : Values allowed for saturation -100 to 100, zero means
- *                no change
- */
-typedef struct OMX_CONFIG_SATURATIONTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nSaturation;
-} OMX_CONFIG_SATURATIONTYPE;
-
-
-/**
- * Define for setting Lightness
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nLightness : Values allowed for lightness -100 to 100, zero means no
- *               change
- */
-typedef struct OMX_CONFIG_LIGHTNESSTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_S32 nLightness;
-} OMX_CONFIG_LIGHTNESSTYPE;
-
-
-/**
- * Plane blend configuration
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Index of input port associated with the plane.
- *  nDepth     : Depth of the plane in relation to the screen. Higher
- *               numbered depths are "behind" lower number depths.
- *               This number defaults to the Port Index number.
- *  nAlpha     : Transparency blending component for the entire plane.
- *               See blending modes for more detail.
- */
-typedef struct OMX_CONFIG_PLANEBLENDTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nDepth;
-    OMX_U32 nAlpha;
-} OMX_CONFIG_PLANEBLENDTYPE;
-
-
-/**
- * Define interlace type
- *
- * STRUCT MEMBERS:
- *  nSize                 : Size of the structure in bytes
- *  nVersion              : OMX specification version information
- *  nPortIndex            : Port that this structure applies to
- *  bEnable               : Enable control variable for this functionality
- *                          (see below)
- *  nInterleavePortIndex  : Index of input or output port associated with
- *                          the interleaved plane.
- *  pPlanarPortIndexes[4] : Index of input or output planar ports.
- */
-typedef struct OMX_PARAM_INTERLEAVETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bEnable;
-    OMX_U32 nInterleavePortIndex;
-} OMX_PARAM_INTERLEAVETYPE;
-
-
-/**
- * Defines the picture effect used for an input picture
- */
-typedef enum OMX_TRANSITIONEFFECTTYPE {
-    OMX_EffectNone,
-    OMX_EffectFadeFromBlack,
-    OMX_EffectFadeToBlack,
-    OMX_EffectUnspecifiedThroughConstantColor,
-    OMX_EffectDissolve,
-    OMX_EffectWipe,
-    OMX_EffectUnspecifiedMixOfTwoScenes,
-    OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_EffectMax = 0x7FFFFFFF
-} OMX_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Structure used to configure current transition effect
- *
- * STRUCT MEMBERS:
- * nSize      : Size of the structure in bytes
- * nVersion   : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eEffect    : Effect to enable
- */
-typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_TRANSITIONEFFECTTYPE eEffect;
-} OMX_CONFIG_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Defines possible data unit types for encoded video data. The data unit
- * types are used both for encoded video input for playback as well as
- * encoded video output from recording.
- */
-typedef enum OMX_DATAUNITTYPE {
-    OMX_DataUnitCodedPicture,
-    OMX_DataUnitVideoSegment,
-    OMX_DataUnitSeveralSegments,
-    OMX_DataUnitArbitraryStreamSection,
-    OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_DataUnitMax = 0x7FFFFFFF
-} OMX_DATAUNITTYPE;
-
-
-/**
- * Defines possible encapsulation types for coded video data unit. The
- * encapsulation information is used both for encoded video input for
- * playback as well as encoded video output from recording.
- */
-typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
-    OMX_DataEncapsulationElementaryStream,
-    OMX_DataEncapsulationGenericPayload,
-    OMX_DataEncapsulationRtpPayload,
-    OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_DataEncapsulationMax = 0x7FFFFFFF
-} OMX_DATAUNITENCAPSULATIONTYPE;
-
-
-/**
- * Structure used to configure the type of being decoded/encoded
- */
-typedef struct OMX_PARAM_DATAUNITTYPE {
-    OMX_U32 nSize;            /**< Size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
-    OMX_DATAUNITTYPE eUnitType;
-    OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
-} OMX_PARAM_DATAUNITTYPE;
-
-
-/**
- * Defines dither types
- */
-typedef enum OMX_DITHERTYPE {
-    OMX_DitherNone,
-    OMX_DitherOrdered,
-    OMX_DitherErrorDiffusion,
-    OMX_DitherOther,
-    OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_DitherMax = 0x7FFFFFFF
-} OMX_DITHERTYPE;
-
-
-/**
- * Structure used to configure current type of dithering
- */
-typedef struct OMX_CONFIG_DITHERTYPE {
-    OMX_U32 nSize;            /**< Size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
-    OMX_DITHERTYPE eDither;   /**< Type of dithering to use */
-} OMX_CONFIG_DITHERTYPE;
-
-typedef struct OMX_CONFIG_CAPTUREMODETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;     /**< Port that this structure applies to */
-    OMX_BOOL bContinuous;   /**< If true then ignore frame rate and emit capture
-                             *   data as fast as possible (otherwise obey port's frame rate). */
-    OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
-                             *   specified number of frames (otherwise the port does not
-                             *   terminate the capture until instructed to do so by the client).
-                             *   Even if set, the client may manually terminate the capture prior
-                             *   to reaching the limit. */
-    OMX_U32 nFrameLimit;      /**< Limit on number of frames emitted during a capture (only
-                               *   valid if bFrameLimited is set). */
-} OMX_CONFIG_CAPTUREMODETYPE;
-
-typedef enum OMX_METERINGTYPE {
-
-    OMX_MeteringModeAverage,     /**< Center-weighted average metering. */
-    OMX_MeteringModeSpot,  	      /**< Spot (partial) metering. */
-    OMX_MeteringModeMatrix,      /**< Matrix or evaluative metering. */
-
-    OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_EVModeMax = 0x7fffffff
-} OMX_METERINGTYPE;
-
-typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_METERINGTYPE eMetering;
-    OMX_S32 xEVCompensation;      /**< Fixed point value stored as Q16 */
-    OMX_U32 nApertureFNumber;     /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
-    OMX_BOOL bAutoAperture;		/**< Whether aperture number is defined automatically */
-    OMX_U32 nShutterSpeedMsec;    /**< Shutterspeed in milliseconds */
-    OMX_BOOL bAutoShutterSpeed;	/**< Whether shutter speed is defined automatically */
-    OMX_U32 nSensitivity;         /**< e.g. nSensitivity = 100 implies "ISO 100" */
-    OMX_BOOL bAutoSensitivity;	/**< Whether sensitivity is defined automatically */
-} OMX_CONFIG_EXPOSUREVALUETYPE;
-
-/**
- * Focus region configuration
- *
- * STRUCT MEMBERS:
- *  nSize           : Size of the structure in bytes
- *  nVersion        : OMX specification version information
- *  nPortIndex      : Port that this structure applies to
- *  bCenter         : Use center region as focus region of interest
- *  bLeft           : Use left region as focus region of interest
- *  bRight          : Use right region as focus region of interest
- *  bTop            : Use top region as focus region of interest
- *  bBottom         : Use bottom region as focus region of interest
- *  bTopLeft        : Use top left region as focus region of interest
- *  bTopRight       : Use top right region as focus region of interest
- *  bBottomLeft     : Use bottom left region as focus region of interest
- *  bBottomRight    : Use bottom right region as focus region of interest
- */
-typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bCenter;
-    OMX_BOOL bLeft;
-    OMX_BOOL bRight;
-    OMX_BOOL bTop;
-    OMX_BOOL bBottom;
-    OMX_BOOL bTopLeft;
-    OMX_BOOL bTopRight;
-    OMX_BOOL bBottomLeft;
-    OMX_BOOL bBottomRight;
-} OMX_CONFIG_FOCUSREGIONTYPE;
-
-/**
- * Focus Status type
- */
-typedef enum OMX_FOCUSSTATUSTYPE {
-    OMX_FocusStatusOff = 0,
-    OMX_FocusStatusRequest,
-    OMX_FocusStatusReached,
-    OMX_FocusStatusUnableToReach,
-    OMX_FocusStatusLost,
-    OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
-    OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_FocusStatusMax = 0x7FFFFFFF
-} OMX_FOCUSSTATUSTYPE;
-
-/**
- * Focus status configuration
- *
- * STRUCT MEMBERS:
- *  nSize               : Size of the structure in bytes
- *  nVersion            : OMX specification version information
- *  nPortIndex          : Port that this structure applies to
- *  eFocusStatus        : Specifies the focus status
- *  bCenterStatus       : Use center region as focus region of interest
- *  bLeftStatus         : Use left region as focus region of interest
- *  bRightStatus        : Use right region as focus region of interest
- *  bTopStatus          : Use top region as focus region of interest
- *  bBottomStatus       : Use bottom region as focus region of interest
- *  bTopLeftStatus      : Use top left region as focus region of interest
- *  bTopRightStatus     : Use top right region as focus region of interest
- *  bBottomLeftStatus   : Use bottom left region as focus region of interest
- *  bBottomRightStatus  : Use bottom right region as focus region of interest
- */
-typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_FOCUSSTATUSTYPE eFocusStatus;
-    OMX_BOOL bCenterStatus;
-    OMX_BOOL bLeftStatus;
-    OMX_BOOL bRightStatus;
-    OMX_BOOL bTopStatus;
-    OMX_BOOL bBottomStatus;
-    OMX_BOOL bTopLeftStatus;
-    OMX_BOOL bTopRightStatus;
-    OMX_BOOL bBottomLeftStatus;
-    OMX_BOOL bBottomRightStatus;
-} OMX_PARAM_FOCUSSTATUSTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Image.h b/include/media/stagefright/openmax/OMX_Image.h
deleted file mode 100644
index 42e39ec..0000000
--- a/include/media/stagefright/openmax/OMX_Image.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- */
-
-/** 
- * @file OMX_Image.h - OpenMax IL version 1.1.2
- * The structures needed by Image components to exchange parameters and 
- * configuration data with the components.
- */
-#ifndef OMX_Image_h
-#define OMX_Image_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the 
- * header to compile without errors.  The includes below are required  
- * for this header file to compile successfully 
- */
-
-#include <OMX_IVCommon.h>
-
-/** @defgroup imaging OpenMAX IL Imaging Domain
- * @ingroup iv
- * Structures for OpenMAX IL Imaging domain
- * @{
- */
-
-/** 
- * Enumeration used to define the possible image compression coding. 
- */
-typedef enum OMX_IMAGE_CODINGTYPE {
-    OMX_IMAGE_CodingUnused,      /**< Value when format is N/A */
-    OMX_IMAGE_CodingAutoDetect,  /**< Auto detection of image format */
-    OMX_IMAGE_CodingJPEG,        /**< JPEG/JFIF image format */
-    OMX_IMAGE_CodingJPEG2K,      /**< JPEG 2000 image format */
-    OMX_IMAGE_CodingEXIF,        /**< EXIF image format */
-    OMX_IMAGE_CodingTIFF,        /**< TIFF image format */
-    OMX_IMAGE_CodingGIF,         /**< Graphics image format */
-    OMX_IMAGE_CodingPNG,         /**< PNG image format */
-    OMX_IMAGE_CodingLZW,         /**< LZW image format */
-    OMX_IMAGE_CodingBMP,         /**< Windows Bitmap format */
-    OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_IMAGE_CodingMax = 0x7FFFFFFF
-} OMX_IMAGE_CODINGTYPE;
-
-
-/**
- * Data structure used to define an image path. The number of image paths 
- * for input and output will vary by type of the image component.  
- * 
- *  Input (aka Source) : Zero Inputs, one Output,
- *  Splitter           : One Input, 2 or more Outputs,
- *  Processing Element : One Input, one output,
- *  Mixer              : 2 or more inputs, one output,
- *  Output (aka Sink)  : One Input, zero outputs.
- * 
- * The PortDefinition structure is used to define all of the parameters 
- * necessary for the compliant component to setup an input or an output  
- * image path.  If additional vendor specific data is required, it should  
- * be transmitted to the component using the CustomCommand function.   
- * Compliant components will prepopulate this structure with optimal  
- * values during the OMX_GetParameter() command.
- *
- * STRUCT MEMBERS:
- *  cMIMEType             : MIME type of data for the port
- *  pNativeRender         : Platform specific reference for a display if a 
- *                          sync, otherwise this field is 0
- *  nFrameWidth           : Width of frame to be used on port if 
- *                          uncompressed format is used.  Use 0 for 
- *                          unknown, don't care or variable
- *  nFrameHeight          : Height of frame to be used on port if 
- *                          uncompressed format is used. Use 0 for 
- *                          unknown, don't care or variable
- *  nStride               : Number of bytes per span of an image (i.e. 
- *                          indicates the number of bytes to get from
- *                          span N to span N+1, where negative stride 
- *                          indicates the image is bottom up
- *  nSliceHeight          : Height used when encoding in slices
- *  bFlagErrorConcealment : Turns on error concealment if it is supported by 
- *                          the OMX component
- *  eCompressionFormat    : Compression format used in this instance of  
- *                          the component. When OMX_IMAGE_CodingUnused is 
- *                          specified, eColorFormat is valid
- *  eColorFormat          : Decompressed format used by this component
- *  pNativeWindow         : Platform specific reference for a window object if a 
- *                          display sink , otherwise this field is 0x0. 
- */
-typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
-    OMX_STRING cMIMEType;
-    OMX_NATIVE_DEVICETYPE pNativeRender;
-    OMX_U32 nFrameWidth; 
-    OMX_U32 nFrameHeight;
-    OMX_S32 nStride;     
-    OMX_U32 nSliceHeight;
-    OMX_BOOL bFlagErrorConcealment;
-    OMX_IMAGE_CODINGTYPE eCompressionFormat;
-    OMX_COLOR_FORMATTYPE eColorFormat;
-    OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_IMAGE_PORTDEFINITIONTYPE;
-
-
-/**  
- * Port format parameter.  This structure is used to enumerate the various 
- * data input/output format supported by the port.
- * 
- * STRUCT MEMBERS:
- *  nSize              : Size of the structure in bytes
- *  nVersion           : OMX specification version information
- *  nPortIndex         : Indicates which port to set
- *  nIndex             : Indicates the enumeration index for the format from 
- *                       0x0 to N-1
- *  eCompressionFormat : Compression format used in this instance of the 
- *                       component. When OMX_IMAGE_CodingUnused is specified, 
- *                       eColorFormat is valid
- *  eColorFormat       : Decompressed format used by this component
- */
-typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nIndex;
-    OMX_IMAGE_CODINGTYPE eCompressionFormat;
-    OMX_COLOR_FORMATTYPE eColorFormat;
-} OMX_IMAGE_PARAM_PORTFORMATTYPE;
-
-
-/** 
- * Flash control type 
- *
- * ENUMS
- *  Torch : Flash forced constantly on
- */
-typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
-    OMX_IMAGE_FlashControlOn = 0,
-    OMX_IMAGE_FlashControlOff,
-    OMX_IMAGE_FlashControlAuto,
-    OMX_IMAGE_FlashControlRedEyeReduction,
-    OMX_IMAGE_FlashControlFillin,
-    OMX_IMAGE_FlashControlTorch,
-    OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FLASHCONTROLTYPE;
-
-
-/** 
- * Flash control configuration 
- *
- * STRUCT MEMBERS:
- *  nSize         : Size of the structure in bytes
- *  nVersion      : OMX specification version information
- *  nPortIndex    : Port that this structure applies to
- *  eFlashControl : Flash control type
- */
-typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
-} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
-
-
-/** 
- * Focus control type 
- */
-typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
-    OMX_IMAGE_FocusControlOn = 0,
-    OMX_IMAGE_FocusControlOff,
-    OMX_IMAGE_FocusControlAuto,
-    OMX_IMAGE_FocusControlAutoLock,
-    OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FOCUSCONTROLTYPE;
-
- 
-/** 
- * Focus control configuration 
- *
- * STRUCT MEMBERS:
- *  nSize           : Size of the structure in bytes
- *  nVersion        : OMX specification version information
- *  nPortIndex      : Port that this structure applies to
- *  eFocusControl   : Focus control
- *  nFocusSteps     : Focus can take on values from 0 mm to infinity. 
- *                    Interest is only in number of steps over this range.
- *  nFocusStepIndex : Current focus step index
- */
-typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
-    OMX_U32 nFocusSteps;
-    OMX_U32 nFocusStepIndex;
-} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
-
-
-/** 
- * Q Factor for JPEG compression, which controls the tradeoff between image
- * quality and size.  Q Factor provides a more simple means of controlling
- * JPEG compression quality, without directly programming Quantization
- * tables for chroma and luma 
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes         
- *  nVersion   : OMX specification version information 
- *  nPortIndex : Port that this structure applies to 
- *  nQFactor   : JPEG Q factor value in the range of 1-100. A factor of 1 
- *               produces the smallest, worst quality images, and a factor 
- *               of 100 produces the largest, best quality images.  A 
- *               typical default is 75 for small good quality images               
- */
-typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
-    OMX_U32 nSize;            
-    OMX_VERSIONTYPE nVersion; 
-    OMX_U32 nPortIndex;       
-    OMX_U32 nQFactor;                                        
-} OMX_IMAGE_PARAM_QFACTORTYPE;
-
-/** 
- * Quantization table type 
- */
-
-typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
-    OMX_IMAGE_QuantizationTableLuma = 0,
-    OMX_IMAGE_QuantizationTableChroma,
-    OMX_IMAGE_QuantizationTableChromaCb,
-    OMX_IMAGE_QuantizationTableChromaCr,
-    OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
-} OMX_IMAGE_QUANTIZATIONTABLETYPE;
-
-/** 
- * JPEG quantization tables are used to determine DCT compression for
- * YUV data, as an alternative to specifying Q factor, providing exact 
- * control of compression 
- *
- * STRUCT MEMBERS:
- *  nSize                   : Size of the structure in bytes
- *  nVersion                : OMX specification version information 
- *  nPortIndex              : Port that this structure applies to
- *  eQuantizationTable      : Quantization table type
- *  nQuantizationMatrix[64] : JPEG quantization table of coefficients stored 
- *                            in increasing columns then by rows of data (i.e. 
- *                            row 1, ... row 8). Quantization values are in 
- *                            the range 0-255 and stored in linear order
- *                            (i.e. the component will zig-zag the 
- *                            quantization table data if required internally) 
- */
-typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
-    OMX_U8 nQuantizationMatrix[64];
-} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
-
-
-/** 
- * Huffman table type, the same Huffman table is applied for chroma and 
- * luma component 
- */
-typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
-    OMX_IMAGE_HuffmanTableAC = 0,
-    OMX_IMAGE_HuffmanTableDC,
-    OMX_IMAGE_HuffmanTableACLuma,
-    OMX_IMAGE_HuffmanTableACChroma,
-    OMX_IMAGE_HuffmanTableDCLuma,
-    OMX_IMAGE_HuffmanTableDCChroma,
-    OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
-} OMX_IMAGE_HUFFMANTABLETYPE;
-
-/** 
- * JPEG Huffman table 
- *
- * STRUCT MEMBERS:
- *  nSize                            : Size of the structure in bytes
- *  nVersion                         : OMX specification version information
- *  nPortIndex                       : Port that this structure applies to
- *  eHuffmanTable                    : Huffman table type
- *  nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each 
- *                                     possible length
- *  nHuffmanTable[256]               : 0-255, the size used for AC and DC 
- *                                     HuffmanTable are 16 and 162 
- */
-typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
-    OMX_U8 nNumberOfHuffmanCodeOfLength[16];
-    OMX_U8 nHuffmanTable[256];
-}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Index.h b/include/media/stagefright/openmax/OMX_Index.h
deleted file mode 100644
index c0b8d92..0000000
--- a/include/media/stagefright/openmax/OMX_Index.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** @file OMX_Index.h - OpenMax IL version 1.1.2
- *  The OMX_Index header file contains the definitions for both applications
- *  and components .
- */
-
-
-#ifndef OMX_Index_h
-#define OMX_Index_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- *  header to compile without errors.  The includes below are required
- *  for this header file to compile successfully 
- */
-#include <OMX_Types.h>
-
-
-/** The OMX_INDEXTYPE enumeration is used to select a structure when either
- *  getting or setting parameters and/or configuration data.  Each entry in 
- *  this enumeration maps to an OMX specified structure.  When the 
- *  OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
- *  are used, the second parameter will always be an entry from this enumeration
- *  and the third entry will be the structure shown in the comments for the entry.
- *  For example, if the application is initializing a cropping function, the 
- *  OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter 
- *  and would send a pointer to an initialized OMX_RECTTYPE structure as the 
- *  third parameter.
- *  
- *  The enumeration entries named with the OMX_Config prefix are sent using
- *  the OMX_SetConfig command and the enumeration entries named with the
- *  OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
- */
-typedef enum OMX_INDEXTYPE {
-
-    OMX_IndexComponentStartUnused = 0x01000000,
-    OMX_IndexParamPriorityMgmt,             /**< reference: OMX_PRIORITYMGMTTYPE */
-    OMX_IndexParamAudioInit,                /**< reference: OMX_PORT_PARAM_TYPE */
-    OMX_IndexParamImageInit,                /**< reference: OMX_PORT_PARAM_TYPE */
-    OMX_IndexParamVideoInit,                /**< reference: OMX_PORT_PARAM_TYPE */
-    OMX_IndexParamOtherInit,                /**< reference: OMX_PORT_PARAM_TYPE */
-    OMX_IndexParamNumAvailableStreams,      /**< reference: OMX_PARAM_U32TYPE */
-    OMX_IndexParamActiveStream,             /**< reference: OMX_PARAM_U32TYPE */
-    OMX_IndexParamSuspensionPolicy,         /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
-    OMX_IndexParamComponentSuspended,       /**< reference: OMX_PARAM_SUSPENSIONTYPE */
-    OMX_IndexConfigCapturing,               /**< reference: OMX_CONFIG_BOOLEANTYPE */ 
-    OMX_IndexConfigCaptureMode,             /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ 
-    OMX_IndexAutoPauseAfterCapture,         /**< reference: OMX_CONFIG_BOOLEANTYPE */ 
-    OMX_IndexParamContentURI,               /**< reference: OMX_PARAM_CONTENTURITYPE */
-    OMX_IndexParamCustomContentPipe,        /**< reference: OMX_PARAM_CONTENTPIPETYPE */ 
-    OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
-    OMX_IndexConfigMetadataItemCount,       /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
-    OMX_IndexConfigContainerNodeCount,      /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
-    OMX_IndexConfigMetadataItem,            /**< reference: OMX_CONFIG_METADATAITEMTYPE */
-    OMX_IndexConfigCounterNodeID,           /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
-    OMX_IndexParamMetadataFilterType,       /**< reference: OMX_PARAM_METADATAFILTERTYPE */
-    OMX_IndexParamMetadataKeyFilter,        /**< reference: OMX_PARAM_METADATAFILTERTYPE */
-    OMX_IndexConfigPriorityMgmt,            /**< reference: OMX_PRIORITYMGMTTYPE */
-    OMX_IndexParamStandardComponentRole,    /**< reference: OMX_PARAM_COMPONENTROLETYPE */
-
-    OMX_IndexPortStartUnused = 0x02000000,
-    OMX_IndexParamPortDefinition,           /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
-    OMX_IndexParamCompBufferSupplier,       /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ 
-    OMX_IndexReservedStartUnused = 0x03000000,
-
-    /* Audio parameters and configurations */
-    OMX_IndexAudioStartUnused = 0x04000000,
-    OMX_IndexParamAudioPortFormat,          /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
-    OMX_IndexParamAudioPcm,                 /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
-    OMX_IndexParamAudioAac,                 /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
-    OMX_IndexParamAudioRa,                  /**< reference: OMX_AUDIO_PARAM_RATYPE */
-    OMX_IndexParamAudioMp3,                 /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
-    OMX_IndexParamAudioAdpcm,               /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
-    OMX_IndexParamAudioG723,                /**< reference: OMX_AUDIO_PARAM_G723TYPE */
-    OMX_IndexParamAudioG729,                /**< reference: OMX_AUDIO_PARAM_G729TYPE */
-    OMX_IndexParamAudioAmr,                 /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
-    OMX_IndexParamAudioWma,                 /**< reference: OMX_AUDIO_PARAM_WMATYPE */
-    OMX_IndexParamAudioSbc,                 /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
-    OMX_IndexParamAudioMidi,                /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
-    OMX_IndexParamAudioGsm_FR,              /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
-    OMX_IndexParamAudioMidiLoadUserSound,   /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
-    OMX_IndexParamAudioG726,                /**< reference: OMX_AUDIO_PARAM_G726TYPE */
-    OMX_IndexParamAudioGsm_EFR,             /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
-    OMX_IndexParamAudioGsm_HR,              /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
-    OMX_IndexParamAudioPdc_FR,              /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
-    OMX_IndexParamAudioPdc_EFR,             /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
-    OMX_IndexParamAudioPdc_HR,              /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
-    OMX_IndexParamAudioTdma_FR,             /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
-    OMX_IndexParamAudioTdma_EFR,            /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
-    OMX_IndexParamAudioQcelp8,              /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
-    OMX_IndexParamAudioQcelp13,             /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
-    OMX_IndexParamAudioEvrc,                /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
-    OMX_IndexParamAudioSmv,                 /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
-    OMX_IndexParamAudioVorbis,              /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
-
-    OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
-    OMX_IndexConfigAudioMidiControl,        /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
-    OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
-    OMX_IndexConfigAudioMidiStatus,         /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
-    OMX_IndexConfigAudioMidiMetaEvent,      /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
-    OMX_IndexConfigAudioMidiMetaEventData,  /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
-    OMX_IndexConfigAudioVolume,             /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
-    OMX_IndexConfigAudioBalance,            /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
-    OMX_IndexConfigAudioChannelMute,        /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
-    OMX_IndexConfigAudioMute,               /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
-    OMX_IndexConfigAudioLoudness,           /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
-    OMX_IndexConfigAudioEchoCancelation,    /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
-    OMX_IndexConfigAudioNoiseReduction,     /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
-    OMX_IndexConfigAudioBass,               /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
-    OMX_IndexConfigAudioTreble,             /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
-    OMX_IndexConfigAudioStereoWidening,     /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
-    OMX_IndexConfigAudioChorus,             /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
-    OMX_IndexConfigAudioEqualizer,          /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
-    OMX_IndexConfigAudioReverberation,      /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
-    OMX_IndexConfigAudioChannelVolume,      /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
-
-    /* Image specific parameters and configurations */
-    OMX_IndexImageStartUnused = 0x05000000,
-    OMX_IndexParamImagePortFormat,          /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
-    OMX_IndexParamFlashControl,             /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
-    OMX_IndexConfigFocusControl,            /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
-    OMX_IndexParamQFactor,                  /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
-    OMX_IndexParamQuantizationTable,        /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
-    OMX_IndexParamHuffmanTable,             /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
-    OMX_IndexConfigFlashControl,            /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
-
-    /* Video specific parameters and configurations */
-    OMX_IndexVideoStartUnused = 0x06000000,
-    OMX_IndexParamVideoPortFormat,          /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
-    OMX_IndexParamVideoQuantization,        /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
-    OMX_IndexParamVideoFastUpdate,          /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
-    OMX_IndexParamVideoBitrate,             /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
-    OMX_IndexParamVideoMotionVector,        /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
-    OMX_IndexParamVideoIntraRefresh,        /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
-    OMX_IndexParamVideoErrorCorrection,     /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
-    OMX_IndexParamVideoVBSMC,               /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
-    OMX_IndexParamVideoMpeg2,               /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
-    OMX_IndexParamVideoMpeg4,               /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
-    OMX_IndexParamVideoWmv,                 /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
-    OMX_IndexParamVideoRv,                  /**< reference: OMX_VIDEO_PARAM_RVTYPE */
-    OMX_IndexParamVideoAvc,                 /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
-    OMX_IndexParamVideoH263,                /**< reference: OMX_VIDEO_PARAM_H263TYPE */
-    OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
-    OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
-    OMX_IndexConfigVideoBitrate,            /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
-    OMX_IndexConfigVideoFramerate,          /**< reference: OMX_CONFIG_FRAMERATETYPE */
-    OMX_IndexConfigVideoIntraVOPRefresh,    /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
-    OMX_IndexConfigVideoIntraMBRefresh,     /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
-    OMX_IndexConfigVideoMBErrorReporting,   /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
-    OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
-    OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
-    OMX_IndexParamVideoSliceFMO,            /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
-    OMX_IndexConfigVideoAVCIntraPeriod,     /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
-    OMX_IndexConfigVideoNalSize,            /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
-
-    /* Image & Video common Configurations */
-    OMX_IndexCommonStartUnused = 0x07000000,
-    OMX_IndexParamCommonDeblocking,         /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
-    OMX_IndexParamCommonSensorMode,         /**< reference: OMX_PARAM_SENSORMODETYPE */
-    OMX_IndexParamCommonInterleave,         /**< reference: OMX_PARAM_INTERLEAVETYPE */
-    OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
-    OMX_IndexConfigCommonScale,             /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
-    OMX_IndexConfigCommonImageFilter,       /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
-    OMX_IndexConfigCommonColorEnhancement,  /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
-    OMX_IndexConfigCommonColorKey,          /**< reference: OMX_CONFIG_COLORKEYTYPE */
-    OMX_IndexConfigCommonColorBlend,        /**< reference: OMX_CONFIG_COLORBLENDTYPE */
-    OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
-    OMX_IndexConfigCommonRotate,            /**< reference: OMX_CONFIG_ROTATIONTYPE */
-    OMX_IndexConfigCommonMirror,            /**< reference: OMX_CONFIG_MIRRORTYPE */
-    OMX_IndexConfigCommonOutputPosition,    /**< reference: OMX_CONFIG_POINTTYPE */
-    OMX_IndexConfigCommonInputCrop,         /**< reference: OMX_CONFIG_RECTTYPE */
-    OMX_IndexConfigCommonOutputCrop,        /**< reference: OMX_CONFIG_RECTTYPE */
-    OMX_IndexConfigCommonDigitalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
-    OMX_IndexConfigCommonOpticalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
-    OMX_IndexConfigCommonWhiteBalance,      /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
-    OMX_IndexConfigCommonExposure,          /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
-    OMX_IndexConfigCommonContrast,          /**< reference: OMX_CONFIG_CONTRASTTYPE */
-    OMX_IndexConfigCommonBrightness,        /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
-    OMX_IndexConfigCommonBacklight,         /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
-    OMX_IndexConfigCommonGamma,             /**< reference: OMX_CONFIG_GAMMATYPE */
-    OMX_IndexConfigCommonSaturation,        /**< reference: OMX_CONFIG_SATURATIONTYPE */
-    OMX_IndexConfigCommonLightness,         /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
-    OMX_IndexConfigCommonExclusionRect,     /**< reference: OMX_CONFIG_RECTTYPE */
-    OMX_IndexConfigCommonDithering,         /**< reference: OMX_CONFIG_DITHERTYPE */
-    OMX_IndexConfigCommonPlaneBlend,        /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
-    OMX_IndexConfigCommonExposureValue,     /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
-    OMX_IndexConfigCommonOutputSize,        /**< reference: OMX_FRAMESIZETYPE */
-    OMX_IndexParamCommonExtraQuantData,     /**< reference: OMX_OTHER_EXTRADATATYPE */
-    OMX_IndexConfigCommonFocusRegion,       /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
-    OMX_IndexConfigCommonFocusStatus,       /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
-    OMX_IndexConfigCommonTransitionEffect,  /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
-
-    /* Reserved Configuration range */
-    OMX_IndexOtherStartUnused = 0x08000000,
-    OMX_IndexParamOtherPortFormat,          /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
-    OMX_IndexConfigOtherPower,              /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
-    OMX_IndexConfigOtherStats,              /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
-
-
-    /* Reserved Time range */
-    OMX_IndexTimeStartUnused = 0x09000000,
-    OMX_IndexConfigTimeScale,               /**< reference: OMX_TIME_CONFIG_SCALETYPE */
-    OMX_IndexConfigTimeClockState,          /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
-    OMX_IndexConfigTimeActiveRefClock,      /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
-    OMX_IndexConfigTimeCurrentMediaTime,    /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
-    OMX_IndexConfigTimeCurrentWallTime,     /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
-    OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
-    OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
-    OMX_IndexConfigTimeMediaTimeRequest,    /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
-    OMX_IndexConfigTimeClientStartTime,     /**<reference:  OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
-    OMX_IndexConfigTimePosition,            /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
-    OMX_IndexConfigTimeSeekMode,            /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
-
-
-    OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    /* Vendor specific area */
-    OMX_IndexVendorStartUnused = 0x7F000000,
-    /* Vendor specific structures should be in the range of 0x7F000000 
-       to 0x7FFFFFFE.  This range is not broken out by vendor, so
-       private indexes are not guaranteed unique and therefore should
-       only be sent to the appropriate component. */
-
-    OMX_IndexMax = 0x7FFFFFFF
-
-} OMX_INDEXTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Other.h b/include/media/stagefright/openmax/OMX_Other.h
deleted file mode 100644
index efbce83..0000000
--- a/include/media/stagefright/openmax/OMX_Other.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** @file OMX_Other.h - OpenMax IL version 1.1.2
- *  The structures needed by Other components to exchange
- *  parameters and configuration data with the components.
- */
-
-#ifndef OMX_Other_h
-#define OMX_Other_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- *  header to compile without errors.  The includes below are required
- *  for this header file to compile successfully 
- */
-
-#include <OMX_Core.h>
-
-
-/** 
- * Enumeration of possible data types which match to multiple domains or no
- * domain at all.  For types which are vendor specific, a value above
- * OMX_OTHER_VENDORTSTART should be used.
- */
-typedef enum OMX_OTHER_FORMATTYPE {
-    OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, 
-                                   time deltas, etc */
-    OMX_OTHER_FormatPower,    /**< Perhaps used for enabling/disabling power 
-                                   management, setting clocks? */
-    OMX_OTHER_FormatStats,    /**< Could be things such as frame rate, frames 
-                                   dropped, etc */
-    OMX_OTHER_FormatBinary,   /**< Arbitrary binary data */
-    OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific 
-                                                formats */
-
-    OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_OTHER_FormatMax = 0x7FFFFFFF
-} OMX_OTHER_FORMATTYPE;
-
-/** 
- * Enumeration of seek modes.
- */
-typedef enum OMX_TIME_SEEKMODETYPE {
-    OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
-                                * of the requested seek position over   
-                                * the actual seek position if it
-                                * results in a faster seek. */
-    OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek 
-                                * position over an approximation
-                                * of the requested seek position even
-                                * if it results in a slower seek. */
-    OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_TIME_SeekModeMax = 0x7FFFFFFF
-} OMX_TIME_SEEKMODETYPE;
-
-/* Structure representing the seekmode of the component */
-typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
-    OMX_U32 nSize;                  /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
-    OMX_TIME_SEEKMODETYPE eType;    /**< The seek mode */
-} OMX_TIME_CONFIG_SEEKMODETYPE;
-
-/** Structure representing a time stamp used with the following configs 
- * on the Clock Component (CC):
- * 
- * OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall  
- *     time
- * OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media
- *     time
- * OMX_IndexConfigTimeCurrentAudioReference and  
- * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference 
- *     clock sending SC its reference time
- * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends 
- *     this structure to the Clock Component via a SetConfig on its 
- *     client port when it receives a buffer with
- *     OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
- *     specified by that buffer for nStartTimestamp. 
- *
- * It’s also used with the following config on components in general:
- *
- * OMX_IndexConfigTimePosition: IL client querying component position 
- * (GetConfig) or commanding a component to seek to the given location
- * (SetConfig)
- */	
-typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
-    OMX_U32 nSize;               /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;    /**< OMX specification version
-                                  *   information */
-    OMX_U32 nPortIndex;     /**< port that this structure applies to */
-    OMX_TICKS nTimestamp;  	     /**< timestamp .*/ 
-} OMX_TIME_CONFIG_TIMESTAMPTYPE;  
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_UPDATETYPE {
-      OMX_TIME_UpdateRequestFulfillment,    /**< Update is the fulfillment of a media time request. */
-      OMX_TIME_UpdateScaleChanged,	        /**< Update was generated because the scale chagned. */
-      OMX_TIME_UpdateClockStateChanged,     /**< Update was generated because the clock state changed. */
-      OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-      OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-      OMX_TIME_UpdateMax = 0x7FFFFFFF
-} OMX_TIME_UPDATETYPE;
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_REFCLOCKTYPE {
-      OMX_TIME_RefClockNone,    /**< Use no references. */
-      OMX_TIME_RefClockAudio,	/**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
-      OMX_TIME_RefClockVideo,   /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
-      OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-      OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-      OMX_TIME_RefClockMax = 0x7FFFFFFF
-} OMX_TIME_REFCLOCKTYPE;
-
-/** Enumeration of clock states. */
-typedef enum OMX_TIME_CLOCKSTATE {
-      OMX_TIME_ClockStateRunning,             /**< Clock running. */
-      OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the 
-                                               *   prescribed clients emit their
-                                               *   start time. */
-      OMX_TIME_ClockStateStopped,             /**< Clock stopped. */
-      OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-      OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-      OMX_TIME_ClockStateMax = 0x7FFFFFFF
-} OMX_TIME_CLOCKSTATE;
-
-/** Structure representing a media time request to the clock component.
- *
- *  A client component sends this structure to the Clock Component via a SetConfig
- *  on its client port to specify a media timestamp the Clock Component
- *  should emit.  The Clock Component should fulfill the request by sending a
- *  OMX_TIME_MEDIATIMETYPE when its media clock matches the requested 
- *  timestamp.
- *
- *  The client may require a media time request be fulfilled slightly
- *  earlier than the media time specified. In this case the client specifies 
- *  an offset which is equal to the difference between wall time corresponding 
- *  to the requested media time and the wall time when it will be 
- *  fulfilled. 
- *
- *  A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
- *  time events according to timestamps. If a client must perform an operation O at
- *  a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a 
- *  media time request at T (perhaps specifying an offset to ensure the request fulfillment
- *  is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
- *  structure back to the client component, the client may perform operation O (perhaps having
- *  to wait a slight amount more time itself as specified by the return values).
- */
-
-typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
-    OMX_U32 nPortIndex;         /**< port that this structure applies to */
-    OMX_PTR pClientPrivate;     /**< Client private data to disabiguate this media time 
-                                 *   from others (e.g. the number of the frame to deliver). 
-                                 *   Duplicated in the media time structure that fulfills 
-                                 *   this request. A value of zero is reserved for time scale 
-                                 *   updates. */
-    OMX_TICKS nMediaTimestamp;  /**< Media timestamp requested.*/ 
-    OMX_TICKS nOffset;          /**< Amount of wall clock time by which this
-                                 *   request should be fulfilled early */
-} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
-
-/**< Structure sent from the clock component client either when fulfilling 
- *   a media time request or when the time scale has changed. 
- *
- *   In the former case the Clock Component fills this structure and times its emission 
- *   to a client component (via the client port) according to the corresponding media 
- *   time request sent by the client. The Clock Component should time the emission to occur
- *   when the requested timestamp matches the Clock Component's media time but also the 
- *   prescribed offset early. 
- *
- *   Upon scale changes the clock component clears the nClientPrivate data, sends the current
- *   media time and sets the nScale to the new scale via the client port. It emits a 
- *   OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to 
- *   alter processing to accomodate scaling. For instance a video component might skip inter-frames 
- *   in the case of extreme fastforward. Likewise an audio component might add or remove samples 
- *   from an audio frame to scale audio data. 
- *
- *   It is expected that some clock components may not be able to fulfill requests
- *   at exactly the prescribed time. This is acceptable so long as the request is 
- *   fulfilled at least as early as described and not later. This structure provides 
- *   fields the client may use to wait for the remaining time.
- *
- *   The client may use either the nOffset or nWallTimeAtMedia fields to determine the 
- *   wall time until the nMediaTimestamp actually occurs. In the latter case the
- *   client can get a more accurate value for offset by getting the current wall
- *   from the cloc component and subtracting it from nWallTimeAtMedia. 
- */
-
-typedef struct OMX_TIME_MEDIATIMETYPE {
-    OMX_U32 nSize;                  /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
-    OMX_U32 nClientPrivate;         /**< Client private data to disabiguate this media time 
-                                     *   from others. Copied from the media time request. 
-                                     *   A value of zero is reserved for time scale updates. */
-    OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
-    OMX_TICKS nMediaTimestamp;      /**< Media time requested. If no media time was 
-                                     *   requested then this is the current media time. */ 
-    OMX_TICKS nOffset;              /**< Amount of wall clock time by which this
-                                     *   request was actually fulfilled early */
-
-    OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
-                                     *   A client may compare this value to current
-                                     *   media time obtained from the Clock Component to determine
-                                     *   the wall time until the media timestamp is really
-                                     *   current. */
-    OMX_S32 xScale;                 /**< Current media time scale in Q16 format. */
-    OMX_TIME_CLOCKSTATE eState;     /* Seeking Change. Added 7/12.*/
-                                    /**< State of the media time. */
-} OMX_TIME_MEDIATIMETYPE;  
-
-/** Structure representing the current media time scale factor. Applicable only to clock 
- *  component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
- *  the clock component client ports. Upon recieving this config the clock component changes 
- *  the rate by which the media time increases or decreases effectively implementing trick modes. 
- */ 
-typedef struct OMX_TIME_CONFIG_SCALETYPE {
-    OMX_U32 nSize;                  /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
-    OMX_S32 xScale;                 /**< This is a value in Q16 format which is used for
-                                     * scaling the media time */
-} OMX_TIME_CONFIG_SCALETYPE;
- 
-/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE’s nWaitMask field */
-#define OMX_CLOCKPORT0 0x00000001
-#define OMX_CLOCKPORT1 0x00000002
-#define OMX_CLOCKPORT2 0x00000004
-#define OMX_CLOCKPORT3 0x00000008
-#define OMX_CLOCKPORT4 0x00000010
-#define OMX_CLOCKPORT5 0x00000020
-#define OMX_CLOCKPORT6 0x00000040
-#define OMX_CLOCKPORT7 0x00000080
-
-/** Structure representing the current mode of the media clock. 
- *  IL Client uses this config to change or query the mode of the 
- *  media clock of the clock component. Applicable only to clock
- *  component. 
- *  
- *  On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
- *  starts immediately at the prescribed start time. If
- *  OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
- *  the given nStartTime and waits for all clients specified in the 
- *  nWaitMask to send starttimes (via 
- *  OMX_IndexConfigTimeClientStartTime). The Clock Component then starts 
- *  the media clock using the earliest start time supplied. */    
-typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
-    OMX_U32 nSize;              /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;   /**< OMX specification version 
-                                 *   information */
-    OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
-    OMX_TICKS nStartTime;       /**< Start time of the media time. */
-    OMX_TICKS nOffset;          /**< Time to offset the media time by 
-                                 * (e.g. preroll). Media time will be
-                                 * reported to be nOffset ticks earlier.     
-                                 */
-    OMX_U32 nWaitMask;          /**< Mask of OMX_CLOCKPORT values. */
-} OMX_TIME_CONFIG_CLOCKSTATETYPE;
-
-/** Structure representing the reference clock currently being used to
- *  compute media time. IL client uses this config to change or query the 
- *  clock component's active reference clock */
-typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
-    OMX_U32 nSize;                  /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
-    OMX_TIME_REFCLOCKTYPE eClock;   /**< Reference clock used to compute media time */                        
-} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
-
-/** Descriptor for setting specifics of power type.
- *  Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_POWERTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_BOOL bEnablePM;       /**< Flag to enable Power Management */
-} OMX_OTHER_CONFIG_POWERTYPE;
-
-
-/** Descriptor for setting specifics of stats type.
- *  Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_STATSTYPE {
-    OMX_U32 nSize;            /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    /* what goes here */
-} OMX_OTHER_CONFIG_STATSTYPE;
-
-
-/**
- * The PortDefinition structure is used to define all of the parameters 
- * necessary for the compliant component to setup an input or an output other 
- * path.
- */
-typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
-    OMX_OTHER_FORMATTYPE eFormat;  /**< Type of data expected for this channel */
-} OMX_OTHER_PORTDEFINITIONTYPE;
-
-/**  Port format parameter.  This structure is used to enumerate
-  *  the various data input/output format supported by the port.
-  */
-typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
-    OMX_U32 nSize; /**< size of the structure in bytes */
-    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
-    OMX_U32 nPortIndex; /**< Indicates which port to set */
-    OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
-    OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
-} OMX_OTHER_PARAM_PORTFORMATTYPE; 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Types.h b/include/media/stagefright/openmax/OMX_Types.h
deleted file mode 100644
index 03fd4bc..0000000
--- a/include/media/stagefright/openmax/OMX_Types.h
+++ /dev/null
@@ -1,365 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/*
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** OMX_Types.h - OpenMax IL version 1.1.2
- *  The OMX_Types header file contains the primitive type definitions used by 
- *  the core, the application and the component.  This file may need to be
- *  modified to be used on systems that do not have "char" set to 8 bits, 
- *  "short" set to 16 bits and "long" set to 32 bits.
- */
-
-#ifndef OMX_Types_h
-#define OMX_Types_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** The OMX_API and OMX_APIENTRY are platform specific definitions used
- *  to declare OMX function prototypes.  They are modified to meet the
- *  requirements for a particular platform */
-#ifdef __SYMBIAN32__   
-#   ifdef __OMX_EXPORTS
-#       define OMX_API __declspec(dllexport)
-#   else
-#       ifdef _WIN32
-#           define OMX_API __declspec(dllexport) 
-#       else
-#           define OMX_API __declspec(dllimport)
-#       endif
-#   endif
-#else
-#   ifdef _WIN32
-#      ifdef __OMX_EXPORTS
-#          define OMX_API __declspec(dllexport)
-#      else
-//#          define OMX_API __declspec(dllimport)
-#define OMX_API
-#      endif
-#   else
-#      ifdef __OMX_EXPORTS
-#          define OMX_API
-#      else
-#          define OMX_API extern
-#      endif
-#   endif
-#endif
-
-#ifndef OMX_APIENTRY
-#define OMX_APIENTRY 
-#endif 
-
-/** OMX_IN is used to identify inputs to an OMX function.  This designation 
-    will also be used in the case of a pointer that points to a parameter 
-    that is used as an output. */
-#ifndef OMX_IN
-#define OMX_IN
-#endif
-
-/** OMX_OUT is used to identify outputs from an OMX function.  This 
-    designation will also be used in the case of a pointer that points 
-    to a parameter that is used as an input. */
-#ifndef OMX_OUT
-#define OMX_OUT
-#endif
-
-
-/** OMX_INOUT is used to identify parameters that may be either inputs or
-    outputs from an OMX function at the same time.  This designation will 
-    also be used in the case of a pointer that  points to a parameter that 
-    is used both as an input and an output. */
-#ifndef OMX_INOUT
-#define OMX_INOUT
-#endif
-
-/** OMX_ALL is used to as a wildcard to select all entities of the same type
- *  when specifying the index, or referring to a object by an index.  (i.e.
- *  use OMX_ALL to indicate all N channels). When used as a port index
- *  for a config or parameter this OMX_ALL denotes that the config or
- *  parameter applies to the entire component not just one port. */
-#define OMX_ALL 0xFFFFFFFF
-
-/** In the following we define groups that help building doxygen documentation */
-
-/** @defgroup core OpenMAX IL core
- * Functions and structure related to the OMX IL core
- */
- 
- /** @defgroup comp OpenMAX IL component
- * Functions and structure related to the OMX IL component
- */
- 
-/** @defgroup rpm Resource and Policy Management 
- * Structures for resource and policy management of components
- */
-
-/** @defgroup buf Buffer Management
- * Buffer handling functions and structures
- */
-  
-/** @defgroup tun Tunneling
- * @ingroup core comp
- * Structures and functions to manage tunnels among component ports
- */
- 
-/** @defgroup cp Content Pipes
- *  @ingroup core
- */
- 
- /** @defgroup metadata Metadata handling
-  * 
-  */ 
-
-/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
-typedef unsigned char OMX_U8;
-
-/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
-typedef signed char OMX_S8;
-
-/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
-typedef unsigned short OMX_U16;
-
-/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
-typedef signed short OMX_S16;
-
-/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
-typedef unsigned long OMX_U32;
-
-/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
-typedef signed long OMX_S32;
-
-
-/* Users with compilers that cannot accept the "long long" designation should
-   define the OMX_SKIP64BIT macro.  It should be noted that this may cause 
-   some components to fail to compile if the component was written to require
-   64 bit integral types.  However, these components would NOT compile anyway
-   since the compiler does not support the way the component was written.
-*/
-#ifndef OMX_SKIP64BIT
-#ifdef __SYMBIAN32__
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#elif defined(WIN32)
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */   
-typedef unsigned __int64  OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed   __int64  OMX_S64;
-
-#else /* WIN32 */
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#endif /* WIN32 */
-#endif
-
-
-/** The OMX_BOOL type is intended to be used to represent a true or a false 
-    value when passing parameters to and from the OMX core and components.  The
-    OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
- */
-typedef enum OMX_BOOL {
-    OMX_FALSE = 0,
-    OMX_TRUE = !OMX_FALSE,
-    OMX_BOOL_MAX = 0x7FFFFFFF
-} OMX_BOOL; 
- 
-/** The OMX_PTR type is intended to be used to pass pointers between the OMX
-    applications and the OMX Core and components.  This is a 32 bit pointer and
-    is aligned on a 32 bit boundary.
- */
-typedef void* OMX_PTR;
-
-/** The OMX_STRING type is intended to be used to pass "C" type strings between
-    the application and the core and component.  The OMX_STRING type is a 32 
-    bit pointer to a zero terminated string.  The  pointer is word aligned and 
-    the string is byte aligned.  
- */
-typedef char* OMX_STRING;
-
-/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
-    buffers between the application and the component and core.  The OMX_BYTE 
-    type is a 32 bit pointer to a zero terminated string.  The  pointer is word
-    aligned and the string is byte aligned.
- */
-typedef unsigned char* OMX_BYTE;
-
-/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
-    at runtime.  This identifier should be generated by a component in a way
-    that guarantees that every instance of the identifier running on the system
-    is unique. */
-typedef unsigned char OMX_UUIDTYPE[128];
-
-/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
-    an output port.  This enumeration is common across all component types.    
- */
-typedef enum OMX_DIRTYPE
-{
-    OMX_DirInput,              /**< Port is an input port */
-    OMX_DirOutput,             /**< Port is an output port */
-    OMX_DirMax = 0x7FFFFFFF
-} OMX_DIRTYPE;
-
-/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering 
-    for numerical data (i.e. big endian, or little endian).    
- */
-typedef enum OMX_ENDIANTYPE
-{
-    OMX_EndianBig, /**< big endian */
-    OMX_EndianLittle, /**< little endian */
-    OMX_EndianMax = 0x7FFFFFFF
-} OMX_ENDIANTYPE;
-
-
-/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data 
-    is signed or unsigned
- */
-typedef enum OMX_NUMERICALDATATYPE
-{
-    OMX_NumericalDataSigned, /**< signed data */
-    OMX_NumericalDataUnsigned, /**< unsigned data */
-    OMX_NumercialDataMax = 0x7FFFFFFF
-} OMX_NUMERICALDATATYPE;
-
-
-/** Unsigned bounded value type */
-typedef struct OMX_BU32 {
-    OMX_U32 nValue; /**< actual value */
-    OMX_U32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
-    OMX_U32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BU32;
-
-
-/** Signed bounded value type */
-typedef struct OMX_BS32 {
-    OMX_S32 nValue; /**< actual value */
-    OMX_S32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
-    OMX_S32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BS32;
-
-
-/** Structure representing some time or duration in microseconds. This structure
-  *  must be interpreted as a signed 64 bit value. The quantity is signed to accommodate 
-  *  negative deltas and preroll scenarios. The quantity is represented in microseconds 
-  *  to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
-  *  on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. 
-  *  individual audio samples delivered at 192 kHz). The quantity is 64 bit to 
-  *  accommodate a large dynamic range (signed 32 bit values would allow only for plus
-  *  or minus 35 minutes).
-  *
-  *  Implementations with limited precision may convert the signed 64 bit value to 
-  *  a signed 32 bit value internally but risk loss of precision.  
-  */
-#ifndef OMX_SKIP64BIT
-typedef OMX_S64 OMX_TICKS;
-#else
-typedef struct OMX_TICKS
-{
-    OMX_U32 nLowPart;    /** low bits of the signed 64 bit tick value */
-    OMX_U32 nHighPart;   /** high bits of the signed 64 bit tick value */
-} OMX_TICKS;
-#endif
-#define OMX_TICKS_PER_SECOND 1000000
-
-/** Define the public interface for the OMX Handle.  The core will not use
-    this value internally, but the application should only use this value.
- */
-typedef void* OMX_HANDLETYPE;
-
-typedef struct OMX_MARKTYPE
-{
-    OMX_HANDLETYPE hMarkTargetComponent;   /**< The component that will 
-                                                generate a mark event upon 
-                                                processing the mark. */
-    OMX_PTR pMarkData;   /**< Application specific data associated with 
-                              the mark sent on a mark event to disambiguate 
-                              this mark from others. */
-} OMX_MARKTYPE;
-
-
-/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
- *  platform & operating specific object used to reference the display 
- *  or can be used by a audio port for native audio rendering */
-typedef void* OMX_NATIVE_DEVICETYPE;
-
-/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
- *  platform & operating specific object used to reference the window */
-typedef void* OMX_NATIVE_WINDOWTYPE;
-
-/** The OMX_VERSIONTYPE union is used to specify the version for
-    a structure or component.  For a component, the version is entirely
-    specified by the component vendor.  Components doing the same function
-    from different vendors may or may not have the same version.  For 
-    structures, the version shall be set by the entity that allocates the
-    structure.  For structures specified in the OMX 1.1 specification, the
-    value of the version shall be set to 1.1.0.0 in all cases.  Access to the
-    OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
-    by accessing one of the structure elements to, for example, check only
-    the Major revision.
- */
-typedef union OMX_VERSIONTYPE
-{
-    struct
-    {
-        OMX_U8 nVersionMajor;   /**< Major version accessor element */
-        OMX_U8 nVersionMinor;   /**< Minor version accessor element */
-        OMX_U8 nRevision;       /**< Revision version accessor element */
-        OMX_U8 nStep;           /**< Step version accessor element */
-    } s;
-    OMX_U32 nVersion;           /**< 32 bit value to make accessing the
-                                    version easily done in a single word
-                                    size copy/compare operation */
-} OMX_VERSIONTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/include/media/stagefright/openmax/OMX_Video.h b/include/media/stagefright/openmax/OMX_Video.h
deleted file mode 100644
index 4f8485d..0000000
--- a/include/media/stagefright/openmax/OMX_Video.h
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * 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.
- * -------------------------------------------------------------------
- */
-/**
- * Copyright (c) 2008 The Khronos Group Inc. 
- * 
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions: 
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software. 
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
- *
- */
-
-/** 
- *  @file OMX_Video.h - OpenMax IL version 1.1.2
- *  The structures is needed by Video components to exchange parameters 
- *  and configuration data with OMX components.
- */
-#ifndef OMX_Video_h
-#define OMX_Video_h
-
-/** @defgroup video OpenMAX IL Video Domain
- * @ingroup iv
- * Structures for OpenMAX IL Video domain
- * @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the
- * header to compile without errors.  The includes below are required
- * for this header file to compile successfully 
- */
-
-#include <OMX_IVCommon.h>
-
-
-/**
- * Enumeration used to define the possible video compression codings.  
- * NOTE:  This essentially refers to file extensions. If the coding is 
- *        being used to specify the ENCODE type, then additional work 
- *        must be done to configure the exact flavor of the compression 
- *        to be used.  For decode cases where the user application can 
- *        not differentiate between MPEG-4 and H.264 bit streams, it is 
- *        up to the codec to handle this.
- */
-typedef enum OMX_VIDEO_CODINGTYPE {
-    OMX_VIDEO_CodingUnused,     /**< Value when coding is N/A */
-    OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */
-    OMX_VIDEO_CodingMPEG2,      /**< AKA: H.262 */
-    OMX_VIDEO_CodingH263,       /**< H.263 */
-    OMX_VIDEO_CodingMPEG4,      /**< MPEG-4 */
-    OMX_VIDEO_CodingWMV,        /**< all versions of Windows Media Video */
-    OMX_VIDEO_CodingRV,         /**< all versions of Real Video */
-    OMX_VIDEO_CodingAVC,        /**< H.264/AVC */
-    OMX_VIDEO_CodingMJPEG,      /**< Motion JPEG */
-    OMX_VIDEO_CodingVPX,        /**< Google VPX, formerly known as On2 VP8 */
-    OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_CodingMax = 0x7FFFFFFF
-} OMX_VIDEO_CODINGTYPE;
-
-
-/**
- * Data structure used to define a video path.  The number of Video paths for 
- * input and output will vary by type of the Video component.  
- * 
- *    Input (aka Source) : zero Inputs, one Output,
- *    Splitter           : one Input, 2 or more Outputs,
- *    Processing Element : one Input, one output,
- *    Mixer              : 2 or more inputs, one output,
- *    Output (aka Sink)  : one Input, zero outputs.
- * 
- * The PortDefinition structure is used to define all of the parameters 
- * necessary for the compliant component to setup an input or an output video 
- * path.  If additional vendor specific data is required, it should be 
- * transmitted to the component using the CustomCommand function.  Compliant 
- * components will prepopulate this structure with optimal values during the 
- * GetDefaultInitParams command.
- *
- * STRUCT MEMBERS:
- *  cMIMEType             : MIME type of data for the port
- *  pNativeRender         : Platform specific reference for a display if a 
- *                          sync, otherwise this field is 0
- *  nFrameWidth           : Width of frame to be used on channel if 
- *                          uncompressed format is used.  Use 0 for unknown,
- *                          don't care or variable
- *  nFrameHeight          : Height of frame to be used on channel if 
- *                          uncompressed format is used. Use 0 for unknown,
- *                          don't care or variable
- *  nStride               : Number of bytes per span of an image 
- *                          (i.e. indicates the number of bytes to get
- *                          from span N to span N+1, where negative stride
- *                          indicates the image is bottom up
- *  nSliceHeight          : Height used when encoding in slices
- *  nBitrate              : Bit rate of frame to be used on channel if 
- *                          compressed format is used. Use 0 for unknown, 
- *                          don't care or variable
- *  xFramerate            : Frame rate to be used on channel if uncompressed 
- *                          format is used. Use 0 for unknown, don't care or 
- *                          variable.  Units are Q16 frames per second.
- *  bFlagErrorConcealment : Turns on error concealment if it is supported by 
- *                          the OMX component
- *  eCompressionFormat    : Compression format used in this instance of the 
- *                          component. When OMX_VIDEO_CodingUnused is 
- *                          specified, eColorFormat is used
- *  eColorFormat : Decompressed format used by this component
- *  pNativeWindow : Platform specific reference for a window object if a 
- *                          display sink , otherwise this field is 0x0. 
- */
-typedef struct OMX_VIDEO_PORTDEFINITIONTYPE {
-    OMX_STRING cMIMEType;
-    OMX_NATIVE_DEVICETYPE pNativeRender;
-    OMX_U32 nFrameWidth;
-    OMX_U32 nFrameHeight;
-    OMX_S32 nStride;
-    OMX_U32 nSliceHeight;
-    OMX_U32 nBitrate;
-    OMX_U32 xFramerate;
-    OMX_BOOL bFlagErrorConcealment;
-    OMX_VIDEO_CODINGTYPE eCompressionFormat;
-    OMX_COLOR_FORMATTYPE eColorFormat;
-    OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_VIDEO_PORTDEFINITIONTYPE;
-
-/**  
- * Port format parameter.  This structure is used to enumerate the various 
- * data input/output format supported by the port.
- * 
- * STRUCT MEMBERS:
- *  nSize              : Size of the structure in bytes
- *  nVersion           : OMX specification version information
- *  nPortIndex         : Indicates which port to set
- *  nIndex             : Indicates the enumeration index for the format from 
- *                       0x0 to N-1
- *  eCompressionFormat : Compression format used in this instance of the 
- *                       component. When OMX_VIDEO_CodingUnused is specified, 
- *                       eColorFormat is used 
- *  eColorFormat       : Decompressed format used by this component
- *  xFrameRate         : Indicates the video frame rate in Q16 format
- */
-typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nIndex;
-    OMX_VIDEO_CODINGTYPE eCompressionFormat; 
-    OMX_COLOR_FORMATTYPE eColorFormat;
-    OMX_U32 xFramerate;
-} OMX_VIDEO_PARAM_PORTFORMATTYPE;
-
-
-/**
- * This is a structure for configuring video compression quantization 
- * parameter values.  Codecs may support different QP values for different
- * frame types.
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version info
- *  nPortIndex : Port that this structure applies to
- *  nQpI       : QP value to use for index frames
- *  nQpP       : QP value to use for P frames
- *  nQpB       : QP values to use for bidirectional frames 
- */
-typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE {
-    OMX_U32 nSize;            
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nQpI;
-    OMX_U32 nQpP;
-    OMX_U32 nQpB;
-} OMX_VIDEO_PARAM_QUANTIZATIONTYPE;
-
-
-/** 
- * Structure for configuration of video fast update parameters. 
- *  
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version info 
- *  nPortIndex : Port that this structure applies to
- *  bEnableVFU : Enable/Disable video fast update
- *  nFirstGOB  : Specifies the number of the first macroblock row
- *  nFirstMB   : specifies the first MB relative to the specified first GOB
- *  nNumMBs    : Specifies the number of MBs to be refreshed from nFirstGOB 
- *               and nFirstMB
- */
-typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE {
-    OMX_U32 nSize;            
-    OMX_VERSIONTYPE nVersion; 
-    OMX_U32 nPortIndex;       
-    OMX_BOOL bEnableVFU;      
-    OMX_U32 nFirstGOB;                            
-    OMX_U32 nFirstMB;                            
-    OMX_U32 nNumMBs;                                  
-} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE;
-
-
-/** 
- * Enumeration of possible bitrate control types 
- */
-typedef enum OMX_VIDEO_CONTROLRATETYPE {
-    OMX_Video_ControlRateDisable,
-    OMX_Video_ControlRateVariable,
-    OMX_Video_ControlRateConstant,
-    OMX_Video_ControlRateVariableSkipFrames,
-    OMX_Video_ControlRateConstantSkipFrames,
-    OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_Video_ControlRateMax = 0x7FFFFFFF
-} OMX_VIDEO_CONTROLRATETYPE;
-
-
-/** 
- * Structure for configuring bitrate mode of a codec. 
- *
- * STRUCT MEMBERS:
- *  nSize          : Size of the struct in bytes
- *  nVersion       : OMX spec version info
- *  nPortIndex     : Port that this struct applies to
- *  eControlRate   : Control rate type enum
- *  nTargetBitrate : Target bitrate to encode with
- */
-typedef struct OMX_VIDEO_PARAM_BITRATETYPE {
-    OMX_U32 nSize;                          
-    OMX_VERSIONTYPE nVersion;               
-    OMX_U32 nPortIndex;                     
-    OMX_VIDEO_CONTROLRATETYPE eControlRate; 
-    OMX_U32 nTargetBitrate;                 
-} OMX_VIDEO_PARAM_BITRATETYPE;
-
-
-/** 
- * Enumeration of possible motion vector (MV) types 
- */
-typedef enum OMX_VIDEO_MOTIONVECTORTYPE {
-    OMX_Video_MotionVectorPixel,
-    OMX_Video_MotionVectorHalfPel,
-    OMX_Video_MotionVectorQuarterPel,
-    OMX_Video_MotionVectorEighthPel,
-    OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_Video_MotionVectorMax = 0x7FFFFFFF
-} OMX_VIDEO_MOTIONVECTORTYPE;
-
-
-/**
- * Structure for configuring the number of motion vectors used as well
- * as their accuracy.
- * 
- * STRUCT MEMBERS:
- *  nSize            : Size of the struct in bytes
- *  nVersion         : OMX spec version info
- *  nPortIndex       : port that this structure applies to
- *  eAccuracy        : Enumerated MV accuracy
- *  bUnrestrictedMVs : Allow unrestricted MVs
- *  bFourMV          : Allow use of 4 MVs
- *  sXSearchRange    : Search range in horizontal direction for MVs
- *  sYSearchRange    : Search range in vertical direction for MVs
- */
-typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_VIDEO_MOTIONVECTORTYPE eAccuracy;
-    OMX_BOOL bUnrestrictedMVs;
-    OMX_BOOL bFourMV;
-    OMX_S32 sXSearchRange;
-    OMX_S32 sYSearchRange;
-} OMX_VIDEO_PARAM_MOTIONVECTORTYPE;
-
-
-/** 
- * Enumeration of possible methods to use for Intra Refresh 
- */
-typedef enum OMX_VIDEO_INTRAREFRESHTYPE {
-    OMX_VIDEO_IntraRefreshCyclic,
-    OMX_VIDEO_IntraRefreshAdaptive,
-    OMX_VIDEO_IntraRefreshBoth,
-    OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF
-} OMX_VIDEO_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for configuring intra refresh mode 
- * 
- * STRUCT MEMBERS:
- *  nSize        : Size of the structure in bytes
- *  nVersion     : OMX specification version information
- *  nPortIndex   : Port that this structure applies to
- *  eRefreshMode : Cyclic, Adaptive, or Both
- *  nAirMBs      : Number of intra macroblocks to refresh in a frame when 
- *                 AIR is enabled
- *  nAirRef      : Number of times a motion marked macroblock has to be  
- *                 intra coded
- *  nCirMBs      : Number of consecutive macroblocks to be coded as "intra"  
- *                 when CIR is enabled
- */
-typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode;
-    OMX_U32 nAirMBs;
-    OMX_U32 nAirRef;
-    OMX_U32 nCirMBs;
-} OMX_VIDEO_PARAM_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for enabling various error correction methods for video 
- * compression.
- *
- * STRUCT MEMBERS:
- *  nSize                   : Size of the structure in bytes
- *  nVersion                : OMX specification version information 
- *  nPortIndex              : Port that this structure applies to 
- *  bEnableHEC              : Enable/disable header extension codes (HEC)
- *  bEnableResync           : Enable/disable resynchronization markers
- *  nResynchMarkerSpacing   : Resynch markers interval (in bits) to be 
- *                            applied in the stream 
- *  bEnableDataPartitioning : Enable/disable data partitioning 
- *  bEnableRVLC             : Enable/disable reversible variable length 
- *                            coding
- */
-typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bEnableHEC;
-    OMX_BOOL bEnableResync;
-    OMX_U32  nResynchMarkerSpacing;
-    OMX_BOOL bEnableDataPartitioning;
-    OMX_BOOL bEnableRVLC;
-} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE;
-
-
-/** 
- * Configuration of variable block-size motion compensation (VBSMC) 
- * 
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information 
- *  nPortIndex : Port that this structure applies to
- *  b16x16     : Enable inter block search 16x16
- *  b16x8      : Enable inter block search 16x8
- *  b8x16      : Enable inter block search 8x16
- *  b8x8       : Enable inter block search 8x8
- *  b8x4       : Enable inter block search 8x4
- *  b4x8       : Enable inter block search 4x8
- *  b4x4       : Enable inter block search 4x4
- */
-typedef struct OMX_VIDEO_PARAM_VBSMCTYPE {
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion; 
-    OMX_U32 nPortIndex;       
-    OMX_BOOL b16x16; 
-    OMX_BOOL b16x8; 
-    OMX_BOOL b8x16;
-    OMX_BOOL b8x8;
-    OMX_BOOL b8x4;
-    OMX_BOOL b4x8;
-    OMX_BOOL b4x4;
-} OMX_VIDEO_PARAM_VBSMCTYPE;
-
-
-/** 
- * H.263 profile types, each profile indicates support for various 
- * performance bounds and different annexes.
- *
- * ENUMS:
- *  Baseline           : Baseline Profile: H.263 (V1), no optional modes                                                    
- *  H320 Coding        : H.320 Coding Efficiency Backward Compatibility 
- *                       Profile: H.263+ (V2), includes annexes I, J, L.4
- *                       and T
- *  BackwardCompatible : Backward Compatibility Profile: H.263 (V1), 
- *                       includes annex F                                    
- *  ISWV2              : Interactive Streaming Wireless Profile: H.263+ 
- *                       (V2), includes annexes I, J, K and T                 
- *  ISWV3              : Interactive Streaming Wireless Profile: H.263++  
- *                       (V3), includes profile 3 and annexes V and W.6.3.8   
- *  HighCompression    : Conversational High Compression Profile: H.263++  
- *                       (V3), includes profiles 1 & 2 and annexes D and U   
- *  Internet           : Conversational Internet Profile: H.263++ (V3),  
- *                       includes profile 5 and annex K                       
- *  Interlace          : Conversational Interlace Profile: H.263++ (V3),  
- *                       includes profile 5 and annex W.6.3.11               
- *  HighLatency        : High Latency Profile: H.263++ (V3), includes  
- *                       profile 6 and annexes O.1 and P.5                       
- */
-typedef enum OMX_VIDEO_H263PROFILETYPE {
-    OMX_VIDEO_H263ProfileBaseline            = 0x01,        
-    OMX_VIDEO_H263ProfileH320Coding          = 0x02,          
-    OMX_VIDEO_H263ProfileBackwardCompatible  = 0x04,  
-    OMX_VIDEO_H263ProfileISWV2               = 0x08,               
-    OMX_VIDEO_H263ProfileISWV3               = 0x10,               
-    OMX_VIDEO_H263ProfileHighCompression     = 0x20,     
-    OMX_VIDEO_H263ProfileInternet            = 0x40,            
-    OMX_VIDEO_H263ProfileInterlace           = 0x80,           
-    OMX_VIDEO_H263ProfileHighLatency         = 0x100,         
-    OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_H263ProfileMax                 = 0x7FFFFFFF  
-} OMX_VIDEO_H263PROFILETYPE;
-
-
-/** 
- * H.263 level types, each level indicates support for various frame sizes, 
- * bit rates, decoder frame rates.
- */
-typedef enum OMX_VIDEO_H263LEVELTYPE {
-    OMX_VIDEO_H263Level10  = 0x01,  
-    OMX_VIDEO_H263Level20  = 0x02,      
-    OMX_VIDEO_H263Level30  = 0x04,      
-    OMX_VIDEO_H263Level40  = 0x08,      
-    OMX_VIDEO_H263Level45  = 0x10,      
-    OMX_VIDEO_H263Level50  = 0x20,      
-    OMX_VIDEO_H263Level60  = 0x40,      
-    OMX_VIDEO_H263Level70  = 0x80, 
-    OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_H263LevelMax = 0x7FFFFFFF  
-} OMX_VIDEO_H263LEVELTYPE;
-
-
-/** 
- * Specifies the picture type. These values should be OR'd to signal all 
- * pictures types which are allowed.
- *
- * ENUMS:
- *  Generic Picture Types:          I, P and B
- *  H.263 Specific Picture Types:   SI and SP
- *  H.264 Specific Picture Types:   EI and EP
- *  MPEG-4 Specific Picture Types:  S
- */
-typedef enum OMX_VIDEO_PICTURETYPE {
-    OMX_VIDEO_PictureTypeI   = 0x01,
-    OMX_VIDEO_PictureTypeP   = 0x02,
-    OMX_VIDEO_PictureTypeB   = 0x04,
-    OMX_VIDEO_PictureTypeSI  = 0x08,
-    OMX_VIDEO_PictureTypeSP  = 0x10,
-    OMX_VIDEO_PictureTypeEI  = 0x11,
-    OMX_VIDEO_PictureTypeEP  = 0x12,
-    OMX_VIDEO_PictureTypeS   = 0x14,
-    OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF
-} OMX_VIDEO_PICTURETYPE;
-
-
-/** 
- * H.263 Params 
- *
- * STRUCT MEMBERS:
- *  nSize                    : Size of the structure in bytes
- *  nVersion                 : OMX specification version information 
- *  nPortIndex               : Port that this structure applies to
- *  nPFrames                 : Number of P frames between each I frame
- *  nBFrames                 : Number of B frames between each I frame
- *  eProfile                 : H.263 profile(s) to use
- *  eLevel                   : H.263 level(s) to use
- *  bPLUSPTYPEAllowed        : Indicating that it is allowed to use PLUSPTYPE 
- *                             (specified in the 1998 version of H.263) to 
- *                             indicate custom picture sizes or clock 
- *                             frequencies 
- *  nAllowedPictureTypes     : Specifies the picture types allowed in the 
- *                             bitstream
- *  bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is 
- *                             not constrained. It is recommended to change 
- *                             the value of the RTYPE bit for each reference 
- *                             picture in error-free communication
- *  nPictureHeaderRepetition : Specifies the frequency of picture header 
- *                             repetition
- *  nGOBHeaderInterval       : Specifies the interval of non-empty GOB  
- *                             headers in units of GOBs
- */
-typedef struct OMX_VIDEO_PARAM_H263TYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nPFrames;
-    OMX_U32 nBFrames;
-    OMX_VIDEO_H263PROFILETYPE eProfile;
-	OMX_VIDEO_H263LEVELTYPE eLevel;
-    OMX_BOOL bPLUSPTYPEAllowed;
-    OMX_U32 nAllowedPictureTypes;
-    OMX_BOOL bForceRoundingTypeToZero;
-    OMX_U32 nPictureHeaderRepetition;
-    OMX_U32 nGOBHeaderInterval;
-} OMX_VIDEO_PARAM_H263TYPE;
-
-
-/** 
- * MPEG-2 profile types, each profile indicates support for various 
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_MPEG2PROFILETYPE {
-    OMX_VIDEO_MPEG2ProfileSimple = 0,  /**< Simple Profile */
-    OMX_VIDEO_MPEG2ProfileMain,        /**< Main Profile */
-    OMX_VIDEO_MPEG2Profile422,         /**< 4:2:2 Profile */
-    OMX_VIDEO_MPEG2ProfileSNR,         /**< SNR Profile */
-    OMX_VIDEO_MPEG2ProfileSpatial,     /**< Spatial Profile */
-    OMX_VIDEO_MPEG2ProfileHigh,        /**< High Profile */
-    OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF  
-} OMX_VIDEO_MPEG2PROFILETYPE;
-
-
-/** 
- * MPEG-2 level types, each level indicates support for various frame 
- * sizes, bit rates, decoder frame rates.  No need 
- */
-typedef enum OMX_VIDEO_MPEG2LEVELTYPE {
-    OMX_VIDEO_MPEG2LevelLL = 0,  /**< Low Level */ 
-    OMX_VIDEO_MPEG2LevelML,      /**< Main Level */ 
-    OMX_VIDEO_MPEG2LevelH14,     /**< High 1440 */ 
-    OMX_VIDEO_MPEG2LevelHL,      /**< High Level */   
-    OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF  
-} OMX_VIDEO_MPEG2LEVELTYPE;
-
-
-/** 
- * MPEG-2 params 
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nPFrames   : Number of P frames between each I frame
- *  nBFrames   : Number of B frames between each I frame
- *  eProfile   : MPEG-2 profile(s) to use
- *  eLevel     : MPEG-2 levels(s) to use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG2TYPE {
-    OMX_U32 nSize;           
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;      
-    OMX_U32 nPFrames;        
-    OMX_U32 nBFrames;        
-    OMX_VIDEO_MPEG2PROFILETYPE eProfile;
-	OMX_VIDEO_MPEG2LEVELTYPE eLevel;   
-} OMX_VIDEO_PARAM_MPEG2TYPE;
-
-
-/** 
- * MPEG-4 profile types, each profile indicates support for various 
- * performance bounds and different annexes.
- * 
- * ENUMS:
- *  - Simple Profile, Levels 1-3
- *  - Simple Scalable Profile, Levels 1-2
- *  - Core Profile, Levels 1-2
- *  - Main Profile, Levels 2-4
- *  - N-bit Profile, Level 2
- *  - Scalable Texture Profile, Level 1
- *  - Simple Face Animation Profile, Levels 1-2
- *  - Simple Face and Body Animation (FBA) Profile, Levels 1-2
- *  - Basic Animated Texture Profile, Levels 1-2
- *  - Hybrid Profile, Levels 1-2
- *  - Advanced Real Time Simple Profiles, Levels 1-4
- *  - Core Scalable Profile, Levels 1-3
- *  - Advanced Coding Efficiency Profile, Levels 1-4
- *  - Advanced Core Profile, Levels 1-2
- *  - Advanced Scalable Texture, Levels 2-3
- */
-typedef enum OMX_VIDEO_MPEG4PROFILETYPE {
-    OMX_VIDEO_MPEG4ProfileSimple           = 0x01,        
-    OMX_VIDEO_MPEG4ProfileSimpleScalable   = 0x02,    
-    OMX_VIDEO_MPEG4ProfileCore             = 0x04,              
-    OMX_VIDEO_MPEG4ProfileMain             = 0x08,             
-    OMX_VIDEO_MPEG4ProfileNbit             = 0x10,              
-    OMX_VIDEO_MPEG4ProfileScalableTexture  = 0x20,   
-    OMX_VIDEO_MPEG4ProfileSimpleFace       = 0x40,        
-    OMX_VIDEO_MPEG4ProfileSimpleFBA        = 0x80,         
-    OMX_VIDEO_MPEG4ProfileBasicAnimated    = 0x100,     
-    OMX_VIDEO_MPEG4ProfileHybrid           = 0x200,            
-    OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400,  
-    OMX_VIDEO_MPEG4ProfileCoreScalable     = 0x800,      
-    OMX_VIDEO_MPEG4ProfileAdvancedCoding   = 0x1000,    
-    OMX_VIDEO_MPEG4ProfileAdvancedCore     = 0x2000,      
-    OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000,
-    OMX_VIDEO_MPEG4ProfileAdvancedSimple   = 0x8000,
-    OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_MPEG4ProfileMax              = 0x7FFFFFFF  
-} OMX_VIDEO_MPEG4PROFILETYPE;
-
-
-/** 
- * MPEG-4 level types, each level indicates support for various frame 
- * sizes, bit rates, decoder frame rates.  No need 
- */
-typedef enum OMX_VIDEO_MPEG4LEVELTYPE {
-    OMX_VIDEO_MPEG4Level0  = 0x01,   /**< Level 0 */   
-    OMX_VIDEO_MPEG4Level0b = 0x02,   /**< Level 0b */   
-    OMX_VIDEO_MPEG4Level1  = 0x04,   /**< Level 1 */ 
-    OMX_VIDEO_MPEG4Level2  = 0x08,   /**< Level 2 */ 
-    OMX_VIDEO_MPEG4Level3  = 0x10,   /**< Level 3 */ 
-    OMX_VIDEO_MPEG4Level4  = 0x20,   /**< Level 4 */  
-    OMX_VIDEO_MPEG4Level4a = 0x40,   /**< Level 4a */  
-    OMX_VIDEO_MPEG4Level5  = 0x80,   /**< Level 5 */  
-    OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF  
-} OMX_VIDEO_MPEG4LEVELTYPE;
-
-
-/** 
- * MPEG-4 configuration.  This structure handles configuration options
- * which are specific to MPEG4 algorithms
- *
- * STRUCT MEMBERS:
- *  nSize                : Size of the structure in bytes
- *  nVersion             : OMX specification version information
- *  nPortIndex           : Port that this structure applies to
- *  nSliceHeaderSpacing  : Number of macroblocks between slice header (H263+ 
- *                         Annex K). Put zero if not used
- *  bSVH                 : Enable Short Video Header mode
- *  bGov                 : Flag to enable GOV
- *  nPFrames             : Number of P frames between each I frame (also called 
- *                         GOV period)
- *  nBFrames             : Number of B frames between each I frame
- *  nIDCVLCThreshold     : Value of intra DC VLC threshold
- *  bACPred              : Flag to use ac prediction
- *  nMaxPacketSize       : Maximum size of packet in bytes.
- *  nTimeIncRes          : Used to pass VOP time increment resolution for MPEG4. 
- *                         Interpreted as described in MPEG4 standard.
- *  eProfile             : MPEG-4 profile(s) to use.
- *  eLevel               : MPEG-4 level(s) to use.
- *  nAllowedPictureTypes : Specifies the picture types allowed in the bitstream
- *  nHeaderExtension     : Specifies the number of consecutive video packet
- *                         headers within a VOP
- *  bReversibleVLC       : Specifies whether reversible variable length coding 
- *                         is in use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG4TYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nSliceHeaderSpacing;
-    OMX_BOOL bSVH;
-    OMX_BOOL bGov;
-    OMX_U32 nPFrames;
-    OMX_U32 nBFrames;
-    OMX_U32 nIDCVLCThreshold;
-    OMX_BOOL bACPred;
-    OMX_U32 nMaxPacketSize;
-    OMX_U32 nTimeIncRes;
-    OMX_VIDEO_MPEG4PROFILETYPE eProfile;
-    OMX_VIDEO_MPEG4LEVELTYPE eLevel;
-    OMX_U32 nAllowedPictureTypes;
-    OMX_U32 nHeaderExtension;
-    OMX_BOOL bReversibleVLC;
-} OMX_VIDEO_PARAM_MPEG4TYPE;
-
-
-/** 
- * WMV Versions 
- */
-typedef enum OMX_VIDEO_WMVFORMATTYPE {
-    OMX_VIDEO_WMVFormatUnused = 0x01,   /**< Format unused or unknown */
-    OMX_VIDEO_WMVFormat7      = 0x02,   /**< Windows Media Video format 7 */
-    OMX_VIDEO_WMVFormat8      = 0x04,   /**< Windows Media Video format 8 */
-    OMX_VIDEO_WMVFormat9      = 0x08,   /**< Windows Media Video format 9 */
-    OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_WMVFormatMax    = 0x7FFFFFFF
-} OMX_VIDEO_WMVFORMATTYPE;
-
-
-/** 
- * WMV Params 
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  eFormat    : Version of WMV stream / data
- */
-typedef struct OMX_VIDEO_PARAM_WMVTYPE {
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_VIDEO_WMVFORMATTYPE eFormat;
-} OMX_VIDEO_PARAM_WMVTYPE;
-
-
-/** 
- * Real Video Version 
- */
-typedef enum OMX_VIDEO_RVFORMATTYPE {
-    OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */
-    OMX_VIDEO_RVFormat8,          /**< Real Video format 8 */
-    OMX_VIDEO_RVFormat9,          /**< Real Video format 9 */
-    OMX_VIDEO_RVFormatG2,         /**< Real Video Format G2 */
-    OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_RVFormatMax = 0x7FFFFFFF
-} OMX_VIDEO_RVFORMATTYPE;
-
-
-/** 
- * Real Video Params 
- *
- * STUCT MEMBERS:
- *  nSize              : Size of the structure in bytes
- *  nVersion           : OMX specification version information 
- *  nPortIndex         : Port that this structure applies to
- *  eFormat            : Version of RV stream / data
- *  nBitsPerPixel      : Bits per pixel coded in the frame
- *  nPaddedWidth       : Padded width in pixel of a video frame
- *  nPaddedHeight      : Padded Height in pixels of a video frame
- *  nFrameRate         : Rate of video in frames per second
- *  nBitstreamFlags    : Flags which internal information about the bitstream
- *  nBitstreamVersion  : Bitstream version
- *  nMaxEncodeFrameSize: Max encoded frame size
- *  bEnablePostFilter  : Turn on/off post filter
- *  bEnableTemporalInterpolation : Turn on/off temporal interpolation
- *  bEnableLatencyMode : When enabled, the decoder does not display a decoded 
- *                       frame until it has detected that no enhancement layer 
- *  					 frames or dependent B frames will be coming. This 
- *  					 detection usually occurs when a subsequent non-B 
- *  					 frame is encountered 
- */
-typedef struct OMX_VIDEO_PARAM_RVTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_VIDEO_RVFORMATTYPE eFormat;
-    OMX_U16 nBitsPerPixel;
-    OMX_U16 nPaddedWidth;
-    OMX_U16 nPaddedHeight;
-    OMX_U32 nFrameRate;
-    OMX_U32 nBitstreamFlags;
-    OMX_U32 nBitstreamVersion;
-    OMX_U32 nMaxEncodeFrameSize;
-    OMX_BOOL bEnablePostFilter;
-    OMX_BOOL bEnableTemporalInterpolation;
-    OMX_BOOL bEnableLatencyMode;
-} OMX_VIDEO_PARAM_RVTYPE;
-
-
-/** 
- * AVC profile types, each profile indicates support for various 
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_AVCPROFILETYPE {
-    OMX_VIDEO_AVCProfileBaseline = 0x01,   /**< Baseline profile */
-    OMX_VIDEO_AVCProfileMain     = 0x02,   /**< Main profile */
-    OMX_VIDEO_AVCProfileExtended = 0x04,   /**< Extended profile */
-    OMX_VIDEO_AVCProfileHigh     = 0x08,   /**< High profile */
-    OMX_VIDEO_AVCProfileHigh10   = 0x10,   /**< High 10 profile */
-    OMX_VIDEO_AVCProfileHigh422  = 0x20,   /**< High 4:2:2 profile */
-    OMX_VIDEO_AVCProfileHigh444  = 0x40,   /**< High 4:4:4 profile */
-    OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_AVCProfileMax      = 0x7FFFFFFF  
-} OMX_VIDEO_AVCPROFILETYPE;
-
-
-/** 
- * AVC level types, each level indicates support for various frame sizes, 
- * bit rates, decoder frame rates.  No need 
- */
-typedef enum OMX_VIDEO_AVCLEVELTYPE {
-    OMX_VIDEO_AVCLevel1   = 0x01,     /**< Level 1 */
-    OMX_VIDEO_AVCLevel1b  = 0x02,     /**< Level 1b */
-    OMX_VIDEO_AVCLevel11  = 0x04,     /**< Level 1.1 */
-    OMX_VIDEO_AVCLevel12  = 0x08,     /**< Level 1.2 */
-    OMX_VIDEO_AVCLevel13  = 0x10,     /**< Level 1.3 */
-    OMX_VIDEO_AVCLevel2   = 0x20,     /**< Level 2 */
-    OMX_VIDEO_AVCLevel21  = 0x40,     /**< Level 2.1 */
-    OMX_VIDEO_AVCLevel22  = 0x80,     /**< Level 2.2 */
-    OMX_VIDEO_AVCLevel3   = 0x100,    /**< Level 3 */
-    OMX_VIDEO_AVCLevel31  = 0x200,    /**< Level 3.1 */
-    OMX_VIDEO_AVCLevel32  = 0x400,    /**< Level 3.2 */
-    OMX_VIDEO_AVCLevel4   = 0x800,    /**< Level 4 */
-    OMX_VIDEO_AVCLevel41  = 0x1000,   /**< Level 4.1 */
-    OMX_VIDEO_AVCLevel42  = 0x2000,   /**< Level 4.2 */
-    OMX_VIDEO_AVCLevel5   = 0x4000,   /**< Level 5 */
-    OMX_VIDEO_AVCLevel51  = 0x8000,   /**< Level 5.1 */
-    OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF  
-} OMX_VIDEO_AVCLEVELTYPE;
-
-
-/** 
- * AVC loop filter modes 
- *
- * OMX_VIDEO_AVCLoopFilterEnable               : Enable
- * OMX_VIDEO_AVCLoopFilterDisable              : Disable
- * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries
- */
-typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE {
-    OMX_VIDEO_AVCLoopFilterEnable = 0,
-    OMX_VIDEO_AVCLoopFilterDisable,
-    OMX_VIDEO_AVCLoopFilterDisableSliceBoundary,
-    OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCLOOPFILTERTYPE;
-
-
-/** 
- * AVC params 
- *
- * STRUCT MEMBERS:
- *  nSize                     : Size of the structure in bytes
- *  nVersion                  : OMX specification version information
- *  nPortIndex                : Port that this structure applies to
- *  nSliceHeaderSpacing       : Number of macroblocks between slice header, put  
- *                              zero if not used
- *  nPFrames                  : Number of P frames between each I frame
- *  nBFrames                  : Number of B frames between each I frame
- *  bUseHadamard              : Enable/disable Hadamard transform
- *  nRefFrames                : Max number of reference frames to use for inter
- *                              motion search (1-16)
- *  nRefIdxTrailing           : Pic param set ref frame index (index into ref
- *                              frame buffer of trailing frames list), B frame
- *                              support
- *  nRefIdxForward            : Pic param set ref frame index (index into ref
- *                              frame buffer of forward frames list), B frame
- *                              support
- *  bEnableUEP                : Enable/disable unequal error protection. This 
- *                              is only valid of data partitioning is enabled.
- *  bEnableFMO                : Enable/disable flexible macroblock ordering
- *  bEnableASO                : Enable/disable arbitrary slice ordering
- *  bEnableRS                 : Enable/disable sending of redundant slices
- *  eProfile                  : AVC profile(s) to use
- *  eLevel                    : AVC level(s) to use
- *  nAllowedPictureTypes      : Specifies the picture types allowed in the 
- *                              bitstream
- *  bFrameMBsOnly             : specifies that every coded picture of the 
- *                              coded video sequence is a coded frame 
- *                              containing only frame macroblocks
- *  bMBAFF                    : Enable/disable switching between frame and 
- *                              field macroblocks within a picture
- *  bEntropyCodingCABAC       : Entropy decoding method to be applied for the 
- *                              syntax elements for which two descriptors appear 
- *                              in the syntax tables
- *  bWeightedPPrediction      : Enable/disable weighted prediction shall not 
- *                              be applied to P and SP slices
- *  nWeightedBipredicitonMode : Default weighted prediction is applied to B 
- *                              slices 
- *  bconstIpred               : Enable/disable intra prediction
- *  bDirect8x8Inference       : Specifies the method used in the derivation 
- *                              process for luma motion vectors for B_Skip, 
- *                              B_Direct_16x16 and B_Direct_8x8 as specified 
- *                              in subclause 8.4.1.2 of the AVC spec 
- *  bDirectSpatialTemporal    : Flag indicating spatial or temporal direct
- *                              mode used in B slice coding (related to 
- *                              bDirect8x8Inference) . Spatial direct mode is 
- *                              more common and should be the default.
- *  nCabacInitIdx             : Index used to init CABAC contexts
- *  eLoopFilterMode           : Enable/disable loop filter
- */
-typedef struct OMX_VIDEO_PARAM_AVCTYPE {
-    OMX_U32 nSize;                 
-    OMX_VERSIONTYPE nVersion;      
-    OMX_U32 nPortIndex;            
-    OMX_U32 nSliceHeaderSpacing;  
-    OMX_U32 nPFrames;     
-    OMX_U32 nBFrames;     
-    OMX_BOOL bUseHadamard;
-    OMX_U32 nRefFrames;  
-	OMX_U32 nRefIdx10ActiveMinus1;
-	OMX_U32 nRefIdx11ActiveMinus1;
-    OMX_BOOL bEnableUEP;  
-    OMX_BOOL bEnableFMO;  
-    OMX_BOOL bEnableASO;  
-    OMX_BOOL bEnableRS;   
-    OMX_VIDEO_AVCPROFILETYPE eProfile;
-	OMX_VIDEO_AVCLEVELTYPE eLevel; 
-    OMX_U32 nAllowedPictureTypes;  
-	OMX_BOOL bFrameMBsOnly;        									
-    OMX_BOOL bMBAFF;               
-    OMX_BOOL bEntropyCodingCABAC;  
-    OMX_BOOL bWeightedPPrediction; 
-    OMX_U32 nWeightedBipredicitonMode; 
-    OMX_BOOL bconstIpred ;
-    OMX_BOOL bDirect8x8Inference;  
-	OMX_BOOL bDirectSpatialTemporal;
-	OMX_U32 nCabacInitIdc;
-	OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode;
-} OMX_VIDEO_PARAM_AVCTYPE;
-
-typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE {
-   OMX_U32 nSize;                 
-   OMX_VERSIONTYPE nVersion;      
-   OMX_U32 nPortIndex;            
-   OMX_U32 eProfile;      /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, 
-                                 or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
-   OMX_U32 eLevel;        /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, 
-                                 or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
-   OMX_U32 nProfileIndex; /**< Used to query for individual profile support information,
-                               This parameter is valid only for 
-                               OMX_IndexParamVideoProfileLevelQuerySupported index,
-                               For all other indices this parameter is to be ignored. */
-} OMX_VIDEO_PARAM_PROFILELEVELTYPE;
-
-/** 
- * Structure for dynamically configuring bitrate mode of a codec. 
- *
- * STRUCT MEMBERS:
- *  nSize          : Size of the struct in bytes
- *  nVersion       : OMX spec version info
- *  nPortIndex     : Port that this struct applies to
- *  nEncodeBitrate : Target average bitrate to be generated in bps
- */
-typedef struct OMX_VIDEO_CONFIG_BITRATETYPE {
-    OMX_U32 nSize;                          
-    OMX_VERSIONTYPE nVersion;               
-    OMX_U32 nPortIndex;                     
-    OMX_U32 nEncodeBitrate;                 
-} OMX_VIDEO_CONFIG_BITRATETYPE;
-
-/** 
- * Defines Encoder Frame Rate setting
- *
- * STRUCT MEMBERS:
- *  nSize            : Size of the structure in bytes
- *  nVersion         : OMX specification version information 
- *  nPortIndex       : Port that this structure applies to
- *  xEncodeFramerate : Encoding framerate represented in Q16 format
- */
-typedef struct OMX_CONFIG_FRAMERATETYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 xEncodeFramerate; /* Q16 format */
-} OMX_CONFIG_FRAMERATETYPE;
-
-typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL IntraRefreshVOP;
-} OMX_CONFIG_INTRAREFRESHVOPTYPE;
-
-typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nErrMapSize;           /* Size of the Error Map in bytes */
-    OMX_U8  ErrMap[1];             /* Error map hint */
-} OMX_CONFIG_MACROBLOCKERRORMAPTYPE;
-
-typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_BOOL bEnabled;
-} OMX_CONFIG_MBERRORREPORTINGTYPE;
-
-typedef struct OMX_PARAM_MACROBLOCKSTYPE {
-    OMX_U32 nSize;
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nMacroblocks;
-} OMX_PARAM_MACROBLOCKSTYPE;
-
-/** 
- * AVC Slice Mode modes 
- *
- * OMX_VIDEO_SLICEMODE_AVCDefault   : Normal frame encoding, one slice per frame
- * OMX_VIDEO_SLICEMODE_AVCMBSlice   : NAL mode, number of MBs per frame
- * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame
- */
-typedef enum OMX_VIDEO_AVCSLICEMODETYPE {
-    OMX_VIDEO_SLICEMODE_AVCDefault = 0,
-    OMX_VIDEO_SLICEMODE_AVCMBSlice,
-    OMX_VIDEO_SLICEMODE_AVCByteSlice,
-    OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
-    OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
-    OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCSLICEMODETYPE;
-
-/** 
- * AVC FMO Slice Mode Params 
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nNumSliceGroups : Specifies the number of slice groups
- *  nSliceGroupMapType : Specifies the type of slice groups
- *  eSliceMode : Specifies the type of slice
- */
-typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO {
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U8 nNumSliceGroups;
-    OMX_U8 nSliceGroupMapType;
-    OMX_VIDEO_AVCSLICEMODETYPE eSliceMode;
-} OMX_VIDEO_PARAM_AVCSLICEFMO;
-
-/** 
- * AVC IDR Period Configs
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nIDRPeriod : Specifies periodicity of IDR frames
- *  nPFrames : Specifies internal of coding Intra frames
- */
-typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD {
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nIDRPeriod;
-    OMX_U32 nPFrames;
-} OMX_VIDEO_CONFIG_AVCINTRAPERIOD;
-
-/** 
- * AVC NAL Size Configs
- *
- * STRUCT MEMBERS:
- *  nSize      : Size of the structure in bytes
- *  nVersion   : OMX specification version information
- *  nPortIndex : Port that this structure applies to
- *  nNaluBytes : Specifies the NAL unit size
- */
-typedef struct OMX_VIDEO_CONFIG_NALSIZE {
-    OMX_U32 nSize; 
-    OMX_VERSIONTYPE nVersion;
-    OMX_U32 nPortIndex;
-    OMX_U32 nNaluBytes;
-} OMX_VIDEO_CONFIG_NALSIZE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h
index 3aff0c6..0ecc348 100644
--- a/include/private/media/VideoFrame.h
+++ b/include/private/media/VideoFrame.h
@@ -26,7 +26,7 @@
 namespace android {
 
 // A simple buffer to hold binary data
-class MediaAlbumArt 
+class MediaAlbumArt
 {
 public:
     MediaAlbumArt(): mSize(0), mData(0) {}
@@ -57,9 +57,9 @@
         fclose(in);
     }
 
-    MediaAlbumArt(const MediaAlbumArt& copy) { 
-        mSize = copy.mSize; 
-        mData = NULL;  // initialize it first 
+    MediaAlbumArt(const MediaAlbumArt& copy) {
+        mSize = copy.mSize;
+        mData = NULL;  // initialize it first
         if (mSize > 0 && copy.mData != NULL) {
            mData = new uint8_t[copy.mSize];
            if (mData != NULL) {
@@ -89,7 +89,7 @@
 {
 public:
     VideoFrame(): mWidth(0), mHeight(0), mDisplayWidth(0), mDisplayHeight(0), mSize(0), mData(0) {}
- 
+
     VideoFrame(const VideoFrame& copy) {
         mWidth = copy.mWidth;
         mHeight = copy.mHeight;
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index d9b0e5a..24f52e0 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -16,17 +16,15 @@
 
 #define LOG_TAG "OpenGLRenderer"
 
+#include <SkCamera.h>
 
 #include "DisplayListLogBuffer.h"
 #include "DisplayListRenderer.h"
 #include "Caches.h"
 
-#include <utils/String8.h>
-
 namespace android {
 namespace uirenderer {
 
-
 ///////////////////////////////////////////////////////////////////////////////
 // Display list
 ///////////////////////////////////////////////////////////////////////////////
@@ -93,7 +91,9 @@
     fflush(file);
 }
 
-DisplayList::DisplayList(const DisplayListRenderer& recorder) {
+DisplayList::DisplayList(const DisplayListRenderer& recorder) :
+    mTransformMatrix(NULL), mTransformCamera(NULL), mTransformMatrix3D(NULL) {
+
     initFromDisplayListRenderer(recorder);
 }
 
@@ -101,6 +101,34 @@
     clearResources();
 }
 
+void DisplayList::initProperties() {
+    mLeft = 0;
+    mTop = 0;
+    mTop = 0;
+    mBottom = 0;
+    mApplicationScale = -1;
+    mClipChildren = true;
+    mAlpha = 1;
+    mMultipliedAlpha = 255;
+    mTranslationX = 0;
+    mTranslationY = 0;
+    mRotation = 0;
+    mRotationX = 0;
+    mRotationY= 0;
+    mScaleX = 1;
+    mScaleY = 1;
+    mPivotX = 0;
+    mPivotY = 0;
+    mMatrixDirty = false;
+    mMatrixFlags = 0;
+    mPrevWidth = -1;
+    mPrevHeight = -1;
+    mWidth = 0;
+    mHeight = 0;
+    mPivotExplicitlySet = false;
+    mCaching = false;
+}
+
 void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) {
     if (displayList) {
         DISPLAY_LIST_LOGD("Deferring display list destruction");
@@ -111,6 +139,21 @@
 void DisplayList::clearResources() {
     sk_free((void*) mReader.base());
 
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        if (mTransformMatrix) {
+            delete mTransformMatrix;
+            mTransformMatrix = NULL;
+        }
+        if (mTransformCamera) {
+            delete mTransformCamera;
+            mTransformCamera = NULL;
+        }
+        if (mTransformMatrix3D) {
+            delete mTransformMatrix3D;
+            mTransformMatrix3D = NULL;
+        }
+    }
+
     Caches& caches = Caches::getInstance();
 
     for (size_t i = 0; i < mBitmapResources.size(); i++) {
@@ -159,6 +202,7 @@
         // re-using display list - clear out previous allocations
         clearResources();
     }
+    initProperties();
 
     mSize = writer.size();
     void* buffer = sk_malloc_throw(mSize);
@@ -230,6 +274,7 @@
 
     int saveCount = renderer.getSaveCount() - 1;
 
+    outputViewProperties(renderer, (char*) indent);
     mReader.rewind();
 
     while (!mReader.eof()) {
@@ -238,7 +283,7 @@
             int skip = mReader.readInt();
             ALOGD("%sSkip %d", (char*) indent, skip);
             op &= ~OP_MAY_BE_SKIPPED_MASK;
-       }
+        }
 
         switch (op) {
             case DrawGLFunction: {
@@ -268,7 +313,7 @@
                 SkPaint* paint = getPaint(renderer);
                 int flags = getInt();
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p, 0x%x", (char*) indent,
-                    OP_NAMES[op], f1, f2, f3, f4, paint, flags);
+                        OP_NAMES[op], f1, f2, f3, f4, paint, flags);
             }
             break;
             case SaveLayerAlpha: {
@@ -279,7 +324,7 @@
                 int alpha = getInt();
                 int flags = getInt();
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", (char*) indent,
-                    OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
+                        OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
             }
             break;
             case Translate: {
@@ -312,7 +357,10 @@
             break;
             case ConcatMatrix: {
                 SkMatrix* matrix = getMatrix();
-                ALOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
+                ALOGD("%s%s new concat %p: [%f, %f, %f]   [%f, %f, %f]   [%f, %f, %f]",
+                        (char*) indent, OP_NAMES[op], matrix, matrix->get(0), matrix->get(1),
+                        matrix->get(2), matrix->get(3), matrix->get(4), matrix->get(5),
+                        matrix->get(6), matrix->get(7), matrix->get(8));
             }
             break;
             case ClipRect: {
@@ -322,7 +370,7 @@
                 float f4 = getFloat();
                 int regionOp = getInt();
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d", (char*) indent, OP_NAMES[op],
-                    f1, f2, f3, f4, regionOp);
+                        f1, f2, f3, f4, regionOp);
             }
             break;
             case DrawDisplayList: {
@@ -331,7 +379,7 @@
                 uint32_t height = getUInt();
                 int32_t flags = getInt();
                 ALOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op],
-                    displayList, width, height, flags, level + 1);
+                        displayList, width, height, flags, level + 1);
                 renderer.outputDisplayList(displayList, level + 1);
             }
             break;
@@ -341,7 +389,7 @@
                 float y = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    layer, x, y, paint);
+                        layer, x, y, paint);
             }
             break;
             case DrawBitmap: {
@@ -350,7 +398,7 @@
                 float y = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    bitmap, x, y, paint);
+                        bitmap, x, y, paint);
             }
             break;
             case DrawBitmapMatrix: {
@@ -358,7 +406,7 @@
                 SkMatrix* matrix = getMatrix();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %p, %p, %p", (char*) indent, OP_NAMES[op],
-                    bitmap, matrix, paint);
+                        bitmap, matrix, paint);
             }
             break;
             case DrawBitmapRect: {
@@ -373,7 +421,7 @@
                 float f8 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
+                        (char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
             }
             break;
             case DrawBitmapMesh: {
@@ -422,7 +470,7 @@
                 float f4 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    f1, f2, f3, f4, paint);
+                        f1, f2, f3, f4, paint);
             }
             break;
             case DrawRoundRect: {
@@ -434,7 +482,7 @@
                 float f6 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
             }
             break;
             case DrawCircle: {
@@ -443,7 +491,7 @@
                 float f3 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
             }
             break;
             case DrawOval: {
@@ -453,7 +501,7 @@
                 float f4 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
             }
             break;
             case DrawArc: {
@@ -466,7 +514,7 @@
                 int i1 = getInt();
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
             }
             break;
             case DrawPath: {
@@ -497,7 +545,7 @@
                 SkPaint* paint = getPaint(renderer);
                 float length = getFloat();
                 ALOGD("%s%s %s, %d, %d, %.2f, %.2f, %p, %.2f", (char*) indent, OP_NAMES[op],
-                    text.text(), text.length(), count, x, y, paint, length);
+                        text.text(), text.length(), count, x, y, paint, length);
             }
             break;
             case DrawTextOnPath: {
@@ -518,7 +566,7 @@
                 float* positions = getFloats(positionsCount);
                 SkPaint* paint = getPaint(renderer);
                 ALOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
-                    text.text(), text.length(), count, paint);
+                        text.text(), text.length(), count, paint);
             }
             case ResetShader: {
                 ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
@@ -548,7 +596,7 @@
                 float dy = getFloat();
                 int color = getInt();
                 ALOGD("%s%s %.2f, %.2f, %.2f, 0x%x", (char*) indent, OP_NAMES[op],
-                    radius, dx, dy, color);
+                        radius, dx, dy, color);
             }
             break;
             case ResetPaintFilter: {
@@ -563,20 +611,193 @@
             break;
             default:
                 ALOGD("Display List error: op not handled: %s%s",
-                    (char*) indent, OP_NAMES[op]);
+                        (char*) indent, OP_NAMES[op]);
                 break;
         }
     }
-
-    ALOGD("%sDone", (char*) indent + 2);
+    ALOGD("%sDone (%p, %s)", (char*) indent + 2, this, mName.string());
 }
 
+void DisplayList::updateMatrix() {
+    if (mMatrixDirty) {
+        if (!mTransformMatrix) {
+            mTransformMatrix = new SkMatrix();
+        }
+        if (mMatrixFlags == 0 || mMatrixFlags == TRANSLATION) {
+            mTransformMatrix->reset();
+        } else {
+            if (!mPivotExplicitlySet) {
+                if (mWidth != mPrevWidth || mHeight != mPrevHeight) {
+                    mPrevWidth = mWidth;
+                    mPrevHeight = mHeight;
+                    mPivotX = mPrevWidth / 2;
+                    mPivotY = mPrevHeight / 2;
+                }
+            }
+            if ((mMatrixFlags & ROTATION_3D) == 0) {
+                mTransformMatrix->setTranslate(mTranslationX, mTranslationY);
+                mTransformMatrix->preRotate(mRotation, mPivotX, mPivotY);
+                mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY);
+            } else {
+                if (!mTransformCamera) {
+                    mTransformCamera = new Sk3DView();
+                    mTransformMatrix3D = new SkMatrix();
+                }
+                mTransformMatrix->reset();
+                mTransformCamera->save();
+                mTransformMatrix->preScale(mScaleX, mScaleY, mPivotX, mPivotY);
+                mTransformCamera->rotateX(mRotationX);
+                mTransformCamera->rotateY(mRotationY);
+                mTransformCamera->rotateZ(-mRotation);
+                mTransformCamera->getMatrix(mTransformMatrix3D);
+                mTransformMatrix3D->preTranslate(-mPivotX, -mPivotY);
+                mTransformMatrix3D->postTranslate(mPivotX + mTranslationX,
+                        mPivotY + mTranslationY);
+                mTransformMatrix->postConcat(*mTransformMatrix3D);
+                mTransformCamera->restore();
+            }
+        }
+        mMatrixDirty = false;
+    }
+}
+
+void DisplayList::outputViewProperties(OpenGLRenderer& renderer, char* indent) {
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        updateMatrix();
+        if (mApplicationScale >= 0) {
+            ALOGD("%s%s %.2f, %.2f", (char*) indent, "Scale",
+                    mApplicationScale, mApplicationScale);
+        }
+        if (mLeft != 0 || mTop != 0) {
+            ALOGD("%s%s %d, %d", indent, "Translate", mLeft, mTop);
+        }
+        if (mAlpha < 1) {
+            // TODO: should be able to store the size of a DL at record time and not
+            // have to pass it into this call. In fact, this information might be in the
+            // location/size info that we store with the new native transform data.
+            int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+            if (mClipChildren) {
+                flags |= SkCanvas::kClipToLayer_SaveFlag;
+            }
+            ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+                    (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+                    mMultipliedAlpha, flags);
+        }
+        if (mMatrixFlags != 0) {
+            if (mMatrixFlags == TRANSLATION) {
+                ALOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
+            } else {
+                ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]",
+                        indent, "ConcatMatrix", mTransformMatrix,
+                        mTransformMatrix->get(0), mTransformMatrix->get(1),
+                        mTransformMatrix->get(2), mTransformMatrix->get(3),
+                        mTransformMatrix->get(4), mTransformMatrix->get(5),
+                        mTransformMatrix->get(6), mTransformMatrix->get(7),
+                        mTransformMatrix->get(8));
+            }
+        }
+        if (mClipChildren) {
+            ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
+                    (float) mRight - mLeft, (float) mBottom - mTop);
+        }
+    }
+}
+
+void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, uint32_t height,
+        uint32_t level) {
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+#if DEBUG_DISPLAY_LIST
+        uint32_t count = (level + 1) * 2;
+        char indent[count + 1];
+        for (uint32_t i = 0; i < count; i++) {
+            indent[i] = ' ';
+        }
+        indent[count] = '\0';
+#endif
+        updateMatrix();
+        if (mLeft != 0 || mTop != 0) {
+            DISPLAY_LIST_LOGD("%s%s %d, %d", indent, "Translate", mLeft, mTop);
+            renderer.translate(mLeft, mTop);
+        }
+        if (mApplicationScale >= 0) {
+            DISPLAY_LIST_LOGD("%s%s %.2f, %.2f", (char*) indent, "Scale",
+                    mApplicationScale, mApplicationScale);
+            renderer.scale(mApplicationScale, mApplicationScale);
+        }
+        if (mAlpha < 1 && !mCaching) {
+            // TODO: should be able to store the size of a DL at record time and not
+            // have to pass it into this call. In fact, this information might be in the
+            // location/size info that we store with the new native transform data.
+            int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+            if (mClipChildren) {
+                flags |= SkCanvas::kClipToLayer_SaveFlag;
+            }
+            DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+                    (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+                    mMultipliedAlpha, flags);
+            renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop,
+                    mMultipliedAlpha, flags);
+        }
+        if (mMatrixFlags != 0) {
+            if (mMatrixFlags == TRANSLATION) {
+                DISPLAY_LIST_LOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
+                renderer.translate(mTranslationX, mTranslationY);
+            } else {
+                DISPLAY_LIST_LOGD(
+                        "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]",
+                        indent, "ConcatMatrix", mTransformMatrix,
+                        mTransformMatrix->get(0), mTransformMatrix->get(1),
+                        mTransformMatrix->get(2), mTransformMatrix->get(3),
+                        mTransformMatrix->get(4), mTransformMatrix->get(5),
+                        mTransformMatrix->get(6), mTransformMatrix->get(7),
+                        mTransformMatrix->get(8));
+                renderer.concatMatrix(mTransformMatrix);
+            }
+        }
+        if (mClipChildren) {
+            DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
+                    (float) mRight - mLeft, (float) mBottom - mTop);
+            renderer.clipRect(0, 0, mRight - mLeft, mBottom - mTop,
+                    SkRegion::kIntersect_Op);
+        }
+    }
+}
+
+void DisplayList::transformRect(float left, float top, float right, float bottom, Rect& result) {
+    result.left = left + mLeft;
+    result.top = top + mTop;
+    result.right = right + mLeft;
+    result.bottom = bottom + mTop;
+    if (mMatrixFlags != 0) {
+        if (mMatrixFlags == TRANSLATION) {
+            result.left += mTranslationX;
+            result.top += mTranslationY;
+            result.right += mTranslationX;
+            result.bottom += mTranslationY;
+        } else {
+            updateMatrix();
+            SkRect r;
+            r.fLeft = result.left;
+            r.fTop = result.top;
+            r.fRight = result.right;
+            r.fBottom = result.bottom;
+            mTransformMatrix->mapRect(&r);
+            result.left = r.fLeft;
+            result.top = r.fTop;
+            result.right = r.fRight;
+            result.bottom = r.fBottom;
+        }
+    }
+}
+
+
 /**
  * Changes to replay(), specifically those involving opcode or parameter changes, should be mimicked
  * in the output() function, since that function processes the same list of opcodes for the
  * purposes of logging display list info for a given view.
  */
-bool DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, uint32_t level) {
+bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
+        uint32_t height, Rect& dirty, int32_t flags, uint32_t level) {
     bool needsInvalidate = false;
     TextContainer text;
     mReader.rewind();
@@ -592,6 +813,13 @@
 #endif
 
     renderer.startMark(mName.string());
+    int restoreTo = 0;
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        DISPLAY_LIST_LOGD("%s%s %d", indent, "Save",
+                SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
+        restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
+    }
+    setViewProperties(renderer, width, height, level);
 
     DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance();
     int saveCount = renderer.getSaveCount() - 1;
@@ -644,7 +872,7 @@
                 SkPaint* paint = getPaint(renderer);
                 int32_t flags = getInt();
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p, 0x%x", (char*) indent,
-                    OP_NAMES[op], f1, f2, f3, f4, paint, flags);
+                        OP_NAMES[op], f1, f2, f3, f4, paint, flags);
                 renderer.saveLayer(f1, f2, f3, f4, paint, flags);
             }
             break;
@@ -656,7 +884,7 @@
                 int32_t alpha = getInt();
                 int32_t flags = getInt();
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", (char*) indent,
-                    OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
+                        OP_NAMES[op], f1, f2, f3, f4, alpha, flags);
                 renderer.saveLayerAlpha(f1, f2, f3, f4, alpha, flags);
             }
             break;
@@ -695,7 +923,12 @@
             break;
             case ConcatMatrix: {
                 SkMatrix* matrix = getMatrix();
-                DISPLAY_LIST_LOGD("%s%s %p", (char*) indent, OP_NAMES[op], matrix);
+                DISPLAY_LIST_LOGD(
+                        "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]",
+                        (char*) indent, OP_NAMES[op], matrix,
+                        matrix->get(0), matrix->get(1), matrix->get(2),
+                        matrix->get(3), matrix->get(4), matrix->get(5),
+                        matrix->get(6), matrix->get(7), matrix->get(8));
                 renderer.concatMatrix(matrix);
             }
             break;
@@ -706,7 +939,7 @@
                 float f4 = getFloat();
                 int32_t regionOp = getInt();
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d", (char*) indent, OP_NAMES[op],
-                    f1, f2, f3, f4, regionOp);
+                        f1, f2, f3, f4, regionOp);
                 renderer.clipRect(f1, f2, f3, f4, (SkRegion::Op) regionOp);
             }
             break;
@@ -716,9 +949,9 @@
                 uint32_t height = getUInt();
                 int32_t flags = getInt();
                 DISPLAY_LIST_LOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op],
-                    displayList, width, height, flags, level + 1);
-                needsInvalidate |= renderer.drawDisplayList(displayList, width, height,
-                        dirty, flags, level + 1);
+                        displayList, width, height, flags, level + 1);
+                needsInvalidate |= renderer.drawDisplayList(displayList, width,
+                        height, dirty, flags, level + 1);
             }
             break;
             case DrawLayer: {
@@ -726,8 +959,11 @@
                 float x = getFloat();
                 float y = getFloat();
                 SkPaint* paint = getPaint(renderer);
+                if (mCaching && mMultipliedAlpha < 255) {
+                    paint->setAlpha(mMultipliedAlpha);
+                }
                 DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    layer, x, y, paint);
+                        layer, x, y, paint);
                 renderer.drawLayer(layer, x, y, paint);
             }
             break;
@@ -737,7 +973,7 @@
                 float y = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    bitmap, x, y, paint);
+                        bitmap, x, y, paint);
                 renderer.drawBitmap(bitmap, x, y, paint);
             }
             break;
@@ -746,7 +982,7 @@
                 SkMatrix* matrix = getMatrix();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %p, %p, %p", (char*) indent, OP_NAMES[op],
-                    bitmap, matrix, paint);
+                        bitmap, matrix, paint);
                 renderer.drawBitmap(bitmap, matrix, paint);
             }
             break;
@@ -762,7 +998,8 @@
                 float f8 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
+                        (char*) indent, OP_NAMES[op], bitmap,
+                        f1, f2, f3, f4, f5, f6, f7, f8,paint);
                 renderer.drawBitmap(bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
             }
             break;
@@ -821,7 +1058,7 @@
                 float f4 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
-                    f1, f2, f3, f4, paint);
+                        f1, f2, f3, f4, paint);
                 renderer.drawRect(f1, f2, f3, f4, paint);
             }
             break;
@@ -834,7 +1071,7 @@
                 float f6 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, paint);
                 renderer.drawRoundRect(f1, f2, f3, f4, f5, f6, paint);
             }
             break;
@@ -844,7 +1081,7 @@
                 float f3 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, paint);
                 renderer.drawCircle(f1, f2, f3, paint);
             }
             break;
@@ -855,7 +1092,7 @@
                 float f4 = getFloat();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, paint);
                 renderer.drawOval(f1, f2, f3, f4, paint);
             }
             break;
@@ -869,7 +1106,7 @@
                 int32_t i1 = getInt();
                 SkPaint* paint = getPaint(renderer);
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %d, %p",
-                    (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
+                        (char*) indent, OP_NAMES[op], f1, f2, f3, f4, f5, f6, i1, paint);
                 renderer.drawArc(f1, f2, f3, f4, f5, f6, i1 == 1, paint);
             }
             break;
@@ -965,7 +1202,7 @@
                 float dy = getFloat();
                 int32_t color = getInt();
                 DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, 0x%x", (char*) indent, OP_NAMES[op],
-                    radius, dx, dy, color);
+                        radius, dx, dy, color);
                 renderer.setupShadow(radius, dx, dy, color);
             }
             break;
@@ -984,14 +1221,19 @@
             break;
             default:
                 DISPLAY_LIST_LOGD("Display List error: op not handled: %s%s",
-                    (char*) indent, OP_NAMES[op]);
+                        (char*) indent, OP_NAMES[op]);
                 break;
         }
     }
 
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo);
+        renderer.restoreToCount(restoreTo);
+    }
     renderer.endMark();
 
-    DISPLAY_LIST_LOGD("%sDone, returning %d", (char*) indent + 2, needsInvalidate);
+    DISPLAY_LIST_LOGD("%sDone (%p, %s), returning %d", (char*) indent + 2, this, mName.string(),
+            needsInvalidate);
     return needsInvalidate;
 }
 
@@ -999,7 +1241,7 @@
 // Base structure
 ///////////////////////////////////////////////////////////////////////////////
 
-DisplayListRenderer::DisplayListRenderer(): mWriter(MIN_WRITER_SIZE),
+DisplayListRenderer::DisplayListRenderer() : mWriter(MIN_WRITER_SIZE),
         mTranslateX(0.0f), mTranslateY(0.0f), mHasTranslate(false), mHasDrawOps(false) {
 }
 
@@ -1071,7 +1313,6 @@
 void DisplayListRenderer::finish() {
     insertRestoreToCount();
     insertTranlate();
-    OpenGLRenderer::finish();
 }
 
 void DisplayListRenderer::interrupt() {
@@ -1178,7 +1419,19 @@
         uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) {
     // dirty is an out parameter and should not be recorded,
     // it matters only when replaying the display list
-    const bool reject = quickReject(0.0f, 0.0f, width, height);
+    float top = 0;
+    float left = 0;
+    float right = width;
+    float bottom = height;
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        Rect transformedRect;
+        displayList->transformRect(left, top, right, bottom, transformedRect);
+        left = transformedRect.left;
+        top = transformedRect.top;
+        right = transformedRect.right;
+        bottom = transformedRect.bottom;
+    }
+    const bool reject = quickReject(left, top, right, bottom);
     uint32_t* location = addOp(DisplayList::DrawDisplayList, reject);
     addDisplayList(displayList);
     addSize(width, height);
@@ -1275,7 +1528,7 @@
 }
 
 void DisplayListRenderer::drawRoundRect(float left, float top, float right, float bottom,
-            float rx, float ry, SkPaint* paint) {
+        float rx, float ry, SkPaint* paint) {
     const bool reject = paint->getStyle() == SkPaint::kFill_Style &&
             quickReject(left, top, right, bottom);
     uint32_t* location = addOp(DisplayList::DrawRoundRect, reject);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 02f8438..abe8b82 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -20,6 +20,7 @@
 #include <SkChunkAlloc.h>
 #include <SkFlattenable.h>
 #include <SkMatrix.h>
+#include <SkCamera.h>
 #include <SkPaint.h>
 #include <SkPath.h>
 #include <SkRefCnt.h>
@@ -28,11 +29,8 @@
 
 #include <cutils/compiler.h>
 
-#include <utils/String8.h>
-
 #include "DisplayListLogBuffer.h"
 #include "OpenGLRenderer.h"
-#include "utils/Functor.h"
 
 namespace android {
 namespace uirenderer {
@@ -51,6 +49,16 @@
     #define DISPLAY_LIST_LOGD(...)
 #endif
 
+// Set to 1 to enable native processing of View properties. 0 by default. Eventually this
+// will go away and we will always use this approach for accelerated apps.
+#define USE_DISPLAY_LIST_PROPERTIES 0
+
+#define TRANSLATION 0x0001
+#define ROTATION    0x0002
+#define ROTATION_3D 0x0004
+#define SCALE       0x0008
+#define PIVOT       0x0010
+
 ///////////////////////////////////////////////////////////////////////////////
 // Display list
 ///////////////////////////////////////////////////////////////////////////////
@@ -119,13 +127,18 @@
 
     static const char* OP_NAMES[];
 
+    void setViewProperties(OpenGLRenderer& renderer, uint32_t width, uint32_t height,
+            uint32_t level);
+    void outputViewProperties(OpenGLRenderer& renderer, char* indent);
+
     ANDROID_API size_t getSize();
     ANDROID_API static void destroyDisplayListDeferred(DisplayList* displayList);
     ANDROID_API static void outputLogBuffer(int fd);
 
     void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false);
 
-    bool replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, uint32_t level = 0);
+    bool replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height,
+            Rect& dirty, int32_t flags, uint32_t level = 0);
 
     void output(OpenGLRenderer& renderer, uint32_t level = 0);
 
@@ -143,11 +156,240 @@
         }
     }
 
+    void setApplicationScale(float scale) {
+        mApplicationScale = scale;
+    }
+
+    void setClipChildren(bool clipChildren) {
+        mClipChildren = clipChildren;
+    }
+
+    void setAlpha(float alpha) {
+        if (alpha != mAlpha) {
+            mAlpha = alpha;
+            mMultipliedAlpha = (int)(255 * alpha);
+        }
+    }
+
+    void setTranslationX(float translationX) {
+        if (translationX != mTranslationX) {
+            mTranslationX = translationX;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mTranslationX, 0) && ALMOST_EQUAL(mTranslationY, 0)) {
+                mMatrixFlags &= ~TRANSLATION;
+            } else {
+                mMatrixFlags |= TRANSLATION;
+            }
+        }
+    }
+
+    void setTranslationY(float translationY) {
+        if (translationY != mTranslationY) {
+            mTranslationY = translationY;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mTranslationX, 0) && ALMOST_EQUAL(mTranslationY, 0)) {
+                mMatrixFlags &= ~TRANSLATION;
+            } else {
+                mMatrixFlags |= TRANSLATION;
+            }
+        }
+    }
+
+    void setRotation(float rotation) {
+        if (rotation != mRotation) {
+            mRotation = rotation;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mRotation, 0)) {
+                mMatrixFlags &= ~ROTATION;
+            } else {
+                mMatrixFlags |= ROTATION;
+            }
+        }
+    }
+
+    void setRotationX(float rotationX) {
+        if (rotationX != mRotationX) {
+            mRotationX = rotationX;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mRotationX, 0) && ALMOST_EQUAL(mRotationY, 0)) {
+                mMatrixFlags &= ~ROTATION_3D;
+            } else {
+                mMatrixFlags |= ROTATION_3D;
+            }
+        }
+    }
+
+    void setRotationY(float rotationY) {
+        if (rotationY != mRotationY) {
+            mRotationY = rotationY;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mRotationX, 0) && ALMOST_EQUAL(mRotationY, 0)) {
+                mMatrixFlags &= ~ROTATION_3D;
+            } else {
+                mMatrixFlags |= ROTATION_3D;
+            }
+        }
+    }
+
+    void setScaleX(float scaleX) {
+        if (scaleX != mScaleX) {
+            mScaleX = scaleX;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mScaleX, 1) && ALMOST_EQUAL(mScaleY, 1)) {
+                mMatrixFlags &= ~SCALE;
+            } else {
+                mMatrixFlags |= SCALE;
+            }
+        }
+    }
+
+    void setScaleY(float scaleY) {
+        if (scaleY != mScaleY) {
+            mScaleY = scaleY;
+            mMatrixDirty = true;
+            if (ALMOST_EQUAL(mScaleX, 1) && ALMOST_EQUAL(mScaleY, 1)) {
+                mMatrixFlags &= ~SCALE;
+            } else {
+                mMatrixFlags |= SCALE;
+            }
+        }
+    }
+
+    void setPivotX(float pivotX) {
+        mPivotX = pivotX;
+        mMatrixDirty = true;
+        if (ALMOST_EQUAL(mPivotX, 0) && ALMOST_EQUAL(mPivotY, 0)) {
+            mMatrixFlags &= ~PIVOT;
+        } else {
+            mMatrixFlags |= PIVOT;
+        }
+        mPivotExplicitlySet = true;
+    }
+
+    void setPivotY(float pivotY) {
+        mPivotY = pivotY;
+        mMatrixDirty = true;
+        if (ALMOST_EQUAL(mPivotX, 0) && ALMOST_EQUAL(mPivotY, 0)) {
+            mMatrixFlags &= ~PIVOT;
+        } else {
+            mMatrixFlags |= PIVOT;
+        }
+        mPivotExplicitlySet = true;
+    }
+
+    void setCameraDistance(float distance) {
+        if (distance != mCameraDistance) {
+            mCameraDistance = distance;
+            mMatrixDirty = true;
+            if (!mTransformCamera) {
+                mTransformCamera = new Sk3DView();
+                mTransformMatrix3D = new SkMatrix();
+            }
+            mTransformCamera->setCameraLocation(0, 0, distance);
+        }
+    }
+
+    void setLeft(int left) {
+        if (left != mLeft) {
+            mLeft = left;
+            mWidth = mRight - mLeft;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setTop(int top) {
+        if (top != mTop) {
+            mTop = top;
+            mHeight = mBottom - mTop;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setRight(int right) {
+        if (right != mRight) {
+            mRight = right;
+            mWidth = mRight - mLeft;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setBottom(int bottom) {
+        if (bottom != mBottom) {
+            mBottom = bottom;
+            mHeight = mBottom - mTop;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setLeftTop(int left, int top) {
+        if (left != mLeft || top != mTop) {
+            mLeft = left;
+            mTop = top;
+            mWidth = mRight - mLeft;
+            mHeight = mBottom - mTop;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setLeftTopRightBottom(int left, int top, int right, int bottom) {
+        if (left != mLeft || top != mTop || right != mRight || bottom != mBottom) {
+            mLeft = left;
+            mTop = top;
+            mRight = right;
+            mBottom = bottom;
+            mWidth = mRight - mLeft;
+            mHeight = mBottom - mTop;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void offsetLeftRight(int offset) {
+        if (offset != 0) {
+            mLeft += offset;
+            mRight += offset;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void offsetTopBottom(int offset) {
+        if (offset != 0) {
+            mTop += offset;
+            mBottom += offset;
+            if (mMatrixFlags > TRANSLATION && !mPivotExplicitlySet) {
+                mMatrixDirty = true;
+            }
+        }
+    }
+
+    void setCaching(bool caching) {
+        mCaching = caching;
+    }
+
+    void transformRect(float left, float top, float right, float bottom, Rect& result);
+
 private:
     void init();
 
+    void initProperties();
+
     void clearResources();
 
+    void updateMatrix();
+
     class TextContainer {
     public:
         size_t length() const {
@@ -241,6 +483,28 @@
     bool mIsRenderable;
 
     String8 mName;
+
+    // View properties
+    float mApplicationScale;
+    bool mClipChildren;
+    float mAlpha;
+    int mMultipliedAlpha;
+    float mTranslationX, mTranslationY;
+    float mRotation, mRotationX, mRotationY;
+    float mScaleX, mScaleY;
+    float mPivotX, mPivotY;
+    float mCameraDistance;
+    int mLeft, mTop, mRight, mBottom;
+    int mWidth, mHeight;
+    int mPrevWidth, mPrevHeight;
+    bool mPivotExplicitlySet;
+    bool mMatrixDirty;
+    bool mMatrixIsIdentity;
+    uint32_t mMatrixFlags;
+    SkMatrix* mTransformMatrix;
+    Sk3DView* mTransformCamera;
+    SkMatrix* mTransformMatrix3D;
+    bool mCaching;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 339ae0a..685fddc 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1189,7 +1189,7 @@
 }
 
 void OpenGLRenderer::setupDrawColorUniforms() {
-    if (mColorSet || (mShader && mSetShaderColor)) {
+    if ((mColorSet && !mShader) || (mShader && mSetShaderColor)) {
         mCaches.currentProgram->setColor(mColorR, mColorG, mColorB, mColorA);
     }
 }
@@ -1323,14 +1323,26 @@
 
 bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
         Rect& dirty, int32_t flags, uint32_t level) {
-    if (quickReject(0.0f, 0.0f, width, height)) {
+    float top = 0;
+    float left = 0;
+    float right = width;
+    float bottom = height;
+    if (USE_DISPLAY_LIST_PROPERTIES) {
+        Rect transformedRect;
+        displayList->transformRect(left, top, right, bottom, transformedRect);
+        left = transformedRect.left;
+        top = transformedRect.top;
+        right = transformedRect.right;
+        bottom = transformedRect.bottom;
+    }
+    if (quickReject(left, top, right, bottom)) {
         return false;
     }
 
     // All the usual checks and setup operations (quickReject, setupDraw, etc.)
     // will be performed by the display list itself
     if (displayList && displayList->isRenderable()) {
-        return displayList->replay(*this, dirty, flags, level);
+        return displayList->replay(*this, width, height, dirty, flags, level);
     }
 
     return false;
@@ -2174,13 +2186,12 @@
         return;
     }
 
+    if (length < 0.0f) length = paint->measureText(text, bytesCount);
     switch (paint->getTextAlign()) {
         case SkPaint::kCenter_Align:
-            if (length < 0.0f) length = paint->measureText(text, bytesCount);
             x -= length / 2.0f;
             break;
         case SkPaint::kRight_Align:
-            if (length < 0.0f) length = paint->measureText(text, bytesCount);
             x -= length;
             break;
         default:
@@ -2189,7 +2200,6 @@
 
     SkPaint::FontMetrics metrics;
     paint->getFontMetrics(&metrics, 0.0f);
-    // If no length was specified, just perform the hit test on the Y axis
     if (quickReject(x, y + metrics.fTop, x + length, y + metrics.fBottom)) {
         return;
     }
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 45ed453..f92741c 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -1,6 +1,41 @@
 
 LOCAL_PATH:=$(call my-dir)
 
+include $(CLEAR_VARS)
+LOCAL_MODULE := libRSDriver
+
+LOCAL_SRC_FILES:= \
+	driver/rsdAllocation.cpp \
+	driver/rsdBcc.cpp \
+	driver/rsdCore.cpp \
+	driver/rsdFrameBuffer.cpp \
+	driver/rsdFrameBufferObj.cpp \
+	driver/rsdGL.cpp \
+	driver/rsdMesh.cpp \
+	driver/rsdMeshObj.cpp \
+	driver/rsdPath.cpp \
+	driver/rsdProgram.cpp \
+	driver/rsdProgramRaster.cpp \
+	driver/rsdProgramStore.cpp \
+	driver/rsdRuntimeMath.cpp \
+	driver/rsdRuntimeStubs.cpp \
+	driver/rsdSampler.cpp \
+	driver/rsdShader.cpp \
+	driver/rsdShaderCache.cpp \
+	driver/rsdVertexArray.cpp
+
+LOCAL_SHARED_LIBRARIES += libz libcutils libutils libEGL libGLESv1_CM libGLESv2
+LOCAL_SHARED_LIBRARIES += libbcc libbcinfo libgui
+
+LOCAL_C_INCLUDES += external/zlib dalvik
+LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
+
+LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable
+
+LOCAL_LDLIBS := -lpthread -ldl
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_STATIC_LIBRARY)
 
 # Build rsg-generator ====================
 include $(CLEAR_VARS)
@@ -23,19 +58,6 @@
 # TODO: This should go into build/core/config.mk
 RSG_GENERATOR:=$(LOCAL_BUILT_MODULE)
 
-# include $(CLEAR_VARS)
-# input_data_file := $(LOCAL_PATH)/rslib.bc
-# slangdata_output_var_name := rs_runtime_lib_bc
-# LOCAL_MODULE := librslib_rt
-
-# LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-# LOCAL_MODULE_TAGS := optional
-# include frameworks/compile/slang/SlangData.mk
-# include $(BUILD_STATIC_LIBRARY)
-
-# Build render script lib ====================
-
 include $(CLEAR_VARS)
 LOCAL_MODULE := libRS
 
@@ -110,24 +132,6 @@
 	rsStream.cpp \
 	rsThreadIO.cpp \
 	rsType.cpp \
-	driver/rsdAllocation.cpp \
-	driver/rsdBcc.cpp \
-	driver/rsdCore.cpp \
-	driver/rsdFrameBuffer.cpp \
-	driver/rsdFrameBufferObj.cpp \
-	driver/rsdGL.cpp \
-	driver/rsdMesh.cpp \
-	driver/rsdMeshObj.cpp \
-	driver/rsdPath.cpp \
-	driver/rsdProgram.cpp \
-	driver/rsdProgramRaster.cpp \
-	driver/rsdProgramStore.cpp \
-	driver/rsdRuntimeMath.cpp \
-	driver/rsdRuntimeStubs.cpp \
-	driver/rsdSampler.cpp \
-	driver/rsdShader.cpp \
-	driver/rsdShaderCache.cpp \
-	driver/rsdVertexArray.cpp \
 	RenderScript.cpp \
 	BaseObj.cpp \
 	Element.cpp \
@@ -136,9 +140,10 @@
 	Script.cpp \
 	ScriptC.cpp
 
-LOCAL_SHARED_LIBRARIES += libz libcutils libutils libEGL libGLESv1_CM libGLESv2 libui libbcc libbcinfo libgui
+LOCAL_SHARED_LIBRARIES += libz libcutils libutils libEGL libGLESv1_CM libGLESv2 libbcc
+LOCAL_SHARED_LIBRARIES += libui libbcinfo libgui
 
-LOCAL_STATIC_LIBRARIES := libdex libft2
+LOCAL_STATIC_LIBRARIES := libdex libft2 libRSDriver
 
 LOCAL_C_INCLUDES += external/freetype/include external/zlib dalvik
 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 9ac553e..b668a78 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -257,14 +257,14 @@
 
 ObjectBaseRef<Type> Type::cloneAndResize1D(Context *rsc, uint32_t dimX) const {
     return getTypeRef(rsc, mElement.get(), dimX,
-                      mHal.state.dimY, mHal.state.dimZ, mHal.state.lodCount, mHal.state.faces);
+                      getDimY(), getDimZ(), getDimLOD(), getDimFaces());
 }
 
 ObjectBaseRef<Type> Type::cloneAndResize2D(Context *rsc,
                               uint32_t dimX,
                               uint32_t dimY) const {
     return getTypeRef(rsc, mElement.get(), dimX, dimY,
-                      mHal.state.dimZ, mHal.state.lodCount, mHal.state.faces);
+                      getDimZ(), getDimLOD(), getDimFaces());
 }
 
 
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 7f496ca..bccf1f9 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -92,14 +92,12 @@
      *                  "width"         - Integer
      *                  "height"        - Integer
      *                  optional "max-input-size"       - Integer
-     *                  optional "csd-0", "csd-1" ...   - ByteBuffer
      *
      *                Audio formats have the following fields:
      *                  "mime"          - String
      *                  "channel-count" - Integer
      *                  "sample-rate"   - Integer
      *                  optional "max-input-size"       - Integer
-     *                  optional "csd-0", "csd-1" ...   - ByteBuffer
      *
      *                If the format is used to configure an encoder, additional
      *                fields must be included:
@@ -114,7 +112,7 @@
      *
      *  @param surface Specify a surface on which to render the output of this
      *                 decoder.
-     *  @param flags   Specify {@see #CONFIGURE_FLAG_ENCODE} to configure the
+     *  @param flags   Specify {@link #CONFIGURE_FLAG_ENCODE} to configure the
      *                 component as an encoder.
     */
     public void configure(
@@ -155,6 +153,19 @@
 
     /** After filling a range of the input buffer at the specified index
      *  submit it to the component.
+     *
+     *  Many decoders require the actual compressed data stream to be
+     *  preceded by "codec specific data", i.e. setup data used to initialize
+     *  the codec such as PPS/SPS in the case of AVC video or code tables
+     *  in the case of vorbis audio.
+     *  The class MediaExtractor provides codec specific data as part of
+     *  the returned track format in entries named "csd-0", "csd-1" ...
+     *
+     *  These buffers should be submitted using the flag {@link #FLAG_CODECCONFIG}.
+     *
+     *  To indicate that this is the final piece of input data (or rather that
+     *  no more input data follows unless the decoder is subsequently flushed)
+     *  specify the flag {@link FLAG_EOS}.
     */
     public native final void queueInputBuffer(
             int index,
@@ -184,15 +195,25 @@
     public native final void releaseOutputBuffer(int index, boolean render);
 
     /** Call this after dequeueOutputBuffer signals a format change by returning
-     *  {@see #INFO_OUTPUT_FORMAT_CHANGED}
+     *  {@link #INFO_OUTPUT_FORMAT_CHANGED}
      */
     public native final Map<String, Object> getOutputFormat();
 
+    /** Call this after start() returns.
+     */
+    public ByteBuffer[] getInputBuffers() {
+        return getBuffers(true /* input */);
+    }
+
     /** Call this after start() returns and whenever dequeueOutputBuffer
      *  signals an output buffer change by returning
-     *  {@see #INFO_OUTPUT_BUFFERS_CHANGED}
+     *  {@link #INFO_OUTPUT_BUFFERS_CHANGED}
      */
-    public native final ByteBuffer[] getBuffers(boolean input);
+    public ByteBuffer[] getOutputBuffers() {
+        return getBuffers(false /* input */);
+    }
+
+    private native final ByteBuffer[] getBuffers(boolean input);
 
     private static native final void native_init();
 
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index 6a7f2f5..5732c72 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -56,7 +56,7 @@
     public native boolean advance();
 
     // Retrieve the current encoded sample and store it in the byte buffer
-    // starting at the given offset.
+    // starting at the given offset. Returns the sample size.
     public native int readSampleData(ByteBuffer byteBuf, int offset);
 
     // Returns the track index the current sample originates from.
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index e663e91..4e6c174 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -813,6 +813,13 @@
      *
      * @param path the path of the file, or the http/rtsp URL of the stream you want to play
      * @throws IllegalStateException if it is called in an invalid state
+     *
+     * <p>When <code>path</code> refers to a local file, the file may actually be opened by a
+     * process other than the calling application.  This implies that the pathname
+     * should be an absolute path (as any other process runs with unspecified current working
+     * directory), and that the pathname should reference a world-readable file.
+     * As an alternative, the application could first open the file for reading,
+     * and then use the file descriptor form {@link #setDataSource(FileDescriptor)}.
      */
     public native void setDataSource(String path)
             throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;
@@ -1148,6 +1155,26 @@
     }
 
     /**
+     * Set the MediaPlayer to start when this MediaPlayer finishes playback
+     * (i.e. reaches the end of the stream).
+     * The media framework will attempt to transition from this player to
+     * the next as seamlessly as possible. The next player can be set at
+     * any time before completion. The next player must be prepared by the
+     * app, and the application should not call start() on it.
+     * The next MediaPlayer must be different from 'this'. An exception
+     * will be thrown if next == this.
+     * The application may call setNextMediaPlayer(null) to indicate no
+     * next player should be started at the end of playback.
+     * If the current player is looping, it will keep looping and the next
+     * player will not be started.
+     *
+     * @param next the player to start after this one completes playback.
+     *
+     * @hide
+     */
+    public native void setNextMediaPlayer(MediaPlayer next);
+
+    /**
      * Releases resources associated with this MediaPlayer object.
      * It is considered good practice to call this method when you're
      * done using the MediaPlayer. In particular, whenever an Activity
@@ -1652,6 +1679,10 @@
             return;
         }
 
+        if (what == MEDIA_INFO && arg1 == MEDIA_INFO_STARTED_AS_NEXT) {
+            // this acquires the wakelock if needed, and sets the client side state
+            mp.start();
+        }
         if (mp.mEventHandler != null) {
             Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj);
             mp.mEventHandler.sendMessage(m);
@@ -1906,6 +1937,13 @@
      */
     public static final int MEDIA_INFO_UNKNOWN = 1;
 
+    /** The player was started because it was used as the next player for another
+     * player, which just completed playback.
+     * @see android.media.MediaPlayer.OnInfoListener
+     * @hide
+     */
+    public static final int MEDIA_INFO_STARTED_AS_NEXT = 2;
+
     /** The video is too complex for the decoder: it can't decode frames fast
      *  enough. Possibly only the audio plays fine at this stage.
      * @see android.media.MediaPlayer.OnInfoListener
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 6319630..2fe45ec 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -582,6 +582,7 @@
      * Currently not implemented. It does nothing.
      * @deprecated Time lapse mode video recording using camera still image capture
      * is not desirable, and will not be supported.
+     * @hide
      */
     public void setAuxiliaryOutputFile(FileDescriptor fd)
     {
@@ -592,6 +593,7 @@
      * Currently not implemented. It does nothing.
      * @deprecated Time lapse mode video recording using camera still image capture
      * is not desirable, and will not be supported.
+     * @hide
      */
     public void setAuxiliaryOutputFile(String path)
     {
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 070d2d9..a98275a 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -47,7 +47,7 @@
     frameworks/base/media/libstagefright/codecs/amrnb/common \
     frameworks/base/media/libstagefright/codecs/amrnb/common/include \
     frameworks/base/media/mtp \
-    frameworks/base/include/media/stagefright/openmax \
+    frameworks/native/include/media/openmax \
     $(PV_INCLUDES) \
     $(JNI_H_INCLUDE) \
     $(call include-path-for, corecg graphics)
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 71e698f..04d7c22 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -134,7 +134,7 @@
     uint32_t flags;
     status_t err;
     if ((err = mCodec->dequeueOutputBuffer(
-                    index, &size, &offset, &timeUs, &flags, timeoutUs)) != OK) {
+                    index, &offset, &size, &timeUs, &flags, timeoutUs)) != OK) {
         return err;
     }
 
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index 4757adf..0c86fc2 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -101,14 +101,37 @@
 
     void *dst = env->GetDirectBufferAddress(byteBuf);
 
+    jlong dstSize;
+    jbyteArray byteArray = NULL;
+
     if (dst == NULL) {
-        // XXX if dst is NULL also fall back to "array()"
-        return INVALID_OPERATION;
+        jclass byteBufClass = env->FindClass("java/nio/ByteBuffer");
+        CHECK(byteBufClass != NULL);
+
+        jmethodID arrayID =
+            env->GetMethodID(byteBufClass, "array", "()[B");
+        CHECK(arrayID != NULL);
+
+        byteArray =
+            (jbyteArray)env->CallObjectMethod(byteBuf, arrayID);
+
+        if (byteArray == NULL) {
+            return INVALID_OPERATION;
+        }
+
+        jboolean isCopy;
+        dst = env->GetByteArrayElements(byteArray, &isCopy);
+
+        dstSize = env->GetArrayLength(byteArray);
+    } else {
+        dstSize = env->GetDirectBufferCapacity(byteBuf);
     }
 
-    jlong dstSize = env->GetDirectBufferCapacity(byteBuf);
-
     if (dstSize < offset) {
+        if (byteArray != NULL) {
+            env->ReleaseByteArrayElements(byteArray, (jbyte *)dst, 0);
+        }
+
         return -ERANGE;
     }
 
@@ -116,6 +139,10 @@
 
     status_t err = mImpl->readSampleData(buffer);
 
+    if (byteArray != NULL) {
+        env->ReleaseByteArrayElements(byteArray, (jbyte *)dst, 0);
+    }
+
     if (err != OK) {
         return err;
     }
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index f572f71..745e253 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -795,6 +795,33 @@
     process_media_player_call(env, thiz, mp->getParameter(key, reply), NULL, NULL );
 }
 
+static void
+android_media_MediaPlayer_setNextMediaPlayer(JNIEnv *env, jobject thiz, jobject java_player)
+{
+    ALOGV("setNextMediaPlayer");
+    sp<MediaPlayer> thisplayer = getMediaPlayer(env, thiz);
+    if (thisplayer == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", "This player not initialized");
+        return;
+    }
+    sp<MediaPlayer> nextplayer = (java_player == NULL) ? NULL : getMediaPlayer(env, java_player);
+    if (nextplayer == NULL && java_player != NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", "That player not initialized");
+        return;
+    }
+
+    if (nextplayer == thisplayer) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", "Next player can't be self");
+        return;
+    }
+    // tie the two players together
+    process_media_player_call(
+            env, thiz, thisplayer->setNextMediaPlayer(nextplayer),
+            "java/lang/IllegalArgumentException",
+            "setNextMediaPlayer failed." );
+    ;
+}
+
 // ----------------------------------------------------------------------------
 
 static JNINativeMethod gMethods[] = {
@@ -840,6 +867,7 @@
     {"setParameter",        "(ILandroid/os/Parcel;)Z",          (void *)android_media_MediaPlayer_setParameter},
     {"getParameter",        "(ILandroid/os/Parcel;)V",          (void *)android_media_MediaPlayer_getParameter},
     {"native_setRetransmitEndpoint", "(Ljava/lang/String;I)I",  (void *)android_media_MediaPlayer_setRetransmitEndpoint},
+    {"setNextMediaPlayer",  "(Landroid/media/MediaPlayer;)V",   (void *)android_media_MediaPlayer_setNextMediaPlayer},
 };
 
 static const char* const kClassPathName = "android/media/MediaPlayer";
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index b17ae45..688e180 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -36,15 +36,15 @@
     $(TOP)/frameworks/base/media/libstagefright/rtsp \
     $(JNI_H_INCLUDE) \
     $(call include-path-for, corecg graphics) \
-    $(TOP)/frameworks/base/include/media/stagefright/openmax \
+    $(TOP)/frameworks/native/include/media/editor \
     $(TOP)/frameworks/base/core/jni/mediaeditor \
     $(TOP)/frameworks/media/libvideoeditor/vss/inc \
     $(TOP)/frameworks/media/libvideoeditor/vss/common/inc \
     $(TOP)/frameworks/media/libvideoeditor/vss/mcs/inc \
     $(TOP)/frameworks/media/libvideoeditor/vss/stagefrightshells/inc \
-    $(TOP)/frameworks/media/libvideoeditor/include \
     $(TOP)/frameworks/media/libvideoeditor/lvpp \
-    $(TOP)/frameworks/media/libvideoeditor/osal/inc
+    $(TOP)/frameworks/media/libvideoeditor/osal/inc \
+    $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES := \
     libaudioutils \
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index ceb87db..5aed8a1 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -608,10 +608,11 @@
         // do not create a new audio track if current track is compatible with sample parameters
 #ifdef USE_SHARED_MEM_BUFFER
         newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
-                channels, sample->getIMemory(), 0, callback, userData);
+                channels, sample->getIMemory(), AUDIO_POLICY_OUTPUT_FLAG_NONE, callback, userData);
 #else
         newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
-                channels, frameCount, 0, callback, userData, bufferFrames);
+                channels, frameCount, AUDIO_POLICY_OUTPUT_FLAG_NONE, callback, userData,
+                bufferFrames);
 #endif
         oldTrack = mAudioTrack;
         status = newTrack->initCheck();
diff --git a/media/libaah_rtp/Android.mk b/media/libaah_rtp/Android.mk
index 54fd9ec..1e87cf0 100644
--- a/media/libaah_rtp/Android.mk
+++ b/media/libaah_rtp/Android.mk
@@ -21,9 +21,9 @@
 
 LOCAL_C_INCLUDES := \
     frameworks/base/include \
-    frameworks/base/include/media/stagefright/openmax \
     frameworks/base/media \
-    frameworks/base/media/libstagefright
+    frameworks/base/media/libstagefright \
+    frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES := \
     libcommon_time_client \
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 23670df..5ecc8f5 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -57,7 +57,7 @@
 LOCAL_C_INCLUDES := \
     $(JNI_H_INCLUDE) \
     $(call include-path-for, graphics corecg) \
-    $(TOP)/frameworks/base/include/media/stagefright/openmax \
+    $(TOP)/frameworks/native/include/media/openmax \
     external/icu4c/common \
     external/expat/lib \
     system/media/audio_effects/include \
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 6808aa2..34451ca 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -174,7 +174,7 @@
             mIEffect->disconnect();
             mIEffect->asBinder()->unlinkToDeath(mIEffectClient);
         }
-         IPCThreadState::self()->flushCommands();
+        IPCThreadState::self()->flushCommands();
     }
     mIEffect.clear();
     mIEffectClient.clear();
@@ -480,4 +480,3 @@
 
 
 }; // namespace android
-
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 943f3af..05ade75 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -89,7 +89,7 @@
         audio_format_t format,
         uint32_t channelMask,
         int frameCount,
-        uint32_t flags,
+        record_flags flags,
         callback_t cbf,
         void* user,
         int notificationFrames,
@@ -124,7 +124,7 @@
         audio_format_t format,
         uint32_t channelMask,
         int frameCount,
-        uint32_t flags,
+        record_flags flags,
         callback_t cbf,
         void* user,
         int notificationFrames,
@@ -293,13 +293,13 @@
                 return WOULD_BLOCK;
             }
         }
-     }
+    }
 
     AutoMutex lock(mLock);
     // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
     // while we are accessing the cblk
-    sp <IAudioRecord> audioRecord = mAudioRecord;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioRecord> audioRecord = mAudioRecord;
+    sp<IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
     if (mActive == 0) {
         mActive = 1;
@@ -638,8 +638,8 @@
     mLock.lock();
     // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
     // while we are accessing the cblk
-    sp <IAudioRecord> audioRecord = mAudioRecord;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioRecord> audioRecord = mAudioRecord;
+    sp<IMemory> iMem = mCblkMemory;
     mLock.unlock();
 
     do {
@@ -684,8 +684,8 @@
     mLock.lock();
     // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed
     // while we are accessing the cblk
-    sp <IAudioRecord> audioRecord = mAudioRecord;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioRecord> audioRecord = mAudioRecord;
+    sp<IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
     mLock.unlock();
 
@@ -806,7 +806,7 @@
         }
     }
     ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
-         result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
+        result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
         // from now on we switch to the newly created cblk
@@ -843,4 +843,3 @@
 // -------------------------------------------------------------------------
 
 }; // namespace android
-
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index a1cbf0f..33c7d03 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -59,14 +59,14 @@
                 break;
             ALOGW("AudioFlinger not published, waiting...");
             usleep(500000); // 0.5 s
-        } while(true);
+        } while (true);
         if (gAudioFlingerClient == NULL) {
             gAudioFlingerClient = new AudioFlingerClient();
         } else {
             if (gAudioErrorCallback) {
                 gAudioErrorCallback(NO_ERROR);
             }
-         }
+        }
         binder->linkToDeath(gAudioFlingerClient);
         gAudioFlinger = interface_cast<IAudioFlinger>(binder);
         gAudioFlinger->registerClient(gAudioFlingerClient);
@@ -482,7 +482,7 @@
 }
 
 bool AudioSystem::routedToA2dpOutput(audio_stream_type_t streamType) {
-    switch(streamType) {
+    switch (streamType) {
     case AUDIO_STREAM_MUSIC:
     case AUDIO_STREAM_VOICE_CALL:
     case AUDIO_STREAM_BLUETOOTH_SCO:
@@ -512,7 +512,7 @@
                 break;
             ALOGW("AudioPolicyService not published, waiting...");
             usleep(500000); // 0.5 s
-        } while(true);
+        } while (true);
         if (gAudioPolicyServiceClient == NULL) {
             gAudioPolicyServiceClient = new AudioPolicyServiceClient();
         }
@@ -768,4 +768,3 @@
 }
 
 }; // namespace android
-
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index a1c99e5..048be1d 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -72,7 +72,7 @@
     if (minBufCount < 2) minBufCount = 2;
 
     *frameCount = (sampleRate == 0) ? afFrameCount * minBufCount :
-              afFrameCount * minBufCount * sampleRate / afSampleRate;
+            afFrameCount * minBufCount * sampleRate / afSampleRate;
     return NO_ERROR;
 }
 
@@ -92,7 +92,7 @@
         audio_format_t format,
         int channelMask,
         int frameCount,
-        uint32_t flags,
+        audio_policy_output_flags_t flags,
         callback_t cbf,
         void* user,
         int notificationFrames,
@@ -119,10 +119,11 @@
         int notificationFrames,
         int sessionId)
     : mStatus(NO_INIT),
+      mIsTimed(false),
       mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
     mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format, channelMask,
-            frameCount, flags, cbf, user, notificationFrames,
+            frameCount, (audio_policy_output_flags_t)flags, cbf, user, notificationFrames,
             0, false, sessionId);
 }
 
@@ -132,7 +133,7 @@
         audio_format_t format,
         int channelMask,
         const sp<IMemory>& sharedBuffer,
-        uint32_t flags,
+        audio_policy_output_flags_t flags,
         callback_t cbf,
         void* user,
         int notificationFrames,
@@ -172,7 +173,7 @@
         audio_format_t format,
         int channelMask,
         int frameCount,
-        uint32_t flags,
+        audio_policy_output_flags_t flags,
         callback_t cbf,
         void* user,
         int notificationFrames,
@@ -221,7 +222,7 @@
 
     // force direct flag if format is not linear PCM
     if (!audio_is_linear_pcm(format)) {
-        flags |= AUDIO_POLICY_OUTPUT_FLAG_DIRECT;
+        flags = (audio_policy_output_flags_t) (flags | AUDIO_POLICY_OUTPUT_FLAG_DIRECT);
     }
 
     if (!audio_is_output_channel(channelMask)) {
@@ -233,7 +234,7 @@
     audio_io_handle_t output = AudioSystem::getOutput(
                                     streamType,
                                     sampleRate, format, channelMask,
-                                    (audio_policy_output_flags_t)flags);
+                                    flags);
 
     if (output == 0) {
         ALOGE("Could not get audio output for stream type %d", streamType);
@@ -351,13 +352,13 @@
                 return;
             }
         }
-     }
+    }
 
     AutoMutex lock(mLock);
     // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
     // while we are accessing the cblk
-    sp <IAudioTrack> audioTrack = mAudioTrack;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioTrack> audioTrack = mAudioTrack;
+    sp<IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
 
     if (!mActive) {
@@ -707,7 +708,7 @@
 audio_io_handle_t AudioTrack::getOutput_l()
 {
     return AudioSystem::getOutput(mStreamType,
-            mCblk->sampleRate, mFormat, mChannelMask, (audio_policy_output_flags_t)mFlags);
+            mCblk->sampleRate, mFormat, mChannelMask, mFlags);
 }
 
 int AudioTrack::getSessionId() const
@@ -734,7 +735,7 @@
         audio_format_t format,
         uint32_t channelMask,
         int frameCount,
-        uint32_t flags,
+        audio_policy_output_flags_t flags,
         const sp<IMemory>& sharedBuffer,
         audio_io_handle_t output,
         bool enforceFrameCount)
@@ -742,8 +743,8 @@
     status_t status;
     const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
     if (audioFlinger == 0) {
-       ALOGE("Could not get audioflinger");
-       return NO_INIT;
+        ALOGE("Could not get audioflinger");
+        return NO_INIT;
     }
 
     int afSampleRate;
@@ -829,7 +830,7 @@
         mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t);
     } else {
         mCblk->buffers = sharedBuffer->pointer();
-         // Force buffer full condition as data is already present in shared memory
+        // Force buffer full condition as data is already present in shared memory
         mCblk->stepUser(mCblk->frameCount);
     }
 
@@ -990,8 +991,8 @@
     // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
     // while we are accessing the cblk
     mLock.lock();
-    sp <IAudioTrack> audioTrack = mAudioTrack;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioTrack> audioTrack = mAudioTrack;
+    sp<IMemory> iMem = mCblkMemory;
     mLock.unlock();
 
     ssize_t written = 0;
@@ -1094,8 +1095,8 @@
     mLock.lock();
     // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
     // while we are accessing the cblk
-    sp <IAudioTrack> audioTrack = mAudioTrack;
-    sp <IMemory> iMem = mCblkMemory;
+    sp<IAudioTrack> audioTrack = mAudioTrack;
+    sp<IMemory> iMem = mCblkMemory;
     audio_track_cblk_t* cblk = mCblk;
     bool active = mActive;
     mLock.unlock();
@@ -1223,7 +1224,7 @@
 
     if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) {
         ALOGW("dead IAudioTrack, creating a new one from %s TID %d",
-             fromStart ? "start()" : "obtainBuffer()", gettid());
+            fromStart ? "start()" : "obtainBuffer()", gettid());
 
         // signal old cblk condition so that other threads waiting for available buffers stop
         // waiting now
@@ -1309,7 +1310,7 @@
         }
     }
     ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
-         result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
+        result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
         // from now on we switch to the newly created cblk
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index ebadbfa..07b12e4 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -362,7 +362,7 @@
                             audio_format_t *pFormat,
                             uint32_t *pChannels,
                             uint32_t *pLatencyMs,
-                            uint32_t flags)
+                            audio_policy_output_flags_t flags)
     {
         Parcel data, reply;
         uint32_t devices = pDevices ? *pDevices : 0;
@@ -377,7 +377,7 @@
         data.writeInt32(format);
         data.writeInt32(channels);
         data.writeInt32(latency);
-        data.writeInt32(flags);
+        data.writeInt32((int32_t) flags);
         remote()->transact(OPEN_OUTPUT, data, &reply);
         audio_io_handle_t output = (audio_io_handle_t) reply.readInt32();
         ALOGV("openOutput() returned output, %d", output);
@@ -622,11 +622,11 @@
         sp<IEffect> effect;
 
         if (pDesc == NULL) {
-             return effect;
-             if (status) {
-                 *status = BAD_VALUE;
-             }
-         }
+            return effect;
+            if (status) {
+                *status = BAD_VALUE;
+            }
+        }
 
         data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
         data.writeInt32(pid);
@@ -679,7 +679,7 @@
 status_t BnAudioFlinger::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case CREATE_TRACK: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
             pid_t pid = data.readInt32();
@@ -745,7 +745,7 @@
             reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) );
             return NO_ERROR;
         } break;
-         case SET_MASTER_VOLUME: {
+        case SET_MASTER_VOLUME: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
             reply->writeInt32( setMasterVolume(data.readFloat()) );
             return NO_ERROR;
@@ -815,14 +815,14 @@
             String8 keyValuePairs(data.readString8());
             reply->writeInt32(setParameters(ioHandle, keyValuePairs));
             return NO_ERROR;
-         } break;
+        } break;
         case GET_PARAMETERS: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
             audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
             String8 keys(data.readString8());
             reply->writeString8(getParameters(ioHandle, keys));
             return NO_ERROR;
-         } break;
+        } break;
 
         case REGISTER_CLIENT: {
             CHECK_INTERFACE(IAudioFlinger, data, reply);
@@ -845,7 +845,7 @@
             audio_format_t format = (audio_format_t) data.readInt32();
             uint32_t channels = data.readInt32();
             uint32_t latency = data.readInt32();
-            uint32_t flags = data.readInt32();
+            audio_policy_output_flags_t flags = (audio_policy_output_flags_t) data.readInt32();
             audio_io_handle_t output = openOutput(&devices,
                                      &samplingRate,
                                      &format,
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 1db39a3..4178b29 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -68,7 +68,7 @@
 status_t BnAudioFlingerClient::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
     case IO_CONFIG_CHANGED: {
             CHECK_INTERFACE(IAudioFlingerClient, data, reply);
             int event = data.readInt32();
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index da7c124..5040bd9 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -365,7 +365,7 @@
 status_t BnAudioPolicyService::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case SET_DEVICE_CONNECTION_STATE: {
             CHECK_INTERFACE(IAudioPolicyService, data, reply);
             audio_devices_t device =
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp
index 6b473c9..377b9a8 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libmedia/IAudioRecord.cpp
@@ -2,16 +2,16 @@
 **
 ** Copyright 2007, 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 
+** 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 
+**     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 
+** 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.
 */
 
@@ -41,7 +41,7 @@
         : BpInterface<IAudioRecord>(impl)
     {
     }
-    
+
     virtual status_t start(pid_t tid)
     {
         Parcel data, reply;
@@ -55,14 +55,14 @@
         }
         return status;
     }
-    
+
     virtual void stop()
     {
         Parcel data, reply;
         data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor());
         remote()->transact(STOP, data, &reply);
     }
-    
+
     virtual sp<IMemory> getCblk() const
     {
         Parcel data, reply;
@@ -73,7 +73,7 @@
             cblk = interface_cast<IMemory>(reply.readStrongBinder());
         }
         return cblk;
-    }    
+    }
 };
 
 IMPLEMENT_META_INTERFACE(AudioRecord, "android.media.IAudioRecord");
@@ -83,8 +83,8 @@
 status_t BnAudioRecord::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
-       case GET_CBLK: {
+    switch (code) {
+        case GET_CBLK: {
             CHECK_INTERFACE(IAudioRecord, data, reply);
             reply->writeStrongBinder(getCblk()->asBinder());
             return NO_ERROR;
@@ -105,4 +105,3 @@
 }
 
 }; // namespace android
-
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 28ebbbfc..09f31a7 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -2,16 +2,16 @@
 **
 ** Copyright 2007, 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 
+** 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 
+**     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 
+** 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.
 */
 
@@ -48,7 +48,7 @@
         : BpInterface<IAudioTrack>(impl)
     {
     }
-    
+
     virtual sp<IMemory> getCblk() const
     {
         Parcel data, reply;
@@ -74,14 +74,14 @@
         }
         return status;
     }
-    
+
     virtual void stop()
     {
         Parcel data, reply;
         data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
         remote()->transact(STOP, data, &reply);
     }
-    
+
     virtual void flush()
     {
         Parcel data, reply;
@@ -96,14 +96,14 @@
         data.writeInt32(e);
         remote()->transact(MUTE, data, &reply);
     }
-    
+
     virtual void pause()
     {
         Parcel data, reply;
         data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
         remote()->transact(PAUSE, data, &reply);
     }
-    
+
     virtual status_t attachAuxEffect(int effectId)
     {
         Parcel data, reply;
@@ -172,8 +172,8 @@
 status_t BnAudioTrack::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
-       case GET_CBLK: {
+    switch (code) {
+        case GET_CBLK: {
             CHECK_INTERFACE(IAudioTrack, data, reply);
             reply->writeStrongBinder(getCblk()->asBinder());
             return NO_ERROR;
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index 5d40cc8..a303a8f 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -129,7 +129,7 @@
 status_t BnEffect::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case ENABLE: {
             ALOGV("ENABLE");
             CHECK_INTERFACE(IEffect, data, reply);
@@ -186,10 +186,10 @@
         } break;
 
         case GET_CBLK: {
-             CHECK_INTERFACE(IEffect, data, reply);
-             reply->writeStrongBinder(getCblk()->asBinder());
-             return NO_ERROR;
-         } break;
+            CHECK_INTERFACE(IEffect, data, reply);
+            reply->writeStrongBinder(getCblk()->asBinder());
+            return NO_ERROR;
+        } break;
 
         default:
             return BBinder::onTransact(code, data, reply, flags);
@@ -199,4 +199,3 @@
 // ----------------------------------------------------------------------------
 
 }; // namespace android
-
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 4693b45..aef4371 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -94,7 +94,7 @@
 status_t BnEffectClient::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case CONTROL_STATUS_CHANGED: {
             ALOGV("CONTROL_STATUS_CHANGED");
             CHECK_INTERFACE(IEffectClient, data, reply);
@@ -142,4 +142,3 @@
 // ----------------------------------------------------------------------------
 
 }; // namespace android
-
diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp
index aeb35a5..9199db6 100644
--- a/media/libmedia/IMediaDeathNotifier.cpp
+++ b/media/libmedia/IMediaDeathNotifier.cpp
@@ -43,10 +43,10 @@
             binder = sm->getService(String16("media.player"));
             if (binder != 0) {
                 break;
-             }
-             ALOGW("Media player service not published, waiting...");
-             usleep(500000); // 0.5 s
-        } while(true);
+            }
+            ALOGW("Media player service not published, waiting...");
+            usleep(500000); // 0.5 s
+        } while (true);
 
         if (sDeathNotifier == NULL) {
         sDeathNotifier = new DeathNotifier();
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index c47fa41..0bb237d 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -55,6 +55,7 @@
     SET_PARAMETER,
     GET_PARAMETER,
     SET_RETRANSMIT_ENDPOINT,
+    SET_NEXT_PLAYER,
 };
 
 class BpMediaPlayer: public BpInterface<IMediaPlayer>
@@ -307,7 +308,15 @@
         if (OK != err) {
             return err;
         }
+        return reply.readInt32();
+    }
 
+    status_t setNextPlayer(const sp<IMediaPlayer>& player) {
+        Parcel data, reply;
+        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
+        sp<IBinder> b(player->asBinder());
+        data.writeStrongBinder(b);
+        remote()->transact(SET_NEXT_PLAYER, data, &reply);
         return reply.readInt32();
     }
 };
@@ -319,7 +328,7 @@
 status_t BnMediaPlayer::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case DISCONNECT: {
             CHECK_INTERFACE(IMediaPlayer, data, reply);
             disconnect();
@@ -489,7 +498,11 @@
             } else {
                 reply->writeInt32(setRetransmitEndpoint(NULL));
             }
-
+            return NO_ERROR;
+        } break;
+        case SET_NEXT_PLAYER: {
+            CHECK_INTERFACE(IMediaPlayer, data, reply);
+            reply->writeInt32(setNextPlayer(interface_cast<IMediaPlayer>(data.readStrongBinder())));
             return NO_ERROR;
         } break;
         default:
diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp
index 1f135c4..a670c96 100644
--- a/media/libmedia/IMediaPlayerClient.cpp
+++ b/media/libmedia/IMediaPlayerClient.cpp
@@ -56,7 +56,7 @@
 status_t BnMediaPlayerClient::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case NOTIFY: {
             CHECK_INTERFACE(IMediaPlayerClient, data, reply);
             int msg = data.readInt32();
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index f5b5cbd..f5fccef 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -132,7 +132,7 @@
 status_t BnMediaPlayerService::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case CREATE: {
             CHECK_INTERFACE(IMediaPlayerService, data, reply);
             pid_t pid = data.readInt32();
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index 2f4e31a..a710fd7 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -289,7 +289,7 @@
 status_t BnMediaRecorder::onTransact(
                                      uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case RELEASE: {
             ALOGV("RELEASE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp
index ff235c9..e7907e3 100644
--- a/media/libmedia/IMediaRecorderClient.cpp
+++ b/media/libmedia/IMediaRecorderClient.cpp
@@ -53,7 +53,7 @@
 status_t BnMediaRecorderClient::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
-    switch(code) {
+    switch (code) {
         case NOTIFY: {
             CHECK_INTERFACE(IMediaRecorderClient, data, reply);
             int msg = data.readInt32();
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index 6cb5b82..312a493 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -74,14 +74,14 @@
 
     // init the EAS library
     result = EAS_Init(&mEasData);
-    if( result != EAS_SUCCESS) {
+    if (result != EAS_SUCCESS) {
         ALOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting.");
         mState = EAS_STATE_ERROR;
         return result;
     }
     // init the JET library with the default app event controller range
     result = JET_Init(mEasData, NULL, sizeof(S_JET_CONFIG));
-    if( result != EAS_SUCCESS) {
+    if (result != EAS_SUCCESS) {
         ALOGE("JetPlayer::init(): Error initializing JET library, aborting.");
         mState = EAS_STATE_ERROR;
         return result;
@@ -94,7 +94,7 @@
             AUDIO_FORMAT_PCM_16_BIT,
             (pLibConfig->numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
             mTrackBufferSize,
-            0);
+            AUDIO_POLICY_OUTPUT_FLAG_NONE);
 
     // create render and playback thread
     {
@@ -151,7 +151,7 @@
         mAudioBuffer = NULL;
     }
     mEasData = NULL;
-    
+
     return EAS_SUCCESS;
 }
 
@@ -166,7 +166,7 @@
     ALOGV("JetPlayer::render(): entering");
 
     // allocate render buffer
-    mAudioBuffer = 
+    mAudioBuffer =
         new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS];
 
     // signal main thread that we started
@@ -177,8 +177,8 @@
         mCondition.signal();
     }
 
-   while (1) {
-    
+    while (1) {
+
         mMutex.lock(); // [[[[[[[[ LOCK ---------------------------------------
 
         if (mEasData == NULL) {
@@ -186,20 +186,20 @@
             ALOGV("JetPlayer::render(): NULL EAS data, exiting render.");
             goto threadExit;
         }
-            
+
         // nothing to render, wait for client thread to wake us up
         while (!mRender)
         {
             ALOGV("JetPlayer::render(): signal wait");
-            if (audioStarted) { 
-                mAudioTrack->pause(); 
+            if (audioStarted) {
+                mAudioTrack->pause();
                 // we have to restart the playback once we start rendering again
                 audioStarted = false;
             }
             mCondition.wait(mMutex);
             ALOGV("JetPlayer::render(): signal rx'd");
         }
-        
+
         // render midi data into the input buffer
         int num_output = 0;
         EAS_PCM* p = mAudioBuffer;
@@ -210,8 +210,8 @@
             }
             p += count * pLibConfig->numChannels;
             num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM);
-            
-             // send events that were generated (if any) to the event callback
+
+            // send events that were generated (if any) to the event callback
             fireEventsFromJetQueue();
         }
 
@@ -265,9 +265,9 @@
 // precondition: mMutex locked
 void JetPlayer::fireUpdateOnStatusChange()
 {
-    if(  (mJetStatus.currentUserID      != mPreviousJetStatus.currentUserID)
+    if ( (mJetStatus.currentUserID      != mPreviousJetStatus.currentUserID)
        ||(mJetStatus.segmentRepeatCount != mPreviousJetStatus.segmentRepeatCount) ) {
-        if(mEventCallback)  {
+        if (mEventCallback)  {
             mEventCallback(
                 JetPlayer::JET_USERID_UPDATE,
                 mJetStatus.currentUserID,
@@ -278,8 +278,8 @@
         mPreviousJetStatus.segmentRepeatCount = mJetStatus.segmentRepeatCount;
     }
 
-    if(mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) {
-        if(mEventCallback)  {
+    if (mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) {
+        if (mEventCallback)  {
             mEventCallback(
                 JetPlayer::JET_NUMQUEUEDSEGMENT_UPDATE,
                 mJetStatus.numQueuedSegments,
@@ -289,8 +289,8 @@
         mPreviousJetStatus.numQueuedSegments  = mJetStatus.numQueuedSegments;
     }
 
-    if(mJetStatus.paused != mPreviousJetStatus.paused) {
-        if(mEventCallback)  {
+    if (mJetStatus.paused != mPreviousJetStatus.paused) {
+        if (mEventCallback)  {
             mEventCallback(JetPlayer::JET_PAUSE_UPDATE,
                 mJetStatus.paused,
                 -1,
@@ -307,7 +307,7 @@
 // precondition: mMutex locked
 void JetPlayer::fireEventsFromJetQueue()
 {
-    if(!mEventCallback) {
+    if (!mEventCallback) {
         // no callback, just empty the event queue
         while (JET_GetEvent(mEasData, NULL, NULL)) { }
         return;
@@ -341,7 +341,7 @@
     mEasJetFileLoc->offset = 0;
 
     EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc);
-    if(result != EAS_SUCCESS)
+    if (result != EAS_SUCCESS)
         mState = EAS_STATE_ERROR;
     else
         mState = EAS_STATE_OPEN;
@@ -353,7 +353,7 @@
 int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length)
 {
     ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
-    
+
     Mutex::Autolock lock(mMutex);
 
     mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE));
@@ -361,9 +361,9 @@
     mEasJetFileLoc->offset = offset;
     mEasJetFileLoc->length = length;
     mEasJetFileLoc->path = NULL;
-    
+
     EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc);
-    if(result != EAS_SUCCESS)
+    if (result != EAS_SUCCESS)
         mState = EAS_STATE_ERROR;
     else
         mState = EAS_STATE_OPEN;
@@ -392,7 +392,7 @@
 
     JET_Status(mEasData, &mJetStatus);
     this->dumpJetStatus(&mJetStatus);
-    
+
     fireUpdateOnStatusChange();
 
     // wake up render thread
@@ -468,7 +468,7 @@
 
 void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus)
 {
-    if(pJetStatus!=NULL)
+    if (pJetStatus!=NULL)
         ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
                 pJetStatus->currentUserID, pJetStatus->segmentRepeatCount,
                 pJetStatus->numQueuedSegments, pJetStatus->paused);
@@ -478,4 +478,3 @@
 
 
 } // end namespace android
-
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 93ddca8..c224f06 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -26,7 +26,7 @@
 #include <expat.h>
 #include <media/MediaProfiles.h>
 #include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/openmax/OMX_Video.h>
+#include <OMX_Video.h>
 
 namespace android {
 
@@ -1099,12 +1099,12 @@
                                                   camcorder_quality quality) const
 {
     ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
-         name, cameraId, quality);
+        name, cameraId, quality);
 
     int index = getCamcorderProfileIndex(cameraId, quality);
     if (index == -1) {
         ALOGE("The given camcorder profile camera %d quality %d is not found",
-             cameraId, quality);
+            cameraId, quality);
         return -1;
     }
 
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 73d4519..28b5aa7 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -54,7 +54,7 @@
 void MediaScanner::loadSkipList() {
     mSkipList = (char *)malloc(PROPERTY_VALUE_MAX * sizeof(char));
     if (mSkipList) {
-      property_get("testing.mediascanner.skiplist", mSkipList, "");
+        property_get("testing.mediascanner.skiplist", mSkipList, "");
     }
     if (!mSkipList || (strlen(mSkipList) == 0)) {
         free(mSkipList);
@@ -135,8 +135,8 @@
     struct dirent* entry;
 
     if (shouldSkipDirectory(path)) {
-      ALOGD("Skipping: %s", path);
-      return MEDIA_SCAN_RESULT_OK;
+        ALOGD("Skipping: %s", path);
+        return MEDIA_SCAN_RESULT_OK;
     }
 
     // Treat all files as non-media in directories that contain a  ".nomedia" file
diff --git a/media/libmedia/MediaScannerClient.cpp b/media/libmedia/MediaScannerClient.cpp
index cdfd477..e1e334836 100644
--- a/media/libmedia/MediaScannerClient.cpp
+++ b/media/libmedia/MediaScannerClient.cpp
@@ -228,4 +228,3 @@
 }
 
 }  // namespace android
-
diff --git a/media/libmedia/Metadata.cpp b/media/libmedia/Metadata.cpp
index 546a9b0..ef8a9ed 100644
--- a/media/libmedia/Metadata.cpp
+++ b/media/libmedia/Metadata.cpp
@@ -57,7 +57,7 @@
 
 Metadata::Metadata(Parcel *p)
     :mData(p),
-     mBegin(p->dataPosition()) { }
+      mBegin(p->dataPosition()) { }
 
 Metadata::~Metadata() { }
 
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 54eb98a..717d316 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -268,8 +268,8 @@
           repeatCnt: 0,
           repeatSegment: 0 },                            // TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI
         { segments: { { duration: 0,  waveFreq: { 0 }, 0, 0} },
-           repeatCnt: 0,
-           repeatSegment: 0 },                            // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3
+          repeatCnt: 0,
+          repeatSegment: 0 },                            // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3
         { segments: { { duration: 32, waveFreq: { 2091, 0 }, 0, 0 },
                       { duration: 64, waveFreq: { 2556, 0 }, 4, 0 },
                       { duration: 20, waveFreq: { 2091, 0 }, 0, 0 },
@@ -1015,7 +1015,7 @@
         mpAudioTrack = NULL;
     }
 
-   // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
+    // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
     mpAudioTrack = new AudioTrack();
     ALOGV("Create Track: %p", mpAudioTrack);
 
@@ -1024,7 +1024,7 @@
                       AUDIO_FORMAT_PCM_16_BIT,
                       AUDIO_CHANNEL_OUT_MONO,
                       0,
-                      0,
+                      AUDIO_POLICY_OUTPUT_FLAG_NONE,
                       audioCallback,
                       this,
                       0,
@@ -1284,9 +1284,9 @@
             ALOGV("Cbk starting track");
             lpToneGen->mState = TONE_PLAYING;
             lSignal = true;
-           break;
+            break;
         case TONE_PLAYING:
-           break;
+            break;
         default:
             // Force loop exit
             lNumSmp = 0;
@@ -1578,4 +1578,3 @@
 }
 
 }  // end namespace android
-
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index 70f8c0c..bcd6ae4 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -66,7 +66,7 @@
             }
         }
         t->mLock.lock();
-     }
+    }
 
     status_t status = AudioEffect::setEnabled(enabled);
 
@@ -320,4 +320,3 @@
 }
 
 }; // namespace android
-
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index 8d53357..b0241aa 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -45,7 +45,7 @@
             }
             ALOGW("MediaPlayerService not published, waiting...");
             usleep(500000); // 0.5 s
-        } while(true);
+        } while (true);
         if (sDeathNotifier == NULL) {
             sDeathNotifier = new DeathNotifier();
         }
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index 4ff1862..b52a37d 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -195,8 +195,8 @@
             (mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
             ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
     if ((mPlayer != NULL) && hasBeenInitialized) {
-         ALOGV("invoke %d", request.dataSize());
-         return  mPlayer->invoke(request, reply);
+        ALOGV("invoke %d", request.dataSize());
+        return  mPlayer->invoke(request, reply);
     }
     ALOGE("invoke failed: wrong state %X", mCurrentState);
     return INVALID_OPERATION;
@@ -556,9 +556,9 @@
         return BAD_VALUE;
     }
     if (sessionId != mAudioSessionId) {
-      AudioSystem::releaseAudioSessionId(mAudioSessionId);
-      AudioSystem::acquireAudioSessionId(sessionId);
-      mAudioSessionId = sessionId;
+        AudioSystem::releaseAudioSessionId(mAudioSessionId);
+        AudioSystem::acquireAudioSessionId(sessionId);
+        mAudioSessionId = sessionId;
     }
     return NO_ERROR;
 }
@@ -610,7 +610,7 @@
     ALOGV("MediaPlayer::getParameter(%d)", key);
     Mutex::Autolock _l(mLock);
     if (mPlayer != NULL) {
-         return  mPlayer->getParameter(key, reply);
+        return  mPlayer->getParameter(key, reply);
     }
     ALOGV("getParameter: no active player");
     return INVALID_OPERATION;
@@ -658,7 +658,7 @@
     // and seekTo within the same process.
     // FIXME: Remember, this is a hack, it's not even a hack that is applied
     // consistently for all use-cases, this needs to be revisited.
-     if (mLockThreadId != getThreadId()) {
+    if (mLockThreadId != getThreadId()) {
         mLock.lock();
         locked = true;
     }
@@ -788,4 +788,11 @@
 
 }
 
+status_t MediaPlayer::setNextMediaPlayer(const sp<MediaPlayer>& next) {
+    if (mPlayer == NULL) {
+        return NO_INIT;
+    }
+    return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer);
+}
+
 }; // namespace android
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index cc73014..9541015 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -31,7 +31,7 @@
 status_t MediaRecorder::setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
 {
     ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -52,7 +52,7 @@
 status_t MediaRecorder::setPreviewSurface(const sp<Surface>& surface)
 {
     ALOGV("setPreviewSurface(%p)", surface.get());
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -77,7 +77,7 @@
 status_t MediaRecorder::init()
 {
     ALOGV("init");
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -107,7 +107,7 @@
 status_t MediaRecorder::setVideoSource(int vs)
 {
     ALOGV("setVideoSource(%d)", vs);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -142,7 +142,7 @@
 status_t MediaRecorder::setAudioSource(int as)
 {
     ALOGV("setAudioSource(%d)", as);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -175,7 +175,7 @@
 status_t MediaRecorder::setOutputFormat(int of)
 {
     ALOGV("setOutputFormat(%d)", of);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -201,7 +201,7 @@
 status_t MediaRecorder::setVideoEncoder(int ve)
 {
     ALOGV("setVideoEncoder(%d)", ve);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -231,7 +231,7 @@
 status_t MediaRecorder::setAudioEncoder(int ae)
 {
     ALOGV("setAudioEncoder(%d)", ae);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -261,7 +261,7 @@
 status_t MediaRecorder::setOutputFile(const char* path)
 {
     ALOGV("setOutputFile(%s)", path);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -287,7 +287,7 @@
 status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
 {
     ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -324,7 +324,7 @@
 status_t MediaRecorder::setVideoSize(int width, int height)
 {
     ALOGV("setVideoSize(%d, %d)", width, height);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -367,7 +367,7 @@
 status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
 {
     ALOGV("setVideoFrameRate(%d)", frames_per_second);
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -391,7 +391,7 @@
 
 status_t MediaRecorder::setParameters(const String8& params) {
     ALOGV("setParameters(%s)", params.string());
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -419,7 +419,7 @@
 status_t MediaRecorder::prepare()
 {
     ALOGV("prepare");
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -458,7 +458,7 @@
 status_t MediaRecorder::getMaxAmplitude(int* max)
 {
     ALOGV("getMaxAmplitude");
-    if(mMediaRecorder == NULL) {
+    if (mMediaRecorder == NULL) {
         ALOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
@@ -536,7 +536,7 @@
 
     doCleanUp();
     status_t ret = UNKNOWN_ERROR;
-    switch(mCurrentState) {
+    switch (mCurrentState) {
         case MEDIA_RECORDER_IDLE:
             ret = OK;
             break;
@@ -547,7 +547,7 @@
         case MEDIA_RECORDER_ERROR: {
             ret = doReset();
             if (OK != ret) {
-               return ret;  // No need to continue
+                return ret;  // No need to continue
             }
         }  // Intentional fall through
         case MEDIA_RECORDER_INITIALIZED:
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index e521648..41bcab0 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -36,13 +36,13 @@
         libstagefright_nuplayer                 \
         libstagefright_rtsp                     \
 
-LOCAL_C_INCLUDES :=                                                 \
+LOCAL_C_INCLUDES :=                                               \
 	$(JNI_H_INCLUDE)                                                \
 	$(call include-path-for, graphics corecg)                       \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
 	$(TOP)/frameworks/base/media/libstagefright/include             \
 	$(TOP)/frameworks/base/media/libstagefright/rtsp                \
-        $(TOP)/external/tremolo/Tremolo \
+	$(TOP)/frameworks/native/include/media/openmax                  \
+	$(TOP)/external/tremolo/Tremolo
 
 LOCAL_MODULE:= libmediaplayerservice
 
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 1a85c9c..1cc120c 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1068,6 +1068,20 @@
     return ret;
 }
 
+status_t MediaPlayerService::Client::setNextPlayer(const sp<IMediaPlayer>& player) {
+    ALOGV("setNextPlayer");
+    Mutex::Autolock l(mLock);
+    sp<Client> c = static_cast<Client*>(player.get());
+    mNextClient = c;
+    if (mAudioOutput != NULL && c != NULL) {
+        mAudioOutput->setNextOutput(c->mAudioOutput);
+    } else {
+        ALOGE("no current audio output");
+    }
+    return OK;
+}
+
+
 status_t MediaPlayerService::Client::seekTo(int msec)
 {
     ALOGV("[%d] seekTo(%d)", mConnId, msec);
@@ -1189,6 +1203,15 @@
 {
     Client* client = static_cast<Client*>(cookie);
 
+    {
+        Mutex::Autolock l(client->mLock);
+        if (msg == MEDIA_PLAYBACK_COMPLETE && client->mNextClient != NULL) {
+            client->mAudioOutput->switchToNextOutput();
+            client->mNextClient->start();
+            client->mNextClient->mClient->notify(MEDIA_INFO, MEDIA_INFO_STARTED_AS_NEXT, 0, obj);
+        }
+    }
+
     if (MEDIA_INFO == msg &&
         MEDIA_INFO_METADATA_UPDATE == ext1) {
         const media::Metadata::Type metadata_type = ext2;
@@ -1376,9 +1399,11 @@
 MediaPlayerService::AudioOutput::AudioOutput(int sessionId)
     : mCallback(NULL),
       mCallbackCookie(NULL),
+      mCallbackData(NULL),
       mSessionId(sessionId) {
     ALOGV("AudioOutput(%d)", sessionId);
     mTrack = 0;
+    mRecycledTrack = 0;
     mStreamType = AUDIO_STREAM_MUSIC;
     mLeftVolume = 1.0;
     mRightVolume = 1.0;
@@ -1393,6 +1418,8 @@
 MediaPlayerService::AudioOutput::~AudioOutput()
 {
     close();
+    delete mRecycledTrack;
+    delete mCallbackData;
 }
 
 void MediaPlayerService::AudioOutput::setMinBufferCount()
@@ -1473,7 +1500,6 @@
     }
     ALOGV("open(%u, %d, 0x%x, %d, %d, %d)", sampleRate, channelCount, channelMask,
             format, bufferCount, mSessionId);
-    if (mTrack) close();
     int afSampleRate;
     int afFrameCount;
     int frameCount;
@@ -1494,18 +1520,57 @@
             return NO_INIT;
         }
     }
+    if (mRecycledTrack) {
+        // check if the existing track can be reused as-is, or if a new track needs to be created.
+
+        bool reuse = true;
+        if ((mCallbackData == NULL && mCallback != NULL) ||
+                (mCallbackData != NULL && mCallback == NULL)) {
+            // recycled track uses callbacks but the caller wants to use writes, or vice versa
+            ALOGV("can't chain callback and write");
+            reuse = false;
+        } else if ((mRecycledTrack->getSampleRate() != sampleRate) ||
+                (mRecycledTrack->channelCount() != channelCount) ||
+                (mRecycledTrack->frameCount() != frameCount)) {
+            ALOGV("samplerate, channelcount or framecount differ");
+            reuse = false;
+        }
+        if (reuse) {
+            ALOGV("chaining to next output");
+            close();
+            mTrack = mRecycledTrack;
+            mRecycledTrack = NULL;
+            if (mCallbackData != NULL) {
+                mCallbackData->setOutput(this);
+            }
+            return OK;
+        }
+
+        // if we're not going to reuse the track, unblock and flush it
+        if (mCallbackData != NULL) {
+            mCallbackData->setOutput(NULL);
+            mCallbackData->endTrackSwitch();
+        }
+        mRecycledTrack->flush();
+        delete mRecycledTrack;
+        mRecycledTrack = NULL;
+        delete mCallbackData;
+        mCallbackData = NULL;
+        close();
+    }
 
     AudioTrack *t;
     if (mCallback != NULL) {
+        mCallbackData = new CallbackData(this);
         t = new AudioTrack(
                 mStreamType,
                 sampleRate,
                 format,
                 channelMask,
                 frameCount,
-                0 /* flags */,
+                AUDIO_POLICY_OUTPUT_FLAG_NONE,
                 CallbackWrapper,
-                this,
+                mCallbackData,
                 0,
                 mSessionId);
     } else {
@@ -1515,7 +1580,7 @@
                 format,
                 channelMask,
                 frameCount,
-                0,
+                AUDIO_POLICY_OUTPUT_FLAG_NONE,
                 NULL,
                 NULL,
                 0,
@@ -1546,6 +1611,9 @@
 void MediaPlayerService::AudioOutput::start()
 {
     ALOGV("start");
+    if (mCallbackData != NULL) {
+        mCallbackData->endTrackSwitch();
+    }
     if (mTrack) {
         mTrack->setVolume(mLeftVolume, mRightVolume);
         mTrack->setAuxEffectSendLevel(mSendLevel);
@@ -1553,8 +1621,27 @@
     }
 }
 
+void MediaPlayerService::AudioOutput::setNextOutput(const sp<AudioOutput>& nextOutput) {
+    mNextOutput = nextOutput;
+}
 
 
+void MediaPlayerService::AudioOutput::switchToNextOutput() {
+    ALOGV("switchToNextOutput");
+    if (mNextOutput != NULL) {
+        if (mCallbackData != NULL) {
+            mCallbackData->beginTrackSwitch();
+        }
+        delete mNextOutput->mCallbackData;
+        mNextOutput->mCallbackData = mCallbackData;
+        mCallbackData = NULL;
+        mNextOutput->mRecycledTrack = mTrack;
+        mTrack = NULL;
+        mNextOutput->mSampleRateHz = mSampleRateHz;
+        mNextOutput->mMsecsPerFrame = mMsecsPerFrame;
+    }
+}
+
 ssize_t MediaPlayerService::AudioOutput::write(const void* buffer, size_t size)
 {
     LOG_FATAL_IF(mCallback != NULL, "Don't call write if supplying a callback.");
@@ -1646,13 +1733,22 @@
         return;
     }
 
-    AudioOutput *me = (AudioOutput *)cookie;
+    CallbackData *data = (CallbackData*)cookie;
+    data->lock();
+    AudioOutput *me = data->getOutput();
     AudioTrack::Buffer *buffer = (AudioTrack::Buffer *)info;
+    if (me == NULL) {
+        // no output set, likely because the track was scheduled to be reused
+        // by another player, but the format turned out to be incompatible.
+        data->unlock();
+        buffer->size = 0;
+        return;
+    }
 
     size_t actualSize = (*me->mCallback)(
             me, buffer->raw, buffer->size, me->mCallbackCookie);
 
-    if (actualSize == 0 && buffer->size > 0) {
+    if (actualSize == 0 && buffer->size > 0 && me->mNextOutput == NULL) {
         // We've reached EOS but the audio track is not stopped yet,
         // keep playing silence.
 
@@ -1661,6 +1757,7 @@
     }
 
     buffer->size = actualSize;
+    data->unlock();
 }
 
 int MediaPlayerService::AudioOutput::getSessionId()
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 85cec22..d4e0eb1 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -31,6 +31,7 @@
 #include <media/IMediaPlayerService.h>
 #include <media/MediaPlayerInterface.h>
 #include <media/Metadata.h>
+#include <media/stagefright/foundation/ABase.h>
 
 #include <system/audio.h>
 
@@ -69,7 +70,9 @@
 
     class AudioOutput : public MediaPlayerBase::AudioSink
     {
-    public:
+        class CallbackData;
+
+     public:
                                 AudioOutput(int sessionId);
         virtual                 ~AudioOutput();
 
@@ -104,14 +107,21 @@
 
         static bool             isOnEmulator();
         static int              getMinBufferCount();
+                void            setNextOutput(const sp<AudioOutput>& nextOutput);
+                void            switchToNextOutput();
+        virtual bool            needsTrailingPadding() { return mNextOutput == NULL; }
+
     private:
         static void             setMinBufferCount();
         static void             CallbackWrapper(
                 int event, void *me, void *info);
 
         AudioTrack*             mTrack;
+        AudioTrack*             mRecycledTrack;
+        sp<AudioOutput>         mNextOutput;
         AudioCallback           mCallback;
         void *                  mCallbackCookie;
+        CallbackData *          mCallbackData;
         audio_stream_type_t     mStreamType;
         float                   mLeftVolume;
         float                   mRightVolume;
@@ -124,7 +134,38 @@
         static bool             mIsOnEmulator;
         static int              mMinBufferCount;  // 12 for emulator; otherwise 4
 
-    };
+        // CallbackData is what is passed to the AudioTrack as the "user" data.
+        // We need to be able to target this to a different Output on the fly,
+        // so we can't use the Output itself for this.
+        class CallbackData {
+        public:
+            CallbackData(AudioOutput *cookie) {
+                mData = cookie;
+                mSwitching = false;
+            }
+            AudioOutput *   getOutput() { return mData;}
+            void            setOutput(AudioOutput* newcookie) { mData = newcookie; }
+            // lock/unlock are used by the callback before accessing the payload of this object
+            void            lock() { mLock.lock(); }
+            void            unlock() { mLock.unlock(); }
+            // beginTrackSwitch/endTrackSwitch are used when this object is being handed over
+            // to the next sink.
+            void            beginTrackSwitch() { mLock.lock(); mSwitching = true; }
+            void            endTrackSwitch() {
+                if (mSwitching) {
+                    mLock.unlock();
+                }
+                mSwitching = false;
+            }
+        private:
+            AudioOutput *   mData;
+            mutable Mutex   mLock;
+            bool            mSwitching;
+            DISALLOW_EVIL_CONSTRUCTORS(CallbackData);
+        };
+
+    }; // AudioOutput
+
 
     class AudioCache : public MediaPlayerBase::AudioSink
     {
@@ -184,7 +225,7 @@
         bool                mCommandComplete;
 
         sp<Thread>          mCallbackThread;
-    };
+    }; // AudioCache
 
 public:
     static  void                instantiate();
@@ -278,6 +319,7 @@
         virtual status_t        setParameter(int key, const Parcel &request);
         virtual status_t        getParameter(int key, Parcel *reply);
         virtual status_t        setRetransmitEndpoint(const struct sockaddr_in* endpoint);
+        virtual status_t        setNextPlayer(const sp<IMediaPlayer>& player);
 
         sp<MediaPlayerBase>     createPlayer(player_type playerType);
 
@@ -350,6 +392,7 @@
                     sp<IBinder>                 mConnectedWindowBinder;
                     struct sockaddr_in          mRetransmitEndpoint;
                     bool                        mRetransmitEndpointValid;
+                    sp<Client>                  mNextClient;
 
         // Metadata filters.
         media::Metadata::Filter mMetadataAllow;  // protected by mLock
@@ -364,7 +407,7 @@
 #if CALLBACK_ANTAGONIZER
                     Antagonizer*                mAntagonizer;
 #endif
-    };
+    }; // Client
 
 // ----------------------------------------------------------------------------
 
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index 33e2f93..9b485d7 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -12,11 +12,11 @@
         StreamingSource.cpp             \
 
 LOCAL_C_INCLUDES := \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax        \
+	$(TOP)/frameworks/base/media/libstagefright/httplive            \
 	$(TOP)/frameworks/base/media/libstagefright/include             \
-        $(TOP)/frameworks/base/media/libstagefright/mpeg2ts             \
-        $(TOP)/frameworks/base/media/libstagefright/httplive            \
-        $(TOP)/frameworks/base/media/libstagefright/rtsp                \
+	$(TOP)/frameworks/base/media/libstagefright/mpeg2ts             \
+	$(TOP)/frameworks/base/media/libstagefright/rtsp                \
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_MODULE:= libstagefright_nuplayer
 
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 5aea8d0..047b4cb 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -57,8 +57,9 @@
 
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax \
         $(TOP)/frameworks/base/include/media/stagefright/timedtext \
+        $(TOP)/frameworks/native/include/media/hardware \
+        $(TOP)/frameworks/native/include/media/openmax \
         $(TOP)/external/expat/lib \
         $(TOP)/external/flac/include \
         $(TOP)/external/tremolo \
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 2b3cb1a..9db3c97 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -151,7 +151,7 @@
 
         mAudioTrack = new AudioTrack(
                 AUDIO_STREAM_MUSIC, mSampleRate, AUDIO_FORMAT_PCM_16_BIT, audioMask,
-                0, 0, &AudioCallback, this, 0);
+                0, AUDIO_POLICY_OUTPUT_FLAG_NONE, &AudioCallback, this, 0);
 
         if ((err = mAudioTrack->initCheck()) != OK) {
             delete mAudioTrack;
@@ -419,7 +419,11 @@
                          timeToCompletionUs, timeToCompletionUs / 1E6);
 
                     postEOS = true;
-                    postEOSDelayUs = timeToCompletionUs + mLatencyUs;
+                    if (mAudioSink->needsTrailingPadding()) {
+                        postEOSDelayUs = timeToCompletionUs + mLatencyUs;
+                    } else {
+                        postEOSDelayUs = 0;
+                    }
                 }
 
                 mReachedEOS = true;
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 5b2ea1f..cbe709b 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -56,9 +56,10 @@
 
     ALOGV("sampleRate: %d, channels: %d", sampleRate, channels);
     CHECK(channels == 1 || channels == 2);
-    uint32_t flags = AudioRecord::RECORD_AGC_ENABLE |
+    AudioRecord::record_flags flags = (AudioRecord::record_flags)
+                    (AudioRecord::RECORD_AGC_ENABLE |
                      AudioRecord::RECORD_NS_ENABLE  |
-                     AudioRecord::RECORD_IIR_ENABLE;
+                     AudioRecord::RECORD_IIR_ENABLE);
     mRecord = new AudioRecord(
                 inputSource, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
                 channels > 1? AUDIO_CHANNEL_IN_STEREO: AUDIO_CHANNEL_IN_MONO,
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 966416e..278e3a2 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -27,9 +27,9 @@
 #include <binder/IServiceManager.h>
 #include <binder/MemoryDealer.h>
 #include <binder/ProcessState.h>
+#include <HardwareAPI.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/IMediaPlayerService.h>
-#include <media/stagefright/HardwareAPI.h>
 #include <media/stagefright/MediaBuffer.h>
 #include <media/stagefright/MediaBufferGroup.h>
 #include <media/stagefright/MediaDefs.h>
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index ab2cff0..602469b 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -20,8 +20,8 @@
 #include <media/stagefright/SurfaceMediaSource.h>
 #include <media/stagefright/MetaData.h>
 #include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/openmax/OMX_IVCommon.h>
-#include <media/stagefright/MetadataBufferType.h>
+#include <OMX_IVCommon.h>
+#include <MetadataBufferType.h>
 
 #include <ui/GraphicBuffer.h>
 #include <gui/ISurfaceComposer.h>
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index 501f4806..c35a77a 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -28,15 +28,22 @@
 #include <media/stagefright/MediaSource.h>
 #include <media/stagefright/MetaData.h>
 #include <utils/String8.h>
+#include <cutils/bitops.h>
+
+#define CHANNEL_MASK_USE_CHANNEL_ORDER 0
 
 namespace android {
 
 enum {
-    WAVE_FORMAT_PCM = 1,
-    WAVE_FORMAT_ALAW = 6,
-    WAVE_FORMAT_MULAW = 7,
+    WAVE_FORMAT_PCM        = 0x0001,
+    WAVE_FORMAT_ALAW       = 0x0006,
+    WAVE_FORMAT_MULAW      = 0x0007,
+    WAVE_FORMAT_EXTENSIBLE = 0xFFFE
 };
 
+static const char* WAVEEXT_SUBFORMAT = "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71";
+
+
 static uint32_t U32_LE_AT(const uint8_t *ptr) {
     return ptr[3] << 24 | ptr[2] << 16 | ptr[1] << 8 | ptr[0];
 }
@@ -84,7 +91,8 @@
 
 WAVExtractor::WAVExtractor(const sp<DataSource> &source)
     : mDataSource(source),
-      mValidFormat(false) {
+      mValidFormat(false),
+      mChannelMask(CHANNEL_MASK_USE_CHANNEL_ORDER) {
     mInitCheck = init();
 }
 
@@ -161,21 +169,37 @@
                 return NO_INIT;
             }
 
-            uint8_t formatSpec[16];
-            if (mDataSource->readAt(offset, formatSpec, 16) < 16) {
+            uint8_t formatSpec[40];
+            if (mDataSource->readAt(offset, formatSpec, 2) < 2) {
                 return NO_INIT;
             }
 
             mWaveFormat = U16_LE_AT(formatSpec);
             if (mWaveFormat != WAVE_FORMAT_PCM
                     && mWaveFormat != WAVE_FORMAT_ALAW
-                    && mWaveFormat != WAVE_FORMAT_MULAW) {
+                    && mWaveFormat != WAVE_FORMAT_MULAW
+                    && mWaveFormat != WAVE_FORMAT_EXTENSIBLE) {
                 return ERROR_UNSUPPORTED;
             }
 
+            uint8_t fmtSize = 16;
+            if (mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
+                fmtSize = 40;
+            }
+            if (mDataSource->readAt(offset, formatSpec, fmtSize) < fmtSize) {
+                return NO_INIT;
+            }
+
             mNumChannels = U16_LE_AT(&formatSpec[2]);
-            if (mNumChannels != 1 && mNumChannels != 2) {
-                return ERROR_UNSUPPORTED;
+            if (mWaveFormat != WAVE_FORMAT_EXTENSIBLE) {
+                if (mNumChannels != 1 && mNumChannels != 2) {
+                    ALOGW("More than 2 channels (%d) in non-WAVE_EXT, unknown channel mask",
+                            mNumChannels);
+                }
+            } else {
+                if (mNumChannels < 1 && mNumChannels > 8) {
+                    return ERROR_UNSUPPORTED;
+                }
             }
 
             mSampleRate = U32_LE_AT(&formatSpec[4]);
@@ -186,7 +210,8 @@
 
             mBitsPerSample = U16_LE_AT(&formatSpec[14]);
 
-            if (mWaveFormat == WAVE_FORMAT_PCM) {
+            if (mWaveFormat == WAVE_FORMAT_PCM
+                    || mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
                 if (mBitsPerSample != 8 && mBitsPerSample != 16
                     && mBitsPerSample != 24) {
                     return ERROR_UNSUPPORTED;
@@ -199,6 +224,42 @@
                 }
             }
 
+            if (mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
+                uint16_t validBitsPerSample = U16_LE_AT(&formatSpec[18]);
+                if (validBitsPerSample != mBitsPerSample) {
+                    ALOGE("validBits(%d) != bitsPerSample(%d) are not supported",
+                            validBitsPerSample, mBitsPerSample);
+                    return ERROR_UNSUPPORTED;
+                }
+
+                mChannelMask = U32_LE_AT(&formatSpec[20]);
+                ALOGV("numChannels=%d channelMask=0x%x", mNumChannels, mChannelMask);
+                if ((mChannelMask >> 18) != 0) {
+                    ALOGE("invalid channel mask 0x%x", mChannelMask);
+                    return ERROR_MALFORMED;
+                }
+
+                if ((mChannelMask != CHANNEL_MASK_USE_CHANNEL_ORDER)
+                        && (popcount(mChannelMask) != mNumChannels)) {
+                    ALOGE("invalid number of channels (%d) in channel mask (0x%x)",
+                            popcount(mChannelMask), mChannelMask);
+                    return ERROR_MALFORMED;
+                }
+
+                // In a WAVE_EXT header, the first two bytes of the GUID stored at byte 24 contain
+                // the sample format, using the same definitions as a regular WAV header
+                mWaveFormat = U16_LE_AT(&formatSpec[24]);
+                if (mWaveFormat != WAVE_FORMAT_PCM
+                        && mWaveFormat != WAVE_FORMAT_ALAW
+                        && mWaveFormat != WAVE_FORMAT_MULAW) {
+                    return ERROR_UNSUPPORTED;
+                }
+                if (memcmp(&formatSpec[26], WAVEEXT_SUBFORMAT, 14)) {
+                    ALOGE("unsupported GUID");
+                    return ERROR_UNSUPPORTED;
+                }
+            }
+
             mValidFormat = true;
         } else if (!memcmp(chunkHeader, "data", 4)) {
             if (mValidFormat) {
@@ -224,6 +285,7 @@
                 }
 
                 mTrackMeta->setInt32(kKeyChannelCount, mNumChannels);
+                mTrackMeta->setInt32(kKeyChannelMask, mChannelMask);
                 mTrackMeta->setInt32(kKeySampleRate, mSampleRate);
 
                 size_t bytesPerSample = mBitsPerSample >> 3;
diff --git a/media/libstagefright/chromium_http/Android.mk b/media/libstagefright/chromium_http/Android.mk
index 63775f1..e37b4a8 100644
--- a/media/libstagefright/chromium_http/Android.mk
+++ b/media/libstagefright/chromium_http/Android.mk
@@ -10,7 +10,7 @@
 LOCAL_C_INCLUDES:= \
         $(JNI_H_INCLUDE) \
         frameworks/base/media/libstagefright \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax \
+        $(TOP)/frameworks/native/include/media/openmax \
         external/chromium \
         external/chromium/android
 
diff --git a/media/libstagefright/codecs/aacdec/Android.mk b/media/libstagefright/codecs/aacdec/Android.mk
index 20c7bc0..fd6de79 100644
--- a/media/libstagefright/codecs/aacdec/Android.mk
+++ b/media/libstagefright/codecs/aacdec/Android.mk
@@ -164,7 +164,7 @@
 
 LOCAL_C_INCLUDES := \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
 
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 509193c..b47cb1e 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -94,9 +94,9 @@
         SoftAACEncoder.cpp
 
 LOCAL_C_INCLUDES := \
-        frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+	frameworks/base/media/libstagefright/include \
 	frameworks/base/media/libstagefright/codecs/common/include \
+	frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
 
diff --git a/media/libstagefright/codecs/aacenc/src/adj_thr.c b/media/libstagefright/codecs/aacenc/src/adj_thr.c
index 373b063..07b33b7 100644
--- a/media/libstagefright/codecs/aacenc/src/adj_thr.c
+++ b/media/libstagefright/codecs/aacenc/src/adj_thr.c
@@ -438,7 +438,7 @@
 	  for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
         Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
 
-        if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) ) {
+        if (((*pahFlag < AH_ACTIVE) || (deltaPe > 0)) && (redThrExp > 0) && (redThrExp >= *psfbNActiveLines)) {
 
           *psfbPeFactors = (*psfbNActiveLines) * (0x7fffffff / redThrExp);
           normFactor = L_add(normFactor, *psfbPeFactors);
@@ -466,7 +466,7 @@
         deltaSfbPe = *psfbPeFactors * deltaPe;
 
 		/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
-        if (*psfbNActiveLines > 0) {
+        if (*psfbNActiveLines > 0 && (normFactor* (*psfbNActiveLines)) != 0) {
           /* new threshold */
           Word32 thrFactor;
           sfbEn  = psyOutChan->sfbEnergy[sfbGrp+sfb];
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.mk b/media/libstagefright/codecs/amrnb/dec/Android.mk
index 23a22ef..b81306d 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.mk
+++ b/media/libstagefright/codecs/amrnb/dec/Android.mk
@@ -61,12 +61,12 @@
 
 LOCAL_C_INCLUDES := \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/base/media/libstagefright/codecs/amrwb/src \
+        frameworks/native/include/media/openmax \
         $(LOCAL_PATH)/src \
         $(LOCAL_PATH)/include \
         $(LOCAL_PATH)/../common/include \
-        $(LOCAL_PATH)/../common \
-        frameworks/base/media/libstagefright/codecs/amrwb/src \
+        $(LOCAL_PATH)/../common
 
 LOCAL_CFLAGS := -DOSCL_IMPORT_REF=
 
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.mk b/media/libstagefright/codecs/amrnb/enc/Android.mk
index 94e8726..21937bf 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.mk
+++ b/media/libstagefright/codecs/amrnb/enc/Android.mk
@@ -84,7 +84,7 @@
 
 LOCAL_C_INCLUDES := \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax \
         $(LOCAL_PATH)/src \
         $(LOCAL_PATH)/include \
         $(LOCAL_PATH)/../common/include \
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 6ce6171..3a46ec8 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -125,9 +125,9 @@
         SoftAMRWBEncoder.cpp
 
 LOCAL_C_INCLUDES := \
-        frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+	frameworks/base/media/libstagefright/include \
 	frameworks/base/media/libstagefright/codecs/common/include \
+	frameworks/native/include/media/openmax
 
 LOCAL_STATIC_LIBRARIES := \
         libstagefright_amrwbenc
diff --git a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
index c23dce6..f42a27c 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
@@ -29,11 +29,7 @@
 #define MIN_16 (Word16)-32768	/* 0x8000 */
 
 
-#ifdef LINUX
-#define  static_vo  static __inline__
-#else
 #define  static_vo  static __inline
-#endif
 
 #define saturate(L_var1) (((L_var1) > 0X00007fffL) ? (MAX_16): (((L_var1) < (Word32) 0xffff8000L) ? (MIN_16): ((L_var1) & 0xffff)))
 
diff --git a/media/libstagefright/codecs/avc/enc/Android.mk b/media/libstagefright/codecs/avc/enc/Android.mk
index eb2e320..54cc9b1 100644
--- a/media/libstagefright/codecs/avc/enc/Android.mk
+++ b/media/libstagefright/codecs/avc/enc/Android.mk
@@ -25,8 +25,8 @@
 LOCAL_C_INCLUDES := \
     $(LOCAL_PATH)/src \
     $(LOCAL_PATH)/../common/include \
-    $(TOP)/frameworks/base/include/media/stagefright/openmax \
-    $(TOP)/frameworks/base/media/libstagefright/include
+    $(TOP)/frameworks/base/media/libstagefright/include \
+    $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS := \
     -D__arm__ \
diff --git a/media/libstagefright/codecs/g711/dec/Android.mk b/media/libstagefright/codecs/g711/dec/Android.mk
index 6692533..42706a5 100644
--- a/media/libstagefright/codecs/g711/dec/Android.mk
+++ b/media/libstagefright/codecs/g711/dec/Android.mk
@@ -6,7 +6,7 @@
 
 LOCAL_C_INCLUDES := \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES := \
         libstagefright libstagefright_omx libstagefright_foundation libutils
diff --git a/media/libstagefright/codecs/m4v_h263/dec/Android.mk b/media/libstagefright/codecs/m4v_h263/dec/Android.mk
index 2ffa5f2..8c245d1 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/Android.mk
+++ b/media/libstagefright/codecs/m4v_h263/dec/Android.mk
@@ -42,7 +42,7 @@
 	$(LOCAL_PATH)/src \
 	$(LOCAL_PATH)/include \
 	$(TOP)/frameworks/base/media/libstagefright/include \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS := -DOSCL_EXPORT_REF= -DOSCL_IMPORT_REF=
 
@@ -59,7 +59,7 @@
 	$(LOCAL_PATH)/src \
 	$(LOCAL_PATH)/include \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS := -DOSCL_EXPORT_REF= -DOSCL_IMPORT_REF=
 
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.mk b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
index 43318e9..2b7c938 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.mk
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.mk
@@ -31,7 +31,7 @@
 LOCAL_C_INCLUDES := \
     $(LOCAL_PATH)/src \
     $(LOCAL_PATH)/include \
-    $(TOP)/frameworks/base/include/media/stagefright/openmax \
-    $(TOP)/frameworks/base/media/libstagefright/include
+    $(TOP)/frameworks/base/media/libstagefright/include \
+    $(TOP)/frameworks/native/include/media/openmax
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/codecs/mp3dec/Android.mk b/media/libstagefright/codecs/mp3dec/Android.mk
index a08c9f0..ed51aa5 100644
--- a/media/libstagefright/codecs/mp3dec/Android.mk
+++ b/media/libstagefright/codecs/mp3dec/Android.mk
@@ -65,7 +65,7 @@
 
 LOCAL_C_INCLUDES := \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax \
         $(LOCAL_PATH)/src \
         $(LOCAL_PATH)/include
 
diff --git a/media/libstagefright/codecs/on2/dec/Android.mk b/media/libstagefright/codecs/on2/dec/Android.mk
index 32bbd6b..2997228 100644
--- a/media/libstagefright/codecs/on2/dec/Android.mk
+++ b/media/libstagefright/codecs/on2/dec/Android.mk
@@ -9,7 +9,7 @@
         $(TOP)/external/libvpx/vpx_codec \
         $(TOP)/external/libvpx/vpx_ports \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax \
 
 LOCAL_STATIC_LIBRARIES := \
         libvpx
diff --git a/media/libstagefright/codecs/on2/h264dec/Android.mk b/media/libstagefright/codecs/on2/h264dec/Android.mk
index 5b3c876..43c20f0 100644
--- a/media/libstagefright/codecs/on2/h264dec/Android.mk
+++ b/media/libstagefright/codecs/on2/h264dec/Android.mk
@@ -35,7 +35,7 @@
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/./inc \
 	frameworks/base/media/libstagefright/include \
-	frameworks/base/include/media/stagefright/openmax \
+	frameworks/native/include/media/openmax \
 
 MY_ASM := \
 	./source/arm_neon_asm_gcc/h264bsdWriteMacroblock.S \
diff --git a/media/libstagefright/codecs/vorbis/dec/Android.mk b/media/libstagefright/codecs/vorbis/dec/Android.mk
index f33f3ac..fca70b7 100644
--- a/media/libstagefright/codecs/vorbis/dec/Android.mk
+++ b/media/libstagefright/codecs/vorbis/dec/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_C_INCLUDES := \
         external/tremolo \
         frameworks/base/media/libstagefright/include \
-        frameworks/base/include/media/stagefright/openmax \
+        frameworks/native/include/media/openmax \
 
 LOCAL_SHARED_LIBRARIES := \
         libvorbisidec libstagefright libstagefright_omx \
diff --git a/media/libstagefright/colorconversion/Android.mk b/media/libstagefright/colorconversion/Android.mk
index 62ba40f..59a64ba 100644
--- a/media/libstagefright/colorconversion/Android.mk
+++ b/media/libstagefright/colorconversion/Android.mk
@@ -6,7 +6,7 @@
         SoftwareRenderer.cpp
 
 LOCAL_C_INCLUDES := \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax \
+        $(TOP)/frameworks/native/include/media/openmax \
         $(TOP)/hardware/msm7k
 
 LOCAL_MODULE:= libstagefright_color_conversion
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index 9225e41..a5990c3 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -9,9 +9,9 @@
 
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
-        $(TOP)/frameworks/base/media/libstagefright \
-        $(TOP)/external/openssl/include
+	$(TOP)/frameworks/base/media/libstagefright \
+	$(TOP)/frameworks/native/include/media/openmax \
+	$(TOP)/external/openssl/include
 
 LOCAL_MODULE:= libstagefright_httplive
 
diff --git a/media/libstagefright/include/WAVExtractor.h b/media/libstagefright/include/WAVExtractor.h
index ce1f33a..c567ccd 100644
--- a/media/libstagefright/include/WAVExtractor.h
+++ b/media/libstagefright/include/WAVExtractor.h
@@ -47,6 +47,7 @@
     bool mValidFormat;
     uint16_t mWaveFormat;
     uint16_t mNumChannels;
+    uint32_t mChannelMask;
     uint32_t mSampleRate;
     uint16_t mBitsPerSample;
     off64_t mDataOffset;
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index 1f1c68b..e67da4c 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_C_INCLUDES:= \
         $(JNI_H_INCLUDE) \
         $(TOP)/external/libvpx/mkvparser \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax \
+        $(TOP)/frameworks/native/include/media/openmax \
 
 LOCAL_CFLAGS += -Wno-multichar
 
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index 578c669..ac4c2a1 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -11,8 +11,8 @@
 
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
-        $(TOP)/frameworks/base/media/libstagefright
+	$(TOP)/frameworks/base/media/libstagefright \
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_MODULE:= libstagefright_mpeg2ts
 
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index d844f3d..f587a9c 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -14,7 +14,8 @@
 
 LOCAL_C_INCLUDES += \
         frameworks/base/media/libstagefright \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax
+        $(TOP)/frameworks/native/include/media/hardware \
+        $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES :=               \
         libbinder                       \
diff --git a/media/libstagefright/omx/OMXMaster.h b/media/libstagefright/omx/OMXMaster.h
index feee1f9..6069741 100644
--- a/media/libstagefright/omx/OMXMaster.h
+++ b/media/libstagefright/omx/OMXMaster.h
@@ -18,7 +18,7 @@
 
 #define OMX_MASTER_H_
 
-#include <media/stagefright/OMXPluginBase.h>
+#include <OMXPluginBase.h>
 
 #include <utils/threads.h>
 #include <utils/KeyedVector.h>
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 099c4f5..bff3def 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -24,8 +24,8 @@
 #include <OMX_Component.h>
 
 #include <binder/IMemory.h>
+#include <HardwareAPI.h>
 #include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/HardwareAPI.h>
 #include <media/stagefright/MediaErrors.h>
 
 namespace android {
diff --git a/media/libstagefright/omx/SoftOMXPlugin.h b/media/libstagefright/omx/SoftOMXPlugin.h
index f93c323..c89cd87 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.h
+++ b/media/libstagefright/omx/SoftOMXPlugin.h
@@ -19,7 +19,7 @@
 #define SOFT_OMX_PLUGIN_H_
 
 #include <media/stagefright/foundation/ABase.h>
-#include <media/stagefright/OMXPluginBase.h>
+#include <OMXPluginBase.h>
 
 namespace android {
 
diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk
index 0c0a70c..07d47a8 100644
--- a/media/libstagefright/omx/tests/Android.mk
+++ b/media/libstagefright/omx/tests/Android.mk
@@ -10,7 +10,7 @@
 LOCAL_C_INCLUDES := \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_MODULE := omx_tests
 
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index 8230347..b3bc37c 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -19,9 +19,9 @@
 
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
-        $(TOP)/frameworks/base/media/libstagefright/include \
-        $(TOP)/external/openssl/include
+	$(TOP)/frameworks/base/media/libstagefright/include \
+	$(TOP)/frameworks/native/include/media/openmax \
+	$(TOP)/external/openssl/include
 
 LOCAL_MODULE:= libstagefright_rtsp
 
@@ -47,7 +47,7 @@
 LOCAL_C_INCLUDES:= \
 	$(JNI_H_INCLUDE) \
 	frameworks/base/media/libstagefright \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax
+	$(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_CFLAGS += -Wno-multichar
 
diff --git a/media/libstagefright/tests/Android.mk b/media/libstagefright/tests/Android.mk
index 357feb1..656a630 100644
--- a/media/libstagefright/tests/Android.mk
+++ b/media/libstagefright/tests/Android.mk
@@ -38,7 +38,7 @@
     external/stlport/stlport \
 	frameworks/base/media/libstagefright \
 	frameworks/base/media/libstagefright/include \
-	$(TOP)/frameworks/base/include/media/stagefright/openmax \
+	$(TOP)/frameworks/native/include/media/openmax \
 
 include $(BUILD_EXECUTABLE)
 
diff --git a/media/libstagefright/timedtext/TimedText3GPPSource.h b/media/libstagefright/timedtext/TimedText3GPPSource.h
index cb7e47c..dfc6418 100644
--- a/media/libstagefright/timedtext/TimedText3GPPSource.h
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.h
@@ -28,26 +28,26 @@
 class Parcel;
 
 class TimedText3GPPSource : public TimedTextSource {
- public:
-  TimedText3GPPSource(const sp<MediaSource>& mediaSource);
-  virtual status_t start() { return mSource->start(); }
-  virtual status_t stop() { return mSource->stop(); }
-  virtual status_t read(
-          int64_t *timeUs,
-          Parcel *parcel,
-          const MediaSource::ReadOptions *options = NULL);
-  virtual status_t extractGlobalDescriptions(Parcel *parcel);
+public:
+    TimedText3GPPSource(const sp<MediaSource>& mediaSource);
+    virtual status_t start() { return mSource->start(); }
+    virtual status_t stop() { return mSource->stop(); }
+    virtual status_t read(
+            int64_t *timeUs,
+            Parcel *parcel,
+            const MediaSource::ReadOptions *options = NULL);
+    virtual status_t extractGlobalDescriptions(Parcel *parcel);
 
- protected:
-  virtual ~TimedText3GPPSource();
+protected:
+    virtual ~TimedText3GPPSource();
 
- private:
-  sp<MediaSource> mSource;
+private:
+    sp<MediaSource> mSource;
 
-  status_t extractAndAppendLocalDescriptions(
-        int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
+    status_t extractAndAppendLocalDescriptions(
+            int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
 
-  DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
+    DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
 };
 
 }  // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSRTSource.h b/media/libstagefright/timedtext/TimedTextSRTSource.h
index a0734d9..acc01f9 100644
--- a/media/libstagefright/timedtext/TimedTextSRTSource.h
+++ b/media/libstagefright/timedtext/TimedTextSRTSource.h
@@ -31,43 +31,43 @@
 class Parcel;
 
 class TimedTextSRTSource : public TimedTextSource {
- public:
-  TimedTextSRTSource(const sp<DataSource>& dataSource);
-  virtual status_t start();
-  virtual status_t stop();
-  virtual status_t read(
-          int64_t *timeUs,
-          Parcel *parcel,
-          const MediaSource::ReadOptions *options = NULL);
+public:
+    TimedTextSRTSource(const sp<DataSource>& dataSource);
+    virtual status_t start();
+    virtual status_t stop();
+    virtual status_t read(
+            int64_t *timeUs,
+            Parcel *parcel,
+            const MediaSource::ReadOptions *options = NULL);
 
- protected:
-  virtual ~TimedTextSRTSource();
+protected:
+    virtual ~TimedTextSRTSource();
 
- private:
-  sp<DataSource> mSource;
+private:
+    sp<DataSource> mSource;
 
-  struct TextInfo {
-      int64_t endTimeUs;
-      // The offset of the text in the original file.
-      off64_t offset;
-      int textLen;
-  };
+    struct TextInfo {
+        int64_t endTimeUs;
+        // The offset of the text in the original file.
+        off64_t offset;
+        int textLen;
+    };
 
-  int mIndex;
-  KeyedVector<int64_t, TextInfo> mTextVector;
+    int mIndex;
+    KeyedVector<int64_t, TextInfo> mTextVector;
 
-  void reset();
-  status_t scanFile();
-  status_t getNextSubtitleInfo(
-          off64_t *offset, int64_t *startTimeUs, TextInfo *info);
-  status_t readNextLine(off64_t *offset, AString *data);
-  status_t getText(
-          const MediaSource::ReadOptions *options,
-          AString *text, int64_t *startTimeUs, int64_t *endTimeUs);
-  status_t extractAndAppendLocalDescriptions(
-          int64_t timeUs, const AString &text, Parcel *parcel);
+    void reset();
+    status_t scanFile();
+    status_t getNextSubtitleInfo(
+            off64_t *offset, int64_t *startTimeUs, TextInfo *info);
+    status_t readNextLine(off64_t *offset, AString *data);
+    status_t getText(
+            const MediaSource::ReadOptions *options,
+            AString *text, int64_t *startTimeUs, int64_t *endTimeUs);
+    status_t extractAndAppendLocalDescriptions(
+            int64_t timeUs, const AString &text, Parcel *parcel);
 
-  DISALLOW_EVIL_CONSTRUCTORS(TimedTextSRTSource);
+    DISALLOW_EVIL_CONSTRUCTORS(TimedTextSRTSource);
 };
 
 }  // namespace android
diff --git a/media/tests/omxjpegdecoder/Android.mk b/media/tests/omxjpegdecoder/Android.mk
index 025a131..3e09a5f 100644
--- a/media/tests/omxjpegdecoder/Android.mk
+++ b/media/tests/omxjpegdecoder/Android.mk
@@ -40,9 +40,9 @@
     $(TOP)/external/skia/include/utils \
     $(TOP)/external/skia/include/effects \
     $(TOP)/frameworks/base/media/libstagefright \
-    $(TOP)/frameworks/base/include/media/stagefright/openmax \
     $(TOP)/frameworks/base/include/ \
-    $(TOP)/frameworks/base/
+    $(TOP)/frameworks/base/ \
+    $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_MODULE := jpeg_bench
 
diff --git a/opengl/java/android/opengl/GLUtils.java b/opengl/java/android/opengl/GLUtils.java
index 125c56e..1527f22 100644
--- a/opengl/java/android/opengl/GLUtils.java
+++ b/opengl/java/android/opengl/GLUtils.java
@@ -227,9 +227,9 @@
     /**
      * Return a string for the EGL error code, or the hex representation
      * if the error is unknown.
-     * 
+     *
      * @param error The EGL error to convert into a String.
-     * 
+     *
      * @return An error string corresponding to the EGL error code.
      */
     public static String getEGLErrorString(int error) {
@@ -269,6 +269,14 @@
         }
     }
 
+    /**
+     * Enable tracing of OpenGL functions for this application.
+     * @hide
+     */
+    public static void enableTracing() {
+        native_enableTracing();
+    }
+
     native private static void nativeClassInit();
 
     native private static int native_getInternalFormat(Bitmap bitmap);
@@ -277,4 +285,5 @@
             Bitmap bitmap, int type, int border);
     native private static int native_texSubImage2D(int target, int level, int xoffset, int yoffset,
             Bitmap bitmap, int format, int type);
+    native private static void native_enableTracing();
 }
diff --git a/packages/SettingsProvider/res/values-in/strings.xml b/packages/SettingsProvider/res/values-in/strings.xml
index d5aea43..bed20eb 100644
--- a/packages/SettingsProvider/res/values-in/strings.xml
+++ b/packages/SettingsProvider/res/values-in/strings.xml
@@ -19,5 +19,5 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4567566098528588863">"Pengaturan Penyimpanan"</string>
+    <string name="app_label" msgid="4567566098528588863">"Setelan Penyimpanan"</string>
 </resources>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index 1e82646..93d8675 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -39,7 +39,7 @@
     <string name="battery_low_percent_format" msgid="1077244949318261761">"<xliff:g id="NUMBER">%d%%</xliff:g> tersisa"</string>
     <string name="invalid_charger" msgid="4549105996740522523">"Pengisian daya USB tidak didukung."\n"Gunakan hanya pengisi daya yang disediakan."</string>
     <string name="battery_low_why" msgid="7279169609518386372">"Penggunaan baterai"</string>
-    <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Pengaturan"</string>
+    <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Setelan"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Mode pesawat"</string>
     <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Putar layar secara otomatis"</string>
@@ -118,7 +118,7 @@
     <string name="accessibility_bluetooth_tether" msgid="4102784498140271969">"Penambatan bluetooth."</string>
     <string name="accessibility_airplane_mode" msgid="834748999790763092">"Mode pesawat."</string>
     <string name="accessibility_battery_level" msgid="7451474187113371965">"Baterai <xliff:g id="NUMBER">%d</xliff:g> persen."</string>
-    <string name="accessibility_settings_button" msgid="799583911231893380">"Pengaturan sistem."</string>
+    <string name="accessibility_settings_button" msgid="799583911231893380">"Setelan sistem."</string>
     <string name="accessibility_notifications_button" msgid="4498000369779421892">"Pemberitahuan."</string>
     <string name="accessibility_remove_notification" msgid="3603099514902182350">"Menghapus pemberitahuan."</string>
     <string name="accessibility_gps_enabled" msgid="3511469499240123019">"GPS diaktifkan."</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index d33ed3f..6574c7d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -304,6 +304,8 @@
         if (DEBUG) {
             Slog.d(TAG, "reorient(): rot=" + mDisplay.getRotation());
         }
+
+        setNavigationIconHints(mNavigationIconHints, true);
     }
 
     @Override
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 1763674..e0a0d2d 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -3832,7 +3832,8 @@
                         int result = ActivityManagerNative.getDefault()
                                 .startActivity(null, dock,
                                         dock.resolveTypeIfNeeded(mContext.getContentResolver()),
-                                        null, 0, null, null, 0, true /* onlyIfNeeded*/, false,
+                                        null, 0, null, null, 0, true /* onlyIfNeeded*/,
+                                        false /* debug */, false /* openglTrace */,
                                         null, null, false);
                         if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
                             return false;
@@ -3842,7 +3843,8 @@
                 int result = ActivityManagerNative.getDefault()
                         .startActivity(null, mHomeIntent,
                                 mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()),
-                                null, 0, null, null, 0, true /* onlyIfNeeded*/, false,
+                                null, 0, null, null, 0, true /* onlyIfNeeded*/,
+                                false /* debug */, false /* openglTrace */,
                                 null, null, false);
                 if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) {
                     return false;
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 37f15e2..bfa4a49 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -190,13 +190,13 @@
             continue;
 
         ALOGI("Loaded %s audio interface from %s (%s)", audio_interfaces[i],
-             mod->name, mod->id);
+            mod->name, mod->id);
         mAudioHwDevs.push(dev);
 
         if (mPrimaryHardwareDev == NULL) {
             mPrimaryHardwareDev = dev;
             ALOGI("Using '%s' (%s.%s) as the primary audio interface",
-                 mod->name, mod->id, audio_interfaces[i]);
+                mod->name, mod->id, audio_interfaces[i]);
         }
     }
 
@@ -515,7 +515,7 @@
     }
 
 Exit:
-    if(status) {
+    if (status != NULL) {
         *status = lStatus;
     }
     return trackHandle;
@@ -610,7 +610,7 @@
     mMasterVolume   = value;
     mMasterVolumeSW = swmv;
     for (size_t i = 0; i < mPlaybackThreads.size(); i++)
-       mPlaybackThreads.valueAt(i)->setMasterVolume(swmv);
+        mPlaybackThreads.valueAt(i)->setMasterVolume(swmv);
 
     return NO_ERROR;
 }
@@ -642,7 +642,7 @@
         Mutex::Autolock _l(mLock);
         mMode = mode;
         for (size_t i = 0; i < mPlaybackThreads.size(); i++)
-           mPlaybackThreads.valueAt(i)->setMode(mode);
+            mPlaybackThreads.valueAt(i)->setMode(mode);
     }
 
     return ret;
@@ -693,7 +693,7 @@
     // This is an optimization, so PlaybackThread doesn't have to look at the one from AudioFlinger
     mMasterMute = muted;
     for (size_t i = 0; i < mPlaybackThreads.size(); i++)
-       mPlaybackThreads.valueAt(i)->setMasterMute(muted);
+        mPlaybackThreads.valueAt(i)->setMasterMute(muted);
 
     return NO_ERROR;
 }
@@ -723,8 +723,9 @@
         AutoMutex lock(mHardwareLock);
 
         mHardwareStatus = AUDIO_HW_GET_MASTER_VOLUME;
-        assert(NULL != mPrimaryHardwareDev);
-        assert(NULL != mPrimaryHardwareDev->get_master_volume);
+        ALOG_ASSERT((NULL != mPrimaryHardwareDev) &&
+                    (NULL != mPrimaryHardwareDev->get_master_volume),
+                "can't get master volume");
 
         mPrimaryHardwareDev->get_master_volume(mPrimaryHardwareDev, &ret_val);
         mHardwareStatus = AUDIO_HW_IDLE;
@@ -760,7 +761,7 @@
 
     if (thread == NULL) {
         for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
-           mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value);
+            mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value);
         }
     } else {
         thread->setStreamVolume(stream, value);
@@ -785,7 +786,7 @@
     AutoMutex lock(mLock);
     mStreamTypes[stream].mute = muted;
     for (uint32_t i = 0; i < mPlaybackThreads.size(); i++)
-       mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted);
+        mPlaybackThreads.valueAt(i)->setStreamMute(stream, muted);
 
     return NO_ERROR;
 }
@@ -1160,7 +1161,7 @@
 void AudioFlinger::ThreadBase::processConfigEvents()
 {
     mLock.lock();
-    while(!mConfigEvents.isEmpty()) {
+    while (!mConfigEvents.isEmpty()) {
         ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
         ConfigEvent configEvent = mConfigEvents[0];
         mConfigEvents.removeAt(0);
@@ -1344,13 +1345,13 @@
             mSuspendedSessions.editValueAt(index);
 
     for (size_t i = 0; i < sessionEffects.size(); i++) {
-        sp <SuspendedSessionDesc> desc = sessionEffects.valueAt(i);
+        sp<SuspendedSessionDesc> desc = sessionEffects.valueAt(i);
         for (int j = 0; j < desc->mRefCount; j++) {
             if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) {
                 chain->setEffectSuspendedAll_l(true);
             } else {
                 ALOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
-                     desc->mType.timeLow);
+                    desc->mType.timeLow);
                 chain->setEffectSuspended_l(&desc->mType, true);
             }
         }
@@ -1385,7 +1386,7 @@
     }
     index = sessionEffects.indexOfKey(key);
 
-    sp <SuspendedSessionDesc> desc;
+    sp<SuspendedSessionDesc> desc;
     if (suspend) {
         if (index >= 0) {
             desc = sessionEffects.valueAt(index);
@@ -1463,8 +1464,9 @@
         // but it would be safer to explicitly pass initial masterVolume as parameter
         mMasterVolume(audioFlinger->masterVolumeSW_l()),
         mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false),
-        // mMixerStatus
-        mPrevMixerStatus(MIXER_IDLE)
+        mMixerStatus(MIXER_IDLE),
+        mPrevMixerStatus(MIXER_IDLE),
+        standbyDelay(AudioFlinger::mStandbyTimeInNsecs)
 {
     snprintf(mName, kNameLength, "AudioOut_%X", id);
 
@@ -1657,14 +1659,14 @@
         // createTrack() was called by the client process.
         if (!mStreamTypes[streamType].valid) {
             ALOGW("createTrack_l() on thread %p: invalidating track on stream %d",
-                 this, streamType);
+                this, streamType);
             android_atomic_or(CBLK_INVALID_ON, &track->mCblk->flags);
         }
     }
     lStatus = NO_ERROR;
 
 Exit:
-    if(status) {
+    if (status) {
         *status = lStatus;
     }
     return track;
@@ -1997,14 +1999,8 @@
     Vector< sp<Track> > tracksToRemove;
 
     standbyTime = systemTime();
-    mixBufferSize = mFrameCount * mFrameSize;
 
     // MIXER
-    // FIXME: Relaxed timing because of a certain device that can't meet latency
-    // Should be reduced to 2x after the vendor fixes the driver issue
-    // increase threshold again due to low power audio mode. The way this warning threshold is
-    // calculated and its usefulness should be reconsidered anyway.
-    nsecs_t maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
     nsecs_t lastWarning = 0;
 if (mType == MIXER) {
     longStandbyExit = false;
@@ -2014,8 +2010,7 @@
     // FIXME could this be made local to while loop?
     writeFrames = 0;
 
-    activeSleepTime = activeSleepTimeUs();
-    idleSleepTime = idleSleepTimeUs();
+    cacheParameters_l();
     sleepTime = idleSleepTime;
 
 if (mType == MIXER) {
@@ -2025,13 +2020,6 @@
     // MIXER
     CpuStats cpuStats;
 
-    // DIRECT
-if (mType == DIRECT) {
-    // use shorter standby delay as on normal output to release
-    // hardware resources as soon as possible
-    standbyDelay = microseconds(activeSleepTime*2);
-}
-
     acquireWakeLock();
 
     while (!exitPending())
@@ -2044,31 +2032,12 @@
 
         processConfigEvents();
 
-        mMixerStatus = MIXER_IDLE;
         { // scope for mLock
 
             Mutex::Autolock _l(mLock);
 
             if (checkForNewParameters_l()) {
-                mixBufferSize = mFrameCount * mFrameSize;
-
-if (mType == MIXER) {
-                // FIXME: Relaxed timing because of a certain device that can't meet latency
-                // Should be reduced to 2x after the vendor fixes the driver issue
-                // increase threshold again due to low power audio mode. The way this warning
-                // threshold is calculated and its usefulness should be reconsidered anyway.
-                maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
-}
-
-                updateWaitTime_l();
-
-                activeSleepTime = activeSleepTimeUs();
-                idleSleepTime = idleSleepTimeUs();
-
-if (mType == DIRECT) {
-                standbyDelay = microseconds(activeSleepTime*2);
-}
-
+                cacheParameters_l();
             }
 
             saveOutputTracks();
@@ -2103,19 +2072,11 @@
 
                     checkSilentMode_l();
 
-if (mType == MIXER || mType == DUPLICATING) {
-                    standbyTime = systemTime() + mStandbyTimeInNsecs;
-}
-
-if (mType == DIRECT) {
                     standbyTime = systemTime() + standbyDelay;
-}
-
                     sleepTime = idleSleepTime;
-
-if (mType == MIXER) {
-                    sleepTimeShift = 0;
-}
+                    if (mType == MIXER) {
+                        sleepTimeShift = 0;
+                    }
 
                     continue;
                 }
@@ -2261,7 +2222,7 @@
         sleepTimeShift--;
     }
     sleepTime = 0;
-    standbyTime = systemTime() + mStandbyTimeInNsecs;
+    standbyTime = systemTime() + standbyDelay;
     //TODO: delay standby when effects have a tail
 }
 
@@ -2548,6 +2509,32 @@
     return mixerStatus;
 }
 
+/*
+The derived values that are cached:
+ - mixBufferSize from frame count * frame size
+ - activeSleepTime from activeSleepTimeUs()
+ - idleSleepTime from idleSleepTimeUs()
+ - standbyDelay from mActiveSleepTimeUs (DIRECT only)
+ - maxPeriod from frame count and sample rate (MIXER only)
+
+The parameters that affect these derived values are:
+ - frame count
+ - frame size
+ - sample rate
+ - device type: A2DP or not
+ - device latency
+ - format: PCM or not
+ - active sleep time
+ - idle sleep time
+*/
+
+void AudioFlinger::PlaybackThread::cacheParameters_l()
+{
+    mixBufferSize = mFrameCount * mFrameSize;
+    activeSleepTime = activeSleepTimeUs();
+    idleSleepTime = idleSleepTimeUs();
+}
+
 void AudioFlinger::MixerThread::invalidateTracks(audio_stream_type_t streamType)
 {
     ALOGV ("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
@@ -2658,10 +2645,10 @@
             status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
                                                     keyValuePair.string());
             if (!mStandby && status == INVALID_OPERATION) {
-               mOutput->stream->common.standby(&mOutput->stream->common);
-               mStandby = true;
-               mBytesWritten = 0;
-               status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
+                mOutput->stream->common.standby(&mOutput->stream->common);
+                mStandby = true;
+                mBytesWritten = 0;
+                status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
                                                        keyValuePair.string());
             }
             if (status == NO_ERROR && reconfig) {
@@ -2718,6 +2705,17 @@
     return (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000);
 }
 
+void AudioFlinger::MixerThread::cacheParameters_l()
+{
+    PlaybackThread::cacheParameters_l();
+
+    // FIXME: Relaxed timing because of a certain device that can't meet latency
+    // Should be reduced to 2x after the vendor fixes the driver issue
+    // increase threshold again due to low power audio mode. The way this warning
+    // threshold is calculated and its usefulness should be reconsidered anyway.
+    maxPeriod = seconds(mFrameCount) / mSampleRate * 15;
+}
+
 // ----------------------------------------------------------------------------
 AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger,
         AudioStreamOut* output, audio_io_handle_t id, uint32_t device)
@@ -2731,80 +2729,6 @@
 {
 }
 
-void AudioFlinger::DirectOutputThread::applyVolume()
-{
-    // Do not apply volume on compressed audio
-    if (!audio_is_linear_pcm(mFormat)) {
-        return;
-    }
-
-    // convert to signed 16 bit before volume calculation
-    if (mFormat == AUDIO_FORMAT_PCM_8_BIT) {
-        size_t count = mFrameCount * mChannelCount;
-        uint8_t *src = (uint8_t *)mMixBuffer + count-1;
-        int16_t *dst = mMixBuffer + count-1;
-        while(count--) {
-            *dst-- = (int16_t)(*src--^0x80) << 8;
-        }
-    }
-
-    size_t frameCount = mFrameCount;
-    int16_t *out = mMixBuffer;
-    if (rampVolume) {
-        if (mChannelCount == 1) {
-            int32_t d = ((int32_t)leftVol - (int32_t)mLeftVolShort) << 16;
-            int32_t vlInc = d / (int32_t)frameCount;
-            int32_t vl = ((int32_t)mLeftVolShort << 16);
-            do {
-                out[0] = clamp16(mul(out[0], vl >> 16) >> 12);
-                out++;
-                vl += vlInc;
-            } while (--frameCount);
-
-        } else {
-            int32_t d = ((int32_t)leftVol - (int32_t)mLeftVolShort) << 16;
-            int32_t vlInc = d / (int32_t)frameCount;
-            d = ((int32_t)rightVol - (int32_t)mRightVolShort) << 16;
-            int32_t vrInc = d / (int32_t)frameCount;
-            int32_t vl = ((int32_t)mLeftVolShort << 16);
-            int32_t vr = ((int32_t)mRightVolShort << 16);
-            do {
-                out[0] = clamp16(mul(out[0], vl >> 16) >> 12);
-                out[1] = clamp16(mul(out[1], vr >> 16) >> 12);
-                out += 2;
-                vl += vlInc;
-                vr += vrInc;
-            } while (--frameCount);
-        }
-    } else {
-        if (mChannelCount == 1) {
-            do {
-                out[0] = clamp16(mul(out[0], leftVol) >> 12);
-                out++;
-            } while (--frameCount);
-        } else {
-            do {
-                out[0] = clamp16(mul(out[0], leftVol) >> 12);
-                out[1] = clamp16(mul(out[1], rightVol) >> 12);
-                out += 2;
-            } while (--frameCount);
-        }
-    }
-
-    // convert back to unsigned 8 bit after volume calculation
-    if (mFormat == AUDIO_FORMAT_PCM_8_BIT) {
-        size_t count = mFrameCount * mChannelCount;
-        int16_t *src = mMixBuffer;
-        uint8_t *dst = (uint8_t *)mMixBuffer;
-        while(count--) {
-            *dst++ = (uint8_t)(((int32_t)*src++ + (1<<7)) >> 8)^0x80;
-        }
-    }
-
-    mLeftVolShort = leftVol;
-    mRightVolShort = rightVol;
-}
-
 AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prepareTracks_l(
     Vector< sp<Track> > *tracksToRemove
 )
@@ -2932,7 +2856,7 @@
         tracksToRemove->add(trackToRemove);
         mActiveTracks.remove(trackToRemove);
         if (!mEffectChains.isEmpty()) {
-            ALOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
+            ALOGV("stopping track on chain %p for session Id: %d", mEffectChains[0].get(),
                     trackToRemove->sessionId());
             mEffectChains[0]->decActiveTrackCnt();
         }
@@ -2965,7 +2889,79 @@
     sleepTime = 0;
     standbyTime = systemTime() + standbyDelay;
     mActiveTrack.clear();
-    applyVolume();
+
+    // apply volume
+
+    // Do not apply volume on compressed audio
+    if (!audio_is_linear_pcm(mFormat)) {
+        return;
+    }
+
+    // convert to signed 16 bit before volume calculation
+    if (mFormat == AUDIO_FORMAT_PCM_8_BIT) {
+        size_t count = mFrameCount * mChannelCount;
+        uint8_t *src = (uint8_t *)mMixBuffer + count-1;
+        int16_t *dst = mMixBuffer + count-1;
+        while (count--) {
+            *dst-- = (int16_t)(*src--^0x80) << 8;
+        }
+    }
+
+    frameCount = mFrameCount;
+    int16_t *out = mMixBuffer;
+    if (rampVolume) {
+        if (mChannelCount == 1) {
+            int32_t d = ((int32_t)leftVol - (int32_t)mLeftVolShort) << 16;
+            int32_t vlInc = d / (int32_t)frameCount;
+            int32_t vl = ((int32_t)mLeftVolShort << 16);
+            do {
+                out[0] = clamp16(mul(out[0], vl >> 16) >> 12);
+                out++;
+                vl += vlInc;
+            } while (--frameCount);
+
+        } else {
+            int32_t d = ((int32_t)leftVol - (int32_t)mLeftVolShort) << 16;
+            int32_t vlInc = d / (int32_t)frameCount;
+            d = ((int32_t)rightVol - (int32_t)mRightVolShort) << 16;
+            int32_t vrInc = d / (int32_t)frameCount;
+            int32_t vl = ((int32_t)mLeftVolShort << 16);
+            int32_t vr = ((int32_t)mRightVolShort << 16);
+            do {
+                out[0] = clamp16(mul(out[0], vl >> 16) >> 12);
+                out[1] = clamp16(mul(out[1], vr >> 16) >> 12);
+                out += 2;
+                vl += vlInc;
+                vr += vrInc;
+            } while (--frameCount);
+        }
+    } else {
+        if (mChannelCount == 1) {
+            do {
+                out[0] = clamp16(mul(out[0], leftVol) >> 12);
+                out++;
+            } while (--frameCount);
+        } else {
+            do {
+                out[0] = clamp16(mul(out[0], leftVol) >> 12);
+                out[1] = clamp16(mul(out[1], rightVol) >> 12);
+                out += 2;
+            } while (--frameCount);
+        }
+    }
+
+    // convert back to unsigned 8 bit after volume calculation
+    if (mFormat == AUDIO_FORMAT_PCM_8_BIT) {
+        size_t count = mFrameCount * mChannelCount;
+        int16_t *src = mMixBuffer;
+        uint8_t *dst = (uint8_t *)mMixBuffer;
+        while (count--) {
+            *dst++ = (uint8_t)(((int32_t)*src++ + (1<<7)) >> 8)^0x80;
+        }
+    }
+
+    mLeftVolShort = leftVol;
+    mRightVolShort = rightVol;
 }
 
 void AudioFlinger::DirectOutputThread::threadLoop_sleepTime()
@@ -3018,10 +3014,10 @@
             status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
                                                     keyValuePair.string());
             if (!mStandby && status == INVALID_OPERATION) {
-               mOutput->stream->common.standby(&mOutput->stream->common);
-               mStandby = true;
-               mBytesWritten = 0;
-               status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
+                mOutput->stream->common.standby(&mOutput->stream->common);
+                mStandby = true;
+                mBytesWritten = 0;
+                status = mOutput->stream->common.set_parameters(&mOutput->stream->common,
                                                        keyValuePair.string());
             }
             if (status == NO_ERROR && reconfig) {
@@ -3074,6 +3070,14 @@
     return time;
 }
 
+void AudioFlinger::DirectOutputThread::cacheParameters_l()
+{
+    PlaybackThread::cacheParameters_l();
+
+    // use shorter standby delay as on normal output to release
+    // hardware resources as soon as possible
+    standbyDelay = microseconds(activeSleepTime*2);
+}
 
 // ----------------------------------------------------------------------------
 
@@ -3127,7 +3131,7 @@
 
 void AudioFlinger::DuplicatingThread::threadLoop_write()
 {
-    standbyTime = systemTime() + mStandbyTimeInNsecs;
+    standbyTime = systemTime() + standbyDelay;
     for (size_t i = 0; i < outputTracks.size(); i++) {
         outputTracks[i]->write(mMixBuffer, writeFrames);
     }
@@ -3204,7 +3208,7 @@
 bool AudioFlinger::DuplicatingThread::outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks)
 {
     for (size_t i = 0; i < outputTracks.size(); i++) {
-        sp <ThreadBase> thread = outputTracks[i]->thread().promote();
+        sp<ThreadBase> thread = outputTracks[i]->thread().promote();
         if (thread == 0) {
             ALOGW("DuplicatingThread::outputsReady() could not promote thread on output track %p", outputTracks[i].get());
             return false;
@@ -3223,6 +3227,14 @@
     return (mWaitTimeMs * 1000) / 2;
 }
 
+void AudioFlinger::DuplicatingThread::cacheParameters_l()
+{
+    // updateWaitTime_l() sets mWaitTimeMs, which affects activeSleepTimeUs(), so call it first
+    updateWaitTime_l();
+
+    MixerThread::cacheParameters_l();
+}
+
 // ----------------------------------------------------------------------------
 
 // TrackBase constructor must be called with AudioFlinger::mLock held
@@ -3252,14 +3264,14 @@
     ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
     // ALOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
-   size_t size = sizeof(audio_track_cblk_t);
-   uint8_t channelCount = popcount(channelMask);
-   size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
-   if (sharedBuffer == 0) {
-       size += bufferSize;
-   }
+    size_t size = sizeof(audio_track_cblk_t);
+    uint8_t channelCount = popcount(channelMask);
+    size_t bufferSize = frameCount*channelCount*sizeof(int16_t);
+    if (sharedBuffer == 0) {
+        size += bufferSize;
+    }
 
-   if (client != NULL) {
+    if (client != NULL) {
         mCblkMemory = client->heap()->allocate(size);
         if (mCblkMemory != 0) {
             mCblk = static_cast<audio_track_cblk_t *>(mCblkMemory->pointer());
@@ -3286,22 +3298,22 @@
             client->heap()->dump("AudioTrack");
             return;
         }
-   } else {
-       mCblk = (audio_track_cblk_t *)(new uint8_t[size]);
-           // construct the shared structure in-place.
-           new(mCblk) audio_track_cblk_t();
-           // clear all buffers
-           mCblk->frameCount = frameCount;
-           mCblk->sampleRate = sampleRate;
-           mChannelCount = channelCount;
-           mChannelMask = channelMask;
-           mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
-           memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
-           // Force underrun condition to avoid false underrun callback until first data is
-           // written to buffer (other flags are cleared)
-           mCblk->flags = CBLK_UNDERRUN_ON;
-           mBufferEnd = (uint8_t *)mBuffer + bufferSize;
-   }
+    } else {
+        mCblk = (audio_track_cblk_t *)(new uint8_t[size]);
+            // construct the shared structure in-place.
+            new(mCblk) audio_track_cblk_t();
+            // clear all buffers
+            mCblk->frameCount = frameCount;
+            mCblk->sampleRate = sampleRate;
+            mChannelCount = channelCount;
+            mChannelMask = channelMask;
+            mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
+            memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
+            // Force underrun condition to avoid false underrun callback until first data is
+            // written to buffer (other flags are cleared)
+            mCblk->flags = CBLK_UNDERRUN_ON;
+            mBufferEnd = (uint8_t *)mBuffer + bufferSize;
+    }
 }
 
 AudioFlinger::ThreadBase::TrackBase::~TrackBase()
@@ -3479,22 +3491,22 @@
 
 // AudioBufferProvider interface
 status_t AudioFlinger::PlaybackThread::Track::getNextBuffer(
-    AudioBufferProvider::Buffer* buffer, int64_t pts)
+        AudioBufferProvider::Buffer* buffer, int64_t pts)
 {
-     audio_track_cblk_t* cblk = this->cblk();
-     uint32_t framesReady;
-     uint32_t framesReq = buffer->frameCount;
+    audio_track_cblk_t* cblk = this->cblk();
+    uint32_t framesReady;
+    uint32_t framesReq = buffer->frameCount;
 
-     // Check if last stepServer failed, try to step now
-     if (mStepServerFailed) {
-         if (!step())  goto getNextBuffer_exit;
-         ALOGV("stepServer recovered");
-         mStepServerFailed = false;
-     }
+    // Check if last stepServer failed, try to step now
+    if (mStepServerFailed) {
+        if (!step())  goto getNextBuffer_exit;
+        ALOGV("stepServer recovered");
+        mStepServerFailed = false;
+    }
 
-     framesReady = cblk->framesReady();
+    framesReady = cblk->framesReady();
 
-     if (CC_LIKELY(framesReady)) {
+    if (CC_LIKELY(framesReady)) {
         uint32_t s = cblk->server;
         uint32_t bufferEnd = cblk->serverBase + cblk->frameCount;
 
@@ -3506,21 +3518,21 @@
             framesReq = bufferEnd - s;
         }
 
-         buffer->raw = getBuffer(s, framesReq);
-         if (buffer->raw == NULL) goto getNextBuffer_exit;
+        buffer->raw = getBuffer(s, framesReq);
+        if (buffer->raw == NULL) goto getNextBuffer_exit;
 
-         buffer->frameCount = framesReq;
+        buffer->frameCount = framesReq;
         return NO_ERROR;
-     }
+    }
 
 getNextBuffer_exit:
-     buffer->raw = NULL;
-     buffer->frameCount = 0;
-     ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
-     return NOT_ENOUGH_DATA;
+    buffer->raw = NULL;
+    buffer->frameCount = 0;
+    ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
+    return NOT_ENOUGH_DATA;
 }
 
-uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const{
+uint32_t AudioFlinger::PlaybackThread::Track::framesReady() const {
     return mCblk->framesReady();
 }
 
@@ -3672,8 +3684,8 @@
     status_t status = DEAD_OBJECT;
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
-       PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
-       status = playbackThread->attachAuxEffect(this, EffectId);
+        PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
+        status = playbackThread->attachAuxEffect(this, EffectId);
     }
     return status;
 }
@@ -3873,7 +3885,7 @@
         {
             Mutex::Autolock mttLock(mMediaTimeTransformLock);
 
-            assert(mMediaTimeTransformValid);
+            ALOG_ASSERT(mMediaTimeTransformValid, "media time transform invalid");
 
             if (mMediaTimeTransform.a_to_b_denom == 0) {
                 // the transform represents a pause, so yield silence
@@ -4092,14 +4104,14 @@
         mOverflow(false)
 {
     if (mCblk != NULL) {
-       ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
-       if (format == AUDIO_FORMAT_PCM_16_BIT) {
-           mCblk->frameSize = mChannelCount * sizeof(int16_t);
-       } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
-           mCblk->frameSize = mChannelCount * sizeof(int8_t);
-       } else {
-           mCblk->frameSize = sizeof(int8_t);
-       }
+        ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
+        if (format == AUDIO_FORMAT_PCM_16_BIT) {
+            mCblk->frameSize = mChannelCount * sizeof(int16_t);
+        } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
+            mCblk->frameSize = mChannelCount * sizeof(int8_t);
+        } else {
+            mCblk->frameSize = sizeof(int8_t);
+        }
     }
 }
 
@@ -4118,7 +4130,7 @@
     uint32_t framesAvail;
     uint32_t framesReq = buffer->frameCount;
 
-     // Check if last stepServer failed, try to step now
+    // Check if last stepServer failed, try to step now
     if (mStepServerFailed) {
         if (!step()) goto getNextBuffer_exit;
         ALOGV("stepServer recovered");
@@ -4964,7 +4976,7 @@
 status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrack, pid_t tid)
 {
     ALOGV("RecordThread::start tid=%d", tid);
-    sp <ThreadBase> strongMe = this;
+    sp<ThreadBase> strongMe = this;
     status_t status = NO_ERROR;
     {
         AutoMutex lock(mLock);
@@ -5017,7 +5029,7 @@
 
 void AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
     ALOGV("RecordThread::stop");
-    sp <ThreadBase> strongMe = this;
+    sp<ThreadBase> strongMe = this;
     {
         AutoMutex lock(mLock);
         if (mActiveTrack != 0 && recordTrack == mActiveTrack.get()) {
@@ -5184,8 +5196,9 @@
         if (status == NO_ERROR) {
             status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string());
             if (status == INVALID_OPERATION) {
-               mInput->stream->common.standby(&mInput->stream->common);
-               status = mInput->stream->common.set_parameters(&mInput->stream->common, keyValuePair.string());
+                mInput->stream->common.standby(&mInput->stream->common);
+                status = mInput->stream->common.set_parameters(&mInput->stream->common,
+                        keyValuePair.string());
             }
             if (reconfig) {
                 if (status == BAD_VALUE &&
@@ -5273,8 +5286,8 @@
     if (mSampleRate != mReqSampleRate && mChannelCount <= FCC_2 && mReqChannelCount <= FCC_2)
     {
         int channelCount;
-         // optmization: if mono to mono, use the resampler in stereo to stereo mode to avoid
-         // stereo to mono post process as the resampler always outputs stereo.
+        // optimization: if mono to mono, use the resampler in stereo to stereo mode to avoid
+        // stereo to mono post process as the resampler always outputs stereo.
         if (mChannelCount == 1 && mReqChannelCount == 2) {
             channelCount = 1;
         } else {
@@ -5356,7 +5369,7 @@
                                 audio_format_t *pFormat,
                                 uint32_t *pChannels,
                                 uint32_t *pLatencyMs,
-                                uint32_t flags)
+                                audio_policy_output_flags_t flags)
 {
     status_t status;
     PlaybackThread *thread = NULL;
@@ -5448,7 +5461,7 @@
 {
     // keep strong reference on the playback thread so that
     // it is not destroyed while exit() is executed
-    sp <PlaybackThread> thread;
+    sp<PlaybackThread> thread;
     {
         Mutex::Autolock _l(mLock);
         thread = checkPlaybackThread_l(output);
@@ -5475,7 +5488,7 @@
 
     if (thread->type() != ThreadBase::DUPLICATING) {
         AudioStreamOut *out = thread->clearOutput();
-        assert(out != NULL);
+        ALOG_ASSERT(out != NULL, "out shouldn't be NULL");
         // from now on thread->mOutput is NULL
         out->hwDev->close_output_stream(out->hwDev, out->stream);
         delete out;
@@ -5601,7 +5614,7 @@
 {
     // keep strong reference on the record thread so that
     // it is not destroyed while exit() is executed
-    sp <RecordThread> thread;
+    sp<RecordThread> thread;
     {
         Mutex::Autolock _l(mLock);
         thread = checkRecordThread_l(input);
@@ -5618,7 +5631,7 @@
     // but the ThreadBase container still exists.
 
     AudioStreamIn *in = thread->clearInput();
-    assert(in != NULL);
+    ALOG_ASSERT(in != NULL, "in shouldn't be NULL");
     // from now on thread->mInput is NULL
     in->hwDev->close_input_stream(in->hwDev, in->stream);
     delete in;
@@ -5734,7 +5747,7 @@
             AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
             if (ref->mSessionid == sessionid) {
                 ALOGV(" session %d still exists for %d with %d refs",
-                     sessionid, ref->mPid, ref->mCnt);
+                    sessionid, ref->mPid, ref->mCnt);
                 found = true;
                 break;
             }
@@ -5967,7 +5980,7 @@
         // because of code checking output when entering the function.
         // Note: io is never 0 when creating an effect on an input
         if (io == 0) {
-             // look for the thread where the specified audio session is present
+            // look for the thread where the specified audio session is present
             for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
                 if (mPlaybackThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
                     io = mPlaybackThreads.keyAt(i);
@@ -5975,12 +5988,12 @@
                 }
             }
             if (io == 0) {
-               for (size_t i = 0; i < mRecordThreads.size(); i++) {
-                   if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
-                       io = mRecordThreads.keyAt(i);
-                       break;
-                   }
-               }
+                for (size_t i = 0; i < mRecordThreads.size(); i++) {
+                    if (mRecordThreads.valueAt(i)->hasAudioSession(sessionId) != 0) {
+                        io = mRecordThreads.keyAt(i);
+                        break;
+                    }
+                }
             }
             // If no output thread contains the requested session ID, default to
             // first output. The effect chain will be moved to the correct output
@@ -6011,7 +6024,7 @@
     }
 
 Exit:
-    if(status) {
+    if (status != NULL) {
         *status = lStatus;
     }
     return handle;
@@ -6214,7 +6227,7 @@
         handle.clear();
     }
 
-    if(status) {
+    if (status != NULL) {
         *status = lStatus;
     }
     return handle;
@@ -6284,7 +6297,7 @@
 }
 
 void AudioFlinger::ThreadBase::lockEffectChains_l(
-        Vector<sp <AudioFlinger::EffectChain> >& effectChains)
+        Vector< sp<AudioFlinger::EffectChain> >& effectChains)
 {
     effectChains = mEffectChains;
     for (size_t i = 0; i < mEffectChains.size(); i++) {
@@ -6293,7 +6306,7 @@
 }
 
 void AudioFlinger::ThreadBase::unlockEffectChains(
-        const Vector<sp <AudioFlinger::EffectChain> >& effectChains)
+        const Vector< sp<AudioFlinger::EffectChain> >& effectChains)
 {
     for (size_t i = 0; i < effectChains.size(); i++) {
         effectChains[i]->unlock();
@@ -6469,7 +6482,7 @@
 
 void AudioFlinger::PlaybackThread::detachAuxEffect_l(int effectId)
 {
-     for (size_t i = 0; i < mTracks.size(); ++i) {
+    for (size_t i = 0; i < mTracks.size(); ++i) {
         sp<Track> track = mTracks[i];
         if (track->auxEffectId() == effectId) {
             attachAuxEffect_l(track, 0);
@@ -7253,7 +7266,7 @@
         if (mCblk != NULL) {
             new(mCblk) effect_param_cblk_t();
             mBuffer = (uint8_t *)mCblk + bufOffset;
-         }
+        }
     } else {
         ALOGE("not enough memory for Effect size=%u", EFFECT_PARAM_BUFFER_SIZE + sizeof(effect_param_cblk_t));
         return;
@@ -8020,7 +8033,7 @@
             }
         }
         ALOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
-             effect->desc().type.timeLow);
+            effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         // if effect is requested to suspended but was not yet enabled, supend it now.
         if (desc->mEffect == 0) {
@@ -8033,7 +8046,7 @@
             return;
         }
         ALOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
-             effect->desc().type.timeLow);
+            effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         desc->mEffect.clear();
         effect->setSuspended(false);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index d9f2972..0e4b24aa 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -73,7 +73,7 @@
     public BinderService<AudioFlinger>,
     public BnAudioFlinger
 {
-    friend class BinderService<AudioFlinger>;
+    friend class BinderService<AudioFlinger>;   // for AudioFlinger()
 public:
     static const char* getServiceName() { return "media.audio_flinger"; }
 
@@ -143,7 +143,7 @@
                                     audio_format_t *pFormat,
                                     uint32_t *pChannels,
                                     uint32_t *pLatencyMs,
-                                    uint32_t flags);
+                                    audio_policy_output_flags_t flags);
 
     virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1,
                                                   audio_io_handle_t output2);
@@ -222,6 +222,8 @@
     audio_hw_device_t*      findSuitableHwDev_l(uint32_t devices);
     void                    purgeStaleEffects_l();
 
+    // standby delay for MIXER and DUPLICATING playback threads is read from property
+    // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs
     static nsecs_t          mStandbyTimeInNsecs;
 
     // Internal dump utilites.
@@ -340,13 +342,6 @@
                     int         sessionId() const { return mSessionId; }
 
         protected:
-            friend class ThreadBase;
-            friend class RecordHandle;
-            friend class PlaybackThread;
-            friend class RecordThread;
-            friend class MixerThread;
-            friend class DirectOutputThread;
-
                                 TrackBase(const TrackBase&);
                                 TrackBase& operator = (const TrackBase&);
 
@@ -470,9 +465,9 @@
                     // ThreadBase mutex before processing the mixer and effects. This guarantees the
                     // integrity of the chains during the process.
                     // Also sets the parameter 'effectChains' to current value of mEffectChains.
-                    void lockEffectChains_l(Vector<sp <EffectChain> >& effectChains);
+                    void lockEffectChains_l(Vector< sp<EffectChain> >& effectChains);
                     // unlock effect chains after process
-                    void unlockEffectChains(const Vector<sp<EffectChain> >& effectChains);
+                    void unlockEffectChains(const Vector< sp<EffectChain> >& effectChains);
                     // set audio mode to all effect chains
                     void setMode(audio_mode_t mode);
                     // get effect module with corresponding ID on specified audio session
@@ -532,15 +527,7 @@
                     // check if some effects must be suspended when an effect chain is added
                     void checkSuspendOnAddEffectChain_l(const sp<EffectChain>& chain);
 
-        friend class AudioFlinger;
-        friend class Track;
-        friend class TrackBase;
-        friend class PlaybackThread;
-        friend class MixerThread;
-        friend class DirectOutputThread;
-        friend class DuplicatingThread;
-        friend class RecordThread;
-        friend class RecordTrack;
+        friend class AudioFlinger;      // for mEffectChains
 
                     const type_t            mType;
 
@@ -655,8 +642,7 @@
                     int         auxEffectId() const { return mAuxEffectId; }
 
         protected:
-            friend class ThreadBase;
-            friend class TrackHandle;
+            // for numerous
             friend class PlaybackThread;
             friend class MixerThread;
             friend class DirectOutputThread;
@@ -685,7 +671,9 @@
                 return (mStreamType == AUDIO_STREAM_CNT);
             }
 
+        public:
             virtual bool isTimedTrack() const { return false; }
+        protected:
 
             // we don't really need a lock for these
             volatile bool       mMute;
@@ -824,7 +812,7 @@
                         audio_io_handle_t id, uint32_t device, type_t type);
         virtual             ~PlaybackThread();
 
-        virtual     status_t    dump(int fd, const Vector<String16>& args);
+                    status_t    dump(int fd, const Vector<String16>& args);
 
         // Thread virtuals
         virtual     status_t    readyToRun();
@@ -840,12 +828,6 @@
         virtual     void        threadLoop_write();
         virtual     void        threadLoop_standby();
 
-        // Non-trivial for DUPLICATING only
-        virtual     void        updateWaitTime_l() { }
-
-        // Non-trivial for DIRECT only
-        virtual     void        applyVolume() { }
-
                     // prepareTracks_l reads and writes mActiveTracks, and also returns the
                     // pending set of tracks to remove via Vector 'tracksToRemove'.  The caller is
                     // responsible for clearing or destroying this Vector later on, when it
@@ -856,7 +838,8 @@
 
         virtual     status_t    initCheck() const { return (mOutput == NULL) ? NO_INIT : NO_ERROR; }
 
-        virtual     uint32_t    latency() const;
+                    // return estimated latency in milliseconds, as reported by HAL
+                    uint32_t    latency() const;
 
                     void        setMasterVolume(float value);
                     void        setMasterMute(bool muted);
@@ -887,7 +870,7 @@
                     bool        isSuspended() const { return (mSuspended > 0); }
         virtual     String8     getParameters(const String8& keys);
         virtual     void        audioConfigChanged_l(int event, int param = 0);
-        virtual     status_t    getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames);
+                    status_t    getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames);
                     int16_t     *mixBuffer() const { return mMixBuffer; };
 
         virtual     void detachAuxEffect_l(int effectId);
@@ -929,15 +912,12 @@
         virtual     void        saveOutputTracks() { }
         virtual     void        clearOutputTracks() { }
 
+        // Cache various calculated values, at threadLoop() entry and after a parameter change
+        virtual     void        cacheParameters_l();
+
     private:
 
-        friend class AudioFlinger;
-        friend class OutputTrack;
-        friend class Track;
-        friend class TrackBase;
-        friend class MixerThread;
-        friend class DirectOutputThread;
-        friend class DuplicatingThread;
+        friend class AudioFlinger;      // for numerous
 
         PlaybackThread(const Client&);
         PlaybackThread& operator = (const PlaybackThread&);
@@ -964,8 +944,11 @@
         // FIXME rename these former local variables of threadLoop to standard "m" names
         nsecs_t                         standbyTime;
         size_t                          mixBufferSize;
+
+        // cached copies of activeSleepTimeUs() and idleSleepTimeUs() made by cacheParameters_l()
         uint32_t                        activeSleepTime;
         uint32_t                        idleSleepTime;
+
         uint32_t                        sleepTime;
 
         // mixer status returned by prepareTracks_l()
@@ -976,8 +959,13 @@
         // MIXER only
         bool                            longStandbyExit;
         uint32_t                        sleepTimeShift;
-        // DIRECT only
+
+        // same as AudioFlinger::mStandbyTimeInNsecs except for DIRECT which uses a shorter value
         nsecs_t                         standbyDelay;
+
+        // MIXER only
+        nsecs_t                         maxPeriod;
+
         // DUPLICATING only
         uint32_t                        writeFrames;
     };
@@ -1003,6 +991,7 @@
         virtual     void        deleteTrackName_l(int name);
         virtual     uint32_t    idleSleepTimeUs();
         virtual     uint32_t    suspendSleepTimeUs();
+        virtual     void        cacheParameters_l();
 
         // threadLoop snippets
         virtual     void        threadLoop_mix();
@@ -1028,6 +1017,7 @@
         virtual     uint32_t    activeSleepTimeUs();
         virtual     uint32_t    idleSleepTimeUs();
         virtual     uint32_t    suspendSleepTimeUs();
+        virtual     void        cacheParameters_l();
 
         // threadLoop snippets
         virtual     mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove);
@@ -1048,8 +1038,6 @@
         uint16_t rightVol;
 
 private:
-                    void        applyVolume();  // FIXME inline into threadLoop_mix()
-
         // prepareTracks_l() tells threadLoop_mix() the name of the single active track
         sp<Track>               mActiveTrack;
     };
@@ -1068,16 +1056,19 @@
         virtual     uint32_t    activeSleepTimeUs();
 
     private:
-                    bool        outputsReady(const SortedVector<sp<OutputTrack> > &outputTracks);
+                    bool        outputsReady(const SortedVector< sp<OutputTrack> > &outputTracks);
     protected:
         // threadLoop snippets
         virtual     void        threadLoop_mix();
         virtual     void        threadLoop_sleepTime();
         virtual     void        threadLoop_write();
         virtual     void        threadLoop_standby();
+        virtual     void        cacheParameters_l();
 
+    private:
         // called from threadLoop, addOutputTrack, removeOutputTrack
         virtual     void        updateWaitTime_l();
+    protected:
         virtual     void        saveOutputTracks();
         virtual     void        clearOutputTracks();
     private:
@@ -1109,8 +1100,6 @@
               PlaybackThread *primaryPlaybackThread_l() const;
               uint32_t primaryOutputDevice_l() const;
 
-    friend class AudioBuffer;
-
     // server side of the client's IAudioTrack
     class TrackHandle : public android::BnAudioTrack {
     public:
@@ -1135,10 +1124,6 @@
         const sp<PlaybackThread::Track> mTrack;
     };
 
-    friend class Client;
-    friend class PlaybackThread::Track;
-
-
                 void        removeClient_l(pid_t pid);
                 void        removeNotificationClient(pid_t pid);
 
@@ -1169,8 +1154,7 @@
                     void        dump(char* buffer, size_t size);
 
         private:
-            friend class AudioFlinger;
-            friend class RecordThread;
+            friend class AudioFlinger;  // for mState
 
                                 RecordTrack(const RecordTrack&);
                                 RecordTrack& operator = (const RecordTrack&);
@@ -1352,8 +1336,7 @@
         status_t         dump(int fd, const Vector<String16>& args);
 
     protected:
-        friend class EffectHandle;
-        friend class AudioFlinger;
+        friend class AudioFlinger;      // for mHandles
         bool                mPinned;
 
         // Maximum time allocated to effect engines to complete the turn off sequence
@@ -1437,8 +1420,7 @@
         void dump(char* buffer, size_t size);
 
     protected:
-        friend class AudioFlinger;
-        friend class EffectModule;
+        friend class AudioFlinger;          // for mEffect, mHasControl, mEnabled
         EffectHandle(const EffectHandle&);
         EffectHandle& operator =(const EffectHandle&);
 
@@ -1522,7 +1504,7 @@
 
         uint32_t strategy() const { return mStrategy; }
         void setStrategy(uint32_t strategy)
-                 { mStrategy = strategy; }
+                { mStrategy = strategy; }
 
         // suspend effect of the given type
         void setEffectSuspended_l(const effect_uuid_t *type,
@@ -1536,7 +1518,7 @@
         status_t dump(int fd, const Vector<String16>& args);
 
     protected:
-        friend class AudioFlinger;
+        friend class AudioFlinger;  // for mThread, mEffects
         EffectChain(const EffectChain&);
         EffectChain& operator =(const EffectChain&);
 
@@ -1562,7 +1544,7 @@
 
         wp<ThreadBase> mThread;     // parent mixer thread
         Mutex mLock;                // mutex protecting effect list
-        Vector<sp<EffectModule> > mEffects; // list of effect modules
+        Vector< sp<EffectModule> > mEffects; // list of effect modules
         int mSessionId;             // audio session ID
         int16_t *mInBuffer;         // chain input buffer
         int16_t *mOutBuffer;        // chain output buffer
@@ -1612,9 +1594,6 @@
         int         mCnt;
     };
 
-    friend class RecordThread;
-    friend class PlaybackThread;
-
     enum master_volume_support {
         // MVS_NONE:
         // Audio HAL has no support for master volume, either setting or
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 2cec525..1ec238b 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -18,7 +18,6 @@
 #define LOG_TAG "AudioMixer"
 //#define LOG_NDEBUG 0
 
-#include <assert.h>
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
@@ -29,6 +28,7 @@
 
 #include <cutils/bitops.h>
 #include <cutils/compiler.h>
+#include <utils/Debug.h>
 
 #include <system/audio.h>
 
@@ -46,7 +46,7 @@
     :   mTrackNames(0), mSampleRate(sampleRate)
 {
     // AudioMixer is not yet capable of multi-channel beyond stereo
-    assert(2 == MAX_NUM_CHANNELS);
+    COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS);
     
     LocalClock lc;
 
@@ -124,7 +124,7 @@
 void AudioMixer::deleteTrackName(int name)
 {
     name -= TRACK0;
-    assert(uint32_t(name) < MAX_NUM_TRACKS);
+    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
     ALOGV("deleteTrackName(%d)", name);
     track_t& track(mState.tracks[ name ]);
     if (track.enabled) {
@@ -146,7 +146,7 @@
 void AudioMixer::enable(int name)
 {
     name -= TRACK0;
-    assert(uint32_t(name) < MAX_NUM_TRACKS);
+    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
     track_t& track = mState.tracks[name];
 
     if (!track.enabled) {
@@ -159,7 +159,7 @@
 void AudioMixer::disable(int name)
 {
     name -= TRACK0;
-    assert(uint32_t(name) < MAX_NUM_TRACKS);
+    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
     track_t& track = mState.tracks[name];
 
     if (track.enabled) {
@@ -172,7 +172,7 @@
 void AudioMixer::setParameter(int name, int target, int param, void *value)
 {
     name -= TRACK0;
-    assert(uint32_t(name) < MAX_NUM_TRACKS);
+    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
     track_t& track = mState.tracks[name];
 
     int valueInt = (int)value;
@@ -185,8 +185,9 @@
         case CHANNEL_MASK: {
             uint32_t mask = (uint32_t)value;
             if (track.channelMask != mask) {
-                uint8_t channelCount = popcount(mask);
-                assert((channelCount <= MAX_NUM_CHANNELS) && (channelCount));
+                uint32_t channelCount = popcount(mask);
+                ALOG_ASSERT((channelCount <= MAX_NUM_CHANNELS) && (channelCount),
+                        "bad channel count %u", channelCount);
                 track.channelMask = mask;
                 track.channelCount = channelCount;
                 ALOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
@@ -208,15 +209,14 @@
             }
             break;
         default:
-            // bad param
-            assert(false);
+            LOG_FATAL("bad param");
         }
         break;
 
     case RESAMPLE:
         switch (param) {
         case SAMPLE_RATE:
-            assert(valueInt > 0);
+            ALOG_ASSERT(valueInt > 0, "bad sample rate %d", valueInt);
             if (track.setResampler(uint32_t(valueInt), mSampleRate)) {
                 ALOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
                         uint32_t(valueInt));
@@ -228,8 +228,7 @@
             invalidateState(1 << name);
             break;
         default:
-            // bad param
-            assert(false);
+            LOG_FATAL("bad param");
         }
         break;
 
@@ -257,7 +256,7 @@
             }
             break;
         case AUXLEVEL:
-            //assert(0 <= valueInt && valueInt <= MAX_GAIN_INT);
+            //ALOG_ASSERT(0 <= valueInt && valueInt <= MAX_GAIN_INT, "bad aux level %d", valueInt);
             if (track.auxLevel != valueInt) {
                 ALOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
                 track.prevAuxLevel = track.auxLevel << 16;
@@ -277,14 +276,12 @@
             }
             break;
         default:
-            // bad param
-            assert(false);
+            LOG_FATAL("bad param");
         }
         break;
 
     default:
-        // bad target
-        assert(false);
+        LOG_FATAL("bad target");
     }
 }
 
@@ -335,7 +332,7 @@
 void AudioMixer::setBufferProvider(int name, AudioBufferProvider* bufferProvider)
 {
     name -= TRACK0;
-    assert(uint32_t(name) < MAX_NUM_TRACKS);
+    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
     mState.tracks[name].bufferProvider = bufferProvider;
 }
 
@@ -979,9 +976,9 @@
     // This method is only called when state->enabledTracks has exactly
     // one bit set.  The asserts below would verify this, but are commented out
     // since the whole point of this method is to optimize performance.
-    //assert(0 != state->enabledTracks);
+    //ALOG_ASSERT(0 != state->enabledTracks, "no tracks enabled");
     const int i = 31 - __builtin_clz(state->enabledTracks);
-    //assert((1 << i) == state->enabledTracks);
+    //ALOG_ASSERT((1 << i) == state->enabledTracks, "more than 1 track enabled");
     const track_t& t = state->tracks[i];
 
     AudioBufferProvider::Buffer& b(t.buffer);
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index d57326b..c23eb04 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -649,7 +649,7 @@
     mLock.lock();
     while (!exitPending())
     {
-        while(!mAudioCommands.isEmpty()) {
+        while (!mAudioCommands.isEmpty()) {
             nsecs_t curTime = systemTime();
             // commands are sorted by increasing time stamp: execute them from index 0 and up
             if (mAudioCommands[0]->mTime <= curTime) {
@@ -693,16 +693,16 @@
                     delete data;
                     }break;
                 case SET_PARAMETERS: {
-                     ParametersData *data = (ParametersData *)command->mParam;
-                     ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
-                             data->mKeyValuePairs.string(), data->mIO);
-                     command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
-                     if (command->mWaitStatus) {
-                         command->mCond.signal();
-                         mWaitWorkCV.wait(mLock);
-                     }
-                     delete data;
-                     }break;
+                    ParametersData *data = (ParametersData *)command->mParam;
+                    ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
+                            data->mKeyValuePairs.string(), data->mIO);
+                    command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
+                    if (command->mWaitStatus) {
+                        command->mCond.signal();
+                        mWaitWorkCV.wait(mLock);
+                    }
+                    delete data;
+                    }break;
                 case SET_VOICE_VOLUME: {
                     VoiceVolumeData *data = (VoiceVolumeData *)command->mParam;
                     ALOGV("AudioCommandThread() processing set voice volume volume %f",
@@ -916,19 +916,19 @@
             AudioParameter param = AudioParameter(data->mKeyValuePairs);
             AudioParameter param2 = AudioParameter(data2->mKeyValuePairs);
             for (size_t j = 0; j < param.size(); j++) {
-               String8 key;
-               String8 value;
-               param.getAt(j, key, value);
-               for (size_t k = 0; k < param2.size(); k++) {
-                  String8 key2;
-                  String8 value2;
-                  param2.getAt(k, key2, value2);
-                  if (key2 == key) {
-                      param2.remove(key2);
-                      ALOGV("Filtering out parameter %s", key2.string());
-                      break;
-                  }
-               }
+                String8 key;
+                String8 value;
+                param.getAt(j, key, value);
+                for (size_t k = 0; k < param2.size(); k++) {
+                    String8 key2;
+                    String8 value2;
+                    param2.getAt(k, key2, value2);
+                    if (key2 == key) {
+                        param2.remove(key2);
+                        ALOGV("Filtering out parameter %s", key2.string());
+                        break;
+                    }
+                }
             }
             // if all keys have been filtered out, remove the command.
             // otherwise, update the key value pairs
@@ -1020,7 +1020,7 @@
         ALOGE("startTone: illegal tone requested (%d)", tone);
     if (stream != AUDIO_STREAM_VOICE_CALL)
         ALOGE("startTone: illegal stream (%d) requested for tone %d", stream,
-             tone);
+            tone);
     mTonePlaybackThread->startToneCommand(ToneGenerator::TONE_SUP_CALL_WAITING,
                                           AUDIO_STREAM_VOICE_CALL);
     return 0;
diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h
index 7119b90..9ed905d 100644
--- a/services/audioflinger/AudioPolicyService.h
+++ b/services/audioflinger/AudioPolicyService.h
@@ -311,8 +311,8 @@
 
     mutable Mutex mLock;    // prevents concurrent access to AudioPolicy manager functions changing
                             // device connection state  or routing
-    sp <AudioCommandThread> mAudioCommandThread;    // audio commands thread
-    sp <AudioCommandThread> mTonePlaybackThread;     // tone playback thread
+    sp<AudioCommandThread> mAudioCommandThread;     // audio commands thread
+    sp<AudioCommandThread> mTonePlaybackThread;     // tone playback thread
     struct audio_policy_device *mpAudioPolicyDev;
     struct audio_policy *mpAudioPolicy;
     KeyedVector< audio_source_t, InputSourceDesc* > mInputSources;
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 398ba0b..fbb54cf 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -227,7 +227,7 @@
             mX0L = mBuffer.i16[mBuffer.frameCount*2-2];
             mX0R = mBuffer.i16[mBuffer.frameCount*2-1];
             provider->releaseBuffer(&mBuffer);
-             // mBuffer.frameCount == 0 now so we reload a new buffer
+            // mBuffer.frameCount == 0 now so we reload a new buffer
         }
 
         int16_t *in = mBuffer.i16;
diff --git a/services/audioflinger/AudioResampler.h b/services/audioflinger/AudioResampler.h
index 9deb796..1610e00 100644
--- a/services/audioflinger/AudioResampler.h
+++ b/services/audioflinger/AudioResampler.h
@@ -33,7 +33,7 @@
     //  HIGH_QUALITY: fixed multi-tap FIR (e.g. 48KHz->44.1KHz)
     // NOTE: high quality SRC will only be supported for
     // certain fixed rate conversions. Sample rate cannot be
-    // changed dynamically. 
+    // changed dynamically.
     enum src_quality {
         DEFAULT=0,
         LOW_QUALITY=1,
diff --git a/services/audioflinger/AudioResamplerCubic.h b/services/audioflinger/AudioResamplerCubic.h
index b72b62a..892785a 100644
--- a/services/audioflinger/AudioResamplerCubic.h
+++ b/services/audioflinger/AudioResamplerCubic.h
@@ -55,7 +55,7 @@
         p->y1 = p->y2;
         p->y2 = p->y3;
         p->y3 = in;
-        p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1;            
+        p->a = (3 * (p->y1 - p->y2) - p->y0 + p->y3) >> 1;
         p->b = (p->y2 << 1) + p->y0 - (((5 * p->y1 + p->y3)) >> 1);
         p->c = (p->y2 - p->y0) >> 1;
     }
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index d373c08..76662d8 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -222,7 +222,7 @@
                 } else {
                     read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex);
                 }
-           }
+            }
         }
         int16_t *in = mBuffer.i16;
         const size_t frameCount = mBuffer.frameCount;
@@ -247,7 +247,7 @@
                 if (inputIndex >= frameCount)
                     break;  // need a new buffer
                 read<CHANNELS>(impulse, phaseFraction, in, inputIndex);
-            } else if(phaseIndex == 2) {    // maximum value
+            } else if (phaseIndex == 2) {    // maximum value
                 inputIndex++;
                 if (inputIndex >= frameCount)
                     break;  // 0 frame available, 2 frames needed
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 149c0d3..da3548f 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -15,6 +15,7 @@
  */
 
 #define LOG_TAG "InputDispatcher"
+#define ATRACE_TAG ATRACE_TAG_INPUT
 
 //#define LOG_NDEBUG 0
 
@@ -44,6 +45,7 @@
 
 #include "InputDispatcher.h"
 
+#include <utils/Trace.h>
 #include <cutils/log.h>
 #include <androidfw/PowerManager.h>
 
@@ -280,6 +282,7 @@
         } else {
             // Inbound queue has at least one entry.
             mPendingEvent = mInboundQueue.dequeueAtHead();
+            traceInboundQueueLengthLocked();
         }
 
         // Poke user activity for this event.
@@ -379,6 +382,7 @@
 bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) {
     bool needWake = mInboundQueue.isEmpty();
     mInboundQueue.enqueueAtTail(entry);
+    traceInboundQueueLengthLocked();
 
     switch (entry->type) {
     case EventEntry::TYPE_KEY: {
@@ -572,6 +576,7 @@
         EventEntry* entry = mInboundQueue.dequeueAtHead();
         releaseInboundEventLocked(entry);
     }
+    traceInboundQueueLengthLocked();
 }
 
 void InputDispatcher::releasePendingEventLocked() {
@@ -1867,6 +1872,7 @@
 
     // Enqueue the dispatch entry.
     connection->outboundQueue.enqueueAtTail(dispatchEntry);
+    traceOutboundQueueLengthLocked(connection);
 }
 
 void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime,
@@ -1978,7 +1984,9 @@
 
         // Re-enqueue the event on the wait queue.
         connection->outboundQueue.dequeue(dispatchEntry);
+        traceOutboundQueueLengthLocked(connection);
         connection->waitQueue.enqueueAtTail(dispatchEntry);
+        traceWaitQueueLengthLocked(connection);
     }
 }
 
@@ -2009,7 +2017,9 @@
 
     // Clear the dispatch queues.
     drainDispatchQueueLocked(&connection->outboundQueue);
+    traceOutboundQueueLengthLocked(connection);
     drainDispatchQueueLocked(&connection->waitQueue);
+    traceWaitQueueLengthLocked(connection);
 
     // The connection appears to be unrecoverably broken.
     // Ignore already broken or zombie connections.
@@ -3311,8 +3321,10 @@
         // a few things.
         if (dispatchEntry == connection->findWaitQueueEntry(seq)) {
             connection->waitQueue.dequeue(dispatchEntry);
+            traceWaitQueueLengthLocked(connection);
             if (restartEvent && connection->status == Connection::STATUS_NORMAL) {
                 connection->outboundQueue.enqueueAtHead(dispatchEntry);
+                traceOutboundQueueLengthLocked(connection);
             } else {
                 releaseDispatchEntryLocked(dispatchEntry);
             }
@@ -3498,6 +3510,28 @@
     // TODO Write some statistics about how long we spend waiting.
 }
 
+void InputDispatcher::traceInboundQueueLengthLocked() {
+    if (ATRACE_ENABLED()) {
+        ATRACE_INT("iq", mInboundQueue.count());
+    }
+}
+
+void InputDispatcher::traceOutboundQueueLengthLocked(const sp<Connection>& connection) {
+    if (ATRACE_ENABLED()) {
+        char counterName[40];
+        snprintf(counterName, sizeof(counterName), "oq:%s", connection->getWindowName());
+        ATRACE_INT(counterName, connection->outboundQueue.count());
+    }
+}
+
+void InputDispatcher::traceWaitQueueLengthLocked(const sp<Connection>& connection) {
+    if (ATRACE_ENABLED()) {
+        char counterName[40];
+        snprintf(counterName, sizeof(counterName), "wq:%s", connection->getWindowName());
+        ATRACE_INT(counterName, connection->waitQueue.count());
+    }
+}
+
 void InputDispatcher::dump(String8& dump) {
     AutoMutex _l(mLock);
 
@@ -4014,6 +4048,16 @@
 InputDispatcher::Connection::~Connection() {
 }
 
+const char* InputDispatcher::Connection::getWindowName() const {
+    if (inputWindowHandle != NULL) {
+        return inputWindowHandle->getName().string();
+    }
+    if (monitor) {
+        return "monitor";
+    }
+    return "?";
+}
+
 const char* InputDispatcher::Connection::getStatusLabel() const {
     switch (status) {
     case STATUS_NORMAL:
diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h
index 4b36480..91f7554 100644
--- a/services/input/InputDispatcher.h
+++ b/services/input/InputDispatcher.h
@@ -805,6 +805,7 @@
 
         inline const char* getInputChannelName() const { return inputChannel->getName().string(); }
 
+        const char* getWindowName() const;
         const char* getStatusLabel() const;
 
         DispatchEntry* findWaitQueueEntry(uint32_t seq);
@@ -1069,6 +1070,9 @@
     // Statistics gathering.
     void updateDispatchStatisticsLocked(nsecs_t currentTime, const EventEntry* entry,
             int32_t injectionResult, nsecs_t timeSpentWaitingForApplication);
+    void traceInboundQueueLengthLocked();
+    void traceOutboundQueueLengthLocked(const sp<Connection>& connection);
+    void traceWaitQueueLengthLocked(const sp<Connection>& connection);
 };
 
 /* Enqueues and dispatches input events, endlessly. */
diff --git a/services/java/com/android/server/CountryDetectorService.java b/services/java/com/android/server/CountryDetectorService.java
index ab61a3c..3112b50 100644
--- a/services/java/com/android/server/CountryDetectorService.java
+++ b/services/java/com/android/server/CountryDetectorService.java
@@ -81,6 +81,9 @@
 
     private final static String TAG = "CountryDetector";
 
+    /** Whether to dump the state of the country detector service to bugreports */
+    private static final boolean DEBUG = false;
+
     private final HashMap<IBinder, Receiver> mReceivers;
     private final Context mContext;
     private ComprehensiveCountryDetector mCountryDetector;
@@ -206,8 +209,10 @@
         return mSystemReady;
     }
 
+    @SuppressWarnings("unused")
     @Override
     protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+        if (!DEBUG) return;
         try {
             final Printer p = new PrintWriterPrinter(fout);
             p.println("CountryDetectorService state:");
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 63418db..52a4110 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1858,6 +1858,7 @@
                 } else {
                     // Update the lights *before* taking care of turning the
                     // screen off, so we can initiate any animations that are desired.
+                    mScreenOffReason = reason;
                     if (stateChanged) {
                         updateLightsLocked(newState, 0);
                     }
@@ -1876,7 +1877,6 @@
                         Binder.restoreCallingIdentity(identity);
                     }
                     mPowerState &= ~SCREEN_ON_BIT;
-                    mScreenOffReason = reason;
                     if (!mScreenBrightnessAnimator.isAnimating()) {
                         err = screenOffFinishedAnimatingLocked(reason);
                     } else {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index fd968e0..94b9e91 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -16,6 +16,8 @@
 
 package com.android.server.am;
 
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+
 import com.android.internal.R;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.internal.os.ProcessStats;
@@ -55,6 +57,7 @@
 import android.content.ClipData;
 import android.content.ComponentCallbacks2;
 import android.content.ComponentName;
+import android.content.ContentProvider;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -746,6 +749,7 @@
     ParcelFileDescriptor mProfileFd;
     int mProfileType = 0;
     boolean mAutoStopProfiler = false;
+    String mOpenGlTraceApp = null;
 
     final RemoteCallbackList<IProcessObserver> mProcessObservers
             = new RemoteCallbackList<IProcessObserver>();
@@ -2263,7 +2267,8 @@
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo,
             String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug,
-            String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler) {
+            boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
+            boolean autoStopProfiler) {
         enforceNotIsolatedCaller("startActivity");
         int userId = 0;
         if (intent.getCategories() != null && intent.getCategories().contains(Intent.CATEGORY_HOME)) {
@@ -2281,24 +2286,25 @@
         }
         return mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
                 grantedUriPermissions, grantedMode, resultTo, resultWho, requestCode, onlyIfNeeded,
-                debug, profileFile, profileFd, autoStopProfiler, null, null, userId);
+                debug, openglTrace, profileFile, profileFd, autoStopProfiler, null, null, userId);
     }
 
     public final WaitResult startActivityAndWait(IApplicationThread caller,
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo,
             String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug,
-            String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler) {
+            boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
+            boolean autoStopProfiler) {
         enforceNotIsolatedCaller("startActivityAndWait");
         WaitResult res = new WaitResult();
         int userId = Binder.getOrigCallingUser();
         mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
                 grantedUriPermissions, grantedMode, resultTo, resultWho,
-                requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler,
+                requestCode, onlyIfNeeded, debug, openglTrace, profileFile, profileFd, autoStopProfiler,
                 res, null, userId);
         return res;
     }
-    
+
     public final int startActivityWithConfig(IApplicationThread caller,
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo,
@@ -2308,7 +2314,7 @@
         int ret = mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
                 grantedUriPermissions, grantedMode, resultTo, resultWho,
                 requestCode, onlyIfNeeded,
-                debug, null, null, false, null, config, Binder.getOrigCallingUser());
+                debug, false, null, null, false, null, config, Binder.getOrigCallingUser());
         return ret;
     }
 
@@ -2451,7 +2457,7 @@
         }
 
         int ret = mMainStack.startActivityMayWait(null, uid, intent, resolvedType,
-                null, 0, resultTo, resultWho, requestCode, onlyIfNeeded, false,
+                null, 0, resultTo, resultWho, requestCode, onlyIfNeeded, false, false,
                 null, null, false, null, null, userId);
         return ret;
     }
@@ -3833,6 +3839,11 @@
                 profileFd = mProfileFd;
                 profileAutoStop = mAutoStopProfiler;
             }
+            boolean enableOpenGlTrace = false;
+            if (mOpenGlTraceApp != null && mOpenGlTraceApp.equals(processName)) {
+                enableOpenGlTrace = true;
+                mOpenGlTraceApp = null;
+            }
 
             // If the app is being launched for restore or full backup, set it up specially
             boolean isRestrictedBackupMode = false;
@@ -3858,8 +3869,8 @@
             }
             thread.bindApplication(processName, appInfo, providers,
                     app.instrumentationClass, profileFile, profileFd, profileAutoStop,
-                    app.instrumentationArguments, app.instrumentationWatcher, testMode, 
-                    isRestrictedBackupMode || !normalMode, app.persistent,
+                    app.instrumentationArguments, app.instrumentationWatcher, testMode,
+                    enableOpenGlTrace, isRestrictedBackupMode || !normalMode, app.persistent,
                     new Configuration(mConfiguration), app.compat, getCommonServicesLocked(),
                     mCoreSettingsObserver.getCoreSettingsLocked());
             updateLruProcessLocked(app, false, true);
@@ -4543,76 +4554,91 @@
         throw new SecurityException(msg);
     }
 
-    private final boolean checkHoldingPermissionsLocked(IPackageManager pm,
-            ProviderInfo pi, Uri uri, int uid, int modeFlags) {
-        boolean readPerm = (modeFlags&Intent.FLAG_GRANT_READ_URI_PERMISSION) == 0;
-        boolean writePerm = (modeFlags&Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == 0;
+    /**
+     * Determine if UID is holding permissions required to access {@link Uri} in
+     * the given {@link ProviderInfo}. Final permission checking is always done
+     * in {@link ContentProvider}.
+     */
+    private final boolean checkHoldingPermissionsLocked(
+            IPackageManager pm, ProviderInfo pi, Uri uri, int uid, int modeFlags) {
         if (DEBUG_URI_PERMISSION) Slog.v(TAG,
                 "checkHoldingPermissionsLocked: uri=" + uri + " uid=" + uid);
+
+        if (pi.applicationInfo.uid == uid) {
+            return true;
+        } else if (!pi.exported) {
+            return false;
+        }
+
+        boolean readMet = (modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) == 0;
+        boolean writeMet = (modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == 0;
         try {
-            // Is the component private from the target uid?
-            final boolean prv = !pi.exported && pi.applicationInfo.uid != uid;
-
-            // Acceptable if the there is no read permission needed from the
-            // target or the target is holding the read permission.
-            if (!readPerm) {
-                if ((!prv && pi.readPermission == null) ||
-                        (pm.checkUidPermission(pi.readPermission, uid)
-                                == PackageManager.PERMISSION_GRANTED)) {
-                    readPerm = true;
-                }
+            // check if target holds top-level <provider> permissions
+            if (!readMet && pi.readPermission != null
+                    && (pm.checkUidPermission(pi.readPermission, uid) == PERMISSION_GRANTED)) {
+                readMet = true;
+            }
+            if (!writeMet && pi.writePermission != null
+                    && (pm.checkUidPermission(pi.writePermission, uid) == PERMISSION_GRANTED)) {
+                writeMet = true;
             }
 
-            // Acceptable if the there is no write permission needed from the
-            // target or the target is holding the read permission.
-            if (!writePerm) {
-                if (!prv && (pi.writePermission == null) ||
-                        (pm.checkUidPermission(pi.writePermission, uid)
-                                == PackageManager.PERMISSION_GRANTED)) {
-                    writePerm = true;
-                }
-            }
+            // track if unprotected read/write is allowed; any denied
+            // <path-permission> below removes this ability
+            boolean allowDefaultRead = pi.readPermission == null;
+            boolean allowDefaultWrite = pi.writePermission == null;
 
-            // Acceptable if there is a path permission matching the URI that
-            // the target holds the permission on.
-            PathPermission[] pps = pi.pathPermissions;
-            if (pps != null && (!readPerm || !writePerm)) {
+            // check if target holds any <path-permission> that match uri
+            final PathPermission[] pps = pi.pathPermissions;
+            if (pps != null) {
                 final String path = uri.getPath();
                 int i = pps.length;
-                while (i > 0 && (!readPerm || !writePerm)) {
+                while (i > 0 && (!readMet || !writeMet)) {
                     i--;
                     PathPermission pp = pps[i];
-                    if (!readPerm) {
-                        final String pprperm = pp.getReadPermission();
-                        if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking read perm for "
-                                + pprperm + " for " + pp.getPath()
-                                + ": match=" + pp.match(path)
-                                + " check=" + pm.checkUidPermission(pprperm, uid));
-                        if (pprperm != null && pp.match(path) &&
-                                (pm.checkUidPermission(pprperm, uid)
-                                        == PackageManager.PERMISSION_GRANTED)) {
-                            readPerm = true;
+                    if (pp.match(path)) {
+                        if (!readMet) {
+                            final String pprperm = pp.getReadPermission();
+                            if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking read perm for "
+                                    + pprperm + " for " + pp.getPath()
+                                    + ": match=" + pp.match(path)
+                                    + " check=" + pm.checkUidPermission(pprperm, uid));
+                            if (pprperm != null) {
+                                if (pm.checkUidPermission(pprperm, uid) == PERMISSION_GRANTED) {
+                                    readMet = true;
+                                } else {
+                                    allowDefaultRead = false;
+                                }
+                            }
                         }
-                    }
-                    if (!writePerm) {
-                        final String ppwperm = pp.getWritePermission();
-                        if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking write perm "
-                                + ppwperm + " for " + pp.getPath()
-                                + ": match=" + pp.match(path)
-                                + " check=" + pm.checkUidPermission(ppwperm, uid));
-                        if (ppwperm != null && pp.match(path) &&
-                                (pm.checkUidPermission(ppwperm, uid)
-                                        == PackageManager.PERMISSION_GRANTED)) {
-                            writePerm = true;
+                        if (!writeMet) {
+                            final String ppwperm = pp.getWritePermission();
+                            if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking write perm "
+                                    + ppwperm + " for " + pp.getPath()
+                                    + ": match=" + pp.match(path)
+                                    + " check=" + pm.checkUidPermission(ppwperm, uid));
+                            if (ppwperm != null) {
+                                if (pm.checkUidPermission(ppwperm, uid) == PERMISSION_GRANTED) {
+                                    writeMet = true;
+                                } else {
+                                    allowDefaultWrite = false;
+                                }
+                            }
                         }
                     }
                 }
             }
+
+            // grant unprotected <provider> read/write, if not blocked by
+            // <path-permission> above
+            if (allowDefaultRead) readMet = true;
+            if (allowDefaultWrite) writeMet = true;
+
         } catch (RemoteException e) {
             return false;
         }
 
-        return readPerm && writePerm;
+        return readMet && writeMet;
     }
 
     private final boolean checkUriPermissionLocked(Uri uri, int uid,
@@ -5819,6 +5845,11 @@
         return providers;
     }
 
+    /**
+     * Check if {@link ProcessRecord} has a possible chance at accessing the
+     * given {@link ProviderInfo}. Final permission checking is always done
+     * in {@link ContentProvider}.
+     */
     private final String checkContentProviderPermissionLocked(
             ProviderInfo cpi, ProcessRecord r) {
         final int callingPid = (r != null) ? r.pid : Binder.getCallingPid();
@@ -6671,6 +6702,19 @@
         }
     }
 
+    void setOpenGlTraceApp(ApplicationInfo app, String processName) {
+        synchronized (this) {
+            boolean isDebuggable = "1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"));
+            if (!isDebuggable) {
+                if ((app.flags&ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
+                    throw new SecurityException("Process not debuggable: " + app.packageName);
+                }
+            }
+
+            mOpenGlTraceApp = processName;
+        }
+    }
+
     void setProfileApp(ApplicationInfo app, String processName, String profileFile,
             ParcelFileDescriptor profileFd, boolean autoStopProfiler) {
         synchronized (this) {
@@ -8625,6 +8669,9 @@
                     + " mDebugTransient=" + mDebugTransient
                     + " mOrigWaitForDebugger=" + mOrigWaitForDebugger);
         }
+        if (mOpenGlTraceApp != null) {
+            pw.println("  mOpenGlTraceApp=" + mOpenGlTraceApp);
+        }
         if (mProfileApp != null || mProfileProc != null || mProfileFile != null
                 || mProfileFd != null) {
             pw.println("  mProfileApp=" + mProfileApp + " mProfileProc=" + mProfileProc);
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index a4e573d..64d52ed 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -2828,7 +2828,8 @@
     }
 
     ActivityInfo resolveActivity(Intent intent, String resolvedType, boolean debug,
-            String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler) {
+            boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
+            boolean autoStopProfiler) {
         // Collect information about the target of the Intent.
         ActivityInfo aInfo;
         try {
@@ -2857,6 +2858,12 @@
                 }
             }
 
+            if (openglTrace) {
+                if (!aInfo.processName.equals("system")) {
+                    mService.setOpenGlTraceApp(aInfo.applicationInfo, aInfo.processName);
+                }
+            }
+
             if (profileFile != null) {
                 if (!aInfo.processName.equals("system")) {
                     mService.setProfileApp(aInfo.applicationInfo, aInfo.processName,
@@ -2871,7 +2878,7 @@
             Intent intent, String resolvedType, Uri[] grantedUriPermissions,
             int grantedMode, IBinder resultTo,
             String resultWho, int requestCode, boolean onlyIfNeeded,
-            boolean debug, String profileFile, ParcelFileDescriptor profileFd,
+            boolean debug, boolean openglTrace, String profileFile, ParcelFileDescriptor profileFd,
             boolean autoStopProfiler,
             WaitResult outResult, Configuration config, int userId) {
         // Refuse possible leaked file descriptors
@@ -2884,7 +2891,7 @@
         intent = new Intent(intent);
 
         // Collect information about the target of the Intent.
-        ActivityInfo aInfo = resolveActivity(intent, resolvedType, debug,
+        ActivityInfo aInfo = resolveActivity(intent, resolvedType, debug, openglTrace,
                 profileFile, profileFd, autoStopProfiler);
         aInfo = mService.getActivityInfoForUser(aInfo, userId);
 
@@ -3074,7 +3081,7 @@
                     intent = new Intent(intent);
 
                     // Collect information about the target of the Intent.
-                    ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i], false,
+                    ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i], false, false,
                             null, null, false);
                     // TODO: New, check if this is correct
                     aInfo = mService.getActivityInfoForUser(aInfo, userId);
diff --git a/services/java/com/android/server/location/ComprehensiveCountryDetector.java b/services/java/com/android/server/location/ComprehensiveCountryDetector.java
index 2d6a148..1026a0d 100755
--- a/services/java/com/android/server/location/ComprehensiveCountryDetector.java
+++ b/services/java/com/android/server/location/ComprehensiveCountryDetector.java
@@ -202,7 +202,7 @@
         if (mDebugLogs.size() >= MAX_LENGTH_DEBUG_LOGS) {
             mDebugLogs.poll();
         }
-        if (Log.isLoggable(TAG, Log.DEBUG)) {
+        if (DEBUG) {
             Slog.d(TAG, country.toString());
         }
         mDebugLogs.add(country);
@@ -394,7 +394,7 @@
     private void notifyIfCountryChanged(final Country country, final Country detectedCountry) {
         if (detectedCountry != null && mListener != null
                 && (country == null || !country.equals(detectedCountry))) {
-            if (Log.isLoggable(TAG, Log.DEBUG)) {
+            if (DEBUG) {
                 Slog.d(TAG, "" + country + " --> " + detectedCountry);
             }
             notifyListener(detectedCountry);
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index a890068..2ad24e2 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -156,6 +156,7 @@
     private static final int VERSION_ADDED_RESTRICT_BACKGROUND = 3;
     private static final int VERSION_ADDED_METERED = 4;
     private static final int VERSION_SPLIT_SNOOZE = 5;
+    private static final int VERSION_ADDED_TIMEZONE = 6;
 
     // @VisibleForTesting
     public static final int TYPE_WARNING = 0x1;
@@ -171,6 +172,7 @@
     private static final String ATTR_NETWORK_TEMPLATE = "networkTemplate";
     private static final String ATTR_SUBSCRIBER_ID = "subscriberId";
     private static final String ATTR_CYCLE_DAY = "cycleDay";
+    private static final String ATTR_CYCLE_TIMEZONE = "cycleTimezone";
     private static final String ATTR_WARNING_BYTES = "warningBytes";
     private static final String ATTR_LIMIT_BYTES = "limitBytes";
     private static final String ATTR_LAST_SNOOZE = "lastSnooze";
@@ -922,13 +924,15 @@
                     com.android.internal.R.integer.config_networkPolicyDefaultWarning)
                     * MB_IN_BYTES;
 
-            final Time time = new Time(Time.TIMEZONE_UTC);
+            final Time time = new Time();
             time.setToNow();
+
             final int cycleDay = time.monthDay;
+            final String cycleTimezone = time.timezone;
 
             final NetworkTemplate template = buildTemplateMobileAll(subscriberId);
-            mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay, warningBytes,
-                    LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, true));
+            mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay, cycleTimezone,
+                    warningBytes, LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, true));
             writePolicyLocked();
         }
     }
@@ -964,6 +968,12 @@
                         final int networkTemplate = readIntAttribute(in, ATTR_NETWORK_TEMPLATE);
                         final String subscriberId = in.getAttributeValue(null, ATTR_SUBSCRIBER_ID);
                         final int cycleDay = readIntAttribute(in, ATTR_CYCLE_DAY);
+                        final String cycleTimezone;
+                        if (version >= VERSION_ADDED_TIMEZONE) {
+                            cycleTimezone = in.getAttributeValue(null, ATTR_CYCLE_TIMEZONE);
+                        } else {
+                            cycleTimezone = Time.TIMEZONE_UTC;
+                        }
                         final long warningBytes = readLongAttribute(in, ATTR_WARNING_BYTES);
                         final long limitBytes = readLongAttribute(in, ATTR_LIMIT_BYTES);
                         final long lastLimitSnooze;
@@ -998,8 +1008,8 @@
                         final NetworkTemplate template = new NetworkTemplate(
                                 networkTemplate, subscriberId);
                         mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay,
-                                warningBytes, limitBytes, lastWarningSnooze, lastLimitSnooze,
-                                metered));
+                                cycleTimezone, warningBytes, limitBytes, lastWarningSnooze,
+                                lastLimitSnooze, metered));
 
                     } else if (TAG_UID_POLICY.equals(tag)) {
                         final int uid = readIntAttribute(in, ATTR_UID);
@@ -1054,7 +1064,7 @@
             out.startDocument(null, true);
 
             out.startTag(null, TAG_POLICY_LIST);
-            writeIntAttribute(out, ATTR_VERSION, VERSION_SPLIT_SNOOZE);
+            writeIntAttribute(out, ATTR_VERSION, VERSION_ADDED_TIMEZONE);
             writeBooleanAttribute(out, ATTR_RESTRICT_BACKGROUND, mRestrictBackground);
 
             // write all known network policies
@@ -1068,6 +1078,7 @@
                     out.attribute(null, ATTR_SUBSCRIBER_ID, subscriberId);
                 }
                 writeIntAttribute(out, ATTR_CYCLE_DAY, policy.cycleDay);
+                out.attribute(null, ATTR_CYCLE_TIMEZONE, policy.cycleTimezone);
                 writeLongAttribute(out, ATTR_WARNING_BYTES, policy.warningBytes);
                 writeLongAttribute(out, ATTR_LIMIT_BYTES, policy.limitBytes);
                 writeLongAttribute(out, ATTR_LAST_WARNING_SNOOZE, policy.lastWarningSnooze);
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 167746f..e11c87a 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -100,6 +100,8 @@
      */
     int mRequestedWidth;
     int mRequestedHeight;
+    int mLastRequestedWidth;
+    int mLastRequestedHeight;
 
     int mLayer;
     int mAnimLayer;
@@ -391,6 +393,8 @@
         mSurface = null;
         mRequestedWidth = 0;
         mRequestedHeight = 0;
+        mLastRequestedWidth = 0;
+        mLastRequestedHeight = 0;
         mXOffset = 0;
         mYOffset = 0;
         mLayer = 0;
@@ -458,6 +462,11 @@
             mParentFrame.set(pf);
             mContentChanged = true;
         }
+        if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
+            mLastRequestedWidth = mRequestedWidth;
+            mLastRequestedHeight = mRequestedHeight;
+            mContentChanged = true;
+        }
 
         final Rect content = mContentFrame;
         content.set(cf);
@@ -1701,6 +1710,10 @@
         pw.print(prefix); pw.print("Requested w="); pw.print(mRequestedWidth);
                 pw.print(" h="); pw.print(mRequestedHeight);
                 pw.print(" mLayoutSeq="); pw.println(mLayoutSeq);
+        if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
+            pw.print(prefix); pw.print("LastRequested w="); pw.print(mLastRequestedWidth);
+                    pw.print(" h="); pw.println(mLastRequestedHeight);
+        }
         if (mAttachedWindow != null || mLayoutAttached) {
             pw.print(prefix); pw.print("mAttachedWindow="); pw.print(mAttachedWindow);
                     pw.print(" mLayoutAttached="); pw.println(mLayoutAttached);
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
index e863f8b..b4fd55e 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
@@ -32,6 +32,7 @@
 import static android.net.TrafficStats.MB_IN_BYTES;
 import static android.text.format.DateUtils.DAY_IN_MILLIS;
 import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
+import static android.text.format.Time.TIMEZONE_UTC;
 import static com.android.server.net.NetworkPolicyManagerService.TYPE_LIMIT;
 import static com.android.server.net.NetworkPolicyManagerService.TYPE_LIMIT_SNOOZED;
 import static com.android.server.net.NetworkPolicyManagerService.TYPE_WARNING;
@@ -439,7 +440,7 @@
         final long expectedCycle = parseTime("2007-11-05T00:00:00.000Z");
 
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 5, 1024L, 1024L, false);
+                sTemplateWifi, 5, TIMEZONE_UTC, 1024L, 1024L, false);
         final long actualCycle = computeLastCycleBoundary(currentTime, policy);
         assertTimeEquals(expectedCycle, actualCycle);
     }
@@ -450,7 +451,7 @@
         final long expectedCycle = parseTime("2007-10-20T00:00:00.000Z");
 
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 20, 1024L, 1024L, false);
+                sTemplateWifi, 20, TIMEZONE_UTC, 1024L, 1024L, false);
         final long actualCycle = computeLastCycleBoundary(currentTime, policy);
         assertTimeEquals(expectedCycle, actualCycle);
     }
@@ -461,7 +462,7 @@
         final long expectedCycle = parseTime("2007-01-30T00:00:00.000Z");
 
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 30, 1024L, 1024L, false);
+                sTemplateWifi, 30, TIMEZONE_UTC, 1024L, 1024L, false);
         final long actualCycle = computeLastCycleBoundary(currentTime, policy);
         assertTimeEquals(expectedCycle, actualCycle);
     }
@@ -472,14 +473,53 @@
         final long expectedCycle = parseTime("2007-02-28T23:59:59.000Z");
 
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 30, 1024L, 1024L, false);
+                sTemplateWifi, 30, TIMEZONE_UTC, 1024L, 1024L, false);
         final long actualCycle = computeLastCycleBoundary(currentTime, policy);
         assertTimeEquals(expectedCycle, actualCycle);
     }
 
+    public void testCycleBoundaryLeapYear() throws Exception {
+        final NetworkPolicy policy = new NetworkPolicy(
+                sTemplateWifi, 29, TIMEZONE_UTC, 1024L, 1024L, false);
+
+        assertTimeEquals(parseTime("2012-01-29T00:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2012-01-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2012-02-29T00:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2012-02-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2012-02-29T00:00:00.000Z"),
+                computeLastCycleBoundary(parseTime("2012-03-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2012-03-29T00:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2012-03-14T00:00:00.000Z"), policy));
+
+        assertTimeEquals(parseTime("2007-01-29T00:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2007-01-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2007-02-28T23:59:59.000Z"),
+                computeNextCycleBoundary(parseTime("2007-02-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2007-02-28T23:59:59.000Z"),
+                computeLastCycleBoundary(parseTime("2007-03-14T00:00:00.000Z"), policy));
+        assertTimeEquals(parseTime("2007-03-29T00:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2007-03-14T00:00:00.000Z"), policy));
+    }
+
+    public void testNextCycleTimezoneAfterUtc() throws Exception {
+        // US/Central is UTC-6
+        final NetworkPolicy policy = new NetworkPolicy(
+                sTemplateWifi, 10, "US/Central", 1024L, 1024L, false);
+        assertTimeEquals(parseTime("2012-01-10T06:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2012-01-05T00:00:00.000Z"), policy));
+    }
+
+    public void testNextCycleTimezoneBeforeUtc() throws Exception {
+        // Israel is UTC+2
+        final NetworkPolicy policy = new NetworkPolicy(
+                sTemplateWifi, 10, "Israel", 1024L, 1024L, false);
+        assertTimeEquals(parseTime("2012-01-09T22:00:00.000Z"),
+                computeNextCycleBoundary(parseTime("2012-01-05T00:00:00.000Z"), policy));
+    }
+
     public void testNextCycleSane() throws Exception {
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 31, WARNING_DISABLED, LIMIT_DISABLED, false);
+                sTemplateWifi, 31, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED, false);
         final LinkedHashSet<Long> seen = new LinkedHashSet<Long>();
 
         // walk forwards, ensuring that cycle boundaries don't get stuck
@@ -494,7 +534,7 @@
 
     public void testLastCycleSane() throws Exception {
         final NetworkPolicy policy = new NetworkPolicy(
-                sTemplateWifi, 31, WARNING_DISABLED, LIMIT_DISABLED, false);
+                sTemplateWifi, 31, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED, false);
         final LinkedHashSet<Long> seen = new LinkedHashSet<Long>();
 
         // walk backwards, ensuring that cycle boundaries look sane
@@ -552,7 +592,7 @@
 
         replay();
         setNetworkPolicies(new NetworkPolicy(
-                sTemplateWifi, CYCLE_DAY, 1 * MB_IN_BYTES, 2 * MB_IN_BYTES, false));
+                sTemplateWifi, CYCLE_DAY, TIMEZONE_UTC, 1 * MB_IN_BYTES, 2 * MB_IN_BYTES, false));
         future.get();
         verifyAndReset();
     }
@@ -609,8 +649,8 @@
             future = expectMeteredIfacesChanged();
 
             replay();
-            setNetworkPolicies(new NetworkPolicy(sTemplateWifi, CYCLE_DAY, 1 * MB_IN_BYTES,
-                    2 * MB_IN_BYTES, false));
+            setNetworkPolicies(new NetworkPolicy(sTemplateWifi, CYCLE_DAY, TIMEZONE_UTC, 1
+                    * MB_IN_BYTES, 2 * MB_IN_BYTES, false));
             future.get();
             verifyAndReset();
         }
@@ -740,8 +780,9 @@
             future = expectMeteredIfacesChanged(TEST_IFACE);
 
             replay();
-            setNetworkPolicies(new NetworkPolicy(sTemplateWifi, CYCLE_DAY, WARNING_DISABLED,
-                    LIMIT_DISABLED, true));
+            setNetworkPolicies(new NetworkPolicy(
+                    sTemplateWifi, CYCLE_DAY, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED,
+                    true));
             future.get();
             verifyAndReset();
         }
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 6e4dd58..5f1a014 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -231,7 +231,8 @@
                     internalDataEnabled &&
                     desiredPowerState &&
                     !mPendingRestartRadio &&
-                    !mCdmaPhone.needsOtaServiceProvisioning();
+                    ((mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) ||
+                            !mCdmaPhone.needsOtaServiceProvisioning());
         if (!allowed && DBG) {
             String reason = "";
             if (!((psState == ServiceState.STATE_IN_SERVICE) || mAutoAttachOnCreation)) {
diff --git a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
index 0f3c0a7..e2bf43d 100644
--- a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
+++ b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
@@ -28,176 +28,6 @@
     allocSampler = sampler;
 }
 
-static int32_t wrapI(rs_sampler_value wrap, int32_t coord, int32_t size) {
-    if (wrap == RS_SAMPLER_WRAP) {
-        coord = coord % size;
-        if (coord < 0) {
-            coord += size;
-        }
-    }
-    return max(0, min(coord, size - 1));
-}
-
-#define convert_float(v) (float)v
-#define SAMPLE_1D_FUNC(vecsize)                                                                 \
-        static float##vecsize get1DSample##vecsize(rs_allocation a, float2 weights,             \
-                                                 int iPixel, int next) {                        \
-            uchar##vecsize *p0c = (uchar##vecsize*)rsGetElementAt(a, iPixel);                   \
-            uchar##vecsize *p1c = (uchar##vecsize*)rsGetElementAt(a, next);                     \
-            float##vecsize p0 = convert_float##vecsize(*p0c);                                   \
-            float##vecsize p1 = convert_float##vecsize(*p1c);                                   \
-            return p0 * weights.x + p1 * weights.y;                                             \
-        }
-#define SAMPLE_2D_FUNC(vecsize)                                                                 \
-        static float##vecsize get2DSample##vecsize(rs_allocation a, float4 weights,             \
-                                                 int2 iPixel, int nextX, int nextY) {           \
-            uchar##vecsize *p0c = (uchar##vecsize*)rsGetElementAt(a, iPixel.x, iPixel.y);       \
-            uchar##vecsize *p1c = (uchar##vecsize*)rsGetElementAt(a, nextX, iPixel.y);          \
-            uchar##vecsize *p2c = (uchar##vecsize*)rsGetElementAt(a, iPixel.x, nextY);          \
-            uchar##vecsize *p3c = (uchar##vecsize*)rsGetElementAt(a, nextX, nextY);             \
-            float##vecsize p0 = convert_float##vecsize(*p0c);                                   \
-            float##vecsize p1 = convert_float##vecsize(*p1c);                                   \
-            float##vecsize p2 = convert_float##vecsize(*p2c);                                   \
-            float##vecsize p3 = convert_float##vecsize(*p3c);                                   \
-            return p0 * weights.x + p1 * weights.y + p2 * weights.z + p3 * weights.w;           \
-        }
-
-SAMPLE_1D_FUNC()
-SAMPLE_1D_FUNC(2)
-SAMPLE_1D_FUNC(3)
-SAMPLE_1D_FUNC(4)
-
-SAMPLE_2D_FUNC()
-SAMPLE_2D_FUNC(2)
-SAMPLE_2D_FUNC(3)
-SAMPLE_2D_FUNC(4)
-
-static float4 getBilinearSample565(rs_allocation a, float4 weights,
-                                   int2 iPixel, int nextX, int nextY) {
-    float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
-    return zero;
-}
-
-static float4 getBilinearSample(rs_allocation a, float4 weights,
-                                int2 iPixel, int nextX, int nextY,
-                                uint32_t vecSize, rs_data_type dt) {
-    if (dt == RS_TYPE_UNSIGNED_5_6_5) {
-        return getBilinearSample565(a, weights, iPixel, nextX, nextY);
-    }
-
-    float4 result;
-    switch(vecSize) {
-    case 1:
-        result.x = get2DSample(a, weights, iPixel, nextX, nextY);
-        result.yzw = 0.0f;
-        break;
-    case 2:
-        result.xy = get2DSample2(a, weights, iPixel, nextX, nextY);
-        result.zw = 0.0f;
-        break;
-    case 3:
-        result.xyz = get2DSample3(a, weights, iPixel, nextX, nextY);
-        result.w = 0.0f;
-        break;
-    case 4:
-        result = get2DSample4(a, weights, iPixel, nextX, nextY);
-        break;
-    }
-
-    return result;
-}
-
-static float4 getNearestSample(rs_allocation a, int2 iPixel, uint32_t vecSize, rs_data_type dt) {
-    if (dt == RS_TYPE_UNSIGNED_5_6_5) {
-        float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
-        return zero;
-    }
-
-    float4 result;
-    switch(vecSize) {
-    case 1:
-        result.x = convert_float(*((uchar*)rsGetElementAt(a, iPixel.x, iPixel.y)));
-        result.yzw = 0.0f;
-    case 2:
-        result.xy = convert_float2(*((uchar2*)rsGetElementAt(a, iPixel.x, iPixel.y)));
-        result.zw = 0.0f;
-    case 3:
-        result.xyz = convert_float3(*((uchar3*)rsGetElementAt(a, iPixel.x, iPixel.y)));
-        result.w = 0.0f;
-    case 4:
-        result = convert_float4(*((uchar4*)rsGetElementAt(a, iPixel.x, iPixel.y)));
-    }
-
-    return result;
-}
-
-
-// Naive implementation of texture filtering for prototyping purposes
-static float4 sample(rs_allocation a, rs_sampler s, float2 uv) {
-
-    // Find out what kind of input data we are sampling
-    rs_element elem = rsAllocationGetElement(a);
-    uint32_t vecSize = rsElementGetVectorSize(elem);
-    rs_data_kind dk = rsElementGetDataKind(elem);
-    rs_data_type dt = rsElementGetDataType(elem);
-
-    if (dk == RS_KIND_USER || (dt != RS_TYPE_UNSIGNED_8 && dt != RS_TYPE_UNSIGNED_5_6_5)) {
-        float4 zero = {0.0f, 0.0f, 0.0f, 0.0f};
-        return zero;
-    }
-    //rsDebug("*****************************************", 0);
-    rs_sampler_value wrapS = rsgSamplerGetWrapS(s);
-    rs_sampler_value wrapT = rsgSamplerGetWrapT(s);
-
-    rs_sampler_value sampleMin = rsgSamplerGetMinification(s);
-    rs_sampler_value sampleMag = rsgSamplerGetMagnification(s);
-
-    int32_t sourceW = rsAllocationGetDimX(a);
-    int32_t sourceH = rsAllocationGetDimY(a);
-
-    float2 dimF;
-    dimF.x = (float)(sourceW);
-    dimF.y = (float)(sourceH);
-    float2 pixelUV = uv * dimF;
-    int2 iPixel = convert_int2(pixelUV);
-
-    if (sampleMin == RS_SAMPLER_NEAREST ||
-        sampleMag == RS_SAMPLER_NEAREST) {
-        iPixel.x = wrapI(wrapS, iPixel.x, sourceW);
-        iPixel.y = wrapI(wrapT, iPixel.y, sourceH);
-        return getNearestSample(a, iPixel, vecSize, dt);
-    }
-
-    float2 frac = pixelUV - convert_float2(iPixel);
-
-    if (frac.x < 0.5f) {
-        iPixel.x -= 1;
-        frac.x += 0.5f;
-    } else {
-        frac.x -= 0.5f;
-    }
-    if (frac.y < 0.5f) {
-        iPixel.y -= 1;
-        frac.y += 0.5f;
-    } else {
-        frac.y -= 0.5f;
-    }
-    float2 oneMinusFrac = 1.0f - frac;
-
-    float4 weights;
-    weights.x = oneMinusFrac.x * oneMinusFrac.y;
-    weights.y = frac.x * oneMinusFrac.y;
-    weights.z = oneMinusFrac.x * frac.y;
-    weights.w = frac.x * frac.y;
-
-    int32_t nextX = wrapI(wrapS, iPixel.x + 1, sourceW);
-    int32_t nextY = wrapI(wrapT, iPixel.y + 1, sourceH);
-    iPixel.x = wrapI(wrapS, iPixel.x, sourceW);
-    iPixel.y = wrapI(wrapT, iPixel.y, sourceH);
-
-    return getBilinearSample(a, weights, iPixel, nextX, nextY, vecSize, dt);
-}
-
 void root(uchar4 *out, uint32_t x, uint32_t y) {
 
     float destX = (float)rsAllocationGetDimX(destAlloc) - 1.0f;
@@ -207,7 +37,7 @@
     uv.x = (float)x / destX;
     uv.y = (float)y / destY;
 
-    out->xyz = convert_uchar3(sample(sourceAlloc, allocSampler, uv*2.0f).xyz);
+    out->xyz = convert_uchar3(rsSample(sourceAlloc, allocSampler, uv*2.0f).xyz);
     out->w = 0xff;
 }
 
diff --git a/tests/SmokeTest/tests/AndroidManifest.xml b/tests/SmokeTest/tests/AndroidManifest.xml
index 517eb1e..cad37c5 100644
--- a/tests/SmokeTest/tests/AndroidManifest.xml
+++ b/tests/SmokeTest/tests/AndroidManifest.xml
@@ -18,20 +18,30 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.smoketest.tests">
 
-    <!-- We add an application tag here just so that we can indicate that
-         this package needs to link against the android.test library,
-         which is needed when building test cases. -->    
+    <!--
+    We add an application tag here just so that we can indicate that this package needs to link
+    against the android.test library, which is needed when building test cases.
+    -->
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
 
     <!--
-    This declares that this app uses the instrumentation test runner targeting
-    the package of com.android.smoketest.  To run the tests use the command:
-    "adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner"
+    This declares that this app uses the instrumentation test runner targeting the package of
+    com.android.smoketest.  To run the tests use the command:
+    `adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner`
     -->
     <instrumentation android:name="android.test.InstrumentationTestRunner"
                      android:targetPackage="com.android.smoketest"
                      android:label="System Smoke Tests"/>
 
+    <!--
+    This declares a method to run the instrumentation with a special runner, which will run each
+    app as a separate testcase.  To do so, use the command:
+    `adb shell am instrument -w com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner`
+    -->
+    <instrumentation android:name="com.android.smoketest.SmokeTestRunner"
+                     android:targetPackage="com.android.smoketest"
+                     android:label="System Smoke Tests"/>
+
 </manifest>
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
index 1a2dcb9..3efd658 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
@@ -16,8 +16,6 @@
 
 package com.android.smoketest;
 
-import com.android.internal.os.RuntimeInit;
-
 import android.app.ActivityManager;
 import android.app.ActivityManager.ProcessErrorStateInfo;
 import android.content.Context;
@@ -42,10 +40,18 @@
 public class ProcessErrorsTest extends AndroidTestCase {
     
     private static final String TAG = "ProcessErrorsTest";
-    
+
+    private final Intent mHomeIntent;
+
     protected ActivityManager mActivityManager;
     protected PackageManager mPackageManager;
 
+    public ProcessErrorsTest() {
+        mHomeIntent = new Intent(Intent.ACTION_MAIN);
+        mHomeIntent.addCategory(Intent.CATEGORY_HOME);
+        mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+    }
+
     @Override
     public void setUp() throws Exception {
         super.setUp();
@@ -59,7 +65,7 @@
         assertNotNull(mPackageManager);
     }
 
-    public void testNoProcessErrors() throws Exception {
+    public void testNoProcessErrorsAfterBoot() throws Exception {
         final String reportMsg = checkForProcessErrors();
         if (reportMsg != null) {
             Log.w(TAG, reportMsg);
@@ -72,16 +78,80 @@
     private String checkForProcessErrors() throws Exception {
         List<ProcessErrorStateInfo> errList;
         errList = mActivityManager.getProcessesInErrorState();
-        
+
         // note: this contains information about each process that is currently in an error
-        // condition.  if the list is empty (null) then "we're good".  
-        
+        // condition.  if the list is empty (null) then "we're good".
+
         // if the list is non-empty, then it's useful to report the contents of the list
         final String reportMsg = reportListContents(errList);
         return reportMsg;
     }
 
     /**
+     * A helper function to query the provided {@link PackageManager} for a list of Activities that
+     * can be launched from Launcher.
+     */
+    static List<ResolveInfo> getLauncherActivities(PackageManager pm) {
+        final Intent launchable = new Intent(Intent.ACTION_MAIN);
+        launchable.addCategory(Intent.CATEGORY_LAUNCHER);
+        final List<ResolveInfo> activities = pm.queryIntentActivities(launchable, 0);
+        return activities;
+    }
+
+    /**
+     * A helper function to create an {@link Intent} to run, given a {@link ResolveInfo} specifying
+     * an activity to be launched.
+     */
+    static Intent intentForActivity(ResolveInfo app) {
+        // build an Intent to launch the specified app
+        final ComponentName component = new ComponentName(app.activityInfo.packageName,
+                app.activityInfo.name);
+        final Intent intent = new Intent(Intent.ACTION_MAIN);
+        intent.setComponent(component);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+        return intent;
+    }
+
+    /**
+     * A method to run the specified Activity and return a {@link Collection} of the Activities that
+     * were in an error state, as listed by {@link ActivityManager.getProcessesInErrorState()}.
+     * <p />
+     * The method will launch the app, wait for 7 seconds, check for apps in the error state, send
+     * the Home intent, wait for 2 seconds, and then return.
+     */
+    public Collection<ProcessErrorStateInfo> runOneActivity(ResolveInfo app) {
+        final long appLaunchWait = 7000;
+        final long homeLaunchWait = 2000;
+
+        Log.i(TAG, String.format("Running activity %s/%s", app.activityInfo.packageName,
+                app.activityInfo.name));
+
+        // launch app, and wait 7 seconds for it to start/settle
+        final Intent intent = intentForActivity(app);
+        getContext().startActivity(intent);
+        try {
+            Thread.sleep(appLaunchWait);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        // See if there are any errors
+        final Collection<ProcessErrorStateInfo> errProcs =
+                mActivityManager.getProcessesInErrorState();
+
+        // Send the "home" intent and wait 2 seconds for us to get there
+        getContext().startActivity(mHomeIntent);
+        try {
+            Thread.sleep(homeLaunchWait);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        return errProcs;
+    }
+
+    /**
      * A test that runs all Launcher-launchable activities and verifies that no ANRs or crashes
      * happened while doing so.
      * <p />
@@ -89,46 +159,12 @@
      * FIXME: first app doesn't go away.
      */
     public void testRunAllActivities() throws Exception {
-        final Intent home = new Intent(Intent.ACTION_MAIN);
-        home.addCategory(Intent.CATEGORY_HOME);
-        home.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-        final Intent launchable = new Intent(Intent.ACTION_MAIN);
-        launchable.addCategory(Intent.CATEGORY_LAUNCHER);
-        final List<ResolveInfo> activities = mPackageManager.queryIntentActivities(launchable, 0);
         final Set<ProcessError> errSet = new HashSet<ProcessError>();
 
-        for (ResolveInfo info : activities) {
-            Log.i(TAG, String.format("Got %s/%s", info.activityInfo.packageName,
-                    info.activityInfo.name));
-
-            // build an Intent to launch the app
-            final ComponentName component = new ComponentName(info.activityInfo.packageName,
-                    info.activityInfo.name);
-            final Intent intent = new Intent(Intent.ACTION_MAIN);
-            intent.setComponent(component);
-            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-            // launch app, and wait 7 seconds for it to start/settle
-            getContext().startActivity(intent);
-            try {
-                Thread.sleep(7000);
-            } catch (InterruptedException e) {
-                // ignore
-            }
-
-            // See if there are any errors
-            Collection<ProcessErrorStateInfo> procs = mActivityManager.getProcessesInErrorState();
-            if (procs != null) {
-                errSet.addAll(ProcessError.fromCollection(procs));
-            }
-
-            // Send the "home" intent and wait 2 seconds for us to get there
-            getContext().startActivity(home);
-            try {
-                Thread.sleep(2000);
-            } catch (InterruptedException e) {
-                // ignore
+        for (ResolveInfo app : getLauncherActivities(mPackageManager)) {
+            final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+            if (errProcs != null) {
+                errSet.addAll(ProcessError.fromCollection(errProcs));
             }
         }
 
@@ -138,7 +174,7 @@
         }
     }
 
-    private String reportWrappedListContents(Collection<ProcessError> errList) {
+    String reportWrappedListContents(Collection<ProcessError> errList) {
         List<ProcessErrorStateInfo> newList = new ArrayList<ProcessErrorStateInfo>(errList.size());
         for (ProcessError err : errList) {
             newList.add(err.info);
@@ -186,7 +222,7 @@
      * A {@link ProcessErrorStateInfo} wrapper class that hashes how we want (so that equivalent
      * crashes are considered equal).
      */
-    private static class ProcessError {
+    static class ProcessError {
         public final ProcessErrorStateInfo info;
 
         public ProcessError(ProcessErrorStateInfo newInfo) {
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
new file mode 100644
index 0000000..40b11c5
--- /dev/null
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 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 com.android.smoketest;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.ProcessErrorStateInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.test.InstrumentationTestRunner;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A special test runner which does a test-start for each app in a separate testcase
+ */
+public class SmokeTestRunner extends InstrumentationTestRunner {
+
+    private static final String SUITE_NAME = "Smoke Test Suite";
+
+    /**
+     * Returns a single testcase for each app to launch
+     */
+    @Override
+    public TestSuite getAllTests() {
+        final TestSuite suite = new TestSuite(SUITE_NAME);
+
+        final PackageManager pm = getTargetContext().getPackageManager();
+        final List<ResolveInfo> apps = ProcessErrorsTest.getLauncherActivities(pm);
+
+        // FIXME: figure out some way to control the reported class names for these anonymous
+        // FIXME: class instances.
+
+        final TestCase setupTest = new ProcessErrorsTest() {
+            @Override
+            public void runTest() throws Exception {
+                testSetUpConditions();
+            }
+        };
+        setupTest.setName("testSetUpConditions");
+        suite.addTest(setupTest);
+
+        final TestCase postBootTest = new ProcessErrorsTest() {
+            @Override
+            public void runTest() throws Exception {
+                testNoProcessErrorsAfterBoot();
+            }
+        };
+        postBootTest.setName("testNoProcessErrorsAfterBoot");
+        suite.addTest(postBootTest);
+
+        for (final ResolveInfo app : apps) {
+            final TestCase appTest = new ProcessErrorsTest() {
+                @Override
+                public void runTest() throws Exception {
+                    final Set<ProcessError> errSet = new HashSet<ProcessError>();
+                    final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+                    if (errProcs != null) {
+                        errSet.addAll(ProcessError.fromCollection(errProcs));
+                    }
+
+                    if (!errSet.isEmpty()) {
+                        fail(String.format("Got %d errors: %s", errSet.size(),
+                                reportWrappedListContents(errSet)));
+                    }
+                }
+            };
+            appTest.setName(app.activityInfo.name);
+            suite.addTest(appTest);
+        }
+
+        return suite;
+    }
+}
+
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index c79e243..198fce4 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -636,6 +636,9 @@
             bool hasWriteExternalStoragePermission = false;
             bool hasReadPhoneStatePermission = false;
 
+            // If an app requests write storage, they will also get read storage.
+            bool hasReadExternalStoragePermission = false;
+
             // This next group of variables is used to implement a group of
             // backward-compatibility heuristics necessitated by the addition of
             // some new uses-feature constants in 2.1 and 2.2. In most cases, the
@@ -999,6 +1002,8 @@
                                 hasTelephonyPermission = true;
                             } else if (name == "android.permission.WRITE_EXTERNAL_STORAGE") {
                                 hasWriteExternalStoragePermission = true;
+                            } else if (name == "android.permission.READ_EXTERNAL_STORAGE") {
+                                hasReadExternalStoragePermission = true;
                             } else if (name == "android.permission.READ_PHONE_STATE") {
                                 hasReadPhoneStatePermission = true;
                             }
@@ -1163,12 +1168,19 @@
             if (targetSdk < 4) {
                 if (!hasWriteExternalStoragePermission) {
                     printf("uses-permission:'android.permission.WRITE_EXTERNAL_STORAGE'\n");
+                    hasWriteExternalStoragePermission = true;
                 }
                 if (!hasReadPhoneStatePermission) {
                     printf("uses-permission:'android.permission.READ_PHONE_STATE'\n");
                 }
             }
 
+            // If the application has requested WRITE_EXTERNAL_STORAGE, we will
+            // force them to always take READ_EXTERNAL_STORAGE as well.
+            if (!hasReadExternalStoragePermission && hasWriteExternalStoragePermission) {
+                printf("uses-permission:'android.permission.READ_EXTERNAL_STORAGE'\n");
+            }
+
             /* The following blocks handle printing "inferred" uses-features, based
              * on whether related features or permissions are used by the app.
              * Note that the various spec*Feature variables denote whether the
diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
index 5c9bef9..f31ee68 100644
--- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java
@@ -113,11 +113,14 @@
     private static final int RSSI_MONITOR_COUNT = 5;
     private int mRssiMonitorCount = 0;
 
-    /* Avoid flapping */
-    private static final int MIN_INTERVAL_AVOID_BSSID_MS = 60 * 1000;
-    private String mLastAvoidedBssid;
-    /* a -ve interval to allow avoidance at boot */
-    private long mLastBssidAvoidedTime = -MIN_INTERVAL_AVOID_BSSID_MS;
+    /* Avoid flapping. The interval is changed over time as long as we continue to avoid
+     * under the max interval after which we reset the interval again */
+    private static final int MIN_INTERVAL_AVOID_BSSID_MS[] = {0, 30 * 1000, 60 * 1000,
+            5 * 60 * 1000, 30 * 60 * 1000};
+    /* Index into the interval array MIN_INTERVAL_AVOID_BSSID_MS */
+    private int mMinIntervalArrayIndex = 0;
+
+    private long mLastBssidAvoidedTime;
 
     private int mCurrentSignalLevel;
 
@@ -744,11 +747,13 @@
                     mCurrentSignalLevel = calculateSignalLevel(msg.arg1);
                     //Ready to avoid bssid again ?
                     long time = android.os.SystemClock.elapsedRealtime();
-                    if (time - mLastBssidAvoidedTime  > MIN_INTERVAL_AVOID_BSSID_MS) {
+                    if (time - mLastBssidAvoidedTime  > MIN_INTERVAL_AVOID_BSSID_MS[
+                            mMinIntervalArrayIndex]) {
                         handleRssiChange();
                     } else {
                         if (DBG) log("Early to avoid " + mWifiInfo + " time: " + time +
-                                " last avoided: " + mLastBssidAvoidedTime);
+                                " last avoided: " + mLastBssidAvoidedTime +
+                                " mMinIntervalArrayIndex: " + mMinIntervalArrayIndex);
                     }
                     break;
                 default:
@@ -892,7 +897,20 @@
     private void sendPoorLinkDetected() {
         if (DBG) log("send POOR_LINK_DETECTED " + mWifiInfo);
         mWsmChannel.sendMessage(POOR_LINK_DETECTED);
-        mLastAvoidedBssid = mWifiInfo.getBSSID();
+
+        long time = android.os.SystemClock.elapsedRealtime();
+        if (time - mLastBssidAvoidedTime  > MIN_INTERVAL_AVOID_BSSID_MS[
+                MIN_INTERVAL_AVOID_BSSID_MS.length - 1]) {
+            mMinIntervalArrayIndex = 1;
+            if (DBG) log("set mMinIntervalArrayIndex to 1");
+        } else {
+
+            if (mMinIntervalArrayIndex < MIN_INTERVAL_AVOID_BSSID_MS.length - 1) {
+                mMinIntervalArrayIndex++;
+            }
+            if (DBG) log("mMinIntervalArrayIndex: " + mMinIntervalArrayIndex);
+        }
+
         mLastBssidAvoidedTime = android.os.SystemClock.elapsedRealtime();
     }