Merge "Set the reason for screen-off before usage."
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 f7d6bce..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);
@@ -10935,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);
@@ -21640,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);
@@ -23197,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/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 599487dc..0f2aa46 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -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/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/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/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/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/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/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/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 e7bc74c..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
@@ -10383,7 +10467,7 @@
                 return null;
             }
 
-            mHardwareLayer.redraw(getDisplayList(), mLocalDirtyRect);
+            mHardwareLayer.redraw(getHardwareLayerDisplayList(mHardwareLayer), mLocalDirtyRect);
             mLocalDirtyRect.setEmpty();
         }
 
@@ -10535,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>
      *
@@ -10543,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;
     }
 
@@ -11151,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;
@@ -11174,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 {
@@ -11187,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) {
@@ -11238,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
@@ -11246,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;
@@ -11278,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);
@@ -11299,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
@@ -11325,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 {
@@ -11350,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));
@@ -11396,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;
@@ -11409,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()) {
@@ -11867,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;
 
@@ -12473,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
      */
@@ -12496,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
      */
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/webkit/AutoCompletePopup.java b/core/java/android/webkit/AutoCompletePopup.java
index e0e5eca..674428a 100644
--- a/core/java/android/webkit/AutoCompletePopup.java
+++ b/core/java/android/webkit/AutoCompletePopup.java
@@ -20,7 +20,6 @@
 import android.os.Handler;
 import android.os.Message;
 import android.text.Editable;
-import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.AbsoluteLayout;
@@ -92,7 +91,6 @@
                     state.handleUpEvent(event);
                 }
                 if (event.isTracking() && !event.isCanceled()) {
-                    Log.v("AutoCompletePopup", "dismiss popup 2");
                     mPopup.dismiss();
                     return true;
                 }
@@ -107,7 +105,6 @@
     public void setFocused(boolean isFocused) {
         mIsFocused = isFocused;
         if (!mIsFocused) {
-            Log.v("AutoCompletePopup", "dismiss popup 3");
             mPopup.dismiss();
         }
     }
@@ -126,7 +123,6 @@
     public void clearAdapter() {
         mAdapter = null;
         mFilter = null;
-        Log.v("AutoCompletePopup", "dismiss popup 4");
         mPopup.dismiss();
         mPopup.setAdapter(null);
     }
@@ -150,7 +146,6 @@
     }
 
     public void resetRect() {
-        Log.v("AutoCompletePopup", "resetRect: " + mNodeBounds);
         int left = mWebView.contentToViewX(mNodeBounds.left);
         int right = mWebView.contentToViewX(mNodeBounds.right);
         int width = right - left;
@@ -175,13 +170,10 @@
                 lp.height = height;
             }
         }
-        Log.v("AutoCompletePopup", "resetRect layout " + lp.x + ", " + lp.y +
-                ", " + lp.width + ", " + lp.height);
         if (needsUpdate) {
             mAnchor.setLayoutParams(lp);
         }
         if (mPopup.isShowing()) {
-            Log.v("AutoCompletePopup", "showing popup again");
             mPopup.show(); // update its position
         }
     }
@@ -222,7 +214,6 @@
                 pushTextToInputConnection();
             }
         }
-        Log.v("AutoCompletePopup", "dismiss popup 5");
         mPopup.dismiss();
     }
 
@@ -240,7 +231,6 @@
     @Override
     public void onFilterComplete(int count) {
         if (!mIsFocused) {
-            Log.v("AutoCompletePopup", "dismiss popup 1");
             mPopup.dismiss();
             return;
         }
@@ -252,11 +242,9 @@
                 // Make sure the list does not obscure the IME when shown for the first time.
                 mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
             }
-            Log.v("AutoCompletePopup", "showing popup");
             mPopup.show();
             mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
         } else {
-            Log.v("AutoCompletePopup", "dismiss popup");
             mPopup.dismiss();
         }
     }
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 812d89a..09ce1e2 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -548,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:
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 8def74b..77d2641 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -954,14 +954,15 @@
         public TextFieldInitData(int fieldPointer,
                 String text, int type, boolean isSpellCheckEnabled,
                 boolean autoComplete, boolean isTextFieldNext,
-                String name, String label, int maxLength,
-                Rect nodeBounds, int nodeLayerId) {
+                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;
@@ -973,6 +974,7 @@
         int mType;
         boolean mIsSpellCheckEnabled;
         boolean mIsTextFieldNext;
+        boolean mIsTextFieldPrev;
         boolean mIsAutoCompleteEnabled;
         String mName;
         String mLabel;
@@ -2798,7 +2800,7 @@
     // called by JNI
     private void initEditField(int pointer, String text, int inputType,
             boolean isSpellCheckEnabled, boolean isAutoCompleteEnabled,
-            boolean nextFieldIsText, String name,
+            boolean nextFieldIsText, boolean prevFieldIsText, String name,
             String label, int start, int end, int selectionPtr, int maxLength,
             Rect nodeRect, int nodeLayer) {
         if (mWebView == null) {
@@ -2806,7 +2808,8 @@
         }
         TextFieldInitData initData = new TextFieldInitData(pointer,
                 text, inputType, isSpellCheckEnabled, isAutoCompleteEnabled,
-                nextFieldIsText, name, label, maxLength, nodeRect, nodeLayer);
+                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/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/TextView.java b/core/java/android/widget/TextView.java
index b8db848..e535170 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -11703,8 +11703,10 @@
                     firstLine, lastLine);
 
             if (mTextDisplayList == null || !mTextDisplayList.isValid()) {
+                boolean displayListCreated = false;
                 if (mTextDisplayList == null) {
                     mTextDisplayList = getHardwareRenderer().createDisplayList("Text");
+                    displayListCreated = true;
                 }
 
                 final HardwareCanvas hardwareCanvas = mTextDisplayList.start();
@@ -11719,6 +11721,9 @@
                 } finally {
                     hardwareCanvas.onPostDraw();
                     mTextDisplayList.end();
+                    if (displayListCreated && USE_DISPLAY_LIST_PROPERTIES) {
+                        mTextDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+                    }
                 }
             }
             canvas.translate(mScrollX, mScrollY);
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 b34dbce..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,7 +197,7 @@
     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
@@ -210,7 +210,7 @@
         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 57f5d3d..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) {
 
@@ -285,15 +285,15 @@
             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,
@@ -302,7 +302,7 @@
             frameCount,
             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/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/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/stress/WifiStressTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
index f46546f..649ec3e 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
@@ -97,6 +97,11 @@
         mOutputWriter = new BufferedWriter(new FileWriter(new File(
                 Environment.getExternalStorageDirectory(), OUTPUT_FILE), true));
         mAct.turnScreenOn();
+        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()) {
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/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/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index c723b6d..0f39cf3 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -78,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
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/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/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/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 b4310ea..685fddc 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -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/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..139ff01 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;
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_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/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index b17ae45..6003608 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -42,7 +42,6 @@
     $(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
 
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 22c3a18..05ade75 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -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 34563ca..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;
 }
 
@@ -352,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) {
@@ -743,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;
@@ -830,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);
     }
 
@@ -991,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;
@@ -1095,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();
@@ -1224,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
@@ -1310,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 47c261da..07b12e4 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -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);
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..f586b02 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -319,7 +319,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();
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 a85956c..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;
@@ -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..a7536b3 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -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 9c3170c..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);
 
@@ -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..7ea9490 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;
     }
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/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/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/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 2f49808..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,7 +1464,7 @@
         // 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
+        mMixerStatus(MIXER_IDLE),
         mPrevMixerStatus(MIXER_IDLE),
         standbyDelay(AudioFlinger::mStandbyTimeInNsecs)
 {
@@ -1658,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;
@@ -2031,7 +2032,6 @@
 
         processConfigEvents();
 
-        mMixerStatus = MIXER_IDLE;
         { // scope for mLock
 
             Mutex::Autolock _l(mLock);
@@ -2645,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) {
@@ -2729,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
 )
@@ -2930,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();
         }
@@ -2963,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()
@@ -3016,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) {
@@ -3210,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;
@@ -3266,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());
@@ -3300,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()
@@ -3493,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;
 
@@ -3520,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();
 }
 
@@ -3686,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;
 }
@@ -3887,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
@@ -4106,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);
+        }
     }
 }
 
@@ -4132,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");
@@ -4978,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);
@@ -5031,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()) {
@@ -5198,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 &&
@@ -5287,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 {
@@ -5462,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);
@@ -5489,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;
@@ -5615,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);
@@ -5632,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;
@@ -5748,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;
             }
@@ -5981,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);
@@ -5989,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
@@ -6025,7 +6024,7 @@
     }
 
 Exit:
-    if(status) {
+    if (status != NULL) {
         *status = lStatus;
     }
     return handle;
@@ -6228,7 +6227,7 @@
         handle.clear();
     }
 
-    if(status) {
+    if (status != NULL) {
         *status = lStatus;
     }
     return handle;
@@ -6298,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++) {
@@ -6307,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();
@@ -6483,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);
@@ -7267,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;
@@ -8034,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) {
@@ -8047,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 194b826..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"; }
 
@@ -342,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&);
 
@@ -472,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
@@ -534,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;
 
@@ -657,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;
@@ -687,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;
@@ -826,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();
@@ -842,9 +828,6 @@
         virtual     void        threadLoop_write();
         virtual     void        threadLoop_standby();
 
-        // 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
@@ -855,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);
@@ -886,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);
@@ -933,13 +917,7 @@
 
     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&);
@@ -1060,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;
     };
@@ -1080,7 +1056,7 @@
         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();
@@ -1124,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:
@@ -1150,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);
 
@@ -1184,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&);
@@ -1367,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
@@ -1452,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&);
 
@@ -1537,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,
@@ -1551,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&);
 
@@ -1577,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
@@ -1627,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/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/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/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();
     }