Merge "Optimize EventHub to process events in big chunks."
diff --git a/api/12.xml b/api/12.xml
index 7835c7f..3785c97 100644
--- a/api/12.xml
+++ b/api/12.xml
@@ -73375,8 +73375,6 @@
 </parameter>
 <parameter name="event" type="android.drm.DrmEvent">
 </parameter>
-<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
-</parameter>
 </method>
 </interface>
 <interface name="DrmManagerClient.OnInfoListener"
diff --git a/api/current.xml b/api/current.xml
index 1b3c731..874c74a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -72665,6 +72665,22 @@
 <parameter name="message" type="java.lang.String">
 </parameter>
 </constructor>
+<constructor name="DrmErrorEvent"
+ type="android.drm.DrmErrorEvent"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="uniqueId" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="message" type="java.lang.String">
+</parameter>
+<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
+</parameter>
+</constructor>
 <field name="TYPE_ACQUIRE_DRM_INFO_FAILED"
  type="int"
  transient="false"
@@ -72775,7 +72791,36 @@
 </parameter>
 <parameter name="message" type="java.lang.String">
 </parameter>
+<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
+</parameter>
 </constructor>
+<constructor name="DrmEvent"
+ type="android.drm.DrmEvent"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="uniqueId" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="message" type="java.lang.String">
+</parameter>
+</constructor>
+<method name="getAttribute"
+ return="java.lang.Object"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="key" type="java.lang.String">
+</parameter>
+</method>
 <method name="getMessage"
  return="java.lang.String"
  abstract="false"
@@ -72809,6 +72854,17 @@
  visibility="public"
 >
 </method>
+<field name="DRM_INFO_OBJECT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;drm_info_object&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="DRM_INFO_STATUS_OBJECT"
  type="java.lang.String"
  transient="false"
@@ -72985,6 +73041,22 @@
 <parameter name="message" type="java.lang.String">
 </parameter>
 </constructor>
+<constructor name="DrmInfoEvent"
+ type="android.drm.DrmInfoEvent"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="uniqueId" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="message" type="java.lang.String">
+</parameter>
+<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
+</parameter>
+</constructor>
 <field name="TYPE_ACCOUNT_ALREADY_REGISTERED"
  type="int"
  transient="false"
@@ -73767,8 +73839,6 @@
 </parameter>
 <parameter name="event" type="android.drm.DrmEvent">
 </parameter>
-<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
-</parameter>
 </method>
 </interface>
 <interface name="DrmManagerClient.OnInfoListener"
@@ -143839,6 +143909,17 @@
  visibility="public"
 >
 </field>
+<field name="HONEYCOMB_MR1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <class name="Bundle"
  extends="java.lang.Object"
@@ -153901,6 +153982,17 @@
  visibility="public"
 >
 </method>
+<method name="getTitleRes"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getView"
  return="android.view.View"
  abstract="false"
@@ -154808,6 +154900,10 @@
 </parameter>
 <parameter name="args" type="android.os.Bundle">
 </parameter>
+<parameter name="titleRes" type="int">
+</parameter>
+<parameter name="shortTitleRes" type="int">
+</parameter>
 </method>
 <method name="onGetInitialHeader"
  return="android.preference.PreferenceActivity.Header"
@@ -155013,6 +155109,29 @@
 <parameter name="resultRequestCode" type="int">
 </parameter>
 </method>
+<method name="startWithFragment"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fragmentName" type="java.lang.String">
+</parameter>
+<parameter name="args" type="android.os.Bundle">
+</parameter>
+<parameter name="resultTo" type="android.app.Fragment">
+</parameter>
+<parameter name="resultRequestCode" type="int">
+</parameter>
+<parameter name="titleRes" type="int">
+</parameter>
+<parameter name="shortTitleRes" type="int">
+</parameter>
+</method>
 <method name="switchToHeader"
  return="void"
  abstract="false"
@@ -155074,6 +155193,28 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_SHOW_FRAGMENT_SHORT_TITLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;:android:show_fragment_short_title&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_SHOW_FRAGMENT_TITLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;:android:show_fragment_title&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="HEADER_ID_UNDEFINED"
  type="long"
  transient="false"
@@ -201858,6 +201999,186 @@
 </parameter>
 </method>
 </class>
+<class name="CorrectionSpan"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.text.ParcelableSpan">
+</implements>
+<constructor name="CorrectionSpan"
+ type="android.text.style.CorrectionSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</constructor>
+<constructor name="CorrectionSpan"
+ type="android.text.style.CorrectionSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="locale" type="java.util.Locale">
+</parameter>
+<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</constructor>
+<constructor name="CorrectionSpan"
+ type="android.text.style.CorrectionSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="locale" type="java.util.Locale">
+</parameter>
+<parameter name="suggests" type="java.util.List&lt;java.lang.CharSequence&gt;">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+<parameter name="originalString" type="java.lang.String">
+</parameter>
+</constructor>
+<constructor name="CorrectionSpan"
+ type="android.text.style.CorrectionSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getFlags"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getLocale"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getOriginalString"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSuggests"
+ return="java.util.List&lt;java.lang.CharSequence&gt;"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
+<field name="CREATOR"
+ type="android.os.Parcelable.Creator"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FLAG_DEFAULT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FLAG_VERBATIM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 <class name="DrawableMarginSpan"
  extends="java.lang.Object"
  abstract="false"
@@ -213150,6 +213471,17 @@
  visibility="public"
 >
 </field>
+<field name="KEYCODE_3D_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="206"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="KEYCODE_4"
  type="int"
  transient="false"
@@ -214305,6 +214637,17 @@
  visibility="public"
 >
 </field>
+<field name="KEYCODE_LANGUAGE_SWITCH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="204"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="KEYCODE_LEFT_BRACKET"
  type="int"
  transient="false"
@@ -214327,6 +214670,17 @@
  visibility="public"
 >
 </field>
+<field name="KEYCODE_MANNER_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="205"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="KEYCODE_MEDIA_CLOSE"
  type="int"
  transient="false"
@@ -220788,7 +221142,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="ev" type="android.view.MotionEvent">
+<parameter name="event" type="android.view.MotionEvent">
 </parameter>
 </method>
 <method name="clear"
@@ -236559,6 +236913,27 @@
 <parameter name="newCursorPosition" type="int">
 </parameter>
 </method>
+<method name="setCorrectionSpan"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="token" type="android.os.IBinder">
+</parameter>
+<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
+</parameter>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <method name="setSelection"
  return="boolean"
  abstract="false"
@@ -237829,6 +238204,27 @@
 <parameter name="newCursorPosition" type="int">
 </parameter>
 </method>
+<method name="setCorrectionSpan"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="token" type="android.os.IBinder">
+</parameter>
+<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
+</parameter>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <method name="setSelection"
  return="boolean"
  abstract="true"
@@ -238159,6 +238555,27 @@
 <parameter name="newCursorPosition" type="int">
 </parameter>
 </method>
+<method name="setCorrectionSpan"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="token" type="android.os.IBinder">
+</parameter>
+<parameter name="correctionSpan" type="android.text.style.CorrectionSpan">
+</parameter>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <method name="setSelection"
  return="boolean"
  abstract="false"
@@ -243664,7 +244081,7 @@
  synchronized="false"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -264485,6 +264902,27 @@
 <parameter name="bottom" type="android.graphics.drawable.Drawable">
 </parameter>
 </method>
+<method name="setCorrectionSpan"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="token" type="android.os.IBinder">
+</parameter>
+<parameter name="span" type="android.text.style.CorrectionSpan">
+</parameter>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <method name="setCursorVisible"
  return="void"
  abstract="false"
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 74649a9..c1d0803 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <binder/ProcessState.h>
 
 #include <media/stagefright/foundation/hexdump.h>
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index 9246a00..bb84bd1 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <binder/ProcessState.h>
 
 #include <media/IStreamSource.h>
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index bd83762..3e5b21f 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -45,6 +45,7 @@
 import android.net.IConnectivityManager;
 import android.net.Proxy;
 import android.net.ProxyProperties;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Debug;
 import android.os.Handler;
@@ -3427,6 +3428,14 @@
         Process.setArgV0(data.processName);
         android.ddm.DdmHandleAppName.setAppName(data.processName);
 
+        // If the app is Honeycomb MR1 or earlier, switch its AsyncTask
+        // implementation to use the pool executor.  Normally, we use the
+        // serialized executor as the default. This has to happen in the
+        // main thread so the main looper is set right.
+        if (data.appInfo.targetSdkVersion <= 12) {
+            AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+        }
+
         /*
          * Before spawning a new process, reset the time zone to be the system time zone.
          * This needs to be done because the system time zone could have changed after the
diff --git a/core/java/android/bluetooth/BluetoothDeviceProfileState.java b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
index 9855709..f4693c2 100644
--- a/core/java/android/bluetooth/BluetoothDeviceProfileState.java
+++ b/core/java/android/bluetooth/BluetoothDeviceProfileState.java
@@ -679,7 +679,6 @@
         @Override
         protected boolean processMessage(Message message) {
             log("IncomingA2dp State->Processing Message: " + message.what);
-            Message deferMsg = new Message();
             switch(message.what) {
                 case CONNECT_HFP_OUTGOING:
                     deferMessage(message);
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 97f0e1b..ed2b205 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -410,8 +410,9 @@
 
     /**
      * Starts capturing and drawing preview frames to the screen.
-     * Preview will not actually start until a surface is supplied with
-     * {@link #setPreviewDisplay(SurfaceHolder)}.
+     * Preview will not actually start until a surface is supplied
+     * with {@link #setPreviewDisplay(SurfaceHolder)} or
+     * {@link #setPreviewTexture(SurfaceTexture)}.
      *
      * <p>If {@link #setPreviewCallback(Camera.PreviewCallback)},
      * {@link #setOneShotPreviewCallback(Camera.PreviewCallback)}, or
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index 1803604..64bba54 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -153,7 +153,6 @@
     private static final int MAXIMUM_POOL_SIZE = 128;
     private static final int KEEP_ALIVE = 1;
 
-
     private static final ThreadFactory sThreadFactory = new ThreadFactory() {
         private final AtomicInteger mCount = new AtomicInteger(1);
 
@@ -183,6 +182,7 @@
 
     private static final InternalHandler sHandler = new InternalHandler();
 
+    private static volatile Executor sDefaultExecutor = SERIAL_EXECUTOR;
     private final WorkerRunnable<Params, Result> mWorker;
     private final FutureTask<Result> mFuture;
 
@@ -240,6 +240,11 @@
         sHandler.getLooper();
     }
 
+    /** @hide */
+    public static void setDefaultExecutor(Executor exec) {
+        sDefaultExecutor = exec;
+    }
+
     /**
      * Creates a new asynchronous task. This constructor must be invoked on the UI thread.
      */
@@ -496,7 +501,7 @@
      *         {@link AsyncTask.Status#RUNNING} or {@link AsyncTask.Status#FINISHED}.
      */
     public final AsyncTask<Params, Progress, Result> execute(Params... params) {
-        return executeOnExecutor(THREAD_POOL_EXECUTOR, params);
+        return executeOnExecutor(sDefaultExecutor, params);
     }
 
     /**
@@ -559,7 +564,7 @@
      * a simple Runnable object.
      */
     public static void execute(Runnable runnable) {
-        THREAD_POOL_EXECUTOR.execute(runnable);
+        sDefaultExecutor.execute(runnable);
     }
 
     /**
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 8d2607a..3bb0821 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -202,12 +202,12 @@
         public static final int GINGERBREAD = 9;
         
         /**
-         * Almost newest version of Android, version 2.3.3.
+         * February 2011: Android 2.3.3.
          */
         public static final int GINGERBREAD_MR1 = 10;
 
         /**
-         * Newest version of Android, version 3.0.
+         * February 2011: Android 3.0.
          *
          * <p>Applications targeting this or a later release will get these
          * new changes in behavior:</p>
@@ -225,6 +225,11 @@
          * </ul>
          */
         public static final int HONEYCOMB = 11;
+        
+        /**
+         * Newest version of Android, version 3.1.
+         */
+        public static final int HONEYCOMB_MR1 = 12;
     }
     
     /** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index efb8415..57fdb0c 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -97,7 +97,8 @@
  *     </tbody>
  * </table>
  * 
- * 
+ * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK}
+ * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
  */
 public class PowerManager
 {
@@ -188,8 +189,11 @@
     
     /**
      * Class lets you say that you need to have the device on.
-     *
-     * <p>Call release when you are done and don't need the lock anymore.
+     * <p>
+     * Call release when you are done and don't need the lock anymore.
+     * <p>
+     * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK}
+     * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
      */
     public class WakeLock
     {
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 7d37e5b..5e1be21 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -89,6 +89,7 @@
 
     private int mOrder = DEFAULT_ORDER;
     private CharSequence mTitle;
+    private int mTitleRes;
     private CharSequence mSummary;
     /**
      * mIconResId is overridden by mIcon, if mIcon is specified.
@@ -214,6 +215,7 @@
                     break;
                     
                 case com.android.internal.R.styleable.Preference_title:
+                    mTitleRes = a.getResourceId(attr, 0);
                     mTitle = a.getString(attr);
                     break;
                     
@@ -582,6 +584,7 @@
      */
     public void setTitle(CharSequence title) {
         if (title == null && mTitle != null || title != null && !title.equals(mTitle)) {
+            mTitleRes = 0;
             mTitle = title;
             notifyChanged();
         }
@@ -595,9 +598,21 @@
      */
     public void setTitle(int titleResId) {
         setTitle(mContext.getString(titleResId));
+        mTitleRes = titleResId;
     }
     
     /**
+     * Returns the title resource ID of this Preference.  If the title did
+     * not come from a resource, 0 is returned.
+     *
+     * @return The title resource.
+     * @see #setTitle(int)
+     */
+    public int getTitleRes() {
+        return mTitleRes;
+    }
+
+    /**
      * Returns the title of this Preference.
      * 
      * @return The title.
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index db50bfc..15d5898 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -132,13 +132,28 @@
 
     /**
      * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
-     * this extra can also be specify to supply a Bundle of arguments to pass
+     * this extra can also be specified to supply a Bundle of arguments to pass
      * to that fragment when it is instantiated during the initial creation
      * of PreferenceActivity.
      */
     public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args";
 
     /**
+     * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
+     * this extra can also be specify to supply the title to be shown for
+     * that fragment.
+     */
+    public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title";
+
+    /**
+     * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
+     * this extra can also be specify to supply the short title to be shown for
+     * that fragment.
+     */
+    public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE
+            = ":android:show_fragment_short_title";
+
+    /**
      * When starting this activity, the invoking Intent can contain this extra
      * boolean that the header list should not be displayed.  This is most often
      * used in conjunction with {@link #EXTRA_SHOW_FRAGMENT} to launch
@@ -488,7 +503,12 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        setContentView(com.android.internal.R.layout.preference_list_content);
+        if (getResources().getConfiguration().isLayoutSizeAtLeast(
+                Configuration.SCREENLAYOUT_SIZE_LARGE)) {
+            setContentView(com.android.internal.R.layout.preference_list_content_large);
+        } else {
+            setContentView(com.android.internal.R.layout.preference_list_content);
+        }
 
         mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer);
         mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame);
@@ -496,6 +516,8 @@
         mSinglePane = hidingHeaders || !onIsMultiPane();
         String initialFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
         Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
+        int initialTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE, 0);
+        int initialShortTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, 0);
 
         if (savedInstanceState != null) {
             // We are restarting from a previous saved state; used that to
@@ -516,6 +538,12 @@
                 // new fragment mode, but don't need to compute and show
                 // the headers.
                 switchToHeader(initialFragment, initialArguments);
+                if (initialTitle != 0) {
+                    CharSequence initialTitleStr = getText(initialTitle);
+                    CharSequence initialShortTitleStr = initialShortTitle != 0
+                            ? getText(initialShortTitle) : null;
+                    showBreadCrumbs(initialTitleStr, initialShortTitleStr);
+                }
 
             } else {
                 // We need to try to build the headers.
@@ -557,7 +585,12 @@
         } else {
             // If there are no headers, we are in the old "just show a screen
             // of preferences" mode.
-            setContentView(com.android.internal.R.layout.preference_list_content_single);
+            if (getResources().getConfiguration().isLayoutSizeAtLeast(
+                    Configuration.SCREENLAYOUT_SIZE_LARGE)) {
+                setContentView(com.android.internal.R.layout.preference_list_content_single_large);
+            } else {
+                setContentView(com.android.internal.R.layout.preference_list_content_single);
+            }
             mListFooter = (FrameLayout) findViewById(com.android.internal.R.id.list_footer);
             mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs);
             mPreferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE);
@@ -942,7 +975,8 @@
 
     /**
      * Called when the user selects an item in the header list.  The default
-     * implementation will call either {@link #startWithFragment(String, Bundle, Fragment, int)}
+     * implementation will call either
+     * {@link #startWithFragment(String, Bundle, Fragment, int, int, int)}
      * or {@link #switchToHeader(Header)} as appropriate.
      *
      * @param header The header that was selected.
@@ -951,7 +985,14 @@
     public void onHeaderClick(Header header, int position) {
         if (header.fragment != null) {
             if (mSinglePane) {
-                startWithFragment(header.fragment, header.fragmentArguments, null, 0);
+                int titleRes = header.breadCrumbTitleRes;
+                int shortTitleRes = header.breadCrumbShortTitleRes;
+                if (titleRes == 0) {
+                    titleRes = header.titleRes;
+                    shortTitleRes = 0;
+                }
+                startWithFragment(header.fragment, header.fragmentArguments, null, 0,
+                        titleRes, shortTitleRes);
             } else {
                 switchToHeader(header);
             }
@@ -961,7 +1002,7 @@
     }
 
     /**
-     * Called by {@link #startWithFragment(String, Bundle, Fragment, int)} when
+     * Called by {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} when
      * in single-pane mode, to build an Intent to launch a new activity showing
      * the selected fragment.  The default implementation constructs an Intent
      * that re-launches the current activity with the appropriate arguments to
@@ -969,19 +1010,33 @@
      * 
      * @param fragmentName The name of the fragment to display.
      * @param args Optional arguments to supply to the fragment.
+     * @param titleRes Optional resource ID of title to show for this item.
+     * @param titleRes Optional resource ID of short title to show for this item.
      * @return Returns an Intent that can be launched to display the given
      * fragment.
      */
-    public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args) {
+    public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args,
+            int titleRes, int shortTitleRes) {
         Intent intent = new Intent(Intent.ACTION_MAIN);
         intent.setClass(this, getClass());
         intent.putExtra(EXTRA_SHOW_FRAGMENT, fragmentName);
         intent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
+        intent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE, titleRes);
+        intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, shortTitleRes);
         intent.putExtra(EXTRA_NO_HEADERS, true);
         return intent;
     }
     
     /**
+     * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)}
+     * but uses a 0 titleRes.
+     */
+    public void startWithFragment(String fragmentName, Bundle args,
+            Fragment resultTo, int resultRequestCode) {
+        startWithFragment(fragmentName, args, resultTo, resultRequestCode, 0, 0);
+    }
+
+    /**
      * Start a new instance of this activity, showing only the given
      * preference fragment.  When launched in this mode, the header list
      * will be hidden and the given preference fragment will be instantiated
@@ -993,10 +1048,14 @@
      * the activity launch.
      * @param resultRequestCode If resultTo is non-null, this is the request
      * code in which to report the result.
+     * @param titleRes Resource ID of string to display for the title of
+     * this set of preferences.
+     * @param titleRes Resource ID of string to display for the short title of
+     * this set of preferences.
      */
     public void startWithFragment(String fragmentName, Bundle args,
-            Fragment resultTo, int resultRequestCode) {
-        Intent intent = onBuildStartFragmentIntent(fragmentName, args);
+            Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) {
+        Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes);
         if (resultTo == null) {
             startActivity(intent);
         } else {
@@ -1013,16 +1072,16 @@
         if (mFragmentBreadCrumbs == null) {
             View crumbs = findViewById(android.R.id.title);
             // For screens with a different kind of title, don't create breadcrumbs.
-            if (!(crumbs instanceof FragmentBreadCrumbs)) return;
-            mFragmentBreadCrumbs = (FragmentBreadCrumbs) findViewById(android.R.id.title);
+            try {
+                mFragmentBreadCrumbs = (FragmentBreadCrumbs)crumbs;
+            } catch (ClassCastException e) {
+                return;
+            }
             if (mFragmentBreadCrumbs == null) {
-                mFragmentBreadCrumbs = new FragmentBreadCrumbs(this);
-                ActionBar actionBar = getActionBar();
-                if (actionBar != null) {
-                    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
-                            ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
-                    actionBar.setCustomView(mFragmentBreadCrumbs);
+                if (title != null) {
+                    setTitle(title);
                 }
+                return;
             }
             mFragmentBreadCrumbs.setMaxVisible(2);
             mFragmentBreadCrumbs.setActivity(this);
@@ -1190,7 +1249,7 @@
     public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes,
             CharSequence titleText, Fragment resultTo, int resultRequestCode) {
         if (mSinglePane) {
-            startWithFragment(fragmentClass, args, resultTo, resultRequestCode);
+            startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0);
         } else {
             Fragment f = Fragment.instantiate(this, fragmentClass, args);
             if (resultTo != null) {
@@ -1236,7 +1295,8 @@
     
     @Override
     public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
-        startPreferencePanel(pref.getFragment(), pref.getExtras(), 0, pref.getTitle(), null, 0);
+        startPreferencePanel(pref.getFragment(), pref.getExtras(), pref.getTitleRes(),
+                pref.getTitle(), null, 0);
         return true;
     }
 
diff --git a/core/java/android/preference/PreferenceFragment.java b/core/java/android/preference/PreferenceFragment.java
index 4e22ba0..7511e14 100644
--- a/core/java/android/preference/PreferenceFragment.java
+++ b/core/java/android/preference/PreferenceFragment.java
@@ -20,6 +20,7 @@
 import android.app.Fragment;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.content.res.Configuration;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -151,8 +152,14 @@
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
-        return inflater.inflate(com.android.internal.R.layout.preference_list_fragment,
-                container, false);
+        if (getResources().getConfiguration().isLayoutSizeAtLeast(
+                Configuration.SCREENLAYOUT_SIZE_LARGE)) {
+            return inflater.inflate(com.android.internal.R.layout.preference_list_fragment_large,
+                    container, false);
+        } else {
+            return inflater.inflate(com.android.internal.R.layout.preference_list_fragment,
+                    container, false);
+        }
     }
 
     @Override
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index b59421e..bb8d874 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -166,7 +166,6 @@
      * If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri
      * value of EXTRA_OUTPUT.
      * @see #EXTRA_OUTPUT
-     * @see #EXTRA_VIDEO_QUALITY
      */
     public final static String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE";
 
@@ -181,6 +180,9 @@
      * written to the standard location for videos, and the Uri of that location will be
      * returned in the data field of the Uri.
      * @see #EXTRA_OUTPUT
+     * @see #EXTRA_VIDEO_QUALITY
+     * @see #EXTRA_SIZE_LIMIT
+     * @see #EXTRA_DURATION_LIMIT
      */
     public final static String ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE";
 
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index d2d2557..6ff9f0e 100644
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -90,12 +90,18 @@
         public static final String PERSON_ID = "person";
 
         /**
-         * The date the message was sent
+         * The date the message was received
          * <P>Type: INTEGER (long)</P>
          */
         public static final String DATE = "date";
 
         /**
+         * The date the message was sent
+         * <P>Type: INTEGER (long)</P>
+         */
+        public static final String DATE_SENT = "date_sent";
+
+        /**
          * Has the message been read
          * <P>Type: INTEGER (boolean)</P>
          */
@@ -650,12 +656,18 @@
         public static final int MESSAGE_BOX_OUTBOX = 4;
 
         /**
-         * The date the message was sent.
+         * The date the message was received.
          * <P>Type: INTEGER (long)</P>
          */
         public static final String DATE = "date";
 
         /**
+         * The date the message was sent.
+         * <P>Type: INTEGER (long)</P>
+         */
+        public static final String DATE_SENT = "date_sent";
+
+        /**
          * The box which the message belong to, for example, MESSAGE_BOX_INBOX.
          * <P>Type: INTEGER</P>
          */
diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java
index 75a5ed5..32b2d8f 100644
--- a/core/java/android/speech/RecognitionService.java
+++ b/core/java/android/speech/RecognitionService.java
@@ -68,6 +68,8 @@
 
     private static final int MSG_CANCEL = 3;
 
+    private static final int MSG_RESET = 4;
+
     private final Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -81,6 +83,10 @@
                     break;
                 case MSG_CANCEL:
                     dispatchCancel((IRecognitionListener) msg.obj);
+                    break;
+                case MSG_RESET:
+                    dispatchClearCallback();
+                    break;
             }
         }
     };
@@ -128,6 +134,10 @@
         }
     }
 
+    private void dispatchClearCallback() {
+        mCurrentCallback = null;
+    }
+
     private class StartListeningArgs {
         public final Intent mIntent;
 
@@ -241,7 +251,7 @@
          * @param error code is defined in {@link SpeechRecognizer}
          */
         public void error(int error) throws RemoteException {
-            mCurrentCallback = null;
+            Message.obtain(mHandler, MSG_RESET).sendToTarget();
             mListener.onError(error);
         }
 
@@ -278,7 +288,7 @@
          *        {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter
          */
         public void results(Bundle results) throws RemoteException {
-            mCurrentCallback = null;
+            Message.obtain(mHandler, MSG_RESET).sendToTarget();
             mListener.onResults(results);
         }
 
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index 30a1f48..ee6342a 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -565,6 +565,8 @@
     public static final int TEXT_APPEARANCE_SPAN = 17;
     /** @hide */
     public static final int ANNOTATION = 18;
+    /** @hide */
+    public static final int CORRECTION_SPAN = 19;
 
     /**
      * Flatten a CharSequence and whatever styles can be copied across processes
diff --git a/core/java/android/text/style/CorrectionSpan.aidl b/core/java/android/text/style/CorrectionSpan.aidl
new file mode 100644
index 0000000..82e3d04
--- /dev/null
+++ b/core/java/android/text/style/CorrectionSpan.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.text.style;
+
+parcelable CorrectionSpan;
diff --git a/core/java/android/text/style/CorrectionSpan.java b/core/java/android/text/style/CorrectionSpan.java
new file mode 100644
index 0000000..6142e6f
--- /dev/null
+++ b/core/java/android/text/style/CorrectionSpan.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.text.style;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.text.ParcelableSpan;
+import android.text.TextUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+public class CorrectionSpan implements ParcelableSpan {
+
+    /**
+     * Flag for the default value.
+     */
+    public static final int FLAG_DEFAULT = 0x0000;
+    /**
+     * Flag for indicating that the input is verbatim. TextView refers to this flag to determine
+     * how it displays a word with CorrectionSpan.
+     */
+    public static final int FLAG_VERBATIM = 0x0001;
+
+    private static final int SUGGESTS_MAX_SIZE = 5;
+
+    /*
+     * TODO: Needs to check the validity and add a feature that TextView will change
+     * the current IME to the other IME which is specified in CorrectionSpan.
+     * An IME needs to set the span by specifying the target IME and Subtype of CorrectionSpan.
+     * And the current IME might want to specify any IME as the target IME including other IMEs.
+     */
+
+    private final int mFlags;
+    private final List<CharSequence> mSuggests = new ArrayList<CharSequence>();
+    private final String mLocaleString;
+    private final String mOriginalString;
+    /*
+     * TODO: If switching IME is required, needs to add parameters for ids of InputMethodInfo
+     * and InputMethodSubtype.
+     */
+
+    /**
+     * @param context Context for the application
+     * @param suggests Suggests for the string under the span
+     * @param flags Additional flags indicating how this span is handled in TextView
+     */
+    public CorrectionSpan(Context context, List<CharSequence> suggests, int flags) {
+        this(context, null, suggests, flags, null);
+    }
+
+    /**
+     * @param locale Locale of the suggestions
+     * @param suggests Suggests for the string under the span
+     * @param flags Additional flags indicating how this span is handled in TextView
+     */
+    public CorrectionSpan(Locale locale, List<CharSequence> suggests, int flags) {
+        this(null, locale, suggests, flags, null);
+    }
+
+    /**
+     * @param context Context for the application
+     * @param locale locale Locale of the suggestions
+     * @param suggests suggests Suggests for the string under the span
+     * @param flags Additional flags indicating how this span is handled in TextView
+     * @param originalString originalString for suggests
+     */
+    public CorrectionSpan(Context context, Locale locale, List<CharSequence> suggests, int flags,
+            String originalString) {
+        final int N = Math.min(SUGGESTS_MAX_SIZE, suggests.size());
+        for (int i = 0; i < N; ++i) {
+            mSuggests.add(suggests.get(i));
+        }
+        mFlags = flags;
+        if (context != null && locale == null) {
+            mLocaleString = context.getResources().getConfiguration().locale.toString();
+        } else {
+            mLocaleString = locale.toString();
+        }
+        mOriginalString = originalString;
+    }
+
+    public CorrectionSpan(Parcel src) {
+        src.readList(mSuggests, null);
+        mFlags = src.readInt();
+        mLocaleString = src.readString();
+        mOriginalString = src.readString();
+    }
+
+    /**
+     * @return suggestions
+     */
+    public List<CharSequence> getSuggests() {
+        return new ArrayList<CharSequence>(mSuggests);
+    }
+
+    /**
+     * @return locale of suggestions
+     */
+    public String getLocale() {
+        return mLocaleString;
+    }
+
+    /**
+     * @return original string of suggestions
+     */
+    public String getOriginalString() {
+        return mOriginalString;
+    }
+
+    public int getFlags() {
+        return mFlags;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeList(mSuggests);
+        dest.writeInt(mFlags);
+        dest.writeString(mLocaleString);
+        dest.writeString(mOriginalString);
+    }
+
+    @Override
+    public int getSpanTypeId() {
+        return TextUtils.CORRECTION_SPAN;
+    }
+
+    public static final Parcelable.Creator<CorrectionSpan> CREATOR =
+            new Parcelable.Creator<CorrectionSpan>() {
+        @Override
+        public CorrectionSpan createFromParcel(Parcel source) {
+            return new CorrectionSpan(source);
+        }
+
+        @Override
+        public CorrectionSpan[] newArray(int size) {
+            return new CorrectionSpan[size];
+        }
+    };
+}
diff --git a/core/java/android/util/JsonReader.java b/core/java/android/util/JsonReader.java
index 8f44895..563c500 100644
--- a/core/java/android/util/JsonReader.java
+++ b/core/java/android/util/JsonReader.java
@@ -86,7 +86,11 @@
  *
  *   public List<Message> readJsonStream(InputStream in) throws IOException {
  *     JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
- *     return readMessagesArray(reader);
+ *     try {
+ *       return readMessagesArray(reader);
+ *     } finally {
+ *       reader.close();
+ *     }
  *   }
  *
  *   public List<Message> readMessagesArray(JsonReader reader) throws IOException {
diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java
index 834dac3..5540000 100644
--- a/core/java/android/util/LruCache.java
+++ b/core/java/android/util/LruCache.java
@@ -304,7 +304,8 @@
     }
 
     /**
-     * Returns the number of times {@link #get} returned a value.
+     * Returns the number of times {@link #get} returned a value that was
+     * already present in the cache.
      */
     public synchronized final int hitCount() {
         return hitCount;
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 14f2e9d..d841419 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -39,6 +39,12 @@
  * An implementation of Canvas on top of OpenGL ES 2.0.
  */
 class GLES20Canvas extends HardwareCanvas {
+    // Must match modifiers used in the JNI layer
+    private static final int MODIFIER_NONE = 0;
+    private static final int MODIFIER_SHADOW = 1;
+    private static final int MODIFIER_SHADER = 2;
+    private static final int MODIFIER_COLOR_FILTER = 4;
+
     private final boolean mOpaque;
     private int mRenderer;
 
@@ -259,10 +265,10 @@
     
     void drawHardwareLayer(HardwareLayer layer, float x, float y, Paint paint) {
         final GLES20Layer glLayer = (GLES20Layer) layer;
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawLayer(mRenderer, glLayer.getLayer(), x, y, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
     }
 
     private static native void nDrawLayer(int renderer, int layer, float x, float y, int paint);
@@ -455,10 +461,10 @@
     public int saveLayer(float left, float top, float right, float bottom, Paint paint,
             int saveFlags) {
         if (left < right && top < bottom) {
-            boolean hasColorFilter = paint != null && setupColorFilter(paint);
+            int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
             final int nativePaint = paint == null ? 0 : paint.mNativePaint;
             int count = nSaveLayer(mRenderer, left, top, right, bottom, nativePaint, saveFlags);
-            if (hasColorFilter) nResetModifiers(mRenderer);
+            if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
             return count;
         }
         return save(saveFlags);
@@ -527,10 +533,10 @@
     @Override
     public void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter,
             Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawArc(mRenderer, oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle,
                 useCenter, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawArc(int renderer, float left, float top,
@@ -545,11 +551,11 @@
     @Override
     public void drawPatch(Bitmap bitmap, byte[] chunks, RectF dst, Paint paint) {
         // Shaders are ignored when drawing patches
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawPatch(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, chunks,
                 dst.left, dst.top, dst.right, dst.bottom, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
     }
 
     private static native void nDrawPatch(int renderer, int bitmap, byte[] buffer, byte[] chunks,
@@ -558,10 +564,10 @@
     @Override
     public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) {
         // Shaders are ignored when drawing bitmaps
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, left, top, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawBitmap(
@@ -570,11 +576,11 @@
     @Override
     public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
         // Shaders are ignored when drawing bitmaps
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer,
                 matrix.native_instance, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawBitmap(int renderer, int bitmap, byte[] buff,
@@ -583,7 +589,7 @@
     @Override
     public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {
         // Shaders are ignored when drawing bitmaps
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
 
         int left, top, right, bottom;
@@ -600,17 +606,17 @@
 
         nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, left, top, right, bottom,
                 dst.left, dst.top, dst.right, dst.bottom, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     @Override
     public void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) {
         // Shaders are ignored when drawing bitmaps
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, src.left, src.top, src.right,
                 src.bottom, dst.left, dst.top, dst.right, dst.bottom, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
@@ -621,13 +627,13 @@
     public void drawBitmap(int[] colors, int offset, int stride, float x, float y,
             int width, int height, boolean hasAlpha, Paint paint) {
         // Shaders are ignored when drawing bitmaps
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
         final Bitmap.Config config = hasAlpha ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
         final Bitmap b = Bitmap.createBitmap(colors, offset, stride, width, height, config);
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;
         nDrawBitmap(mRenderer, b.mNativeBitmap, b.mBuffer, x, y, nativePaint);
         b.recycle();
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
     }
 
     @Override
@@ -655,11 +661,11 @@
         colors = null;
         colorOffset = 0;
 
-        boolean hasColorFilter = paint != null && setupColorFilter(paint);
+        int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
         final int nativePaint = paint == null ? 0 : paint.mNativePaint;        
         nDrawBitmapMesh(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, meshWidth, meshHeight,
                 verts, vertOffset, colors, colorOffset, nativePaint);
-        if (hasColorFilter) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawBitmapMesh(int renderer, int bitmap, byte[] buffer,
@@ -668,9 +674,9 @@
 
     @Override
     public void drawCircle(float cx, float cy, float radius, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawCircle(mRenderer, cx, cy, radius, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer);        
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);        
     }
 
     private static native void nDrawCircle(int renderer, float cx, float cy,
@@ -702,9 +708,9 @@
         if ((offset | count) < 0 || offset + count > pts.length) {
             throw new IllegalArgumentException("The lines array must contain 4 elements per line.");
         }
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawLines(mRenderer, pts, offset, count, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawLines(int renderer, float[] points,
@@ -717,9 +723,9 @@
 
     @Override
     public void drawOval(RectF oval, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawOval(mRenderer, oval.left, oval.top, oval.right, oval.bottom, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer); 
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers); 
     }
 
     private static native void nDrawOval(int renderer, float left, float top,
@@ -734,7 +740,7 @@
 
     @Override
     public void drawPath(Path path, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         if (path.isSimplePath) {
             if (path.rects != null) {
                 nDrawRects(mRenderer, path.rects.mNativeRegion, paint.mNativePaint);
@@ -742,7 +748,7 @@
         } else {
             nDrawPath(mRenderer, path.mNativePath, paint.mNativePaint);
         }
-        if (hasModifier) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawPath(int renderer, int path, int paint);
@@ -792,9 +798,9 @@
 
     @Override
     public void drawRect(float left, float top, float right, float bottom, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawRect(mRenderer, left, top, right, bottom, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer);
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
     }
 
     private static native void nDrawRect(int renderer, float left, float top,
@@ -817,10 +823,10 @@
 
     @Override
     public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         nDrawRoundRect(mRenderer, rect.left, rect.top, rect.right, rect.bottom,
                 rx, ry, paint.mNativePaint);
-        if (hasModifier) nResetModifiers(mRenderer);        
+        if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);        
     }
 
     private static native void nDrawRoundRect(int renderer, float left, float top,
@@ -832,11 +838,11 @@
             throw new IndexOutOfBoundsException();
         }
 
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             nDrawText(mRenderer, text, index, count, x, y, paint.mBidiFlags, paint.mNativePaint);
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
     
@@ -845,7 +851,7 @@
 
     @Override
     public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             if (text instanceof String || text instanceof SpannedString ||
                     text instanceof SpannableString) {
@@ -862,7 +868,7 @@
                 TemporaryBuffer.recycle(buf);
             }
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
@@ -872,11 +878,11 @@
             throw new IndexOutOfBoundsException();
         }
 
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             nDrawText(mRenderer, text, start, end, x, y, paint.mBidiFlags, paint.mNativePaint);
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
@@ -885,12 +891,12 @@
 
     @Override
     public void drawText(String text, float x, float y, Paint paint) {
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             nDrawText(mRenderer, text, 0, text.length(), x, y, paint.mBidiFlags,
                     paint.mNativePaint);
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
@@ -915,12 +921,12 @@
             throw new IllegalArgumentException("Unknown direction: " + dir);
         }
 
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             nDrawTextRun(mRenderer, text, index, count, contextIndex, contextCount, x, y, dir,
                     paint.mNativePaint);
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
@@ -934,7 +940,7 @@
             throw new IndexOutOfBoundsException();
         }
 
-        boolean hasModifier = setupModifiers(paint);
+        int modifiers = setupModifiers(paint);
         try {
             int flags = dir == 0 ? 0 : 1;
             if (text instanceof String || text instanceof SpannedString ||
@@ -954,7 +960,7 @@
                 TemporaryBuffer.recycle(buf);
             }
         } finally {
-            if (hasModifier) nResetModifiers(mRenderer);
+            if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
         }
     }
 
@@ -968,43 +974,50 @@
         // TODO: Implement
     }
 
-    private boolean setupModifiers(Paint paint) {
-        boolean hasModifier = false;
+    private int setupModifiers(Bitmap b, Paint paint) {
+        if (b.getConfig() == Bitmap.Config.ALPHA_8) {
+            return setupModifiers(paint);
+        }
+        return MODIFIER_NONE;
+    }
+
+    private int setupModifiers(Paint paint) {
+        int modifiers = MODIFIER_NONE;
 
         if (paint.hasShadow) {
             nSetupShadow(mRenderer, paint.shadowRadius, paint.shadowDx, paint.shadowDy,
                     paint.shadowColor);
-            hasModifier = true;
+            modifiers |= MODIFIER_SHADOW;
         }
 
         final Shader shader = paint.getShader();
         if (shader != null) {
             nSetupShader(mRenderer, shader.native_shader);
-            hasModifier = true;
+            modifiers |= MODIFIER_SHADER;
         }
 
         final ColorFilter filter = paint.getColorFilter();
         if (filter != null) {
             nSetupColorFilter(mRenderer, filter.nativeColorFilter);
-            hasModifier = true;
+            modifiers |= MODIFIER_COLOR_FILTER;
         }
 
-        return hasModifier;
+        return modifiers;
     }
 
-    private boolean setupColorFilter(Paint paint) {
+    private int setupColorFilter(Paint paint) {
         final ColorFilter filter = paint.getColorFilter();
         if (filter != null) {
             nSetupColorFilter(mRenderer, filter.nativeColorFilter);
-            return true;
+            return MODIFIER_COLOR_FILTER;
         }
-        return false;        
+        return MODIFIER_NONE;        
     }
-    
+
     private static native void nSetupShader(int renderer, int shader);
     private static native void nSetupColorFilter(int renderer, int colorFilter);
     private static native void nSetupShadow(int renderer, float radius,
             float dx, float dy, int color);
 
-    private static native void nResetModifiers(int renderer);
+    private static native void nResetModifiers(int renderer, int modifiers);
 }
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 81d5a6e..8070c6a 100755
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -566,6 +566,19 @@
     public static final int KEYCODE_BUTTON_15       = 202;
     /** Key code constant: Generic Game Pad Button #16.*/
     public static final int KEYCODE_BUTTON_16       = 203;
+    /** Key code constant: Language Switch key.
+     * Toggles the current input language such as switching between English and Japanese on
+     * a QWERTY keyboard.  On some devices, the same function may be performed by
+     * pressing Shift+Spacebar. */
+    public static final int KEYCODE_LANGUAGE_SWITCH = 204;
+    /** Key code constant: Manner Mode key.
+     * Toggles silent or vibrate mode on and off to make the device behave more politely
+     * in certain settings such as on a crowded train.  On some devices, the key may only
+     * operate when long-pressed. */
+    public static final int KEYCODE_MANNER_MODE     = 205;
+    /** Key code constant: 3D Mode key.
+     * Toggles the display between 2D and 3D mode. */
+    public static final int KEYCODE_3D_MODE         = 206;
 
     private static final int LAST_KEYCODE           = KEYCODE_BUTTON_16;
 
@@ -791,6 +804,9 @@
         names.append(KEYCODE_BUTTON_14, "KEYCODE_BUTTON_14");
         names.append(KEYCODE_BUTTON_15, "KEYCODE_BUTTON_15");
         names.append(KEYCODE_BUTTON_16, "KEYCODE_BUTTON_16");
+        names.append(KEYCODE_LANGUAGE_SWITCH, "KEYCODE_LANGUAGE_SWITCH");
+        names.append(KEYCODE_MANNER_MODE, "KEYCODE_MANNER_MODE");
+        names.append(KEYCODE_3D_MODE, "KEYCODE_3D_MODE");
     };
 
     // Symbolic names of all metakeys in bit order from least significant to most significant.
diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java
index 5521e92..d638e70 100644
--- a/core/java/android/view/ScaleGestureDetector.java
+++ b/core/java/android/view/ScaleGestureDetector.java
@@ -156,6 +156,7 @@
     private float mRightSlopEdge;
     private float mBottomSlopEdge;
     private boolean mSloppyGesture;
+    private boolean mInvalidGesture;
 
     // Pointer IDs currently responsible for the two fingers controlling the gesture
     private int mActiveId0;
@@ -177,6 +178,8 @@
             reset(); // Start fresh
         }
 
+        if (mInvalidGesture) return false;
+
         if (!mGestureInProgress) {
             switch (action) {
             case MotionEvent.ACTION_DOWN: {
@@ -518,6 +521,15 @@
         final int currIndex0 = curr.findPointerIndex(mActiveId0);
         final int currIndex1 = curr.findPointerIndex(mActiveId1);
 
+        if (prevIndex0 < 0 || prevIndex1 < 0 || currIndex0 < 0 || currIndex1 < 0) {
+            mInvalidGesture = true;
+            Log.e(TAG, "Invalid MotionEvent stream detected.", new Throwable());
+            if (mGestureInProgress) {
+                mListener.onScaleEnd(this);
+            }
+            return;
+        }
+
         final float px0 = prev.getX(prevIndex0);
         final float py0 = prev.getY(prevIndex0);
         final float px1 = prev.getX(prevIndex1);
@@ -556,6 +568,7 @@
         mGestureInProgress = false;
         mActiveId0 = -1;
         mActiveId1 = -1;
+        mInvalidGesture = false;
     }
 
     /**
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 5a96efd..c729ccd 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5241,6 +5241,10 @@
         final int viewFlags = mViewFlags;
 
         if ((viewFlags & ENABLED_MASK) == DISABLED) {
+            if (event.getAction() == MotionEvent.ACTION_UP && (mPrivateFlags & PRESSED) != 0) {
+                mPrivateFlags &= ~PRESSED;
+                refreshDrawableState();
+            }
             // A disabled view that is clickable still consumes the touch
             // events, it just doesn't respond to them.
             return (((viewFlags & CLICKABLE) == CLICKABLE ||
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index fc61700..9af19b8 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -159,7 +159,12 @@
      *
      * @see #getBeforeText()
      * @see #getText()
+     * </br>
+     * Note: This constant is no longer needed since there
+     *       is no limit on the length of text that is contained
+     *       in an accessibility event anymore.
      */
+    @Deprecated
     public static final int MAX_TEXT_LENGTH = 500;
 
     /**
diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java
index e644045..b95e7c9 100644
--- a/core/java/android/view/inputmethod/BaseInputConnection.java
+++ b/core/java/android/view/inputmethod/BaseInputConnection.java
@@ -20,6 +20,7 @@
 import android.content.res.TypedArray;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.SystemClock;
 import android.text.Editable;
 import android.text.NoCopySpan;
@@ -29,6 +30,7 @@
 import android.text.Spanned;
 import android.text.TextUtils;
 import android.text.method.MetaKeyKeyListener;
+import android.text.style.CorrectionSpan;
 import android.util.Log;
 import android.util.LogPrinter;
 import android.view.KeyCharacterMap;
@@ -190,6 +192,15 @@
     }
 
     /**
+     * Default implementation does nothing and returns false.
+     */
+    @Override
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags) {
+        return false;
+    }
+
+    /**
      * The default implementation performs the deletion around the current
      * selection position of the editable text.
      */
diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java
index ea9e402..a8a5346 100644
--- a/core/java/android/view/inputmethod/InputConnection.java
+++ b/core/java/android/view/inputmethod/InputConnection.java
@@ -17,6 +17,8 @@
 package android.view.inputmethod;
 
 import android.os.Bundle;
+import android.os.IBinder;
+import android.text.style.CorrectionSpan;
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 
@@ -353,4 +355,10 @@
      * valid.
      */
     public boolean performPrivateCommand(String action, Bundle data);
+
+    /**
+     * Add a correction span.
+     */
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags);
 }
diff --git a/core/java/android/view/inputmethod/InputConnectionWrapper.java b/core/java/android/view/inputmethod/InputConnectionWrapper.java
index 4d9d51e..fee88d9 100644
--- a/core/java/android/view/inputmethod/InputConnectionWrapper.java
+++ b/core/java/android/view/inputmethod/InputConnectionWrapper.java
@@ -17,6 +17,8 @@
 package android.view.inputmethod;
 
 import android.os.Bundle;
+import android.os.IBinder;
+import android.text.style.CorrectionSpan;
 import android.view.KeyEvent;
 
 /**
@@ -126,4 +128,9 @@
     public boolean performPrivateCommand(String action, Bundle data) {
         return mTarget.performPrivateCommand(action, data);
     }
+
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags) {
+        return mTarget.setCorrectionSpan(token, correctionSpan, start, end, flags);
+    }
 }
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
new file mode 100644
index 0000000..6be988e
--- /dev/null
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -0,0 +1,320 @@
+
+package android.webkit;
+
+import android.content.Context;
+import android.media.MediaPlayer;
+import android.media.Metadata;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.HTML5VideoView;
+import android.webkit.HTML5VideoViewProxy;
+import android.widget.FrameLayout;
+import android.widget.MediaController;
+import android.widget.MediaController.MediaPlayerControl;
+
+
+/**
+ * @hide This is only used by the browser
+ */
+public class HTML5VideoFullScreen extends HTML5VideoView
+    implements MediaPlayerControl, MediaPlayer.OnPreparedListener,
+    View.OnTouchListener {
+
+    // Add this sub-class to handle the resizing when rotating screen.
+    private class VideoSurfaceView extends SurfaceView {
+
+        public VideoSurfaceView(Context context) {
+            super(context);
+        }
+
+        @Override
+        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+            int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
+            int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
+            if (mVideoWidth > 0 && mVideoHeight > 0) {
+                if ( mVideoWidth * height  > width * mVideoHeight ) {
+                    height = width * mVideoHeight / mVideoWidth;
+                } else if ( mVideoWidth * height  < width * mVideoHeight ) {
+                    width = height * mVideoWidth / mVideoHeight;
+                }
+            }
+            setMeasuredDimension(width, height);
+        }
+    }
+
+    // This view will contain the video.
+    private VideoSurfaceView mVideoSurfaceView;
+
+    // We need the full screen state to decide which surface to render to and
+    // when to create the MediaPlayer accordingly.
+    static final int FULLSCREEN_OFF               = 0;
+    static final int FULLSCREEN_SURFACECREATING   = 1;
+    static final int FULLSCREEN_SURFACECREATED    = 2;
+
+    private int mFullScreenMode;
+    // The Media Controller only used for full screen mode
+    private MediaController mMediaController;
+
+    // SurfaceHolder for full screen
+    private SurfaceHolder mSurfaceHolder = null;
+
+    // Data only for MediaController
+    private boolean mCanSeekBack;
+    private boolean mCanSeekForward;
+    private boolean mCanPause;
+    private int mCurrentBufferPercentage;
+
+    // The progress view.
+    private static View mProgressView;
+    // The container for the progress view and video view
+    private static FrameLayout mLayout;
+
+    // The video size will be ready when prepared. Used to make sure the aspect
+    // ratio is correct.
+    private int mVideoWidth;
+    private int mVideoHeight;
+
+    SurfaceHolder.Callback mSHCallback = new SurfaceHolder.Callback()
+    {
+        public void surfaceChanged(SurfaceHolder holder, int format,
+                                    int w, int h)
+        {
+            if (mPlayer != null && mMediaController != null
+                    && mCurrentState == STATE_PREPARED) {
+                if (mMediaController.isShowing()) {
+                    // ensure the controller will get repositioned later
+                    mMediaController.hide();
+                }
+                mMediaController.show();
+            }
+        }
+
+        public void surfaceCreated(SurfaceHolder holder)
+        {
+            mSurfaceHolder = holder;
+            mFullScreenMode = FULLSCREEN_SURFACECREATED;
+
+            prepareForFullScreen();
+        }
+
+        public void surfaceDestroyed(SurfaceHolder holder)
+        {
+            // after we return from this we can't use the surface any more
+            mSurfaceHolder = null;
+            // The current Video View will be destroy when we play a new video.
+        }
+    };
+
+    private SurfaceView getSurfaceView() {
+        return mVideoSurfaceView;
+    }
+
+    HTML5VideoFullScreen(Context context, int videoLayerId, int position,
+            boolean autoStart) {
+        mVideoSurfaceView = new VideoSurfaceView(context);
+        mFullScreenMode = FULLSCREEN_OFF;
+        mVideoWidth = 0;
+        mVideoHeight = 0;
+        init(videoLayerId, position, autoStart);
+    }
+
+    private void setMediaController(MediaController m) {
+        mMediaController  = m;
+        attachMediaController();
+    }
+
+    private void attachMediaController() {
+        if (mPlayer != null && mMediaController != null) {
+            mMediaController.setMediaPlayer(this);
+            mMediaController.setAnchorView(mVideoSurfaceView);
+            //Will be enabled when prepared
+            mMediaController.setEnabled(false);
+        }
+    }
+
+    @Override
+    public void decideDisplayMode() {
+        mPlayer.setDisplay(mSurfaceHolder);
+    }
+
+    private void prepareForFullScreen() {
+        // So in full screen, we reset the MediaPlayer
+        mPlayer.reset();
+        setMediaController(new MediaController(mProxy.getContext()));
+
+        prepareDataAndDisplayMode(mProxy);
+    }
+
+
+    private void toggleMediaControlsVisiblity() {
+        if (mMediaController.isShowing()) {
+            mMediaController.hide();
+        } else {
+            mMediaController.show();
+        }
+    }
+
+    @Override
+    public void onPrepared(MediaPlayer mp) {
+        super.onPrepared(mp);
+
+        mVideoSurfaceView.setOnTouchListener(this);
+        // Get the capabilities of the player for this stream
+        Metadata data = mp.getMetadata(MediaPlayer.METADATA_ALL,
+                MediaPlayer.BYPASS_METADATA_FILTER);
+        if (data != null) {
+            mCanPause = !data.has(Metadata.PAUSE_AVAILABLE)
+                    || data.getBoolean(Metadata.PAUSE_AVAILABLE);
+            mCanSeekBack = !data.has(Metadata.SEEK_BACKWARD_AVAILABLE)
+                    || data.getBoolean(Metadata.SEEK_BACKWARD_AVAILABLE);
+            mCanSeekForward = !data.has(Metadata.SEEK_FORWARD_AVAILABLE)
+                    || data.getBoolean(Metadata.SEEK_FORWARD_AVAILABLE);
+        } else {
+            mCanPause = mCanSeekBack = mCanSeekForward = true;
+        }
+
+        // mMediaController status depends on the Metadata result, so put it
+        // after reading the MetaData
+        if (mMediaController != null) {
+            mMediaController.setEnabled(true);
+            // If paused , should show the controller for ever!
+            if (getAutostart())
+                mMediaController.show();
+            else
+                mMediaController.show(0);
+        }
+
+        if (mProgressView != null) {
+            mProgressView.setVisibility(View.GONE);
+            mLayout.removeView(mProgressView);
+            mProgressView = null;
+        }
+
+        mVideoWidth = mp.getVideoWidth();
+        mVideoHeight = mp.getVideoHeight();
+        // This will trigger the onMeasure to get the display size right.
+        mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
+    }
+
+
+    private final WebChromeClient.CustomViewCallback mCallback =
+        new WebChromeClient.CustomViewCallback() {
+            public void onCustomViewHidden() {
+                // It listens to SurfaceHolder.Callback.SurfaceDestroyed event
+                // which happens when the video view is detached from its parent
+                // view. This happens in the WebChromeClient before this method
+                // is invoked.
+                mTimer.cancel();
+                mTimer = null;
+
+                pauseAndDispatch(mProxy);
+
+                mLayout.removeView(getSurfaceView());
+
+                if (mProgressView != null) {
+                    mLayout.removeView(mProgressView);
+                    mProgressView = null;
+                }
+                mLayout = null;
+                // Re enable plugin views.
+                mProxy.getWebView().getViewManager().showAll();
+
+                mProxy = null;
+            }
+        };
+
+    @Override
+    public void enterFullScreenVideoState(int layerId,
+            HTML5VideoViewProxy proxy, WebView webView) {
+        mFullScreenMode = FULLSCREEN_SURFACECREATING;
+        mCurrentBufferPercentage = 0;
+        mPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
+        mProxy = proxy;
+
+        mVideoSurfaceView.getHolder().addCallback(mSHCallback);
+        mVideoSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+        mVideoSurfaceView.setFocusable(true);
+        mVideoSurfaceView.setFocusableInTouchMode(true);
+        mVideoSurfaceView.requestFocus();
+
+        // Create a FrameLayout that will contain the VideoView and the
+        // progress view (if any).
+        mLayout = new FrameLayout(mProxy.getContext());
+        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
+                            ViewGroup.LayoutParams.WRAP_CONTENT,
+                            ViewGroup.LayoutParams.WRAP_CONTENT,
+                            Gravity.CENTER);
+
+        mLayout.addView(getSurfaceView(), layoutParams);
+
+        mLayout.setVisibility(View.VISIBLE);
+
+        WebChromeClient client = webView.getWebChromeClient();
+        client.onShowCustomView(mLayout, mCallback);
+        // Plugins like Flash will draw over the video so hide
+        // them while we're playing.
+        mProxy.getWebView().getViewManager().hideAll();
+
+        mProgressView = client.getVideoLoadingProgressView();
+        if (mProgressView != null) {
+            mLayout.addView(mProgressView, layoutParams);
+            mProgressView.setVisibility(View.VISIBLE);
+        }
+
+    }
+
+    /**
+     * @return true when we are in full screen mode, even the surface not fully
+     * created.
+     */
+    public boolean isFullScreenMode() {
+        return true;
+    }
+
+    // MediaController FUNCTIONS:
+    @Override
+    public boolean canPause() {
+        return mCanPause;
+    }
+
+    @Override
+    public boolean canSeekBackward() {
+        return mCanSeekBack;
+    }
+
+    @Override
+    public boolean canSeekForward() {
+        return mCanSeekForward;
+    }
+
+    @Override
+    public int getBufferPercentage() {
+        if (mPlayer != null) {
+            return mCurrentBufferPercentage;
+        }
+    return 0;
+    }
+
+    // Other listeners functions:
+    private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener =
+        new MediaPlayer.OnBufferingUpdateListener() {
+        public void onBufferingUpdate(MediaPlayer mp, int percent) {
+            mCurrentBufferPercentage = percent;
+        }
+    };
+
+    @Override
+    public boolean onTouch(View v, MotionEvent event) {
+        if (mFullScreenMode >= FULLSCREEN_SURFACECREATED
+                && mMediaController != null) {
+            toggleMediaControlsVisiblity();
+        }
+        return false;
+    }
+
+}
diff --git a/core/java/android/webkit/HTML5VideoInline.java b/core/java/android/webkit/HTML5VideoInline.java
new file mode 100644
index 0000000..f1d9189
--- /dev/null
+++ b/core/java/android/webkit/HTML5VideoInline.java
@@ -0,0 +1,99 @@
+
+package android.webkit;
+
+import android.graphics.SurfaceTexture;
+import android.media.MediaPlayer;
+import android.webkit.HTML5VideoView;
+import android.webkit.HTML5VideoViewProxy;
+import android.opengl.GLES20;
+
+/**
+ * @hide This is only used by the browser
+ */
+public class HTML5VideoInline extends HTML5VideoView{
+
+    // Due to the fact that SurfaceTexture consume a lot of memory, we make it
+    // as static. m_textureNames is the texture bound with this SurfaceTexture.
+    private static SurfaceTexture mSurfaceTexture = null;
+    private static int[] mTextureNames;
+
+    // Only when the video is prepared, we render using SurfaceTexture.
+    // This in fact is used to avoid showing the obsolete content when
+    // switching videos.
+    private static boolean mReadyToUseSurfTex = false;
+
+    // Video control FUNCTIONS:
+    @Override
+    public void start() {
+        super.start();
+        if (mCurrentState == STATE_PREPARED) {
+            mReadyToUseSurfTex = true;
+        }
+    }
+
+    HTML5VideoInline(int videoLayerId, int position,
+            boolean autoStart) {
+        init(videoLayerId, position, autoStart);
+        mReadyToUseSurfTex = false;
+    }
+
+    @Override
+    public void decideDisplayMode() {
+        mPlayer.setTexture(getSurfaceTextureInstance());
+    }
+
+    // Normally called immediately after setVideoURI. But for full screen,
+    // this should be after surface holder created
+    @Override
+    public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) {
+        super.prepareDataAndDisplayMode(proxy);
+        setFrameAvailableListener(proxy);
+    }
+
+    // Pause the play and update the play/pause button
+    @Override
+    public void pauseAndDispatch(HTML5VideoViewProxy proxy) {
+        super.pauseAndDispatch(proxy);
+        mReadyToUseSurfTex = false;
+    }
+
+    // Inline Video specific FUNCTIONS:
+
+    @Override
+    public SurfaceTexture getSurfaceTexture() {
+        return mSurfaceTexture;
+    }
+
+    @Override
+    public void deleteSurfaceTexture() {
+        mSurfaceTexture = null;
+        return;
+    }
+
+    // SurfaceTexture is a singleton here , too
+    private SurfaceTexture getSurfaceTextureInstance() {
+        // Create the surface texture.
+        if (mSurfaceTexture == null)
+        {
+            mTextureNames = new int[1];
+            GLES20.glGenTextures(1, mTextureNames, 0);
+            mSurfaceTexture = new SurfaceTexture(mTextureNames[0]);
+        }
+        return mSurfaceTexture;
+    }
+
+    @Override
+    public int getTextureName() {
+        return mTextureNames[0];
+    }
+
+    @Override
+    public boolean getReadyToUseSurfTex() {
+        return mReadyToUseSurfTex;
+    }
+
+    private void setFrameAvailableListener(SurfaceTexture.OnFrameAvailableListener l) {
+        mSurfaceTexture.setOnFrameAvailableListener(l);
+    }
+
+}
diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java
index 2312160..663497c 100644
--- a/core/java/android/webkit/HTML5VideoView.java
+++ b/core/java/android/webkit/HTML5VideoView.java
@@ -4,72 +4,93 @@
 import android.graphics.SurfaceTexture;
 import android.media.MediaPlayer;
 import android.util.Log;
+import android.view.SurfaceView;
 import android.webkit.HTML5VideoViewProxy;
-import android.widget.MediaController;
-import android.opengl.GLES20;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
 
 /**
  * @hide This is only used by the browser
  */
 public class HTML5VideoView implements MediaPlayer.OnPreparedListener{
-    // Due to the fact that SurfaceTexture consume a lot of memory, we make it
-    // as static. m_textureNames is the texture bound with this SurfaceTexture.
-    private static SurfaceTexture mSurfaceTexture = null;
-    private static int[] mTextureNames;
 
-    // Only when the video is prepared, we render using SurfaceTexture.
-    // This in fact is used to avoid showing the obsolete content when
-    // switching videos.
-    private static boolean mReadyToUseSurfTex = false;
+    protected static final String LOGTAG = "HTML5VideoView";
+
+    protected static final String COOKIE = "Cookie";
+    protected static final String HIDE_URL_LOGS = "x-hide-urls-from-log";
 
     // For handling the seekTo before prepared, we need to know whether or not
     // the video is prepared. Therefore, we differentiate the state between
     // prepared and not prepared.
     // When the video is not prepared, we will have to save the seekTo time,
     // and use it when prepared to play.
-    private static final int STATE_NOTPREPARED        = 0;
-    private static final int STATE_PREPARED           = 1;
+    protected static final int STATE_NOTPREPARED        = 0;
+    protected static final int STATE_PREPARED           = 1;
 
-    // We only need state for handling seekTo
-    private int mCurrentState;
+    protected int mCurrentState;
 
-    // Basically for calling back the OnPrepared in the proxy
-    private HTML5VideoViewProxy mProxy;
+    protected HTML5VideoViewProxy mProxy;
 
     // Save the seek time when not prepared. This can happen when switching
     // video besides initial load.
-    private int mSaveSeekTime;
+    protected int mSaveSeekTime;
 
     // This is used to find the VideoLayer on the native side.
-    private int mVideoLayerId;
+    protected int mVideoLayerId;
 
     // Every video will have one MediaPlayer. Given the fact we only have one
     // SurfaceTexture, there is only one MediaPlayer in action. Every time we
     // switch videos, a new instance of MediaPlayer will be created in reset().
-    private MediaPlayer mPlayer;
+    // Switching between inline and full screen will also create a new instance.
+    protected MediaPlayer mPlayer;
 
-    private static HTML5VideoView mInstance = new HTML5VideoView();
+    // This will be set up every time we create the Video View object.
+    // Set to true only when switching into full screen while playing
+    protected boolean mAutostart;
 
-    // Video control FUNCTIONS:
+    // We need to save such info.
+    protected String mUri;
+    protected Map<String, String> mHeaders;
+
+    // The timer for timeupate events.
+    // See http://www.whatwg.org/specs/web-apps/current-work/#event-media-timeupdate
+    protected static Timer mTimer;
+
+    // The spec says the timer should fire every 250 ms or less.
+    private static final int TIMEUPDATE_PERIOD = 250;  // ms
+
+    // common Video control FUNCTIONS:
     public void start() {
         if (mCurrentState == STATE_PREPARED) {
             mPlayer.start();
-            mReadyToUseSurfTex = true;
         }
     }
 
     public void pause() {
-        mPlayer.pause();
+        if (mCurrentState == STATE_PREPARED && mPlayer.isPlaying()) {
+            mPlayer.pause();
+        }
+        if (mTimer != null) {
+            mTimer.purge();
+        }
     }
 
     public int getDuration() {
-        return mPlayer.getDuration();
+        if (mCurrentState == STATE_PREPARED) {
+            return mPlayer.getDuration();
+        } else {
+            return -1;
+        }
     }
 
     public int getCurrentPosition() {
-        return mPlayer.getCurrentPosition();
+        if (mCurrentState == STATE_PREPARED) {
+            return mPlayer.getCurrentPosition();
+        }
+        return 0;
     }
 
     public void seekTo(int pos) {
@@ -88,53 +109,50 @@
     }
 
     public void stopPlayback() {
-        mPlayer.stop();
+        if (mCurrentState == STATE_PREPARED) {
+            mPlayer.stop();
+        }
     }
 
-    private void reset(int videoLayerId) {
+    public boolean getAutostart() {
+        return mAutostart;
+    }
+
+    // Every time we start a new Video, we create a VideoView and a MediaPlayer
+    public void init(int videoLayerId, int position, boolean autoStart) {
         mPlayer = new MediaPlayer();
         mCurrentState = STATE_NOTPREPARED;
         mProxy = null;
         mVideoLayerId = videoLayerId;
-        mReadyToUseSurfTex = false;
+        mSaveSeekTime = position;
+        mAutostart = autoStart;
     }
 
-    public static HTML5VideoView getInstance(int videoLayerId) {
-        // Every time we switch between the videos, a new MediaPlayer will be
-        // created. Make sure we call the m_player.release() when it is done.
-        mInstance.reset(videoLayerId);
-        return mInstance;
+    protected HTML5VideoView() {
     }
 
-    private HTML5VideoView() {
-        // This is a singleton across WebViews (i.e. Tabs).
-        // HTML5VideoViewProxy will reset the internal state every time a new
-        // video start.
-    }
-
-    public void setMediaController(MediaController m) {
-        this.setMediaController(m);
-    }
-
-    public void setVideoURI(String uri, Map<String, String> headers) {
-        // When switching players, surface texture will be reused.
-        mPlayer.setTexture(getSurfaceTextureInstance());
-
-        // When there is exception, we could just bail out silently.
-        // No Video will be played though. Write the stack for debug
-        try {
-            mPlayer.setDataSource(uri, headers);
-            mPlayer.prepareAsync();
-        } catch (IllegalArgumentException e) {
-            e.printStackTrace();
-        } catch (IllegalStateException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
+    protected static Map<String, String> generateHeaders(String url,
+            HTML5VideoViewProxy proxy) {
+        boolean isPrivate = proxy.getWebView().isPrivateBrowsingEnabled();
+        String cookieValue = CookieManager.getInstance().getCookie(url, isPrivate);
+        Map<String, String> headers = new HashMap<String, String>();
+        if (cookieValue != null) {
+            headers.put(COOKIE, cookieValue);
         }
+        if (isPrivate) {
+            headers.put(HIDE_URL_LOGS, "true");
+        }
+
+        return headers;
     }
 
-    // TODO [FULL SCREEN SUPPORT]
+    public void setVideoURI(String uri, HTML5VideoViewProxy proxy) {
+        // When switching players, surface texture will be reused.
+        mUri = uri;
+        mHeaders = generateHeaders(uri, proxy);
+
+        mTimer = new Timer();
+    }
 
     // Listeners setup FUNCTIONS:
     public void setOnCompletionListener(HTML5VideoViewProxy proxy) {
@@ -150,43 +168,47 @@
         mPlayer.setOnPreparedListener(this);
     }
 
-    // Inline Video specific FUNCTIONS:
+    // Normally called immediately after setVideoURI. But for full screen,
+    // this should be after surface holder created
+    public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) {
+        // SurfaceTexture will be created lazily here for inline mode
+        decideDisplayMode();
 
-    public SurfaceTexture getSurfaceTexture() {
-        return mSurfaceTexture;
-    }
+        setOnCompletionListener(proxy);
+        setOnPreparedListener(proxy);
+        setOnErrorListener(proxy);
 
-    public void deleteSurfaceTexture() {
-        mSurfaceTexture = null;
-        return;
-    }
-
-    // SurfaceTexture is a singleton here , too
-    private SurfaceTexture getSurfaceTextureInstance() {
-        // Create the surface texture.
-        if (mSurfaceTexture == null)
-        {
-            mTextureNames = new int[1];
-            GLES20.glGenTextures(1, mTextureNames, 0);
-            mSurfaceTexture = new SurfaceTexture(mTextureNames[0]);
+        // When there is exception, we could just bail out silently.
+        // No Video will be played though. Write the stack for debug
+        try {
+            mPlayer.setDataSource(mUri, mHeaders);
+            mPlayer.prepareAsync();
+        } catch (IllegalArgumentException e) {
+            e.printStackTrace();
+        } catch (IllegalStateException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
         }
-        return mSurfaceTexture;
     }
 
-    public int getTextureName() {
-        return mTextureNames[0];
-    }
 
+    // Common code
     public int getVideoLayerId() {
         return mVideoLayerId;
     }
 
-    public boolean getReadyToUseSurfTex() {
-        return mReadyToUseSurfTex;
-    }
+    private static final class TimeupdateTask extends TimerTask {
+        private HTML5VideoViewProxy mProxy;
 
-    public void setFrameAvailableListener(SurfaceTexture.OnFrameAvailableListener l) {
-        mSurfaceTexture.setOnFrameAvailableListener(l);
+        public TimeupdateTask(HTML5VideoViewProxy proxy) {
+            mProxy = proxy;
+        }
+
+        @Override
+        public void run() {
+            mProxy.onTimeupdate();
+        }
     }
 
     @Override
@@ -195,6 +217,9 @@
         seekTo(mSaveSeekTime);
         if (mProxy != null)
             mProxy.onPrepared(mp);
+
+        mTimer.schedule(new TimeupdateTask(mProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
+
     }
 
     // Pause the play and update the play/pause button
@@ -205,7 +230,35 @@
                 proxy.dispatchOnPaused();
             }
         }
-        mReadyToUseSurfTex = false;
+    }
+
+    // Below are functions that are different implementation on inline and full-
+    // screen mode. Some are specific to one type, but currently are called
+    // directly from the proxy.
+    public void enterFullScreenVideoState(int layerId,
+            HTML5VideoViewProxy proxy, WebView webView) {
+    }
+
+    public boolean isFullScreenMode() {
+        return false;
+    }
+
+    public void decideDisplayMode() {
+    }
+
+    public boolean getReadyToUseSurfTex() {
+        return false;
+    }
+
+    public SurfaceTexture getSurfaceTexture() {
+        return null;
+    }
+
+    public void deleteSurfaceTexture() {
+    }
+
+    public int getTextureName() {
+        return 0;
     }
 
 }
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index b614d8f..d3fcfa5 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -21,29 +21,16 @@
 import android.graphics.BitmapFactory;
 import android.graphics.SurfaceTexture;
 import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnPreparedListener;
-import android.media.MediaPlayer.OnCompletionListener;
-import android.media.MediaPlayer.OnErrorListener;
 import android.net.http.EventHandler;
 import android.net.http.Headers;
 import android.net.http.RequestHandle;
 import android.net.http.RequestQueue;
 import android.net.http.SslCertificate;
 import android.net.http.SslError;
-import android.net.Uri;
-import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.util.Log;
-import android.view.MotionEvent;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsoluteLayout;
-import android.widget.FrameLayout;
-import android.widget.MediaController;
-import android.widget.VideoView;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -51,8 +38,6 @@
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
 
 /**
  * <p>Proxy for HTML5 video views.
@@ -78,9 +63,6 @@
     private static final int POSTER_FETCHED    = 202;
     private static final int PAUSED            = 203;
 
-    private static final String COOKIE = "Cookie";
-    private static final String HIDE_URL_LOGS = "x-hide-urls-from-log";
-
     // Timer thread -> UI thread
     private static final int TIMEUPDATE = 300;
 
@@ -104,38 +86,19 @@
         // The VideoView instance. This is a singleton for now, at least until
         // http://b/issue?id=1973663 is fixed.
         private static HTML5VideoView mHTML5VideoView;
-        // The progress view.
-        private static View mProgressView;
-        // The container for the progress view and video view
-        private static FrameLayout mLayout;
-        // The timer for timeupate events.
-        // See http://www.whatwg.org/specs/web-apps/current-work/#event-media-timeupdate
-        private static Timer mTimer;
-        private static final class TimeupdateTask extends TimerTask {
-            private HTML5VideoViewProxy mProxy;
 
-            public TimeupdateTask(HTML5VideoViewProxy proxy) {
-                mProxy = proxy;
-            }
-
-            public void run() {
-                mProxy.onTimeupdate();
-            }
-        }
-        // The spec says the timer should fire every 250 ms or less.
-        private static final int TIMEUPDATE_PERIOD = 250;  // ms
         private static boolean isVideoSelfEnded = false;
         // By using the baseLayer and the current video Layer ID, we can
         // identify the exact layer on the UI thread to use the SurfaceTexture.
         private static int mBaseLayer = 0;
 
-        // TODO: [FULL SCREEN SUPPORT]
-
         // Every time webView setBaseLayer, this will be called.
         // When we found the Video layer, then we set the Surface Texture to it.
         // Otherwise, we may want to delete the Surface Texture to save memory.
         public static void setBaseLayer(int layer) {
-            if (mHTML5VideoView != null) {
+            // Don't do this for full screen mode.
+            if (mHTML5VideoView != null
+                    && !mHTML5VideoView.isFullScreenMode()) {
                 mBaseLayer = layer;
                 SurfaceTexture surfTexture = mHTML5VideoView.getSurfaceTexture();
                 int textureName = mHTML5VideoView.getTextureName();
@@ -165,16 +128,47 @@
             }
         }
 
+        public static void enterFullScreenVideo(int layerId, String url,
+                HTML5VideoViewProxy proxy, WebView webView) {
+                // Save the inline video info and inherit it in the full screen
+                int savePosition = 0;
+                boolean savedIsPlaying = false;
+                if (mHTML5VideoView != null) {
+                    // If we are playing the same video, then it is better to
+                    // save the current position.
+                    if (layerId == mHTML5VideoView.getVideoLayerId()) {
+                        savePosition = mHTML5VideoView.getCurrentPosition();
+                        savedIsPlaying = mHTML5VideoView.isPlaying();
+                    }
+                    mHTML5VideoView.pauseAndDispatch(mCurrentProxy);
+                    mHTML5VideoView.release();
+                }
+                mHTML5VideoView = new HTML5VideoFullScreen(proxy.getContext(),
+                        layerId, savePosition, savedIsPlaying);
+                mCurrentProxy = proxy;
+
+                mHTML5VideoView.setVideoURI(url, mCurrentProxy);
+
+                mHTML5VideoView.enterFullScreenVideoState(layerId, proxy, webView);
+        }
+
         // This is on the UI thread.
         // When native tell Java to play, we need to check whether or not it is
         // still the same video by using videoLayerId and treat it differently.
         public static void play(String url, int time, HTML5VideoViewProxy proxy,
                 WebChromeClient client, int videoLayerId) {
             int currentVideoLayerId = -1;
-            if (mHTML5VideoView != null)
-                currentVideoLayerId = mHTML5VideoView.getVideoLayerId();
+            boolean backFromFullScreenMode = false;
 
-            if (currentVideoLayerId != videoLayerId
+            if (mHTML5VideoView != null) {
+                currentVideoLayerId = mHTML5VideoView.getVideoLayerId();
+                if (mHTML5VideoView instanceof HTML5VideoFullScreen) {
+                    backFromFullScreenMode = true;
+                }
+            }
+
+            if (backFromFullScreenMode
+                ||  currentVideoLayerId != videoLayerId
                 || mHTML5VideoView.getSurfaceTexture() == null) {
                 // Here, we handle the case when switching to a new video,
                 // either inside a WebView or across WebViews
@@ -186,35 +180,11 @@
                     // release the media player to avoid finalize error
                     mHTML5VideoView.release();
                 }
-                // HTML5VideoView is singleton, however, the internal state will
-                // be reset since we are switching from one video to another.
-                // Then we need to set up all the source/listener etc...
-                mHTML5VideoView = HTML5VideoView.getInstance(videoLayerId);
-
                 mCurrentProxy = proxy;
+                mHTML5VideoView = new HTML5VideoInline(videoLayerId, time, false);
 
-                // TODO: [FULL SCREEN SUPPORT]
-
-                boolean isPrivate = mCurrentProxy.getWebView().isPrivateBrowsingEnabled();
-                String cookieValue = CookieManager.getInstance().getCookie(url, isPrivate);
-                Map<String, String> headers = new HashMap<String, String>();
-                if (cookieValue != null) {
-                    headers.put(COOKIE, cookieValue);
-                }
-                if (isPrivate) {
-                    headers.put(HIDE_URL_LOGS, "true");
-                }
-
-                mHTML5VideoView.setVideoURI(url, headers);
-                mHTML5VideoView.setOnCompletionListener(proxy);
-                mHTML5VideoView.setOnPreparedListener(proxy);
-                mHTML5VideoView.setOnErrorListener(proxy);
-                mHTML5VideoView.setFrameAvailableListener(proxy);
-
-                mHTML5VideoView.seekTo(time);
-
-                mTimer = new Timer();
-
+                mHTML5VideoView.setVideoURI(url, mCurrentProxy);
+                mHTML5VideoView.prepareDataAndDisplayMode(proxy);
             } else if (mCurrentProxy == proxy) {
                 // Here, we handle the case when we keep playing with one video
                 if (!mHTML5VideoView.isPlaying()) {
@@ -222,7 +192,8 @@
                     mHTML5VideoView.start();
                 }
             } else if (mCurrentProxy != null) {
-                // Some other video is already playing. Notify the caller that its playback ended.
+                // Some other video is already playing. Notify the caller that
+                // its playback ended.
                 proxy.dispatchOnEnded();
             }
         }
@@ -249,14 +220,14 @@
         public static void pause(HTML5VideoViewProxy proxy) {
             if (mCurrentProxy == proxy && mHTML5VideoView != null) {
                 mHTML5VideoView.pause();
-                mTimer.purge();
             }
         }
 
         public static void onPrepared() {
-            mHTML5VideoView.start();
-            mTimer.schedule(new TimeupdateTask(mCurrentProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
-            // TODO: [FULL SCREEN SUPPORT]
+            if (!mHTML5VideoView.isFullScreenMode() ||
+                    mHTML5VideoView.isFullScreenMode() &&
+                    mHTML5VideoView.getAutostart() )
+                mHTML5VideoView.start();
         }
 
         public static void end() {
@@ -349,8 +320,6 @@
                     VideoPlayer.isVideoSelfEnded = true;
                 VideoPlayer.end();
                 break;
-                // TODO: [FULL SCREEN SUPPORT]
-                // For full screen case, end may need hide the view.
             case ERROR: {
                 WebChromeClient client = mWebView.getWebChromeClient();
                 if (client != null) {
@@ -665,7 +634,7 @@
         mPosterDownloader.start();
     }
 
-    // These two function are called from UI thread only by WebView.
+    // These three function are called from UI thread only by WebView.
     public void setBaseLayer(int layer) {
         VideoPlayer.setBaseLayer(layer);
     }
@@ -673,6 +642,11 @@
     public void pauseAndDispatch() {
         VideoPlayer.pauseAndDispatch();
     }
+
+    public void enterFullScreenVideo(int layerId, String url) {
+        VideoPlayer.enterFullScreenVideo(layerId, url, this, mWebView);
+    }
+
     /**
      * The factory for HTML5VideoViewProxy instances.
      * @param webViewCore is the WebViewCore that is requesting the proxy.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index dfdae53..056650c 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1356,10 +1356,10 @@
         return mTitleBar != null ? mTitleBar.getHeight() : 0;
     }
 
-    /*
+    /**
      * Return the amount of the titlebarview (if any) that is visible
      *
-     * @hide
+     * @deprecated This method is now obsolete.
      */
     public int getVisibleTitleHeight() {
         // need to restrict mScrollY due to over scroll
@@ -1663,6 +1663,7 @@
 
         mDrawHistory = true;
         mHistoryPicture = p;
+
         mScrollX = sx;
         mScrollY = sy;
         mZoomManager.restoreZoomState(b);
@@ -2102,7 +2103,7 @@
     public void clearView() {
         mContentWidth = 0;
         mContentHeight = 0;
-        setBaseLayer(0, null, false);
+        setBaseLayer(0, null, false, false);
         mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT);
     }
 
@@ -4030,10 +4031,12 @@
         }
     }
 
-    void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator) {
+    void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator,
+            boolean isPictureAfterFirstLayout) {
         if (mNativeClass == 0)
             return;
-        nativeSetBaseLayer(layer, invalRegion, showVisualIndicator);
+        nativeSetBaseLayer(layer, invalRegion, showVisualIndicator,
+                isPictureAfterFirstLayout);
         if (mHTML5VideoViewProxy != null) {
             mHTML5VideoViewProxy.setBaseLayer(layer);
         }
@@ -4119,8 +4122,11 @@
         if (mNativeClass != 0 && nativeEvaluateLayersAnimations()) {
             UIAnimationsRunning = true;
             // If we have unfinished (or unstarted) animations,
-            // we ask for a repaint.
-            invalidate();
+            // we ask for a repaint. We only need to do this in software
+            // rendering (with hardware rendering we already have a different
+            // method of requesting a repaint)
+            if (!canvas.isHardwareAccelerated())
+                invalidate();
         }
 
         // decide which adornments to draw
@@ -5453,7 +5459,6 @@
     private boolean handleTouchEventCommon(MotionEvent ev, int action, int x, int y) {
         long eventTime = ev.getEventTime();
 
-
         // Due to the touch screen edge effect, a touch closer to the edge
         // always snapped to the edge. As getViewWidth() can be different from
         // getWidth() due to the scrollbar, adjusting the point to match
@@ -5557,6 +5562,8 @@
                         ted.mIds[0] = ev.getPointerId(0);
                         ted.mPoints = new Point[1];
                         ted.mPoints[0] = new Point(contentX, contentY);
+                        ted.mPointsInView = new Point[1];
+                        ted.mPointsInView[0] = new Point(x, y);
                         ted.mMetaState = ev.getMetaState();
                         ted.mReprocess = mDeferTouchProcess;
                         ted.mNativeLayer = nativeScrollableLayer(
@@ -5604,6 +5611,8 @@
                     ted.mIds[0] = ev.getPointerId(0);
                     ted.mPoints = new Point[1];
                     ted.mPoints[0] = new Point(contentX, contentY);
+                    ted.mPointsInView = new Point[1];
+                    ted.mPointsInView[0] = new Point(x, y);
                     ted.mMetaState = ev.getMetaState();
                     ted.mReprocess = mDeferTouchProcess;
                     ted.mNativeLayer = mScrollingLayer;
@@ -5786,6 +5795,8 @@
                     ted.mAction = action;
                     ted.mPoints = new Point[1];
                     ted.mPoints[0] = new Point(contentX, contentY);
+                    ted.mPointsInView = new Point[1];
+                    ted.mPointsInView[0] = new Point(x, y);
                     ted.mMetaState = ev.getMetaState();
                     ted.mReprocess = mDeferTouchProcess;
                     ted.mNativeLayer = mScrollingLayer;
@@ -5808,6 +5819,8 @@
                             ted.mAction = WebViewCore.ACTION_DOUBLETAP;
                             ted.mPoints = new Point[1];
                             ted.mPoints[0] = new Point(contentX, contentY);
+                            ted.mPointsInView = new Point[1];
+                            ted.mPointsInView[0] = new Point(x, y);
                             ted.mMetaState = ev.getMetaState();
                             ted.mReprocess = mDeferTouchProcess;
                             ted.mNativeLayer = nativeScrollableLayer(
@@ -5944,11 +5957,13 @@
         final int count = ev.getPointerCount();
         ted.mIds = new int[count];
         ted.mPoints = new Point[count];
+        ted.mPointsInView = new Point[count];
         for (int c = 0; c < count; c++) {
             ted.mIds[c] = ev.getPointerId(c);
             int x = viewToContentX((int) ev.getX(c) + mScrollX);
             int y = viewToContentY((int) ev.getY(c) + mScrollY);
             ted.mPoints[c] = new Point(x, y);
+            ted.mPointsInView[c] = new Point((int) ev.getX(c), (int) ev.getY(c));
         }
         if (ted.mAction == MotionEvent.ACTION_POINTER_DOWN
             || ted.mAction == MotionEvent.ACTION_POINTER_UP) {
@@ -6033,6 +6048,10 @@
             ted.mIds[0] = 0;
             ted.mPoints = new Point[1];
             ted.mPoints[0] = new Point(x, y);
+            ted.mPointsInView = new Point[1];
+            int viewX = contentToViewX(x) - mScrollX;
+            int viewY = contentToViewY(y) - mScrollY;
+            ted.mPointsInView[0] = new Point(viewX, viewY);
             ted.mAction = MotionEvent.ACTION_CANCEL;
             ted.mNativeLayer = nativeScrollableLayer(
                     x, y, ted.mNativeLayerRect, null);
@@ -7165,14 +7184,15 @@
     private class TouchEventQueue {
         private long mNextTouchSequence = Long.MIN_VALUE + 1;
         private long mLastHandledTouchSequence = Long.MIN_VALUE;
-        private long mIgnoreUntilSequence = Long.MIN_VALUE;
+        private long mIgnoreUntilSequence = Long.MIN_VALUE + 1;
         private QueuedTouch mTouchEventQueue;
         private QueuedTouch mQueuedTouchRecycleBin;
         private int mQueuedTouchRecycleCount;
+        private long mLastEventTime = Long.MAX_VALUE;
         private static final int MAX_RECYCLED_QUEUED_TOUCH = 15;
 
         // milliseconds until we abandon hope of getting all of a previous gesture
-        private static final int QUEUED_GESTURE_TIMEOUT = 2000;
+        private static final int QUEUED_GESTURE_TIMEOUT = 1000;
 
         private QueuedTouch obtainQueuedTouch() {
             if (mQueuedTouchRecycleBin != null) {
@@ -7206,7 +7226,7 @@
         public void reset() {
             mNextTouchSequence = Long.MIN_VALUE + 1;
             mLastHandledTouchSequence = Long.MIN_VALUE;
-            mIgnoreUntilSequence = Long.MIN_VALUE;
+            mIgnoreUntilSequence = Long.MIN_VALUE + 1;
             while (mTouchEventQueue != null) {
                 QueuedTouch recycleMe = mTouchEventQueue;
                 mTouchEventQueue = mTouchEventQueue.mNext;
@@ -7240,7 +7260,9 @@
                 return;
             }
 
-            dropStaleGestures(ted.mMotionEvent, ted.mSequence);
+            if (dropStaleGestures(ted.mMotionEvent, ted.mSequence)) {
+                return;
+            }
 
             if (mLastHandledTouchSequence + 1 == ted.mSequence) {
                 handleQueuedTouchEventData(ted);
@@ -7275,7 +7297,9 @@
         public void enqueueTouchEvent(MotionEvent ev) {
             final long sequence = nextTouchSequence();
 
-            dropStaleGestures(ev, sequence);
+            if (dropStaleGestures(ev, sequence)) {
+                return;
+            }
 
             if (mLastHandledTouchSequence + 1 == sequence) {
                 handleQueuedMotionEvent(ev);
@@ -7298,16 +7322,30 @@
             }
         }
 
-        private void dropStaleGestures(MotionEvent ev, long sequence) {
-            if (mTouchEventQueue == null) return;
+        private boolean dropStaleGestures(MotionEvent ev, long sequence) {
+            if (ev != null && ev.getAction() == MotionEvent.ACTION_MOVE && !mConfirmMove) {
+                // This is to make sure that we don't attempt to process a tap
+                // or long press when webkit takes too long to get back to us.
+                // The movement will be properly confirmed when we process the
+                // enqueued event later.
+                final int dx = Math.round(ev.getX()) - mLastTouchX;
+                final int dy = Math.round(ev.getY()) - mLastTouchY;
+                if (dx * dx + dy * dy > mTouchSlopSquare) {
+                    mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
+                    mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
+                }
+            }
 
-            MotionEvent nextQueueEvent = mTouchEventQueue.mTed != null ?
-                    mTouchEventQueue.mTed.mMotionEvent : mTouchEventQueue.mEvent;
+            if (mTouchEventQueue == null) {
+                return sequence <= mLastHandledTouchSequence;
+            }
 
-            if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && nextQueueEvent != null) {
+            // If we have a new down event and it's been a while since the last event
+            // we saw, just reset and keep going.
+            if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN) {
                 long eventTime = ev.getEventTime();
-                long nextQueueTime = nextQueueEvent.getEventTime();
-                if (eventTime > nextQueueTime + QUEUED_GESTURE_TIMEOUT) {
+                long lastHandledEventTime = mLastEventTime;
+                if (eventTime > lastHandledEventTime + QUEUED_GESTURE_TIMEOUT) {
                     Log.w(LOGTAG, "Got ACTION_DOWN but still waiting on stale event. " +
                             "Ignoring previous queued events.");
                     QueuedTouch qd = mTouchEventQueue;
@@ -7321,17 +7359,18 @@
                 }
             }
 
-            if (mIgnoreUntilSequence > mLastHandledTouchSequence) {
+            if (mIgnoreUntilSequence - 1 > mLastHandledTouchSequence) {
                 QueuedTouch qd = mTouchEventQueue;
-                while (qd != null && qd.mSequence < mIgnoreUntilSequence &&
-                        qd.mSequence < sequence) {
-                    mLastHandledTouchSequence = qd.mSequence;
+                while (qd != null && qd.mSequence < mIgnoreUntilSequence) {
                     QueuedTouch recycleMe = qd;
                     qd = qd.mNext;
                     recycleQueuedTouch(recycleMe);
                 }
                 mTouchEventQueue = qd;
+                mLastHandledTouchSequence = mIgnoreUntilSequence - 1;
             }
+
+            return sequence <= mLastHandledTouchSequence;
         }
 
         private void handleQueuedTouch(QueuedTouch qt) {
@@ -7344,6 +7383,7 @@
         }
 
         private void handleQueuedMotionEvent(MotionEvent ev) {
+            mLastEventTime = ev.getEventTime();
             int action = ev.getActionMasked();
             if (ev.getPointerCount() > 1) {  // Multi-touch
                 handleMultiTouchInWebView(ev);
@@ -7361,6 +7401,9 @@
         }
 
         private void handleQueuedTouchEventData(TouchEventData ted) {
+            if (ted.mMotionEvent != null) {
+                mLastEventTime = ted.mMotionEvent.getEventTime();
+            }
             if (!ted.mReprocess) {
                 if (ted.mAction == MotionEvent.ACTION_DOWN
                         && mPreventDefault == PREVENT_DEFAULT_MAYBE_YES) {
@@ -7397,16 +7440,15 @@
                     // Following is for single touch.
                     switch (ted.mAction) {
                         case MotionEvent.ACTION_DOWN:
-                            mLastDeferTouchX = contentToViewX(ted.mPoints[0].x)
-                                    - mScrollX;
-                            mLastDeferTouchY = contentToViewY(ted.mPoints[0].y)
-                                    - mScrollY;
+                            mLastDeferTouchX = ted.mPointsInView[0].x;
+                            mLastDeferTouchY = ted.mPointsInView[0].y;
                             mDeferTouchMode = TOUCH_INIT_MODE;
                             break;
                         case MotionEvent.ACTION_MOVE: {
                             // no snapping in defer process
-                            int x = contentToViewX(ted.mPoints[0].x) - mScrollX;
-                            int y = contentToViewY(ted.mPoints[0].y) - mScrollY;
+                            int x = ted.mPointsInView[0].x;
+                            int y = ted.mPointsInView[0].y;
+
                             if (mDeferTouchMode != TOUCH_DRAG_MODE) {
                                 mDeferTouchMode = TOUCH_DRAG_MODE;
                                 mLastDeferTouchX = x;
@@ -7440,8 +7482,8 @@
                             break;
                         case WebViewCore.ACTION_DOUBLETAP:
                             // doDoubleTap() needs mLastTouchX/Y as anchor
-                            mLastTouchX = contentToViewX(ted.mPoints[0].x) - mScrollX;
-                            mLastTouchY = contentToViewY(ted.mPoints[0].y) - mScrollY;
+                            mLastDeferTouchX = ted.mPointsInView[0].x;
+                            mLastDeferTouchY = ted.mPointsInView[0].y;
                             mZoomManager.handleDoubleTap(mLastTouchX, mLastTouchY);
                             mDeferTouchMode = TOUCH_DONE_MODE;
                             break;
@@ -7565,6 +7607,8 @@
                         ted.mPoints = new Point[1];
                         ted.mPoints[0] = new Point(viewToContentX(mLastTouchX + mScrollX),
                                                    viewToContentY(mLastTouchY + mScrollY));
+                        ted.mPointsInView = new Point[1];
+                        ted.mPointsInView[0] = new Point(mLastTouchX, mLastTouchY);
                         // metaState for long press is tricky. Should it be the
                         // state when the press started or when the press was
                         // released? Or some intermediary key state? For
@@ -7620,11 +7664,12 @@
                 case NEW_PICTURE_MSG_ID: {
                     // called for new content
                     final WebViewCore.DrawData draw = (WebViewCore.DrawData) msg.obj;
-                    setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,
-                            getSettings().getShowVisualIndicator());
-                    final Point viewSize = draw.mViewSize;
                     WebViewCore.ViewState viewState = draw.mViewState;
                     boolean isPictureAfterFirstLayout = viewState != null;
+                    setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,
+                            getSettings().getShowVisualIndicator(),
+                            isPictureAfterFirstLayout);
+                    final Point viewSize = draw.mViewSize;
                     if (isPictureAfterFirstLayout) {
                         // Reset the last sent data here since dealing with new page.
                         mLastWidthSent = 0;
@@ -7842,7 +7887,11 @@
 
                 case ENTER_FULLSCREEN_VIDEO:
                     int layerId = msg.arg1;
-                    Log.v(LOGTAG, "Display the video layer " + layerId + " fullscreen");
+
+                    String url = (String) msg.obj;
+                    if (mHTML5VideoViewProxy != null) {
+                        mHTML5VideoViewProxy.enterFullScreenVideo(layerId, url);
+                    }
                     break;
 
                 case SHOW_FULLSCREEN: {
@@ -8679,7 +8728,7 @@
     private native void     nativeSetFindIsUp(boolean isUp);
     private native void     nativeSetHeightCanMeasure(boolean measure);
     private native void     nativeSetBaseLayer(int layer, Region invalRegion,
-            boolean showVisualIndicator);
+            boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
     private native void     nativeShowCursorTimed();
     private native void     nativeReplaceBaseContent(int content);
     private native void     nativeCopyBaseContentToPicture(Picture pict);
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index bed77ef..0271695 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -483,10 +483,12 @@
     /**
      * Notify the webview that we want to display the video layer fullscreen.
      */
-    protected void enterFullscreenForVideoLayer(int layerId) {
+    protected void enterFullscreenForVideoLayer(int layerId, String url) {
         if (mWebView == null) return;
-        Message.obtain(mWebView.mPrivateHandler,
-                       WebView.ENTER_FULLSCREEN_VIDEO, layerId, 0).sendToTarget();
+        Message message = Message.obtain(mWebView.mPrivateHandler,
+                       WebView.ENTER_FULLSCREEN_VIDEO, layerId, 0);
+        message.obj = url;
+        message.sendToTarget();
     }
 
     //-------------------------------------------------------------------------
@@ -829,6 +831,7 @@
         int mAction;
         int[] mIds;  // Ids of the touch points
         Point[] mPoints;
+        Point[] mPointsInView;  // the point coordinates in view axis.
         int mActionIndex;  // Associated pointer index for ACTION_POINTER_DOWN/UP
         int mMetaState;
         boolean mReprocess;
diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java
index 72052a6..f2a1ec3 100644
--- a/core/java/android/webkit/ZoomManager.java
+++ b/core/java/android/webkit/ZoomManager.java
@@ -504,7 +504,7 @@
     }
 
     public boolean isFixedLengthAnimationInProgress() {
-        return mZoomScale != 0;
+        return mZoomScale != 0 || mInHWAcceleratedZoom;
     }
 
     public void refreshZoomScale(boolean reflowText) {
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 0da73a4..2621e64 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -201,7 +201,8 @@
     }
     
     @Override
-    void onProgressRefresh(float scale, boolean fromUser) { 
+    void onProgressRefresh(float scale, boolean fromUser) {
+        super.onProgressRefresh(scale, fromUser);
         Drawable thumb = mThumb;
         if (thumb != null) {
             setThumbPos(getWidth(), thumb, scale, Integer.MIN_VALUE);
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 1d442db..7210e21 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -410,73 +410,27 @@
     }
 
     /**
-     * Reorders the spinners according to the date format in the current
-     * {@link Locale}.
+     * Reorders the spinners according to the date format that is
+     * explicitly set by the user and if no such is set fall back
+     * to the current locale's default format.
      */
     private void reorderSpinners() {
-        java.text.DateFormat format;
-        String order;
-
-        /*
-         * If the user is in a locale where the medium date format is still
-         * numeric (Japanese and Czech, for example), respect the date format
-         * order setting. Otherwise, use the order that the locale says is
-         * appropriate for a spelled-out date.
-         */
-
-        if (getShortMonths()[0].startsWith("1")) {
-            format = DateFormat.getDateFormat(getContext());
-        } else {
-            format = DateFormat.getMediumDateFormat(getContext());
-        }
-
-        if (format instanceof SimpleDateFormat) {
-            order = ((SimpleDateFormat) format).toPattern();
-        } else {
-            // Shouldn't happen, but just in case.
-            order = new String(DateFormat.getDateFormatOrder(getContext()));
-        }
-
-        /*
-         * Remove the 3 spinners from their parent and then add them back in the
-         * required order.
-         */
-        LinearLayout parent = mSpinners;
-        parent.removeAllViews();
-
-        boolean quoted = false;
-        boolean didDay = false, didMonth = false, didYear = false;
-
-        for (int i = 0; i < order.length(); i++) {
-            char c = order.charAt(i);
-
-            if (c == '\'') {
-                quoted = !quoted;
+        mSpinners.removeAllViews();
+        char[] order = DateFormat.getDateFormatOrder(getContext());
+        for (int i = 0; i < order.length; i++) {
+            switch (order[i]) {
+                case DateFormat.DATE:
+                    mSpinners.addView(mDaySpinner);
+                    break;
+                case DateFormat.MONTH:
+                    mSpinners.addView(mMonthSpinner);
+                    break;
+                case DateFormat.YEAR:
+                    mSpinners.addView(mYearSpinner);
+                    break;
+                default:
+                    throw new IllegalArgumentException();
             }
-
-            if (!quoted) {
-                if (c == DateFormat.DATE && !didDay) {
-                    parent.addView(mDaySpinner);
-                    didDay = true;
-                } else if ((c == DateFormat.MONTH || c == 'L') && !didMonth) {
-                    parent.addView(mMonthSpinner);
-                    didMonth = true;
-                } else if (c == DateFormat.YEAR && !didYear) {
-                    parent.addView(mYearSpinner);
-                    didYear = true;
-                }
-            }
-        }
-
-        // Shouldn't happen, but just in case.
-        if (!didMonth) {
-            parent.addView(mMonthSpinner);
-        }
-        if (!didDay) {
-            parent.addView(mDaySpinner);
-        }
-        if (!didYear) {
-            parent.addView(mYearSpinner);
         }
     }
 
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index cf72ec4..8db34d9 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -16,6 +16,8 @@
 
 package android.widget;
 
+import com.android.internal.R;
+
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
@@ -41,6 +43,8 @@
 import android.view.RemotableViewMethod;
 import android.view.View;
 import android.view.ViewDebug;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityManager;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
@@ -49,8 +53,6 @@
 import android.view.animation.Transformation;
 import android.widget.RemoteViews.RemoteView;
 
-import com.android.internal.R;
-
 
 /**
  * <p>
@@ -125,6 +127,7 @@
 public class ProgressBar extends View {
     private static final int MAX_LEVEL = 10000;
     private static final int ANIMATION_RESOLUTION = 200;
+    private static final int TIMEOUT_SEND_ACCESSIBILITY_EVENT = 200;
 
     int mMinWidth;
     int mMaxWidth;
@@ -156,6 +159,8 @@
 
     private int mAnimationResolution;
 
+    private AccessibilityEventSender mAccessibilityEventSender;
+
     /**
      * Create a new progress bar with range 0...100 and initial progress of 0.
      * @param context the application environment
@@ -542,8 +547,11 @@
             onProgressRefresh(scale, fromUser);
         }
     }
-    
-    void onProgressRefresh(float scale, boolean fromUser) {        
+
+    void onProgressRefresh(float scale, boolean fromUser) {
+        if (AccessibilityManager.getInstance(mContext).isEnabled()) {
+            scheduleAccessibilityEventSender();
+        }
     }
 
     private synchronized void refreshProgress(int id, int progress, boolean fromUser) {
@@ -1007,8 +1015,48 @@
         if (mIndeterminate) {
             stopAnimation();
         }
+        if(mRefreshProgressRunnable != null) {
+            removeCallbacks(mRefreshProgressRunnable);
+        }
+        if (mAccessibilityEventSender != null) {
+            removeCallbacks(mAccessibilityEventSender);
+        }
         // This should come after stopAnimation(), otherwise an invalidate message remains in the
         // queue, which can prevent the entire view hierarchy from being GC'ed during a rotation
         super.onDetachedFromWindow();
     }
+
+    @Override
+    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+        if (!super.dispatchPopulateAccessibilityEvent(event)) {
+            event.setItemCount(mMax);
+            event.setCurrentItemIndex(mProgress);
+        }
+        return true;
+    }
+
+    /**
+     * Schedule a command for sending an accessibility event.
+     * </br>
+     * Note: A command is used to ensure that accessibility events
+     *       are sent at most one in a given time frame to save
+     *       system resources while the progress changes quickly.
+     */
+    private void scheduleAccessibilityEventSender() {
+        if (mAccessibilityEventSender == null) {
+            mAccessibilityEventSender = new AccessibilityEventSender();
+        } else {
+            removeCallbacks(mAccessibilityEventSender);
+        }
+        postDelayed(mAccessibilityEventSender, TIMEOUT_SEND_ACCESSIBILITY_EVENT);
+    }
+
+    /**
+     * Command for sending an accessibility event.
+     */
+    private class AccessibilityEventSender implements Runnable {
+        public void run() {
+            sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
+        }
+    }
 }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a3ea6a9..222bc84 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -43,6 +43,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.Message;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -81,6 +82,7 @@
 import android.text.method.TimeKeyListener;
 import android.text.method.TransformationMethod;
 import android.text.style.ClickableSpan;
+import android.text.style.CorrectionSpan;
 import android.text.style.ParagraphStyle;
 import android.text.style.URLSpan;
 import android.text.style.UpdateAppearance;
@@ -126,6 +128,7 @@
 import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
+import java.util.HashSet;
 
 /**
  * Displays text to the user and optionally allows them to edit it.  A TextView
@@ -7895,9 +7898,6 @@
                 text = getHint();
             }
             if (!TextUtils.isEmpty(text)) {
-                if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) {
-                    text = text.subSequence(0, AccessibilityEvent.MAX_TEXT_LENGTH + 1);
-                }
                 event.getText().add(text);
             }
         } else {
@@ -8339,6 +8339,19 @@
         sLastCutOrCopyTime = SystemClock.uptimeMillis();
     }
 
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan span, int start, int end,
+            int flags) {
+        if (getWindowToken() != token || !(mText instanceof Spannable)) return false;
+        Spannable spannable = (Spannable)mText;
+        CorrectionSpan[] spans = spannable.getSpans(start, end, CorrectionSpan.class);
+        final int N = spans.length;
+        for (int i = 0; i < N; ++i) {
+            spannable.removeSpan(spans[i]);
+        }
+        spannable.setSpan(span, start, end, flags);
+        return true;
+    }
+
     /**
      * An ActionMode Callback class that is used to provide actions while in text selection mode.
      *
diff --git a/core/java/com/android/internal/app/LocalePicker.java b/core/java/com/android/internal/app/LocalePicker.java
index e32c62d..52cb679 100644
--- a/core/java/com/android/internal/app/LocalePicker.java
+++ b/core/java/com/android/internal/app/LocalePicker.java
@@ -88,7 +88,7 @@
     public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
             int layoutId, int fieldId) {
         final Resources resources = context.getResources();
-        final String[] locales = context.getAssets().getLocales();
+        final String[] locales = Resources.getSystem().getAssets().getLocales();
         final String[] specialLocaleCodes = resources.getStringArray(R.array.special_locale_codes);
         final String[] specialLocaleNames = resources.getStringArray(R.array.special_locale_names);
         Arrays.sort(locales);
diff --git a/core/java/com/android/internal/view/IInputConnectionWrapper.java b/core/java/com/android/internal/view/IInputConnectionWrapper.java
index b5df812..8719fde 100644
--- a/core/java/com/android/internal/view/IInputConnectionWrapper.java
+++ b/core/java/com/android/internal/view/IInputConnectionWrapper.java
@@ -18,9 +18,11 @@
 
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
+import android.text.style.CorrectionSpan;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.inputmethod.CompletionInfo;
@@ -45,6 +47,7 @@
     private static final int DO_PERFORM_EDITOR_ACTION = 58;
     private static final int DO_PERFORM_CONTEXT_MENU_ACTION = 59;
     private static final int DO_SET_COMPOSING_TEXT = 60;
+    private static final int DO_SET_SECURE_CORRECTION_SPAN = 61;
     private static final int DO_SET_COMPOSING_REGION = 63;
     private static final int DO_FINISH_COMPOSING_TEXT = 65;
     private static final int DO_SEND_KEY_EVENT = 70;
@@ -174,7 +177,14 @@
     public void performPrivateCommand(String action, Bundle data) {
         dispatchMessage(obtainMessageOO(DO_PERFORM_PRIVATE_COMMAND, action, data));
     }
-    
+
+    @Override
+    public void setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags) {
+        dispatchMessage(obtainMessageOOIII(DO_SET_SECURE_CORRECTION_SPAN, token, correctionSpan,
+                start, end, flags));
+    }
+
     void dispatchMessage(Message msg) {
         // If we are calling this from the main thread, then we can call
         // right through.  Otherwise, we need to send the message to the
@@ -420,6 +430,17 @@
                         (Bundle)args.arg2);
                 return;
             }
+            case DO_SET_SECURE_CORRECTION_SPAN: {
+                InputConnection ic = mInputConnection.get();
+                if (ic == null || !isActive()) {
+                    Log.w(TAG, "setCorrectionSpan on inactive InputConnection");
+                    return;
+                }
+                SomeArgs args = (SomeArgs)msg.obj;
+                ic.setCorrectionSpan((IBinder)args.arg1, (CorrectionSpan)args.arg2, msg.arg1,
+                        msg.arg2, args.seq);
+                return;
+            }
         }
         Log.w(TAG, "Unhandled message code: " + msg.what);
     }
@@ -469,4 +490,12 @@
         args.arg2 = arg2;
         return mH.obtainMessage(what, 0, 0, args);
     }
+
+    Message obtainMessageOOIII(int what, Object arg1, Object arg2, int arg3, int arg4, int arg5) {
+        SomeArgs args = new SomeArgs();
+        args.arg1 = arg1;
+        args.arg2 = arg2;
+        args.seq = arg5;
+        return mH.obtainMessage(what, arg3, arg4, args);
+    }
 }
diff --git a/core/java/com/android/internal/view/IInputContext.aidl b/core/java/com/android/internal/view/IInputContext.aidl
index e00dd4e..eb20d61 100644
--- a/core/java/com/android/internal/view/IInputContext.aidl
+++ b/core/java/com/android/internal/view/IInputContext.aidl
@@ -17,6 +17,7 @@
 package com.android.internal.view;
 
 import android.os.Bundle;
+import android.text.style.CorrectionSpan;
 import android.view.KeyEvent;
 import android.view.inputmethod.CompletionInfo;
 import android.view.inputmethod.CorrectionInfo;
@@ -72,4 +73,7 @@
     void setComposingRegion(int start, int end);
 
     void getSelectedText(int flags, int seq, IInputContextCallback callback);
+
+    void setCorrectionSpan(in IBinder token, in CorrectionSpan correctionSpan, int start,
+            int end, int flags);
 }
diff --git a/core/java/com/android/internal/view/InputConnectionWrapper.java b/core/java/com/android/internal/view/InputConnectionWrapper.java
index b13118a..efe315f 100644
--- a/core/java/com/android/internal/view/InputConnectionWrapper.java
+++ b/core/java/com/android/internal/view/InputConnectionWrapper.java
@@ -17,8 +17,10 @@
 package com.android.internal.view;
 
 import android.os.Bundle;
+import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.SystemClock;
+import android.text.style.CorrectionSpan;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.inputmethod.CompletionInfo;
@@ -413,4 +415,14 @@
             return false;
         }
     }
+    @Override
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags) {
+        try {
+            mIInputContext.setCorrectionSpan(token, correctionSpan, start, end, flags);
+            return true;
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
 }
diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java
index 9f9f020..ea82bc7 100644
--- a/core/java/com/android/internal/widget/EditableInputConnection.java
+++ b/core/java/com/android/internal/widget/EditableInputConnection.java
@@ -17,8 +17,10 @@
 package com.android.internal.widget;
 
 import android.os.Bundle;
+import android.os.IBinder;
 import android.text.Editable;
 import android.text.method.KeyListener;
+import android.text.style.CorrectionSpan;
 import android.util.Log;
 import android.view.inputmethod.BaseInputConnection;
 import android.view.inputmethod.CompletionInfo;
@@ -144,4 +146,13 @@
 
         return success;
     }
+
+    @Override
+    public boolean setCorrectionSpan(IBinder token, CorrectionSpan correctionSpan, int start,
+            int end, int flags) {
+        mTextView.beginBatchEdit();
+        boolean retval = mTextView.setCorrectionSpan(token, correctionSpan, start, end, flags);
+        mTextView.endBatchEdit();
+        return retval;
+    }
 }
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index c4e5878..2f70190 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -171,6 +171,12 @@
     env->ReleaseFloatArrayElements(jmtx, mtx, 0);
 }
 
+static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz)
+{
+    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+    return surfaceTexture->getTimestamp();
+}
+
 // ----------------------------------------------------------------------------
 
 const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTexture";
@@ -178,9 +184,10 @@
 static JNINativeMethod gSurfaceTextureMethods[] = {
     {"nativeClassInit",          "()V",   (void*)SurfaceTexture_classInit },
     {"nativeInit",               "(ILjava/lang/Object;)V", (void*)SurfaceTexture_init },
-    {"nativeFinalize",            "()V",  (void*)SurfaceTexture_finalize },
+    {"nativeFinalize",           "()V",   (void*)SurfaceTexture_finalize },
     {"nativeUpdateTexImage",     "()V",   (void*)SurfaceTexture_updateTexImage },
     {"nativeGetTransformMatrix", "([F)V", (void*)SurfaceTexture_getTransformMatrix },
+    {"nativeGetTimestamp",       "()J",   (void*)SurfaceTexture_getTimestamp }
 };
 
 int register_android_graphics_SurfaceTexture(JNIEnv* env)
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index ed93d64..d6d3e4f 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -67,6 +67,10 @@
     #define RENDERER_LOGD(...)
 #endif
 
+#define MODIFIER_SHADOW 1
+#define MODIFIER_SHADER 2
+#define MODIFIER_COLOR_FILTER 4
+
 // ----------------------------------------------------------------------------
 
 static struct {
@@ -381,10 +385,10 @@
 // ----------------------------------------------------------------------------
 
 static void android_view_GLES20Canvas_resetModifiers(JNIEnv* env, jobject clazz,
-        OpenGLRenderer* renderer) {
-    renderer->resetShader();
-    renderer->resetColorFilter();
-    renderer->resetShadow();
+        OpenGLRenderer* renderer, jint modifiers) {
+    if (modifiers & MODIFIER_SHADOW) renderer->resetShadow();
+    if (modifiers & MODIFIER_SHADER) renderer->resetShader();
+    if (modifiers & MODIFIER_COLOR_FILTER) renderer->resetColorFilter();
 }
 
 static void android_view_GLES20Canvas_setupShader(JNIEnv* env, jobject clazz,
@@ -645,7 +649,7 @@
     { "nDrawPath",          "(III)V",          (void*) android_view_GLES20Canvas_drawPath },
     { "nDrawLines",         "(I[FIII)V",       (void*) android_view_GLES20Canvas_drawLines },
 
-    { "nResetModifiers",    "(I)V",            (void*) android_view_GLES20Canvas_resetModifiers },
+    { "nResetModifiers",    "(II)V",           (void*) android_view_GLES20Canvas_resetModifiers },
     { "nSetupShader",       "(II)V",           (void*) android_view_GLES20Canvas_setupShader },
     { "nSetupColorFilter",  "(II)V",           (void*) android_view_GLES20Canvas_setupColorFilter },
     { "nSetupShadow",       "(IFFFI)V",        (void*) android_view_GLES20Canvas_setupShadow },
diff --git a/core/res/res/drawable-hdpi/ic_media_video_poster.png b/core/res/res/drawable-hdpi/ic_media_video_poster.png
new file mode 100644
index 0000000..6c1fd6b
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_media_video_poster.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_copy_dark.png b/core/res/res/drawable-hdpi/ic_menu_copy_dark.png
deleted file mode 100644
index 852f146..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_copy_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_copy_light.png b/core/res/res/drawable-hdpi/ic_menu_copy_light.png
deleted file mode 100644
index ad09b37..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_copy_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_cut_dark.png b/core/res/res/drawable-hdpi/ic_menu_cut_dark.png
deleted file mode 100644
index 7716a94..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_cut_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_cut_light.png b/core/res/res/drawable-hdpi/ic_menu_cut_light.png
deleted file mode 100644
index bea6db1..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_cut_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_paste_dark.png b/core/res/res/drawable-hdpi/ic_menu_paste_dark.png
deleted file mode 100644
index 5579443..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_paste_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_paste_light.png b/core/res/res/drawable-hdpi/ic_menu_paste_light.png
deleted file mode 100644
index 6674914..0000000
--- a/core/res/res/drawable-hdpi/ic_menu_paste_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_adb.png b/core/res/res/drawable-hdpi/stat_sys_adb.png
index 877e731..9c56e24 100755
--- a/core/res/res/drawable-hdpi/stat_sys_adb.png
+++ b/core/res/res/drawable-hdpi/stat_sys_adb.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/ic_media_video_poster.png b/core/res/res/drawable-ldpi/ic_media_video_poster.png
new file mode 100644
index 0000000..786d0e6
--- /dev/null
+++ b/core/res/res/drawable-ldpi/ic_media_video_poster.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_video_poster.png b/core/res/res/drawable-mdpi/ic_media_video_poster.png
new file mode 100644
index 0000000..10bbd74
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_media_video_poster.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_copy_dark.png b/core/res/res/drawable-mdpi/ic_menu_copy_dark.png
deleted file mode 100644
index 35c3318..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_copy_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_copy_light.png b/core/res/res/drawable-mdpi/ic_menu_copy_light.png
deleted file mode 100644
index 3b179d8..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_copy_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_cut_dark.png b/core/res/res/drawable-mdpi/ic_menu_cut_dark.png
deleted file mode 100644
index dfe8b4a..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_cut_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_cut_light.png b/core/res/res/drawable-mdpi/ic_menu_cut_light.png
deleted file mode 100644
index 748dc9b..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_cut_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_paste_dark.png b/core/res/res/drawable-mdpi/ic_menu_paste_dark.png
deleted file mode 100644
index caec299..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_paste_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_paste_light.png b/core/res/res/drawable-mdpi/ic_menu_paste_light.png
deleted file mode 100644
index 434f5d1..0000000
--- a/core/res/res/drawable-mdpi/ic_menu_paste_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_adb.png b/core/res/res/drawable-mdpi/stat_sys_adb.png
index e259ca5..1400bb3 100644
--- a/core/res/res/drawable-mdpi/stat_sys_adb.png
+++ b/core/res/res/drawable-mdpi/stat_sys_adb.png
Binary files differ
diff --git a/core/res/res/drawable/expander_group_holo_dark.xml b/core/res/res/drawable/expander_group_holo_dark.xml
index 51a7290..2481dcb 100644
--- a/core/res/res/drawable/expander_group_holo_dark.xml
+++ b/core/res/res/drawable/expander_group_holo_dark.xml
@@ -17,7 +17,7 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item
         android:state_expanded="true"
-        android:drawable="@drawable/expander_open_holo_dark" />
-    <item
         android:drawable="@drawable/expander_close_holo_dark" />
+    <item
+        android:drawable="@drawable/expander_open_holo_dark" />
 </selector>
diff --git a/core/res/res/drawable/expander_group_holo_light.xml b/core/res/res/drawable/expander_group_holo_light.xml
index 0ce71a5..8006574 100644
--- a/core/res/res/drawable/expander_group_holo_light.xml
+++ b/core/res/res/drawable/expander_group_holo_light.xml
@@ -17,7 +17,7 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item
         android:state_expanded="true"
-        android:drawable="@drawable/expander_open_holo_light" />
-    <item
         android:drawable="@drawable/expander_close_holo_light" />
+    <item
+        android:drawable="@drawable/expander_open_holo_light" />
 </selector>
diff --git a/core/res/res/layout/preference_list_content.xml b/core/res/res/layout/preference_list_content.xml
index 5d034a5..925b715 100644
--- a/core/res/res/layout/preference_list_content.xml
+++ b/core/res/res/layout/preference_list_content.xml
@@ -36,8 +36,6 @@
             android:layout_height="match_parent"
             android:layout_marginRight="@dimen/preference_screen_side_margin_negative"
             android:layout_marginLeft="@dimen/preference_screen_side_margin"
-            android:layout_marginTop="32dp"
-            android:layout_marginBottom="32dp"
             android:layout_weight="10">
 
             <ListView android:id="@android:id/list"
@@ -61,33 +59,9 @@
                 android:layout_width="0px"
                 android:layout_height="match_parent"
                 android:layout_weight="20"
-                android:layout_marginLeft="@dimen/preference_screen_side_margin"
-                android:layout_marginRight="@dimen/preference_screen_side_margin"
-                android:layout_marginTop="16dp"
-                android:layout_marginBottom="16dp"
-                android:background="?attr/detailsElementBackground"
                 android:orientation="vertical"
                 android:visibility="gone" >
 
-            <!-- Breadcrumb inserted here -->
-            <android.app.FragmentBreadCrumbs
-                android:id="@android:id/title"
-                android:layout_height="72dip"
-                android:layout_width="match_parent"
-                android:paddingTop="16dip"
-                android:paddingBottom="8dip"
-                android:gravity="center_vertical|left"
-                android:layout_marginLeft="48dip"
-                android:layout_marginRight="48dip"
-                />
-
-            <ImageView
-                    android:layout_width="match_parent"
-                    android:layout_height="1dip"
-                    android:paddingLeft="32dip"
-                    android:paddingRight="32dip"
-                    android:src="#404040"
-                />
             <android.preference.PreferenceFrameLayout android:id="@+id/prefs"
                     android:layout_width="match_parent"
                     android:layout_height="0dip"
diff --git a/core/res/res/layout/preference_list_content_large.xml b/core/res/res/layout/preference_list_content_large.xml
new file mode 100644
index 0000000..14d188e
--- /dev/null
+++ b/core/res/res/layout/preference_list_content_large.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/layout/list_content.xml
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent">
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1">
+
+        <LinearLayout
+            android:id="@+id/headers"
+            android:orientation="vertical"
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:layout_marginRight="@dimen/preference_screen_side_margin_negative"
+            android:layout_marginLeft="@dimen/preference_screen_side_margin"
+            android:layout_marginTop="32dp"
+            android:layout_marginBottom="32dp"
+            android:layout_weight="10">
+
+            <ListView android:id="@android:id/list"
+                android:layout_width="match_parent"
+                android:layout_height="0px"
+                android:layout_weight="1"
+                android:drawSelectorOnTop="false"
+                android:cacheColorHint="@android:color/transparent"
+                android:listPreferredItemHeight="48dp"
+                android:scrollbarAlwaysDrawVerticalTrack="true" />
+
+            <FrameLayout android:id="@+id/list_footer"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="0" />
+
+        </LinearLayout>
+
+        <LinearLayout
+                android:id="@+id/prefs_frame"
+                android:layout_width="0px"
+                android:layout_height="match_parent"
+                android:layout_weight="20"
+                android:layout_marginLeft="@dimen/preference_screen_side_margin"
+                android:layout_marginRight="@dimen/preference_screen_side_margin"
+                android:layout_marginTop="16dp"
+                android:layout_marginBottom="16dp"
+                android:background="?attr/detailsElementBackground"
+                android:orientation="vertical"
+                android:visibility="gone" >
+
+            <!-- Breadcrumb inserted here -->
+            <android.app.FragmentBreadCrumbs
+                android:id="@android:id/title"
+                android:layout_height="72dip"
+                android:layout_width="match_parent"
+                android:paddingTop="16dip"
+                android:paddingBottom="8dip"
+                android:gravity="center_vertical|left"
+                android:layout_marginLeft="48dip"
+                android:layout_marginRight="48dip"
+                />
+
+            <ImageView
+                    android:layout_width="match_parent"
+                    android:layout_height="1dip"
+                    android:paddingLeft="32dip"
+                    android:paddingRight="32dip"
+                    android:src="#404040"
+                />
+            <android.preference.PreferenceFrameLayout android:id="@+id/prefs"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dip"
+                    android:layout_weight="1"
+                    android:layout_marginTop="-1dip"
+                />
+        </LinearLayout>
+    </LinearLayout>
+
+    <RelativeLayout android:id="@+id/button_bar"
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_weight="0"
+        android:background="@android:drawable/bottom_bar"
+        android:visibility="gone">
+
+        <Button android:id="@+id/back_button"
+            android:layout_width="150dip"
+            android:layout_height="wrap_content"
+            android:layout_margin="5dip"
+            android:layout_alignParentLeft="true"
+            android:drawableLeft="@drawable/ic_btn_back"
+            android:drawablePadding="3dip"
+            android:text="@string/back_button_label"
+        />
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true">
+
+            <Button android:id="@+id/skip_button"
+                android:layout_width="150dip"
+                android:layout_height="wrap_content"
+                android:layout_margin="5dip"
+                android:text="@string/skip_button_label"
+                android:visibility="gone"
+            />
+
+            <Button android:id="@+id/next_button"
+                android:layout_width="150dip"
+                android:layout_height="wrap_content"
+                android:layout_margin="5dip"
+                android:drawableRight="@drawable/ic_btn_next"
+                android:drawablePadding="3dip"
+                android:text="@string/next_button_label"
+            />
+        </LinearLayout>
+    </RelativeLayout>
+</LinearLayout>
diff --git a/core/res/res/layout-xlarge/preference_list_content_single.xml b/core/res/res/layout/preference_list_content_single_large.xml
similarity index 100%
rename from core/res/res/layout-xlarge/preference_list_content_single.xml
rename to core/res/res/layout/preference_list_content_single_large.xml
diff --git a/core/res/res/layout/preference_list_fragment.xml b/core/res/res/layout/preference_list_fragment.xml
index 393cecf..4044371 100644
--- a/core/res/res/layout/preference_list_fragment.xml
+++ b/core/res/res/layout/preference_list_fragment.xml
@@ -28,10 +28,6 @@
         android:layout_width="match_parent"
         android:layout_height="0px"
         android:layout_weight="1"
-        android:paddingTop="0dip"
-        android:paddingBottom="48dip"
-        android:paddingLeft="32dip"
-        android:paddingRight="32dip"
         android:clipToPadding="false"
         android:drawSelectorOnTop="false"
         android:cacheColorHint="@android:color/transparent"
diff --git a/core/res/res/layout/preference_list_fragment_large.xml b/core/res/res/layout/preference_list_fragment_large.xml
new file mode 100644
index 0000000..cde84ff
--- /dev/null
+++ b/core/res/res/layout/preference_list_fragment_large.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:background="@android:color/transparent"
+    android:layout_removeBorders="true">
+
+    <ListView android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1"
+        android:paddingTop="0dip"
+        android:paddingBottom="48dip"
+        android:paddingLeft="32dip"
+        android:paddingRight="32dip"
+        android:clipToPadding="false"
+        android:drawSelectorOnTop="false"
+        android:cacheColorHint="@android:color/transparent"
+        android:scrollbarAlwaysDrawVerticalTrack="true" />
+
+    <RelativeLayout android:id="@+id/button_bar"
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_weight="0"
+        android:background="@android:drawable/bottom_bar"
+        android:visibility="gone">
+
+        <Button android:id="@+id/back_button"
+            android:layout_width="150dip"
+            android:layout_height="wrap_content"
+            android:layout_margin="5dip"
+            android:layout_alignParentLeft="true"
+            android:drawableLeft="@drawable/ic_btn_back"
+            android:drawablePadding="3dip"
+            android:text="@string/back_button_label"
+        />
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true">
+
+            <Button android:id="@+id/skip_button"
+                android:layout_width="150dip"
+                android:layout_height="wrap_content"
+                android:layout_margin="5dip"
+                android:text="@string/skip_button_label"
+                android:visibility="gone"
+            />
+
+            <Button android:id="@+id/next_button"
+                android:layout_width="150dip"
+                android:layout_height="wrap_content"
+                android:layout_margin="5dip"
+                android:drawableRight="@drawable/ic_btn_next"
+                android:drawablePadding="3dip"
+                android:text="@string/next_button_label"
+            />
+        </LinearLayout>
+    </RelativeLayout>
+</LinearLayout>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index e9261d9..3731aaa 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"للسماح للتطبيق بالتحكم في الهزاز."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"التحكم في الضوء الوامض"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"للسماح للتطبيق بالتحكم في الضوء الوامض."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"إدارة التفضيلات والأذونات لأجهزة USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"للسماح للتطبيق بإدارة التفضيلات والأذونات لأجهزة USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"تنفيذ بروتوكول MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"لإتاحة الدخول إلى برنامج تشغيل kernel MTP لتنفيذ بروتوكول MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"اختبار الأجهزة"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"الاستخدام بشكل افتراضي لهذا الإجراء."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"محو الإعداد الافتراضي في الإعدادات الرئيسية &gt; التطبيقات &gt; إدارة التطبيقات."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"تحديد إجراء"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"تحديد تطبيق لجهاز USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"ليس هناك تطبيقات يمكنها تنفيذ هذا الإجراء."</string>
     <string name="aerr_title" msgid="653922989522758100">"عذرًا!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"توقف التطبيق <xliff:g id="APPLICATION">%1$s</xliff:g> (العملية <xliff:g id="PROCESS">%2$s</xliff:g>) على نحو غير متوقع. الرجاء المحاولة مرة أخرى."</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index d15baa9..0173f45 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Разрешава на приложението да контролира устройството за вибрация."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"контролиране на фенерчето"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Разрешава на приложението да контролира фенерчето."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"управление на предпочитанията и разрешенията за USB устройства"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Разрешава на приложението да управлява предпочитанията и разрешенията за USB устройства."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"внедряване на MTP протокол"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Разрешава достъп до MTP драйвера на ядрото за внедряване на протокола MTP през USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"тест на хардуера"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Използване по подразбиране за това действие."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Изчистване на стандартната стойност в „Начални настройки“ &gt; „Приложения“ &gt; „Управление на приложенията“."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Избиране на действие"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Избор на приложение за USB устройството"</string>
     <string name="noApplications" msgid="1691104391758345586">"Това действие не може да се изпълни от нито едно приложение."</string>
     <string name="aerr_title" msgid="653922989522758100">"Съжаляваме!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Приложението „<xliff:g id="APPLICATION">%1$s</xliff:g>“ (процес „<xliff:g id="PROCESS">%2$s</xliff:g>“) спря неочаквано. Моля, опитайте отново."</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 263f1c4..e94e7e5 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permet a l\'aplicació controlar el vibrador."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controlar el flaix"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permet a l\'aplicació controlar el flaix."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gestiona les preferències i els permisos dels dispositius USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permet que l\'aplicació gestioni les preferències i els permisos dels dispositius USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementa el protocol MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permet l\'accés al programa de control MTP de kernel per implementar el protocol USB d\'MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"provar el maquinari"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Utilitza-ho de manera predeterminada per a aquesta acció."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Esborra el valor predeterminat a Configuració de la pantalla d\'inici &gt; Aplicacions &gt; Gestiona les aplicacions."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Seleccioneu una acció"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selecciona una aplicació per al dispositiu USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"No hi ha cap aplicació que pugui dur a terme aquesta acció."</string>
     <string name="aerr_title" msgid="653922989522758100">"Ho sentim."</string>
     <string name="aerr_application" msgid="4683614104336409186">"L\'aplicació <xliff:g id="APPLICATION">%1$s</xliff:g> (procés <xliff:g id="PROCESS">%2$s</xliff:g>) s\'ha aturat inesperadament. Torneu-ho a provar."</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index b93989f..0102536 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Umožňuje aplikaci ovládat vibrace."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"ovládání kontrolky"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Umožňuje aplikaci ovládat kontrolku."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"spravovat nastavení a oprávnění pro zařízení USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Umožňuje aplikaci spravovat nastavení a oprávnění pro zařízení USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementace protokolu MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Povoluje přístup k ovladači protokolu MTP jádra za účelem implementace protokolu MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testování hardwaru"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Použít jako výchozí nastavení pro tuto činnost."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Vymažte výchozí hodnoty v Nastavení plochy &gt; Aplikace &gt; Správa aplikací."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Vyberte akci"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Zvolte aplikaci pro zařízení USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Tuto činnost nemohou provádět žádné aplikace."</string>
     <string name="aerr_title" msgid="653922989522758100">"Omlouváme se"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Aplikace <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) byla neočekávaně ukončena. Zkuste to znovu."</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 25246f6..93b59aa 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Lader programmet kontrollere vibratoren."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kontroller lommelygte"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Tillader, at programmet kontrollerer lommelygten."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"administrer præferencer og tilladelser for USB-enheder"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Tillader, at programmet administrerer præferencer og tilladelser for USB-enheder."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementere MTP-protokol"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Tillader adgang til kerne-MTP-driveren for at implementere MTB USB-protokollen."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"test hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Brug som standard til denne handling."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Ryd standard i Startindstillinger &gt; Programmer &gt; Administrer programmer."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Vælg en handling"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Vælg et program for USB-enheden"</string>
     <string name="noApplications" msgid="1691104391758345586">"Der er ingen programmer, der kan foretage denne handling."</string>
     <string name="aerr_title" msgid="653922989522758100">"Beklager!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Programmet <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) er standset uventet. Prøv igen."</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 98e0ef3..db3e9d9 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Ermöglicht der Anwendung, den Vibrationsalarm zu steuern"</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"Lichtanzeige steuern"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Ermöglicht der Anwendung, die Lichtanzeige zu steuern"</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"Einstellungen und Berechtigungen für USB-Geräte verwalten"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Ermöglicht der Anwendung das Verwalten von Einstellungen und Berechtigungen für USB-Geräte"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTP-Protokoll implementieren"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Erlaubt den Zugriff auf den Kernel-MTP-Treiber zur Implementierung des MTP-USB-Protokolls."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"Hardware testen"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Standardmäßig für diese Aktion verwenden"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Standardeinstellung zurücksetzen unter \"Einstellungen &gt; Anwendungen &gt; Anwendungen verwalten\""</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Aktion auswählen"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Anwendung für das USB-Gerät auswählen"</string>
     <string name="noApplications" msgid="1691104391758345586">"Diese Aktion kann von keiner Anwendung ausgeführt werden."</string>
     <string name="aerr_title" msgid="653922989522758100">"Tut uns leid!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Die Anwendung <xliff:g id="APPLICATION">%1$s</xliff:g> (Prozess <xliff:g id="PROCESS">%2$s</xliff:g>) wurde unerwartet beendet. Versuchen Sie es erneut."</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 8b9a8df..571dc43 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Επιτρέπει στην εφαρμογή τον έλεγχο του δονητή."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"έλεγχος φακού"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Επιτρέπει στην εφαρμογή τον έλεγχο του φακού."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"διαχείριση προτιμήσεων και αδειών για συσκευές USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Επιτρέπει στην εφαρμογή να διαχειρίζεται προτιμήσεις και άδειες για συσκευές USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"εφαρμογή πρωτοκόλλου MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Επιτρέπει την πρόσβαση στο πρόγραμμα οδήγησης kernel MTP για την εφαρμογή του πρωτοκόλλου MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"δοκιμή υλικού"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Χρήση από προεπιλογή για αυτήν την ενέργεια."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Εκκαθάριση προεπιλεγμένων σε Ρυθμίσεις αρχικής σελίδας &gt; Εφαρμογές &gt; Διαχείριση εφαρμογών."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Επιλέξτε μια ενέργεια"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Επιλέξτε μια εφαρμογή για τη συσκευή USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Δεν υπάρχουν εφαρμογές, οι οποίες μπορούν να εκτελέσουν αυτήν την ενέργεια."</string>
     <string name="aerr_title" msgid="653922989522758100">"Λυπούμαστε!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Υπήρξε μη αναμενόμενη διακοπή της εφαρμογής <xliff:g id="APPLICATION">%1$s</xliff:g> (διαδικασία <xliff:g id="PROCESS">%2$s</xliff:g>). Προσπαθήστε ξανά."</string>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 0a511eb..7015d48 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Allows the application to control the vibrator."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"control flashlight"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Allows the application to control the flashlight."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"manage preferences and permissions for USB devices"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Allows the application to manage preferences and permissions for USB devices."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implement MTP protocol"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Allows access to the kernel MTP driver to implement the MTP USB protocol."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"test hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Use by default for this action."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Clear default in Home Settings &gt; Applications &gt; Manage applications."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Select an action"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Select an application for the USB device"</string>
     <string name="noApplications" msgid="1691104391758345586">"No applications can perform this action."</string>
     <string name="aerr_title" msgid="653922989522758100">"Sorry!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"The application <xliff:g id="APPLICATION">%1$s</xliff:g> (process <xliff:g id="PROCESS">%2$s</xliff:g>) has stopped unexpectedly. Please try again."</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 688565b..0052b18 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Admite que la aplicación controle el vibrador."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controlar linterna"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Admite que la aplicación controle la linterna."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"administrar preferencias y permisos para los dispositivos USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permite a la aplicación administrar preferencias y permisos para los dispositivos USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementar protocolo MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permite acceso al driver kernel MTP para implementar el protocolo MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"probar el hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Utilizar de manera predeterminada en esta acción."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Borrar la predeterminación en Configuración de la página principal &gt; Aplicaciones &gt; Administrar aplicaciones."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Seleccionar una acción"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selecciona una aplicación para el dispositivo USB."</string>
     <string name="noApplications" msgid="1691104391758345586">"Ninguna aplicación puede realizar esta acción."</string>
     <string name="aerr_title" msgid="653922989522758100">"¡Lo sentimos!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"La aplicación <xliff:g id="APPLICATION">%1$s</xliff:g> (proceso <xliff:g id="PROCESS">%2$s</xliff:g>) se ha detenido de forma imprevista. Vuelve a intentarlo."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 9ab0169..bdca91f 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permite que la aplicación controle la función de vibración."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controlar linterna"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permite que la aplicación controle la función de linterna."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"administrar preferencias y permisos de dispositivos USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permite que la aplicación administre las preferencias y los permisos de los dispositivos USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementar protocolo MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permite el acceso al controlador MTP del kernel para implementar el protocolo USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"probar hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Utilizar de forma predeterminada para esta acción"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Borrar valores predeterminados en la página de configuración de la pantalla de inicio del teléfono &gt; Aplicaciones &gt; Administrar aplicaciones\"."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Seleccionar una acción"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Seleccionar una aplicación para el dispositivo USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Ninguna aplicación puede realizar esta acción."</string>
     <string name="aerr_title" msgid="653922989522758100">"Lo sentimos."</string>
     <string name="aerr_application" msgid="4683614104336409186">"La aplicación <xliff:g id="APPLICATION">%1$s</xliff:g> (proceso <xliff:g id="PROCESS">%2$s</xliff:g>) se ha interrumpido inesperadamente. Inténtalo de nuevo."</string>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 655f250..1f3ca7e 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"به برنامه کاربردی اجازه می دهد لرزاننده را کنترل کند."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"کنترل چراغ قوه"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"به برنامه کاربردی اجازه می دهد چراغ قوه را کنترل کند."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"مدیریت تنظیمات برگزیده و مجوزها برای دستگاه های USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"به برنامه کاربردی جهت مدیریت تنظیمات برگزیده و مجوزها برای دستگاه های USB اجازه می دهد."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"اعمال پروتکل MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"دسترسی به درایور کرنل MTP جهت اعمال پروتکل MTP USB را اجازه می دهد."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"تست سخت افزار"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"استفاده به صورت پیش فرض برای این عملکرد."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"پاک کردن موارد پیش فرض در تنظیمات صفحه اصلی &gt; برنامه های کاربردی &gt; مدیریت برنامه ها."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"انتخاب یک عملکرد"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"انتخاب یک برنامه کاربردی برای دستگاه USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"هیچ برنامه ای نمی تواند این عملکرد را اجرا کند."</string>
     <string name="aerr_title" msgid="653922989522758100">"متأسفیم!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"برنامه کاربردی <xliff:g id="APPLICATION">%1$s</xliff:g> ( فرآیند <xliff:g id="PROCESS">%2$s</xliff:g>) به طور غیر منتظره ای متوقف شد. لطفاً دوباره امتحان کنید."</string>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 28312a1..c9b6826 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Antaa sovelluksen hallita värinää."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"hallitse taskulamppua"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Antaa sovelluksen hallita lamppua."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"hallinnoi USB-laitteiden asetuksia ja käyttöoikeuksia"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Antaa sovelluksen hallinnoida USB-laitteiden asetuksia ja käyttöoikeuksia"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"ota käyttöön MTP-protokolla"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Antaa sovelluksen käyttää kernel-MTP-ajuria ja ottaa käyttöön MTP USB-protokollan."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testaa laitteistoa"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Käytä oletuksena tälle toiminnolle."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Tyhjennä oletusasetus kohdassa Etusivun asetukset &gt; Sovellukset &gt; Hallinnoi sovelluksia."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Valitse toiminto"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Valitse sovellus USB-laitteelle"</string>
     <string name="noApplications" msgid="1691104391758345586">"Yksikään sovellus ei voi suorittaa tätä toimintoa."</string>
     <string name="aerr_title" msgid="653922989522758100">"Pahoittelemme!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Sovellus <xliff:g id="APPLICATION">%1$s</xliff:g> (prosessi <xliff:g id="PROCESS">%2$s</xliff:g>) pysähtyi yllättäen. Yritä uudelleen."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 7a6c43a..7e7b24e 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permet à l\'application de contrôler le vibreur."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"Contrôle de la lampe de poche"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permet à l\'application de contrôler la lampe de poche."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gérer les préférences et les autorisations des périphériques USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permet à l\'application de gérer les préférences et les autorisations des périphériques USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"mettre en œuvre le protocole MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permet l\'accès au pilote MTP du noyau à des fins de mise en œuvre du protocole USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"Tests du matériel"</string>
@@ -462,11 +460,11 @@
     <string name="permdesc_readDictionary" msgid="1082972603576360690">"Permet à une application de lire tous les mots, noms et expressions que l\'utilisateur a pu enregistrer dans son dictionnaire personnel."</string>
     <string name="permlab_writeDictionary" msgid="6703109511836343341">"Enregistrement dans le dictionnaire défini par l\'utilisateur"</string>
     <string name="permdesc_writeDictionary" msgid="2241256206524082880">"Permet à une application d\'enregistrer de nouveaux mots dans le dictionnaire personnel de l\'utilisateur."</string>
-    <string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modifier/supprimer le contenu de la mémoire de stockage USB"</string>
+    <string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modif./suppr. contenu mémoire USB"</string>
     <string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modifier/supprimer le contenu de la carte SD"</string>
     <string name="permdesc_sdcardWrite" product="nosdcard" msgid="6594393334785738252">"Autorise une application à écrire sur la mémoire USB."</string>
     <string name="permdesc_sdcardWrite" product="default" msgid="6643963204976471878">"Autorise une application à écrire sur la carte SD."</string>
-    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modif./suppr. contenu mémoire interne support"</string>
+    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modif./suppr. contenu mémoire interne"</string>
     <string name="permdesc_mediaStorageWrite" product="default" msgid="8232008512478316233">"Permet à une application de modifier le contenu de la mémoire de stockage interne du support."</string>
     <string name="permlab_cache_filesystem" msgid="5656487264819669824">"accéder au système de fichiers en cache"</string>
     <string name="permdesc_cache_filesystem" msgid="1624734528435659906">"Permet à une application de lire et d\'écrire dans le système de fichiers en cache."</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Utiliser cette application par défaut pour cette action"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Effacer les paramètres par défaut dans les Paramètres de page d\'accueil &gt; Applications &gt; Gérer les applications."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Sélectionner une action"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Sélectionnez une application pour le périphérique USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Aucune application ne peut effectuer cette action."</string>
     <string name="aerr_title" msgid="653922989522758100">"Désolé !"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Fermeture soudaine de l\'application <xliff:g id="APPLICATION">%1$s</xliff:g> (du processus <xliff:g id="PROCESS">%2$s</xliff:g>). Merci de réessayer."</string>
@@ -922,11 +919,11 @@
     <string name="ext_media_unmountable_notification_title" product="default" msgid="6410723906019100189">"Carte SD endommagée"</string>
     <string name="ext_media_unmountable_notification_message" product="nosdcard" msgid="529021299294450667">"La mémoire de stockage USB est endommagée. Un reformatage est peut-être nécessaire."</string>
     <string name="ext_media_unmountable_notification_message" product="default" msgid="6902531775948238989">"La carte SD est endommagée. Vous devrez peut-être la reformater."</string>
-    <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"Mémoire de stockage USB retirée inopinément"</string>
+    <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"Mémoire USB retirée inopinément"</string>
     <string name="ext_media_badremoval_notification_title" product="default" msgid="6872152882604407837">"Carte SD retirée inopinément"</string>
     <string name="ext_media_badremoval_notification_message" product="nosdcard" msgid="4329848819865594241">"Désinstaller la mémoire de stockage USB avant de la retirer pour éviter toute perte de données."</string>
     <string name="ext_media_badremoval_notification_message" product="default" msgid="7260183293747448241">"Désinstaller la carte SD avant de la retirer pour éviter toute perte de données."</string>
-    <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"La mémoire de stockage USB peut être retirée en toute sécurité."</string>
+    <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"Vous pouvez retirer la mémoire USB."</string>
     <string name="ext_media_safe_unmount_notification_title" product="default" msgid="6729801130790616200">"La carte SD peut être retirée en toute sécurité"</string>
     <string name="ext_media_safe_unmount_notification_message" product="nosdcard" msgid="6142195361606493530">"Vous pouvez retirer la mémoire de stockage USB en toute sécurité."</string>
     <string name="ext_media_safe_unmount_notification_message" product="default" msgid="568841278138377604">"Vous pouvez retirer la carte SD en toute sécurité."</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index 860bec9..25e66b4 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Aplikaciji omogućuje nadzor nad vibracijom."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"nadzor bljeskalice"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Aplikaciji omogućuje nadzor nad bljeskalicom."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"upravljanje postavkama i dozvolama za USB uređaje"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Aplikaciji omogućuje upravljanje postavkama i dozvolama za USB uređaje."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"Primjena MTP protokola"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Omogućuje pristup upravljačkom programu jezgre MTP-a radi implementacije MTP USB protokola."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testiranje hardvera"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Koristi se kao zadana postavka za ovu lokaciju."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Izbrišite zadane postavke u izborniku Početne postavke &gt; Aplikacije &gt; Upravljanje aplikacijama."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Odaberite radnju"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Odaberite aplikaciju za USB uređaj"</string>
     <string name="noApplications" msgid="1691104391758345586">"Tu radnju ne može izvesti nijedna aplikacija."</string>
     <string name="aerr_title" msgid="653922989522758100">"Žao nam je."</string>
     <string name="aerr_application" msgid="4683614104336409186">"Aplikacija <xliff:g id="APPLICATION">%1$s</xliff:g> (postupak <xliff:g id="PROCESS">%2$s</xliff:g>) neočekivano je zaustavljen. Pokušajte ponovo."</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index f962f35..ea4f81f 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Lehetővé teszi az alkalmazás számára a rezgés vezérlését."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"vaku vezérlése"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Lehetővé teszi az alkalmazás számára a vaku vezérlését."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"USB-eszközök preferenciáinak és engedélyeinek kezelése"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Lehetővé teszi, hogy az alkalmazás kezelje az USB-eszközök preferenciáit és engedélyeit."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTP-protokoll megvalósítása"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Hozzáférést biztosít a kernel MTP illesztőprogramjához az MTP USB-protokoll megvalósításának céljából."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"hardver tesztelése"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Ez legyen az alapértelmezett program ehhez a művelethez."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Az alapértelmezés törlése a Főoldal beállításai &gt; Alkalmazások &gt; Alkalmazások kezelése menüben lehetséges."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Válasszon műveletet"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Válasszon egy alkalmazást az USB-eszköz számára"</string>
     <string name="noApplications" msgid="1691104391758345586">"Egyik alkalmazás sem tudja végrehajtani ezt a műveletet."</string>
     <string name="aerr_title" msgid="653922989522758100">"Sajnáljuk!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"A(z) <xliff:g id="APPLICATION">%1$s</xliff:g> alkalmazás <xliff:g id="PROCESS">%2$s</xliff:g> folyamata váratlanul leállt. Kérjük, próbálja újra."</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 7b10651..4d5352a 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Mengizinkan aplikasi mengontrol penggetar."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"mengontrol lampu senter"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Mengizinkan aplikasi mengontrol lampu senter."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"kelola preferensi dan izin untuk perangkat USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Membiarkan aplikasi mengelola preferensi dan izin untuk perangkat USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementasikan protokol MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Izinkan akses pada driver MTP kernel untuk mengimplementasikan protokol USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"uji perangkat keras"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Gunakan secara bawaan untuk tindakan ini."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Bersihkan bawaan pada Setelan Beranda &gt; Aplikasi &gt; Kelola aplikasi."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Pilih tindakan"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Pilih sebuah aplikasi untuk perangkat USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Tidak ada aplikasi dapat melakukan tindakan ini."</string>
     <string name="aerr_title" msgid="653922989522758100">"Maaf!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"<xliff:g id="APPLICATION">%1$s</xliff:g> aplikasi (<xliff:g id="PROCESS">%2$s</xliff:g> proses) berhenti tiba-tiba. Harap coba lagi."</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 76b6d1d..3196dbe 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Consente all\'applicazione di controllare la vibrazione."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controllo flash"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Consente all\'applicazione di controllare il flash."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gestione preferenze e autorizzazioni per dispositivi USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Consente all\'applicazione di gestire le preferenze e le autorizzazioni relative ai dispositivi USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementa protocollo MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Consente di accedere al driver MTP del kernel per implementare il protocollo USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"esecuzione test hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Usa come predefinita per questa azione."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Cancella predefinita in Home &gt; Impostazioni &gt; Applicazioni &gt; Gestisci applicazioni."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Seleziona un\'azione"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Seleziona un\'applicazione per il dispositivo USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Nessuna applicazione è in grado di svolgere questa azione."</string>
     <string name="aerr_title" msgid="653922989522758100">"Spiacenti."</string>
     <string name="aerr_application" msgid="4683614104336409186">"Interruzione imprevista dell\'applicazione <xliff:g id="APPLICATION">%1$s</xliff:g> (processo <xliff:g id="PROCESS">%2$s</xliff:g>). Riprova."</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 1b597c8..07fab9e 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"מאפשר ליישום לשלוט ברטט."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"שליטה בפנס"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"מאפשר ליישום לשלוט בפנס."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"נהל העדפות ואישורים עבור התקני USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"מאפשר ליישום לנהל העדפות ואישורים עבור התקני USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"יישם פרוטוקול MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"מאפשר גישה למנהל התקן MTP של הליבה כדי ליישם פרוטוקול USB של MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"בדוק חומרה"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"השתמש כברירת מחדל עבור פעולה זו."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"נקה את ברירת המחדל ב\'הגדרות דף הבית\' &gt; \'יישומים\' &gt; \'נהל יישומים\'."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"בחר פעולה"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"בחר יישום עבור התקן ה-USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"אין יישומים שיכולים לבצע פעולה זו."</string>
     <string name="aerr_title" msgid="653922989522758100">"מצטערים!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"היישום <xliff:g id="APPLICATION">%1$s</xliff:g> (תהליך <xliff:g id="PROCESS">%2$s</xliff:g>) הופסק באופן לא צפוי. נסה שוב."</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 7594744..c6a5f95 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"バイブレーションの制御をアプリケーションに許可します。"</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"ライトのコントロール"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"ライトの制御をアプリケーションに許可します。"</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"USBデバイスの設定と許可の管理"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"USBデバイスの設定と許可の管理をアプリケーションに許可します。"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTPプロトコルの実装"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"カーネルMTPドライバにアクセスしてMTP USBプロトコルを実装することを許可します。"</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"ハードウェアのテスト"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"常にこの操作で使用する"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"ホームの[設定]&gt;[アプリケーション]&gt;[アプリケーションの管理]でデフォルト設定をクリアします。"</string>
     <string name="chooseActivity" msgid="1009246475582238425">"操作の選択"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"USBデバイス用アプリケーションを選択"</string>
     <string name="noApplications" msgid="1691104391758345586">"この操作を実行できるアプリケーションはありません。"</string>
     <string name="aerr_title" msgid="653922989522758100">"エラー"</string>
     <string name="aerr_application" msgid="4683614104336409186">"<xliff:g id="APPLICATION">%1$s</xliff:g>(<xliff:g id="PROCESS">%2$s</xliff:g>)が予期せず停止しました。やり直してください。"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index a718344..1b7051e 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"애플리케이션이 진동을 제어할 수 있도록 합니다."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"카메라 플래시 제어"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"애플리케이션이 카메라 플래시를 제어할 수 있도록 합니다."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"USB 기기에 대한 환경설정 및 권한 관리"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"애플리케이션이 USB 기기에 대한 환경설정 및 권한을 관리하도록 허용합니다."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTP 프로토콜 구현"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"커널 MTP 드라이버에 액세스하여 MTP USB 프로토콜을 구현할 수 있도록 허용합니다."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"하드웨어 테스트"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"이 작업에 대해 기본값으로 사용"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"홈 설정 &gt; 애플리케이션 &gt; 애플리케이션 관리에서 기본값을 지웁니다."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"작업 선택"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"USB 기기에 대한 애플리케이션 선택"</string>
     <string name="noApplications" msgid="1691104391758345586">"작업을 수행할 수 있는 애플리케이션이 없습니다."</string>
     <string name="aerr_title" msgid="653922989522758100">"죄송합니다."</string>
     <string name="aerr_application" msgid="4683614104336409186">"<xliff:g id="APPLICATION">%1$s</xliff:g> 애플리케이션(<xliff:g id="PROCESS">%2$s</xliff:g> 프로세스)이 예상치 않게 중지되었습니다. 다시 시도해 주세요."</string>
diff --git a/core/res/res/values-large/dimens.xml b/core/res/res/values-large/dimens.xml
index 5691548..cd1847f 100644
--- a/core/res/res/values-large/dimens.xml
+++ b/core/res/res/values-large/dimens.xml
@@ -19,4 +19,7 @@
 <resources>
     <item type="dimen" name="dialog_min_width_major">55%</item>
     <item type="dimen" name="dialog_min_width_minor">80%</item>
+
+    <!-- Preference UI dimensions for larger screens. -->
+    <dimen name="preference_widget_width">56dp</dimen>
 </resources>
diff --git a/core/res/res/values-large/styles.xml b/core/res/res/values-large/styles.xml
new file mode 100644
index 0000000..96a8c84
--- /dev/null
+++ b/core/res/res/values-large/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <style name="Widget.Holo.PreferenceFrameLayout">
+        <item name="android:borderTop">0dip</item>
+        <item name="android:borderBottom">48dip</item>
+        <item name="android:borderLeft">32dip</item>
+        <item name="android:borderRight">32dip</item>
+    </style>
+</resources>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index 2580af9..850a6c9 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Leidžia programai valdyti vibratorių."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"valdyti šviesos signalą"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Leidžia programai valdyti šviesos signalą."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"valdyti USB įrenginių nuostatas ir leidimus"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Leidžiama programai valdyti USB įrenginių nuostatas ir leidimus."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"taikyti MTP protokolą"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Leidžiama prieiga prie pagrindinės MTP tvarkyklės taikyti MTP USB protokolą."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"bandyti aparatinę įrangą"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Šiam veiksmui tai naudoti pagal numatytuosius nustatymus."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Išvalykite numatytuosius nustatymus apsilankę „Pagrindiniai nustatymai“ &gt; „Programos“ &gt; „Valdyti programas“."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"pasirinkti veiksmą"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Pasirinkti programą USB įrenginiui"</string>
     <string name="noApplications" msgid="1691104391758345586">"Šio veiksmo negali atlikti jokios programos."</string>
     <string name="aerr_title" msgid="653922989522758100">"Apgailestaujame!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Programa <xliff:g id="APPLICATION">%1$s</xliff:g> (<xliff:g id="PROCESS">%2$s</xliff:g> procesas) netikėtai sustojo. Bandykite dar kartą."</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index b7adf2d..a4936ac 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Ļauj lietojumprogrammai kontrolēt vibrozvanu."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kontrolēt uzliesmojumu"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Ļauj lietojumprogrammai kontrolēt uzliesmojumu."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"USB ierīču preferenču un atļauju pārvaldība"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Ļauj lietojumprogrammai pārvaldīt preferences un atļaujas saistībā ar USB ierīcēm."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"Ieviests MTP protokols"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Ļauj piekļūt kodola MTP dzinim, lai ieviestu MTP USB protokolu."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"pārbaudīt aparatūru"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Pēc noklusējuma izmantot šai darbībai."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Notīriet noklusējumu šeit: Sākuma iestatījumi &gt; Lietojumprogrammas &gt; Lietojumprogrammu pārvaldība."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Atlasiet darbību"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Atlasīt lietojumprogrammu USB ierīcei"</string>
     <string name="noApplications" msgid="1691104391758345586">"Šo darbību nevar veikt neviena lietojumprogramma."</string>
     <string name="aerr_title" msgid="653922989522758100">"Atvainojiet!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Lietojumprogrammas <xliff:g id="APPLICATION">%1$s</xliff:g> (process <xliff:g id="PROCESS">%2$s</xliff:g>) darbība neparedzēti tika apturēta. Lūdzu, mēģiniet vēlreiz."</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index d3463fd..3b15f88 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Lar applikasjonen kontrollere vibratoren."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kontrollere lommelykten"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Lar applikasjonen kontrollere lommelykten."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"administrere innstillinger og tillatelser for USB-enheter"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Tillater at programmet administrerer innstillinger og tillatelser for USB-enheter."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementer MTP-protokoll"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Tillater tilgang til kjerne-MTP-driver for implementering av MTP USB-protokollen."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"teste maskinvare"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Bruk som standardvalg."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Fjern standardvalg i Innstillinger &gt; Applikasjoner &gt; Installerte applikasjoner."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Velg en aktivitet"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Velg et program for USB-enheten"</string>
     <string name="noApplications" msgid="1691104391758345586">"Ingen applikasjoner kan gjøre dette."</string>
     <string name="aerr_title" msgid="653922989522758100">"Beklager!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Applikasjonen <xliff:g id="APPLICATION">%1$s</xliff:g> (prosess <xliff:g id="PROCESS">%2$s</xliff:g>) stoppet uventet. Prøv igjen."</string>
@@ -922,11 +919,11 @@
     <string name="ext_media_unmountable_notification_title" product="default" msgid="6410723906019100189">"Skadet minnekort"</string>
     <string name="ext_media_unmountable_notification_message" product="nosdcard" msgid="529021299294450667">"USB-lagring er skadet. Det kan være nødvendig å formatere enheten på nytt."</string>
     <string name="ext_media_unmountable_notification_message" product="default" msgid="6902531775948238989">"Minnekortet er skadet. Du må kanskje formatere det."</string>
-    <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"USB-lagring fjernet uventet"</string>
+    <string name="ext_media_badremoval_notification_title" product="nosdcard" msgid="1661683031330951073">"USB-enhet fjernet uventet"</string>
     <string name="ext_media_badremoval_notification_title" product="default" msgid="6872152882604407837">"Minnekortet ble tatt ut uventet"</string>
     <string name="ext_media_badremoval_notification_message" product="nosdcard" msgid="4329848819865594241">"Koble fra USB-enheten før du tar den ut for å unngå tap av data."</string>
     <string name="ext_media_badremoval_notification_message" product="default" msgid="7260183293747448241">"Avmonter minnekortet før det tas ut, for å unngå datatap."</string>
-    <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"USB-lagring kan trygt fjernes"</string>
+    <string name="ext_media_safe_unmount_notification_title" product="nosdcard" msgid="3967973893270360230">"USB-enheten kan trygt fjernes"</string>
     <string name="ext_media_safe_unmount_notification_title" product="default" msgid="6729801130790616200">"Trygt å ta ut minnekort"</string>
     <string name="ext_media_safe_unmount_notification_message" product="nosdcard" msgid="6142195361606493530">"Det er trygt å ta ut enheten for USB-lagring."</string>
     <string name="ext_media_safe_unmount_notification_message" product="default" msgid="568841278138377604">"Det er trygt å ta ut minnekortet."</string>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index 68ab40c..5ca1e4d 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Hiermee kan de app de trilstand beheren."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"zaklamp bedienen"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Hiermee kan de app de zaklamp bedienen."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"voorkeuren en rechten voor USB-apparaten beheren"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Hiermee kan de app voorkeuren en rechten voor USB-apparaten beheren."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTP-protocol implementeren"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Staat toegang tot de kernel van de MTP-driver toe voor het implementeren van het MTP-USB-protocol."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"hardware testen"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Standaard gebruiken voor deze actie."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Wis standaardinstelling via startscherm: \'Instellingen\' &gt; \'Toepassingen\' &gt; \'Toepassingen beheren\'."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Een actie selecteren"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selecteer een app voor het USB-apparaat"</string>
     <string name="noApplications" msgid="1691104391758345586">"Geen enkele app kan deze actie uitvoeren."</string>
     <string name="aerr_title" msgid="653922989522758100">"Helaas!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"De app <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) is onverwachts gestopt. Probeer het opnieuw."</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 4c5f062..de44e72 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Pozwala aplikacjom na kontrolowanie wibracji."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kontrolowanie latarki"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Pozwala aplikacji kontrolować latarkę."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"zarządzanie ustawieniami i uprawnieniami urządzeń USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Umożliwia aplikacji zarządzanie ustawieniami i uprawnieniami urządzeń USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementowanie protokołu MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Zezwala na dostęp do sterownika MTP jądra w celu implementacji protokołu USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testowanie sprzętu"</string>
@@ -466,7 +464,7 @@
     <string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modyfikowanie/usuwanie zawartości karty SD"</string>
     <string name="permdesc_sdcardWrite" product="nosdcard" msgid="6594393334785738252">"Umożliwia zapis na nośnik USB."</string>
     <string name="permdesc_sdcardWrite" product="default" msgid="6643963204976471878">"Umożliwia aplikacji zapis na karcie SD."</string>
-    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modyf./usuw. zawartości pam. wewn."</string>
+    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modyfikowanie/usuwanie zawartości pamięci wew."</string>
     <string name="permdesc_mediaStorageWrite" product="default" msgid="8232008512478316233">"Zezwala aplikacji na modyfikowanie zawartości pamięci wewnętrznej."</string>
     <string name="permlab_cache_filesystem" msgid="5656487264819669824">"dostęp do systemu plików pamięci podręcznej"</string>
     <string name="permdesc_cache_filesystem" msgid="1624734528435659906">"Zezwala aplikacji na odczyt i zapis w systemie plików pamięci podręcznej."</string>
@@ -668,7 +666,7 @@
     <string name="save_password_label" msgid="6860261758665825069">"Potwierdź"</string>
     <string name="double_tap_toast" msgid="1068216937244567247">"Wskazówka: dotknij dwukrotnie, aby powiększyć lub pomniejszyć."</string>
     <string name="autofill_this_form" msgid="1272247532604569872">"Autouzupełnianie"</string>
-    <string name="setup_autofill" msgid="8154593408885654044">"Konfiguruj autouzupełnianie"</string>
+    <string name="setup_autofill" msgid="8154593408885654044">"Opcje autouzupełniania"</string>
     <string name="autofill_address_name_separator" msgid="2504700673286691795">" "</string>
     <string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
     <string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Używaj domyślnie dla tej czynności."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Wyczyść domyślne w: Ustawienia strony głównej &gt; Aplikacje &gt; Zarządzaj aplikacjami."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Wybierz czynność"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Wybierz aplikację dla urządzenia USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Żadna z aplikacji nie może wykonać tej czynności."</string>
     <string name="aerr_title" msgid="653922989522758100">"Przepraszamy!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Aplikacja <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) została niespodziewanie zatrzymana. Spróbuj ponownie."</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 014bf88..1e2bd22 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permite à aplicação controlar o vibrador."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controlar lanterna"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permite à aplicação controlar a lanterna."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gerir preferências e permissões para dispositivos USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permite à aplicação gerir as preferências e permissões para dispositivos USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementar protocolo MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permite o acesso ao controlador MTP de kernel para implementar o protocolo MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testar hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Utilizar por predefinição para esta acção."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Limpar predefinição em Definições iniciais &gt; Aplicações &gt; Gerir aplicações."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Seleccionar uma acção"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selecione uma aplicação para o dispositivo USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Nenhuma aplicação pode efectuar esta acção."</string>
     <string name="aerr_title" msgid="653922989522758100">"Lamentamos."</string>
     <string name="aerr_application" msgid="4683614104336409186">"A aplicação <xliff:g id="APPLICATION">%1$s</xliff:g> (processo <xliff:g id="PROCESS">%2$s</xliff:g>) parou de forma inesperada. Tente novamente."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index 07907fb..fd3775a 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permite que o aplicativo controle o vibrador."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"controlar lanterna"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permite que o aplicativo controle a lanterna."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gerenciar preferências e permissões de aplicativos USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permite que o aplicativo gerencie as preferências e as permissões de aplicativos USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementar protocolo MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permite acesso ao driver MTP do núcleo para implementar o protocolo USB MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testar hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Usar como padrão para esta ação."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Limpar o padrão em Configurações da página inicial &gt; Aplicativos &gt; Gerenciar aplicativos."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Selecionar uma ação"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selecione um aplicativo para o dispositivo USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Nenhum aplicativo pode realizar esta ação."</string>
     <string name="aerr_title" msgid="653922989522758100">"Desculpe!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"O aplicativo <xliff:g id="APPLICATION">%1$s</xliff:g> (processo <xliff:g id="PROCESS">%2$s</xliff:g>) parou inesperadamente. Tente novamente."</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 59fc5c9..b388128 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Permite aplicaţiei să controleze mecanismul de vibrare."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"control lanternă"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Permite aplicaţiei să controleze lanterna."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"gestionaţi preferinţele şi permisiunile pentru dispozitivele USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Permite aplicaţiei să gestioneze preferinţele şi permisiunile pentru dispozitivele USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementare protocol MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Permite accesul la driverul MTP al nucleului pentru a implementa protocolul USB pentru MTP."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testare hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Se utilizează în mod prestabilit pentru această acţiune."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Ştergeţi setările prestabilite din Setări pagină de pornire &gt; Aplicaţii &gt; Gestionare aplicaţii."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Selectaţi o acţiune"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Selectaţi o aplicaţie pentru dispozitivul USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Această acţiune nu poate fi efectuată de nicio aplicaţie."</string>
     <string name="aerr_title" msgid="653922989522758100">"Ne pare rău!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Aplicaţia <xliff:g id="APPLICATION">%1$s</xliff:g> (procesul <xliff:g id="PROCESS">%2$s</xliff:g>) s-a oprit în mod neaşteptat. Încercaţi din nou."</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index ff67961..10a2898 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Позволяет приложению управлять виброзвонком."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"управлять вспышкой"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Позволяет приложению управлять вспышкой."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"управлять настройками и разрешениями для USB-устройств"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Приложение может управлять настройками и разрешениями для USB-устройств."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"Реализовать протокол MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Разрешает доступ к драйверу основного устройства MTP для реализации протокола MTP USB"</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"проверять аппаратное обеспечение"</string>
@@ -466,8 +464,8 @@
     <string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"изменять/удалять содержимое SD-карты"</string>
     <string name="permdesc_sdcardWrite" product="nosdcard" msgid="6594393334785738252">"Разрешает приложению запись на USB-накопитель."</string>
     <string name="permdesc_sdcardWrite" product="default" msgid="6643963204976471878">"Разрешает приложению запись на SD-карту"</string>
-    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"изм./удал. содерж. мультимедиа"</string>
-    <string name="permdesc_mediaStorageWrite" product="default" msgid="8232008512478316233">"Позволяет приложению изменять содержание внутреннего хранилища мультимедиа."</string>
+    <string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"изменение/удаление данных из внутреннего хранилища мультимедиа"</string>
+    <string name="permdesc_mediaStorageWrite" product="default" msgid="8232008512478316233">"Приложение сможет изменять содержание внутреннего хранилища мультимедиа."</string>
     <string name="permlab_cache_filesystem" msgid="5656487264819669824">"получать доступ к кэшу файловой системы"</string>
     <string name="permdesc_cache_filesystem" msgid="1624734528435659906">"Разрешает программам доступ для записи и чтения к кэшу файловой системы."</string>
     <string name="permlab_use_sip" msgid="5986952362795870502">"совершать и принимать интернет-вызовы"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"По умолчанию для этого действия"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Удалить настройки по умолчанию: главный экран &gt; \"Настройки\" &gt; \"Приложения\" &gt; \"Управление приложениями\"."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Выберите действие"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Выбор приложения для USB-устройства"</string>
     <string name="noApplications" msgid="1691104391758345586">"Это действие не может выполнять ни одно приложение."</string>
     <string name="aerr_title" msgid="653922989522758100">"Ошибка приложения!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Произошла неожиданная остановка приложения <xliff:g id="APPLICATION">%1$s</xliff:g> (процесс <xliff:g id="PROCESS">%2$s</xliff:g>). Повторите попытку."</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 5d10d27..8a37fd1 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Umožňuje aplikácii ovládať vibrácie."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"ovládanie kontrolky"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Umožňuje aplikácii ovládať kontrolku."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"spravovať predvoľby a povolenia zariadení USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Povolí aplikácii spravovať predvoľby a povolenia zariadení USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementovať protokol MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Povoľuje prístup k ovládaču kernel MTP na implementáciu protokolu MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testovanie hardvéru"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Použiť ako predvolené nastavenie pre túto akciu."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Vymazanie predvolených hodnôt v časti Nastavenia plochy &gt; Aplikácie &gt; Správa aplikácií."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Vyberte akciu"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Vyberte aplikáciu pre zariadenia USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Túto akciu nemôžu vykonávať žiadne aplikácie."</string>
     <string name="aerr_title" msgid="653922989522758100">"Je nám ľúto!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Aplikácia <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) bola neočakávane zastavená. Skúste to znova."</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index 3d003fb..6ee4ac0 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Programu dovoljuje nadzor vibriranja."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"nadzor svetilke"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Programu dovoljuje nadzor svetilke."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"upravljanje nastavitev in dovoljenj za naprave USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Omogoči programu upravljanje nastavitev in dovoljenj za naprave USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"uveljavitev protokola MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Omogoča dostop do gonilnika jedra MTP za uveljavitev protokola MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"preskušanje strojne opreme"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Privzeta uporaba za to dejanje."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Počistite privzete nastavitve v razdelku Osnovne nastavitve &gt; Programi &gt; Upravljanje programov."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Izberite dejanje"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Izberite program za napravo USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Tega dejanja ne more izvesti noben program."</string>
     <string name="aerr_title" msgid="653922989522758100">"Oprostite."</string>
     <string name="aerr_application" msgid="4683614104336409186">"Program <xliff:g id="APPLICATION">%1$s</xliff:g> (postopek <xliff:g id="PROCESS">%2$s</xliff:g>) se je nepričakovano ustavil. Poskusite znova."</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index a8d9e29..6faf9da 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Омогућава да апликација контролише вибрације."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"контрола осветљења"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Омогућава да апликација контролише осветљење."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"управљање подешавањима и дозволама за USB уређаје"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Омогућава да апликација управља подешавањима и дозволама за USB уређаје."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"примени MTP протокол"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Омогућава приступ основном MTP управљачком програму ради примене MTP USB протокола."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"тестирање хардвера"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Подразумевано користи за ову радњу."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Обришите подразумевана подешавања у оквиру ставки Подешавања почетне странице &gt; Апликације &gt; Управљање апликацијама."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Избор радње"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Избор апликације за USB уређај"</string>
     <string name="noApplications" msgid="1691104391758345586">"Ниједна апликација не може да изврши ову радњу."</string>
     <string name="aerr_title" msgid="653922989522758100">"Жао нам је!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Апликација <xliff:g id="APPLICATION">%1$s</xliff:g> (процес <xliff:g id="PROCESS">%2$s</xliff:g>) је неочекивано заустављена. Покушајте поново."</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 9b93047..fcc1fdd 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Tillåter att programmet styr vibratorn."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"styra lampa"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Tillåter att programmet styr lampan."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"hantera inställningar och behörighet för USB-enheter"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Tillåter att programmet hanterar inställningar och behörigheter för USB-enheter."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"implementera MTP-protokoll"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Ger åtkomst till MTP-kerneldrivrutinen för att implementera MTP/USB-protokollet."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"testa maskinvara"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Använd som standard för denna åtgärd."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Rensa standardinställning i Startinställningar &gt; Appar &gt; Hantera appar."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Välj en åtgärd"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Välj ett program för USB-enheten"</string>
     <string name="noApplications" msgid="1691104391758345586">"Inga appar kan utföra den här åtgärden."</string>
     <string name="aerr_title" msgid="653922989522758100">"Tyvärr!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Processen <xliff:g id="PROCESS">%2$s</xliff:g> för programmet <xliff:g id="APPLICATION">%1$s</xliff:g> stoppades oväntat. Försök igen."</string>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index 62dfc29..fae3853 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"อนุญาตให้แอปพลิเคชันควบคุมการสั่นเตือน"</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"ควบคุมไฟฉาย"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"อนุญาตให้แอปพลิเคชันควบคุมไฟฉาย"</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"จัดการค่ากำหนดและการอนุญาตสำหรับอุปกรณ์ USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"อนุญาตให้แอปพลิเคชันจัดการค่ากำหนดและการอนุญาตสำหรับอุปกรณ์ USB"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"ใช้โปรโตคอล MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"อนุญาตการเข้าถึงไดรเวอร์ Kernel MTP เพื่อใช้โปรโตคอล MTP USB"</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"ทดสอบฮาร์ดแวร์"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"ใช้ค่าเริ่มต้นสำหรับการทำงานนี้"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"ล้างข้อมูลค่าเริ่มต้นในการตั้งค่าหน้าแรก &gt; แอปพลิเคชัน &gt; จัดการแอปพลิเคชัน"</string>
     <string name="chooseActivity" msgid="1009246475582238425">"เลือกการทำงาน"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"เลือกแอปพลิเคชันสำหรับอุปกรณ์ USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"ไม่มีแอปพลิเคชันใดทำงานนี้ได้"</string>
     <string name="aerr_title" msgid="653922989522758100">"ขออภัย!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"แอปพลิเคชัน <xliff:g id="APPLICATION">%1$s</xliff:g> (กระบวนการ <xliff:g id="PROCESS">%2$s</xliff:g> หยุดทำงานโดยไม่คาดหมาย โปรดลองอีกครั้ง"</string>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 08c3ff7..5d4a916 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Pinapayagan ang application na kontrolin ang vibrator."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kontrolin ang flashlight"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Pinapayagan ang application na kontrolin ang flashlight."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"pamahalaan ang mga kagustuhan at pahintulot para sa mga USB device"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Pinapayagan ang application na pamahalaan ang mga kagustuhan at pahintulot para sa mga USB device."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"ipatupad ang MTP protocol"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Pinapayagan ang access sa kernel MTP driver upang maipatupad ang MTP USB protocol."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"subukan ang hardware"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Gamitin bilang default para sa pagkilos na ito."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"I-clear ang default sa Mga Setting ng Home &gt; Mga Application &gt; Pamahalaan ang mga application."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Pumili ng pagkilos"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Pumili ng application para sa USB device"</string>
     <string name="noApplications" msgid="1691104391758345586">"Walang mga application ang makakapagsagawa ng pagkilos na ito."</string>
     <string name="aerr_title" msgid="653922989522758100">"Paumanhin!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Hindi inaasahang humito ang <xliff:g id="APPLICATION">%1$s</xliff:g> (proseso <xliff:g id="PROCESS">%2$s</xliff:g>) ng application. Pakisubukang muli."</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 0b0ef01..58b681e 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Uygulamanın titreşimi denetlemesine izin verir."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"flaşı denetle"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Uygulamaların flaş ışığını denetlemesine izin verir."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"USB cihazları için tercihleri ve izinleri yönet"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Uygulamanın USB cihazları için tercihleri ve izinleri yönetmesine izin verir."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"MTP protokolünü uygula"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"MTP USB protokolünü uygulamak için çekirdekteki MTP sürücüsüne erişim izni ver."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"donanımı test et"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Varsayılan olarak bu işlem için kullan."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Giriş Ayarları &gt; Uygulamalar &gt; Uygulamaları yönet\'te varsayılanı temizleyin."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"İşlem seç"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"USB cihazı için bir uygulama seçin"</string>
     <string name="noApplications" msgid="1691104391758345586">"Hiçbir uygulama bu işlemi yapamaz."</string>
     <string name="aerr_title" msgid="653922989522758100">"Üzgünüz!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"<xliff:g id="APPLICATION">%1$s</xliff:g> uygulaması (<xliff:g id="PROCESS">%2$s</xliff:g> işlemi) beklenmedik biçimde durdu. Lütfen yeniden deneyin."</string>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index eabbea1..60cea7b 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Дозволяє програмі контролювати вібросигнал."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"контр. блим. світло"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Дозволяє програмі контролювати світловий сигнал."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"керувати налаштуваннями та дозволами для пристроїв USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Дозволяє програмі керувати налаштуваннями та дозволами для пристроїв USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"впроваджувати протокол MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Дозволяє доступ до драйвера ядра MTP для впровадження протоколу MTP (USB)."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"тест-ти обладн."</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Використ. за умовч. для цієї дії."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Очист. налашт. за умовч. у Дом. налашт. &gt; Програми &gt; Керув. програмами."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Виберіть дію"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Виберіть програму для пристрою USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Жодна програма не може виконати цю дію."</string>
     <string name="aerr_title" msgid="653922989522758100">"Помилка!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Програма <xliff:g id="APPLICATION">%1$s</xliff:g> (процес <xliff:g id="PROCESS">%2$s</xliff:g>) несподівано зупинилася. Спробуйте ще."</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index 812004b..8070767 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"Cho phép ứng dụng kiểm soát bộ rung."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"kiểm soát đèn nháy"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"Cho phép ứng dụng kiểm soát đèn nháy."</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"quản lý các tùy chọn và quyền dành cho thiết bị USB"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"Cho phép ứng dụng quản lý các tùy chọn và quyền dành cho thiết bị USB."</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"triển khai giao thức MTP"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"Cho phép truy cập tới trình điều khiển MTP nhân hệ điều hành để triển khai giao thức MTP USB."</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"kiểm tra phần cứng"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"Sử dụng theo mặc định đối với tác vụ này."</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"Xoá mặc định trong Cài đặt Màn hình trang chủ &gt; Ứng dụng&gt; Quản lý ứng dụng."</string>
     <string name="chooseActivity" msgid="1009246475582238425">"Chọn tác vụ"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"Chọn ứng dụng cho thiết bị USB"</string>
     <string name="noApplications" msgid="1691104391758345586">"Không ứng dụng nào có thể thực hiện tác vụ này."</string>
     <string name="aerr_title" msgid="653922989522758100">"Rất tiếc!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"Ứng dụng <xliff:g id="APPLICATION">%1$s</xliff:g> (quá trình <xliff:g id="PROCESS">%2$s</xliff:g>) đã dừng đột ngột. Vui lòng thử lại."</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index 3b70dd7..fce5fca 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"允许应用程序控制振动器。"</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"控制闪光灯"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"允许应用程序控制闪光灯。"</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"管理 USB 设备的偏好设置和权限"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"允许应用程序管理 USB 设备的偏好设置和权限。"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"应用 MTP 协议"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"允许访问内核 MTP 驱动程序,以便应用 MTP USB 协议。"</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"测试硬件"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"默认使用此方式发送。"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"通过主屏幕上的“设置”&gt;“应用程序”&gt;“管理应用程序”清除默认设置。"</string>
     <string name="chooseActivity" msgid="1009246475582238425">"选择一项操作"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"选择适用于 USB 设备的应用程序"</string>
     <string name="noApplications" msgid="1691104391758345586">"没有应用程序可执行此操作。"</string>
     <string name="aerr_title" msgid="653922989522758100">"很抱歉!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"应用程序 <xliff:g id="APPLICATION">%1$s</xliff:g>(进程:<xliff:g id="PROCESS">%2$s</xliff:g>)意外停止,请重试。"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index e72b28e..141ed01 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -361,10 +361,8 @@
     <string name="permdesc_vibrate" msgid="2886677177257789187">"允許應用程式控制震動。"</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"控制閃光燈"</string>
     <string name="permdesc_flashlight" msgid="6433045942283802309">"允許應用程式控制閃光燈。"</string>
-    <!-- no translation found for permlab_manageUsb (1113453430645402723) -->
-    <skip />
-    <!-- no translation found for permdesc_manageUsb (6148489202092166164) -->
-    <skip />
+    <string name="permlab_manageUsb" msgid="1113453430645402723">"管理 USB 裝置的偏好設定和權限"</string>
+    <string name="permdesc_manageUsb" msgid="6148489202092166164">"允許應用程式管理 USB 裝置的偏好設定和權限。"</string>
     <string name="permlab_accessMtp" msgid="4953468676795917042">"執行 MTP 通訊協定"</string>
     <string name="permdesc_accessMtp" msgid="6532961200486791570">"允許存取核心 MTP 驅動程式,以執行 MTP USB 通訊協定。"</string>
     <string name="permlab_hardware_test" msgid="4148290860400659146">"測試硬體"</string>
@@ -816,8 +814,7 @@
     <string name="alwaysUse" msgid="4583018368000610438">"以此為本操作預設值。"</string>
     <string name="clearDefaultHintMsg" msgid="4815455344600932173">"清除首頁設定 (應用程式) 管理應用程式的預設值。"</string>
     <string name="chooseActivity" msgid="1009246475582238425">"選取一項操作"</string>
-    <!-- no translation found for chooseUsbActivity (7892597146032121735) -->
-    <skip />
+    <string name="chooseUsbActivity" msgid="7892597146032121735">"選取要以 USB 裝置存取的應用程式"</string>
     <string name="noApplications" msgid="1691104391758345586">"沒有應用程式可執行此項操作。"</string>
     <string name="aerr_title" msgid="653922989522758100">"很抱歉!"</string>
     <string name="aerr_application" msgid="4683614104336409186">"<xliff:g id="APPLICATION">%1$s</xliff:g> 應用程式 (程序:<xliff:g id="PROCESS">%2$s</xliff:g>) 異常終止。請再試一次。"</string>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index fa33b0a..9073531 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -242,15 +242,15 @@
        <item>@drawable/action_bar_background</item>
        <item>@drawable/action_bar_divider</item>
        <item>@drawable/ic_menu_close_clear_cancel</item>
-       <item>@drawable/ic_menu_copy_dark</item>
-       <item>@drawable/ic_menu_copy_light</item>
-       <item>@drawable/ic_menu_cut_dark</item>
-       <item>@drawable/ic_menu_cut_light</item>
+       <item>@drawable/ic_menu_copy_holo_dark</item>
+       <item>@drawable/ic_menu_copy_holo_light</item>
+       <item>@drawable/ic_menu_cut_holo_dark</item>
+       <item>@drawable/ic_menu_cut_holo_light</item>
        <item>@drawable/ic_menu_more</item>
        <item>@drawable/ic_menu_moreoverflow_holo_dark</item>
        <item>@drawable/ic_menu_moreoverflow_holo_light</item>
-       <item>@drawable/ic_menu_paste_dark</item>
-       <item>@drawable/ic_menu_paste_light</item>
+       <item>@drawable/ic_menu_paste_holo_dark</item>
+       <item>@drawable/ic_menu_paste_holo_light</item>
        <item>@drawable/dialog_bottom_holo_dark</item>
        <item>@drawable/dialog_bottom_holo_light</item>
        <item>@drawable/dialog_full_holo_dark</item>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 71a8b2a..c81f8c0 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1374,6 +1374,9 @@
         <enum name="KEYCODE_BUTTON_14" value="201" />
         <enum name="KEYCODE_BUTTON_15" value="202" />
         <enum name="KEYCODE_BUTTON_16" value="203" />
+        <enum name="KEYCODE_LANGUAGE_SWITCH" value="204" />
+        <enum name="KEYCODE_MANNER_MODE" value="205" />
+        <enum name="KEYCODE_3D_MODE" value="206" />
     </attr>
 
     <!-- ***************************************************************** -->
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 8a590cd..cca7d8b 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -52,12 +52,13 @@
     <dimen name="password_keyboard_key_height_numeric">56dip</dimen>
     <!-- Default correction for the space key in the password keyboard -->
     <dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
+
     <!-- Preference activity side margins -->
     <dimen name="preference_screen_side_margin">0dp</dimen>
     <!-- Preference activity side margins negative-->
     <dimen name="preference_screen_side_margin_negative">0dp</dimen>
     <!-- Preference widget area width (to the left of the text) -->
-    <dimen name="preference_widget_width">56dp</dimen>
+    <dimen name="preference_widget_width">8dp</dimen>
 
     <!-- The platform's desired minimum size for a dialog's width when it
          is along the major axis (that is the screen is landscape).  This may
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 11c3916..08f5410 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -2179,8 +2179,8 @@
 
     <style name="Widget.Holo.PreferenceFrameLayout">
         <item name="android:borderTop">0dip</item>
-        <item name="android:borderBottom">48dip</item>
-        <item name="android:borderLeft">32dip</item>
-        <item name="android:borderRight">32dip</item>
+        <item name="android:borderBottom">0dip</item>
+        <item name="android:borderLeft">0dip</item>
+        <item name="android:borderRight">0dip</item>
     </style>
 </resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 5f4ea32..b127747 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -260,11 +260,11 @@
         <item name="actionOverflowButtonStyle">@android:style/Widget.ActionButton.Overflow</item>
         <item name="actionModeBackground">@android:drawable/cab_background_dark</item>
         <item name="actionModeCloseDrawable">@android:drawable/ic_menu_close_clear_cancel</item>
-        <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_dark</item>
-        <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_dark</item>
-        <item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_dark</item>
-        <item name="actionModeShareDrawable">@android:drawable/ic_menu_share</item>
-        <item name="actionModeFindDrawable">@android:drawable/ic_menu_find</item>
+        <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_holo_dark</item>
+        <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_holo_dark</item>
+        <item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_holo_dark</item>
+        <item name="actionModeShareDrawable">@android:drawable/ic_menu_share_holo_dark</item>
+        <item name="actionModeFindDrawable">@android:drawable/ic_menu_find_holo_dark</item>
         <item name="actionModeWebSearchDrawable">@android:drawable/ic_menu_search</item>
         <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item>
         <item name="actionBarTabBarStyle">@style/Widget.ActionBarView_TabBar</item>
@@ -385,9 +385,9 @@
         <item name="progressBarStyleInverse">@android:style/Widget.ProgressBar</item>
         <item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small</item>
         <item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large</item>
-        <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_light</item>
-        <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_light</item>
-        <item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_light</item>
+        <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_holo_light</item>
+        <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_holo_light</item>
+        <item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_holo_light</item>
         <item name="actionModeShareDrawable">@android:drawable/ic_menu_share_holo_light</item>
         <item name="actionModeFindDrawable">@android:drawable/ic_menu_find_holo_light</item>
         <item name="actionModeWebSearchDrawable">@android:drawable/ic_menu_search_holo_light</item>
diff --git a/drm/common/DrmInfoEvent.cpp b/drm/common/DrmInfoEvent.cpp
index 8d115a8..27a5a2d 100644
--- a/drm/common/DrmInfoEvent.cpp
+++ b/drm/common/DrmInfoEvent.cpp
@@ -19,7 +19,7 @@
 
 using namespace android;
 
-DrmInfoEvent::DrmInfoEvent(int uniqueId, int infoType, const String8& message)
+DrmInfoEvent::DrmInfoEvent(int uniqueId, int infoType, const String8 message)
     : mUniqueId(uniqueId),
       mInfoType(infoType),
       mMessage(message) {
@@ -34,7 +34,7 @@
     return mInfoType;
 }
 
-const String8& DrmInfoEvent::getMessage() const {
+const String8 DrmInfoEvent::getMessage() const {
     return mMessage;
 }
 
diff --git a/drm/java/android/drm/DrmErrorEvent.java b/drm/java/android/drm/DrmErrorEvent.java
index 90adb47f..7cc9a87 100644
--- a/drm/java/android/drm/DrmErrorEvent.java
+++ b/drm/java/android/drm/DrmErrorEvent.java
@@ -16,6 +16,8 @@
 
 package android.drm;
 
+import java.util.HashMap;
+
 /**
  * This is an entity class which would be passed to caller in
  * {@link DrmManagerClient.OnErrorListener#onError(DrmManagerClient, DrmErrorEvent)}
@@ -62,11 +64,25 @@
      * constructor to create DrmErrorEvent object with given parameters
      *
      * @param uniqueId Unique session identifier
-     * @param type Type of information
+     * @param type Type of the event. It could be one of the types defined above
      * @param message Message description
      */
     public DrmErrorEvent(int uniqueId, int type, String message) {
         super(uniqueId, type, message);
     }
+
+    /**
+     * constructor to create DrmErrorEvent object with given parameters
+     *
+     * @param uniqueId Unique session identifier
+     * @param type Type of the event. It could be one of the types defined above
+     * @param message Message description
+     * @param attributes Attributes for extensible information. Could be any
+     * information provided by the plugin
+     */
+    public DrmErrorEvent(int uniqueId, int type, String message,
+                            HashMap<String, Object> attributes) {
+        super(uniqueId, type, message, attributes);
+    }
 }
 
diff --git a/drm/java/android/drm/DrmEvent.java b/drm/java/android/drm/DrmEvent.java
index f7bc5cd..eba458b 100644
--- a/drm/java/android/drm/DrmEvent.java
+++ b/drm/java/android/drm/DrmEvent.java
@@ -16,6 +16,8 @@
 
 package android.drm;
 
+import java.util.HashMap;
+
 /**
  * This is the base class which would be used to notify the caller
  * about any event occurred in DRM framework.
@@ -33,11 +35,36 @@
     public static final int TYPE_DRM_INFO_PROCESSED = 1002;
 
     public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
+    public static final String DRM_INFO_OBJECT = "drm_info_object";
 
     private final int mUniqueId;
     private final int mType;
     private String mMessage = "";
 
+    private HashMap<String, Object> mAttributes = new HashMap<String, Object>();
+
+    /**
+     * constructor for DrmEvent class
+     *
+     * @param uniqueId Unique session identifier
+     * @param type Type of information
+     * @param message Message description
+     * @param attributes Attributes for extensible information
+     */
+    protected DrmEvent(int uniqueId, int type, String message,
+                            HashMap<String, Object> attributes) {
+        mUniqueId = uniqueId;
+        mType = type;
+
+        if (null != message) {
+            mMessage = message;
+        }
+
+        if (null != attributes) {
+            mAttributes = attributes;
+        }
+    }
+
     /**
      * constructor for DrmEvent class
      *
@@ -80,5 +107,15 @@
     public String getMessage() {
         return mMessage;
     }
+
+    /**
+     * Returns the attribute corresponding to the specified key
+     *
+     * @return one of the attributes or null if no mapping for
+     * the key is found
+     */
+    public Object getAttribute(String key) {
+        return mAttributes.get(key);
+    }
 }
 
diff --git a/drm/java/android/drm/DrmInfoEvent.java b/drm/java/android/drm/DrmInfoEvent.java
index 72f37ea..190199a 100644
--- a/drm/java/android/drm/DrmInfoEvent.java
+++ b/drm/java/android/drm/DrmInfoEvent.java
@@ -16,6 +16,8 @@
 
 package android.drm;
 
+import java.util.HashMap;
+
 /**
  * This is an entity class which would be passed to caller in
  * {@link DrmManagerClient.OnInfoListener#onInfo(DrmManagerClient, DrmInfoEvent)}
@@ -54,11 +56,25 @@
      * constructor to create DrmInfoEvent object with given parameters
      *
      * @param uniqueId Unique session identifier
-     * @param type Type of information
+     * @param type Type of the event. It could be one of the types defined above
      * @param message Message description
      */
     public DrmInfoEvent(int uniqueId, int type, String message) {
         super(uniqueId, type, message);
     }
+
+    /**
+     * constructor to create DrmInfoEvent object with given parameters
+     *
+     * @param uniqueId Unique session identifier
+     * @param type Type of the event. It could be one of the types defined above
+     * @param message Message description
+     * @param attributes Attributes for extensible information. Could be any
+     * information provided by the plugin
+     */
+    public DrmInfoEvent(int uniqueId, int type, String message,
+                            HashMap<String, Object> attributes) {
+        super(uniqueId, type, message, attributes);
+    }
 }
 
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index aa56159..f7479b5 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -81,10 +81,8 @@
          *
          * @param client DrmManagerClient instance
          * @param event instance which wraps type and message
-         * @param attributes resultant values in key and value pair.
          */
-        public void onEvent(DrmManagerClient client, DrmEvent event,
-                HashMap<String, Object> attributes);
+        public void onEvent(DrmManagerClient client, DrmEvent event);
     }
 
     /**
@@ -128,12 +126,17 @@
             case ACTION_PROCESS_DRM_INFO: {
                 final DrmInfo drmInfo = (DrmInfo) msg.obj;
                 DrmInfoStatus status = _processDrmInfo(mUniqueId, drmInfo);
+
+                attributes.put(DrmEvent.DRM_INFO_STATUS_OBJECT, status);
+                attributes.put(DrmEvent.DRM_INFO_OBJECT, drmInfo);
+
                 if (null != status && DrmInfoStatus.STATUS_OK == status.statusCode) {
-                    attributes.put(DrmEvent.DRM_INFO_STATUS_OBJECT, status);
-                    event = new DrmEvent(mUniqueId, getEventType(status.infoType), null);
+                    event = new DrmEvent(mUniqueId,
+                            getEventType(status.infoType), null, attributes);
                 } else {
                     int infoType = (null != status) ? status.infoType : drmInfo.getInfoType();
-                    error = new DrmErrorEvent(mUniqueId, getErrorType(infoType), null);
+                    error = new DrmErrorEvent(mUniqueId,
+                            getErrorType(infoType), null, attributes);
                 }
                 break;
             }
@@ -151,7 +154,7 @@
                 return;
             }
             if (null != mOnEventListener && null != event) {
-                mOnEventListener.onEvent(DrmManagerClient.this, event, attributes);
+                mOnEventListener.onEvent(DrmManagerClient.this, event);
             }
             if (null != mOnErrorListener && null != error) {
                 mOnErrorListener.onError(DrmManagerClient.this, error);
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index 970b207..b8327a8 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -144,6 +144,21 @@
         nativeGetTransformMatrix(mtx);
     }
 
+    /**
+     * Retrieve the timestamp associated with the texture image set by the most recent call to
+     * updateTexImage.
+     *
+     * This timestamp is in nanoseconds, and is guaranteed to be monotonically increasing. The
+     * specific meaning and zero point of the timestamp depends on the source providing images to
+     * the SurfaceTexture. Unless otherwise specified by the image source, timestamps cannot
+     * generally be compared across SurfaceTexture instances, or across multiple program
+     * invocations. It is mostly useful for determining time offsets between subsequent frames.
+     * @hide
+     */
+    public long getTimestamp() {
+        return nativeGetTimestamp();
+    }
+
     protected void finalize() throws Throwable {
         try {
             nativeFinalize();
@@ -182,6 +197,7 @@
     private native void nativeInit(int texName, Object weakSelf);
     private native void nativeFinalize();
     private native void nativeGetTransformMatrix(float[] mtx);
+    private native long nativeGetTimestamp();
     private native void nativeUpdateTexImage();
 
     /*
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java
index 669beac..8ce1d9a 100644
--- a/graphics/java/android/renderscript/BaseObj.java
+++ b/graphics/java/android/renderscript/BaseObj.java
@@ -75,11 +75,17 @@
      * @param name The name to assign to the object.
      */
     public void setName(String name) {
+        if (name == null) {
+            throw new RSIllegalArgumentException(
+                "setName requires a string of non-zero length.");
+        }
         if(name.length() < 1) {
-            throw new RSIllegalArgumentException("setName does not accept a zero length string.");
+            throw new RSIllegalArgumentException(
+                "setName does not accept a zero length string.");
         }
         if(mName != null) {
-            throw new RSIllegalArgumentException("setName object already has a name.");
+            throw new RSIllegalArgumentException(
+                "setName object already has a name.");
         }
 
         try {
@@ -106,9 +112,9 @@
     }
 
     /**
-     * destroy disconnects the object from the native object effectivly
+     * destroy disconnects the object from the native object effectively
      * rendering this java object dead.  The primary use is to force immediate
-     * cleanup of resources when its believed the GC will not respond quickly
+     * cleanup of resources when it is believed the GC will not respond quickly
      * enough.
      */
     synchronized public void destroy() {
diff --git a/graphics/java/android/renderscript/Matrix2f.java b/graphics/java/android/renderscript/Matrix2f.java
index 78ff97b..acc5bd8 100644
--- a/graphics/java/android/renderscript/Matrix2f.java
+++ b/graphics/java/android/renderscript/Matrix2f.java
@@ -42,7 +42,7 @@
     *                  floats long
     */
     public Matrix2f(float[] dataArray) {
-        mMat = new float[2];
+        mMat = new float[4];
         System.arraycopy(dataArray, 0, mMat, 0, mMat.length);
     }
 
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1b10c5c..f577532 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -83,17 +83,17 @@
                  int alphaMin, int alphaPref,
                  int depthMin, int depthPref,
                  int stencilMin, int stencilPref,
-                 int samplesMin, int samplesPref, float samplesQ);
+                 int samplesMin, int samplesPref, float samplesQ, int dpi);
     synchronized int nContextCreateGL(int dev, int ver,
                  int colorMin, int colorPref,
                  int alphaMin, int alphaPref,
                  int depthMin, int depthPref,
                  int stencilMin, int stencilPref,
-                 int samplesMin, int samplesPref, float samplesQ) {
+                 int samplesMin, int samplesPref, float samplesQ, int dpi) {
         return rsnContextCreateGL(dev, ver, colorMin, colorPref,
                                   alphaMin, alphaPref, depthMin, depthPref,
                                   stencilMin, stencilPref,
-                                  samplesMin, samplesPref, samplesQ);
+                                  samplesMin, samplesPref, samplesQ, dpi);
     }
     native int  rsnContextCreate(int dev, int ver);
     synchronized int nContextCreate(int dev, int ver) {
@@ -457,20 +457,11 @@
         rsnScriptSetVarObj(mContext, id, slot, val);
     }
 
-    native void rsnScriptCBegin(int con);
-    synchronized void nScriptCBegin() {
+    native int  rsnScriptCCreate(int con, String resName, String cacheDir,
+                                 byte[] script, int length);
+    synchronized int nScriptCCreate(String resName, String cacheDir, byte[] script, int length) {
         validate();
-        rsnScriptCBegin(mContext);
-    }
-    native void rsnScriptCSetScript(int con, byte[] script, int offset, int length);
-    synchronized void nScriptCSetScript(byte[] script, int offset, int length) {
-        validate();
-        rsnScriptCSetScript(mContext, script, offset, length);
-    }
-    native int  rsnScriptCCreate(int con, String packageName, String resName, String cacheDir);
-    synchronized int nScriptCCreate(String packageName, String resName, String cacheDir) {
-        validate();
-        return rsnScriptCCreate(mContext, packageName, resName, cacheDir);
+        return rsnScriptCCreate(mContext, resName, cacheDir, script, length);
     }
 
     native void rsnSamplerBegin(int con);
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index 4359795..d4b5434 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -165,13 +165,14 @@
         mWidth = 0;
         mHeight = 0;
         mDev = nDeviceCreate();
+        int dpi = ctx.getResources().getDisplayMetrics().densityDpi;
         mContext = nContextCreateGL(mDev, 0,
                                     mSurfaceConfig.mColorMin, mSurfaceConfig.mColorPref,
                                     mSurfaceConfig.mAlphaMin, mSurfaceConfig.mAlphaPref,
                                     mSurfaceConfig.mDepthMin, mSurfaceConfig.mDepthPref,
                                     mSurfaceConfig.mStencilMin, mSurfaceConfig.mStencilPref,
                                     mSurfaceConfig.mSamplesMin, mSurfaceConfig.mSamplesPref,
-                                    mSurfaceConfig.mSamplesQ);
+                                    mSurfaceConfig.mSamplesQ, dpi);
         if (mContext == 0) {
             throw new RSDriverException("Failed to create RS context.");
         }
diff --git a/graphics/java/android/renderscript/ScriptC.java b/graphics/java/android/renderscript/ScriptC.java
index 9445283..f865753 100644
--- a/graphics/java/android/renderscript/ScriptC.java
+++ b/graphics/java/android/renderscript/ScriptC.java
@@ -92,16 +92,13 @@
             throw new Resources.NotFoundException();
         }
 
-        rs.nScriptCBegin();
-        rs.nScriptCSetScript(pgm, 0, pgmLength);
-
         // E.g, /system/apps/Fountain.apk
-        String packageName = rs.getApplicationContext().getPackageResourcePath();
+        //String packageName = rs.getApplicationContext().getPackageResourcePath();
         // For res/raw/fountain.bc, it wil be /com.android.fountain:raw/fountain
         String resName = resources.getResourceName(resourceID);
         String cacheDir = rs.getApplicationContext().getCacheDir().toString();
 
         Log.v(TAG, "Create script for resource = " + resName);
-        return rs.nScriptCCreate(packageName, resName, cacheDir);
+        return rs.nScriptCCreate(resName, cacheDir, pgm, pgmLength);
     }
 }
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index f86343a..c7f4809 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -164,7 +164,8 @@
                  int alphaMin, int alphaPref,
                  int depthMin, int depthPref,
                  int stencilMin, int stencilPref,
-                 int samplesMin, int samplesPref, float samplesQ)
+                 int samplesMin, int samplesPref, float samplesQ,
+                 int dpi)
 {
     RsSurfaceConfig sc;
     sc.alphaMin = alphaMin;
@@ -178,7 +179,7 @@
     sc.samplesQ = samplesQ;
 
     LOG_API("nContextCreateGL");
-    return (jint)rsContextCreateGL((RsDevice)dev, ver, sc);
+    return (jint)rsContextCreateGL((RsDevice)dev, ver, sc, dpi);
 }
 
 static void
@@ -847,65 +848,51 @@
 
 // -----------------------------------
 
-static void
-nScriptCBegin(JNIEnv *_env, jobject _this, RsContext con)
+static jint
+nScriptCCreate(JNIEnv *_env, jobject _this, RsContext con,
+               jstring resName, jstring cacheDir,
+               jbyteArray scriptRef, jint length)
 {
-    LOG_API("nScriptCBegin, con(%p)", con);
-    rsScriptCBegin(con);
-}
+    LOG_API("nScriptCCreate, con(%p)", con);
 
-static void
-nScriptCSetScript(JNIEnv *_env, jobject _this, RsContext con, jbyteArray scriptRef,
-                  jint offset, jint length)
-{
-    LOG_API("!!! nScriptCSetScript, con(%p)", con);
+    AutoJavaStringToUTF8 resNameUTF(_env, resName);
+    AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
+    jint ret = 0;
+
     jint _exception = 0;
     jint remaining;
-    jbyte* script_base = 0;
     jbyte* script_ptr;
     if (!scriptRef) {
         _exception = 1;
         //_env->ThrowNew(IAEClass, "script == null");
         goto exit;
     }
-    if (offset < 0) {
-        _exception = 1;
-        //_env->ThrowNew(IAEClass, "offset < 0");
-        goto exit;
-    }
     if (length < 0) {
         _exception = 1;
         //_env->ThrowNew(IAEClass, "length < 0");
         goto exit;
     }
-    remaining = _env->GetArrayLength(scriptRef) - offset;
+    remaining = _env->GetArrayLength(scriptRef);
     if (remaining < length) {
         _exception = 1;
         //_env->ThrowNew(IAEClass, "length > script.length - offset");
         goto exit;
     }
-    script_base = (jbyte *)
+    script_ptr = (jbyte *)
         _env->GetPrimitiveArrayCritical(scriptRef, (jboolean *)0);
-    script_ptr = script_base + offset;
 
-    rsScriptCSetText(con, (const char *)script_ptr, length);
+    //rsScriptCSetText(con, (const char *)script_ptr, length);
+
+    ret = (jint)rsScriptCCreate(con, resNameUTF.c_str(), cacheDirUTF.c_str(),
+                                (const char *)script_ptr, length);
 
 exit:
-    if (script_base) {
-        _env->ReleasePrimitiveArrayCritical(scriptRef, script_base,
+    if (script_ptr) {
+        _env->ReleasePrimitiveArrayCritical(scriptRef, script_ptr,
                 _exception ? JNI_ABORT: 0);
     }
-}
 
-static jint
-nScriptCCreate(JNIEnv *_env, jobject _this, RsContext con, jstring packageName, jstring resName, jstring cacheDir)
-{
-    LOG_API("nScriptCCreate, con(%p)", con);
-    AutoJavaStringToUTF8 packageNameUTF(_env, packageName);
-    AutoJavaStringToUTF8 resNameUTF(_env, resName);
-    AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
-    jint i = (jint)rsScriptCCreate(con, packageNameUTF.c_str(), resNameUTF.c_str(), cacheDirUTF.c_str());
-    return i;
+    return ret;
 }
 
 // ---------------------------------------------------------------------------
@@ -1213,7 +1200,7 @@
 
 // All methods below are thread protected in java.
 {"rsnContextCreate",                 "(II)I",                                 (void*)nContextCreate },
-{"rsnContextCreateGL",               "(IIIIIIIIIIIIF)I",                      (void*)nContextCreateGL },
+{"rsnContextCreateGL",               "(IIIIIIIIIIIIFI)I",                     (void*)nContextCreateGL },
 {"rsnContextFinish",                 "(I)V",                                  (void*)nContextFinish },
 {"rsnContextSetPriority",            "(II)V",                                 (void*)nContextSetPriority },
 {"rsnContextSetSurface",             "(IIILandroid/view/Surface;)V",          (void*)nContextSetSurface },
@@ -1281,9 +1268,7 @@
 {"rsnScriptSetVarV",                 "(III[B)V",                              (void*)nScriptSetVarV },
 {"rsnScriptSetVarObj",               "(IIII)V",                               (void*)nScriptSetVarObj },
 
-{"rsnScriptCBegin",                  "(I)V",                                  (void*)nScriptCBegin },
-{"rsnScriptCSetScript",              "(I[BII)V",                              (void*)nScriptCSetScript },
-{"rsnScriptCCreate",                 "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",  (void*)nScriptCCreate },
+{"rsnScriptCCreate",                 "(ILjava/lang/String;Ljava/lang/String;[BI)I",  (void*)nScriptCCreate },
 
 {"rsnProgramStoreBegin",             "(III)V",                                (void*)nProgramStoreBegin },
 {"rsnProgramStoreDepthFunc",         "(II)V",                                 (void*)nProgramStoreDepthFunc },
diff --git a/include/drm/DrmInfoEvent.h b/include/drm/DrmInfoEvent.h
index add33d3..dfca228 100644
--- a/include/drm/DrmInfoEvent.h
+++ b/include/drm/DrmInfoEvent.h
@@ -77,7 +77,7 @@
      * @param[in] infoType Type of information
      * @param[in] message Message description
      */
-    DrmInfoEvent(int uniqueId, int infoType, const String8& message);
+    DrmInfoEvent(int uniqueId, int infoType, const String8 message);
 
     /**
      * Destructor for DrmInfoEvent
@@ -104,12 +104,12 @@
      *
      * @return Message description
      */
-    const String8& getMessage() const;
+    const String8 getMessage() const;
 
 private:
     int mUniqueId;
     int mInfoType;
-    const String8& mMessage;
+    const String8 mMessage;
 };
 
 };
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h
index 168310c..6ed3c6f 100644
--- a/include/gui/ISurfaceTexture.h
+++ b/include/gui/ISurfaceTexture.h
@@ -62,8 +62,11 @@
     // contents of the buffer associated with slot and transfers ownership of
     // that slot back to the server. It is not valid to call queueBuffer on a
     // slot that is not owned by the client or one for which a buffer associated
-    // via requestBuffer.
-    virtual status_t queueBuffer(int slot) = 0;
+    // via requestBuffer. In addition, a timestamp must be provided by the
+    // client for this buffer. The timestamp is measured in nanoseconds, and
+    // must be monotonically increasing. Its other properties (zero point, etc)
+    // are client-dependent, and should be documented by the client.
+    virtual status_t queueBuffer(int slot, int64_t timestamp) = 0;
 
     // cancelBuffer indicates that the client does not wish to fill in the
     // buffer associated with slot and transfers ownership of the slot back to
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 9bf38f7..afa64d3 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -66,7 +66,12 @@
     // unmodified.
     virtual status_t dequeueBuffer(int *buf);
 
-    virtual status_t queueBuffer(int buf);
+    // queueBuffer returns a filled buffer to the SurfaceTexture. In addition, a
+    // timestamp must be provided for the buffer. The timestamp is in
+    // nanoseconds, and must be monotonically increasing. Its other semantics
+    // (zero point, etc) are client-dependent and should be documented by the
+    // client.
+    virtual status_t queueBuffer(int buf, int64_t timestamp);
     virtual void cancelBuffer(int buf);
     virtual status_t setCrop(const Rect& reg);
     virtual status_t setTransform(uint32_t transform);
@@ -98,6 +103,14 @@
     // functions.
     void getTransformMatrix(float mtx[16]);
 
+    // getTimestamp retrieves the timestamp associated with the texture image
+    // set by the most recent call to updateTexImage.
+    //
+    // The timestamp is in nanoseconds, and is monotonically increasing. Its
+    // other semantics (zero point, etc) are source-dependent and should be
+    // documented by the source.
+    int64_t getTimestamp();
+
     // setFrameAvailableListener sets the listener object that will be notified
     // when a new frame becomes available.
     void setFrameAvailableListener(const sp<FrameAvailableListener>& l);
@@ -172,6 +185,10 @@
     // gets set to mLastQueuedTransform each time updateTexImage is called.
     uint32_t mCurrentTransform;
 
+    // mCurrentTimestamp is the timestamp for the current texture. It
+    // gets set to mLastQueuedTimestamp each time updateTexImage is called.
+    int64_t mCurrentTimestamp;
+
     // mLastQueued is the buffer slot index of the most recently enqueued buffer.
     // At construction time it is initialized to INVALID_BUFFER_SLOT, and is
     // updated each time queueBuffer is called.
@@ -187,6 +204,10 @@
     // queueBuffer gets called.
     uint32_t mLastQueuedTransform;
 
+    // mLastQueuedTimestamp is the timestamp for the buffer that was most
+    // recently queued. This gets set by queueBuffer.
+    int64_t mLastQueuedTimestamp;
+
     // mNextCrop is the crop rectangle that will be used for the next buffer
     // that gets queued. It is set by calling setCrop.
     Rect mNextCrop;
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index 7992105..df82bf2 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -63,6 +63,7 @@
     int dispatchSetBufferCount(va_list args);
     int dispatchSetBuffersGeometry(va_list args);
     int dispatchSetBuffersTransform(va_list args);
+    int dispatchSetBuffersTimestamp(va_list args);
     int dispatchSetCrop(va_list args);
     int dispatchSetUsage(va_list args);
 
@@ -71,6 +72,7 @@
     int setBufferCount(int bufferCount);
     int setBuffersGeometry(int w, int h, int format);
     int setBuffersTransform(int transform);
+    int setBuffersTimestamp(int64_t timestamp);
     int setCrop(Rect const* rect);
     int setUsage(uint32_t reqUsage);
 
@@ -114,6 +116,11 @@
     // at the next deuque operation. It is initialized to 0.
     uint32_t mReqUsage;
 
+    // mTimestamp is the timestamp that will be used for the next buffer queue
+    // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
+    // a timestamp is auto-generated when queueBuffer is called.
+    int64_t mTimestamp;
+
     // mMutex is the mutex used to prevent concurrent access to the member
     // variables of SurfaceTexture objects. It must be locked whenever the
     // member variables are accessed.
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h
index a710546..67d940b 100644
--- a/include/media/mediarecorder.h
+++ b/include/media/mediarecorder.h
@@ -104,35 +104,62 @@
 };
 
 /*
- * The state machine of the media_recorder uses a set of different state names.
- * The mapping between the media_recorder and the pvauthorengine is shown below:
- *
- *    mediarecorder                        pvauthorengine
- * ----------------------------------------------------------------
- *    MEDIA_RECORDER_ERROR                 ERROR
- *    MEDIA_RECORDER_IDLE                  IDLE
- *    MEDIA_RECORDER_INITIALIZED           OPENED
- *    MEDIA_RECORDER_DATASOURCE_CONFIGURED
- *    MEDIA_RECORDER_PREPARED              INITIALIZED
- *    MEDIA_RECORDER_RECORDING             RECORDING
+ * The state machine of the media_recorder.
  */
 enum media_recorder_states {
+    // Error state.
     MEDIA_RECORDER_ERROR                 =      0,
+
+    // Recorder was just created.
     MEDIA_RECORDER_IDLE                  = 1 << 0,
+
+    // Recorder has been initialized.
     MEDIA_RECORDER_INITIALIZED           = 1 << 1,
+
+    // Configuration of the recorder has been completed.
     MEDIA_RECORDER_DATASOURCE_CONFIGURED = 1 << 2,
+
+    // Recorder is ready to start.
     MEDIA_RECORDER_PREPARED              = 1 << 3,
+
+    // Recording is in progress.
     MEDIA_RECORDER_RECORDING             = 1 << 4,
 };
 
 // The "msg" code passed to the listener in notify.
 enum media_recorder_event_type {
+    MEDIA_RECORDER_EVENT_LIST_START               = 1,
     MEDIA_RECORDER_EVENT_ERROR                    = 1,
-    MEDIA_RECORDER_EVENT_INFO                     = 2
+    MEDIA_RECORDER_EVENT_INFO                     = 2,
+    MEDIA_RECORDER_EVENT_LIST_END                 = 99,
+
+    // Track related event types
+    MEDIA_RECORDER_TRACK_EVENT_LIST_START         = 100,
+    MEDIA_RECORDER_TRACK_EVENT_ERROR              = 100,
+    MEDIA_RECORDER_TRACK_EVENT_INFO               = 101,
+    MEDIA_RECORDER_TRACK_EVENT_LIST_END           = 1000,
 };
 
+/*
+ * The (part of) "what" code passed to the listener in notify.
+ * When the error or info type is track specific, the what has
+ * the following layout:
+ * the left-most 16-bit is meant for error or info type.
+ * the right-most 4-bit is meant for track id.
+ * the rest is reserved.
+ *
+ * | track id | reserved |     error or info type     |
+ * 31         28         16                           0
+ *
+ */
 enum media_recorder_error_type {
-    MEDIA_RECORDER_ERROR_UNKNOWN                  = 1
+    MEDIA_RECORDER_ERROR_UNKNOWN                   = 1,
+
+    // Track related error type
+    MEDIA_RECORDER_TRACK_ERROR_LIST_START          = 100,
+    MEDIA_RECORDER_TRACK_ERROR_GENERAL             = 100,
+    MEDIA_RECORDER_ERROR_VIDEO_NO_SYNC_FRAME       = 200,
+    MEDIA_RECORDER_TRACK_ERROR_LIST_END            = 1000,
 };
 
 // The codes are distributed as follow:
@@ -141,11 +168,15 @@
 //
 enum media_recorder_info_type {
     MEDIA_RECORDER_INFO_UNKNOWN                   = 1,
+
     MEDIA_RECORDER_INFO_MAX_DURATION_REACHED      = 800,
     MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED      = 801,
-    MEDIA_RECORDER_INFO_COMPLETION_STATUS         = 802,
-    MEDIA_RECORDER_INFO_PROGRESS_FRAME_STATUS     = 803,
-    MEDIA_RECORDER_INFO_PROGRESS_TIME_STATUS      = 804,
+
+    // All track related informtional events start here
+    MEDIA_RECORDER_TRACK_INFO_LIST_START           = 1000,
+    MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS    = 1000,
+    MEDIA_RECORDER_TRACK_INFO_PROGRESS_IN_TIME     = 1001,
+    MEDIA_RECORDER_TRACK_INFO_LIST_END             = 2000,
 };
 
 // ----------------------------------------------------------------------------
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index a969796..f13e9bb 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef A_CODEC_H_
 
 #define A_CODEC_H_
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h
index 5c5229d..15f86ea 100644
--- a/include/media/stagefright/MPEG4Writer.h
+++ b/include/media/stagefright/MPEG4Writer.h
@@ -157,7 +157,7 @@
     bool use32BitFileOffset() const;
     bool exceedsFileDurationLimit();
     bool isFileStreamable() const;
-    void trackProgressStatus(const Track* track, int64_t timeUs, status_t err = OK);
+    void trackProgressStatus(size_t trackId, int64_t timeUs, status_t err = OK);
     void writeCompositionMatrix(int32_t degrees);
 
     MPEG4Writer(const MPEG4Writer &);
diff --git a/include/media/stagefright/MediaDebug.h b/include/media/stagefright/MediaDebug.h
index c8a8f00e7..2ca9667 100644
--- a/include/media/stagefright/MediaDebug.h
+++ b/include/media/stagefright/MediaDebug.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef MEDIA_DEBUG_H_
 
 #define MEDIA_DEBUG_H_
diff --git a/include/media/stagefright/foundation/AHandlerReflector.h b/include/media/stagefright/foundation/AHandlerReflector.h
index 857866a..9d201b5 100644
--- a/include/media/stagefright/foundation/AHandlerReflector.h
+++ b/include/media/stagefright/foundation/AHandlerReflector.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef A_HANDLER_REFLECTOR_H_
 
 #define A_HANDLER_REFLECTOR_H_
diff --git a/include/media/stagefright/foundation/AHierarchicalStateMachine.h b/include/media/stagefright/foundation/AHierarchicalStateMachine.h
index b5786fb..d2e6b28 100644
--- a/include/media/stagefright/foundation/AHierarchicalStateMachine.h
+++ b/include/media/stagefright/foundation/AHierarchicalStateMachine.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef A_HIERARCHICAL_STATE_MACHINE_H_
 
 #define A_HIERARCHICAL_STATE_MACHINE_H_
diff --git a/include/private/hwui/DrawGlInfo.h b/include/private/hwui/DrawGlInfo.h
new file mode 100644
index 0000000..1e9912b
--- /dev/null
+++ b/include/private/hwui/DrawGlInfo.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HWUI_DRAW_GL_INFO_H
+#define ANDROID_HWUI_DRAW_GL_INFO_H
+
+namespace android {
+namespace uirenderer {
+
+/**
+ * Structure used by OpenGLRenderer::callDrawGLFunction() to pass and
+ * receive data from OpenGL functors.
+ */
+struct DrawGlInfo {
+    // Input: current clip rect
+    int clipLeft;
+    int clipTop;
+    int clipRight;
+    int clipBottom;
+
+    // Input: is the render target an FBO
+    bool isLayer;
+
+    // Input: current transform matrix, in OpenGL format
+    float transform[16];
+
+    // Output: dirty region to redraw
+    float dirtyLeft;
+    float dirtyTop;
+    float dirtyRight;
+    float dirtyBottom;
+}; // struct DrawGlInfo
+
+}; // namespace uirenderer
+}; // namespace android
+
+#endif // ANDROID_HWUI_DRAW_GL_INFO_H
diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h
index 9e0b5bb..a59d9e5 100644
--- a/include/surfaceflinger/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -226,7 +226,8 @@
     int  dispatch_set_buffer_count(va_list args);
     int  dispatch_set_buffers_geometry(va_list args);
     int  dispatch_set_buffers_transform(va_list args);
-    
+    int  dispatch_set_buffers_timestamp(va_list args);
+
     void setUsage(uint32_t reqUsage);
     int  connect(int api);
     int  disconnect(int api);
@@ -234,6 +235,7 @@
     int  setBufferCount(int bufferCount);
     int  setBuffersGeometry(int w, int h, int format);
     int  setBuffersTransform(int transform);
+    int  setBuffersTimestamp(int64_t timestamp);
 
     /*
      *  private stuff...
diff --git a/include/ui/KeycodeLabels.h b/include/ui/KeycodeLabels.h
index b912e9b..8383957 100755
--- a/include/ui/KeycodeLabels.h
+++ b/include/ui/KeycodeLabels.h
@@ -228,6 +228,9 @@
     { "BUTTON_14", 201 },
     { "BUTTON_15", 202 },
     { "BUTTON_16", 203 },
+    { "LANGUAGE_SWITCH", 204 },
+    { "MANNER_MODE", 205 },
+    { "3D_MODE", 206 },
 
     // NOTE: If you add a new keycode here you must also add it to several other files.
     //       Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h
index 0fc1ddf..0a6e4fb 100644
--- a/include/ui/egl/android_natives.h
+++ b/include/ui/egl/android_natives.h
@@ -57,7 +57,7 @@
 {
     /* a magic value defined by the actual EGL native type */
     int magic;
-    
+
     /* the sizeof() of the actual EGL native type */
     int version;
 
@@ -129,6 +129,7 @@
     NATIVE_WINDOW_SET_BUFFER_COUNT,
     NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
     NATIVE_WINDOW_SET_BUFFERS_TRANSFORM,
+    NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP,
 };
 
 /* parameter for NATIVE_WINDOW_[DIS]CONNECT */
@@ -157,7 +158,15 @@
     NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT,       // SurfaceTextureClient
 };
 
-struct ANativeWindow 
+/* parameter for NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
+ *
+ * Special timestamp value to indicate that timestamps should be auto-generated
+ * by the native window when queueBuffer is called.  This is equal to INT64_MIN,
+ * defined directly to avoid problems with C99/C++ inclusion of stdint.h.
+ */
+const int64_t NATIVE_WINDOW_TIMESTAMP_AUTO = (-9223372036854775807LL-1);
+
+struct ANativeWindow
 {
 #ifdef __cplusplus
     ANativeWindow()
@@ -262,7 +271,8 @@
      *     NATIVE_WINDOW_SET_BUFFER_COUNT
      *     NATIVE_WINDOW_SET_BUFFERS_GEOMETRY
      *     NATIVE_WINDOW_SET_BUFFERS_TRANSFORM
-     *  
+     *     NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP
+     *
      */
     
     int     (*perform)(struct ANativeWindow* window,
@@ -389,6 +399,22 @@
             transform);
 }
 
+/*
+ * native_window_set_buffers_timestamp(..., int64_t timestamp)
+ * All buffers queued after this call will be associated with the timestamp
+ * parameter specified. If the timestamp is set to NATIVE_WINDOW_TIMESTAMP_AUTO
+ * (the default), timestamps will be generated automatically when queueBuffer is
+ * called. The timestamp is measured in nanoseconds, and must be monotonically
+ * increasing.
+ */
+static inline int native_window_set_buffers_timestamp(
+        ANativeWindow* window,
+        int64_t timestamp)
+{
+    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP,
+            timestamp);
+}
+
 // ---------------------------------------------------------------------------
 
 /* FIXME: this is legacy for pixmaps */
diff --git a/include/utils/Functor.h b/include/utils/Functor.h
index 565f4a3..e24ded4 100644
--- a/include/utils/Functor.h
+++ b/include/utils/Functor.h
@@ -25,8 +25,7 @@
 public:
     Functor() {}
     virtual ~Functor() {}
-    virtual status_t operator ()() { return true; }
-    virtual status_t operator ()(float* data, uint32_t len) { return true; }
+    virtual status_t operator ()(int what, void* data) { return NO_ERROR; }
 };
 
 }; // namespace android
diff --git a/include/utils/Vector.h b/include/utils/Vector.h
index ec851bd..6fd307f 100644
--- a/include/utils/Vector.h
+++ b/include/utils/Vector.h
@@ -162,6 +162,9 @@
      inline status_t        sort(compar_t cmp);
      inline status_t        sort(compar_r_t cmp, void* state);
 
+     // for debugging only
+     inline size_t getItemSize() const { return itemSize(); }
+
 protected:
     virtual void    do_construct(void* storage, size_t num) const;
     virtual void    do_destroy(void* storage, size_t num) const;
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp
index d661fd5..bc14ad5 100644
--- a/libs/gui/ISurfaceTexture.cpp
+++ b/libs/gui/ISurfaceTexture.cpp
@@ -88,10 +88,11 @@
         return result;
     }
 
-    virtual status_t queueBuffer(int buf) {
+    virtual status_t queueBuffer(int buf, int64_t timestamp) {
         Parcel data, reply;
         data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
         data.writeInt32(buf);
+        data.writeInt64(timestamp);
         remote()->transact(QUEUE_BUFFER, data, &reply);
         status_t result = reply.readInt32();
         return result;
@@ -174,7 +175,8 @@
         case QUEUE_BUFFER: {
             CHECK_INTERFACE(ISurfaceTexture, data, reply);
             int buf = data.readInt32();
-            status_t result = queueBuffer(buf);
+            int64_t timestamp = data.readInt64();
+            status_t result = queueBuffer(buf, timestamp);
             reply->writeInt32(result);
             return NO_ERROR;
         } break;
@@ -196,7 +198,6 @@
             return NO_ERROR;
         } break;
         case SET_TRANSFORM: {
-            Rect reg;
             CHECK_INTERFACE(ISurfaceTexture, data, reply);
             uint32_t transform = data.readInt32();
             status_t result = setTransform(transform);
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 5c6d71b..cdaca47 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -76,9 +76,15 @@
 static void mtxMul(float out[16], const float a[16], const float b[16]);
 
 SurfaceTexture::SurfaceTexture(GLuint tex) :
-    mBufferCount(MIN_BUFFER_SLOTS), mCurrentTexture(INVALID_BUFFER_SLOT),
-    mCurrentTransform(0), mLastQueued(INVALID_BUFFER_SLOT),
-    mLastQueuedTransform(0), mNextTransform(0), mTexName(tex) {
+    mBufferCount(MIN_BUFFER_SLOTS),
+    mCurrentTexture(INVALID_BUFFER_SLOT),
+    mCurrentTransform(0),
+    mCurrentTimestamp(0),
+    mLastQueued(INVALID_BUFFER_SLOT),
+    mLastQueuedTransform(0),
+    mLastQueuedTimestamp(0),
+    mNextTransform(0),
+    mTexName(tex) {
     LOGV("SurfaceTexture::SurfaceTexture");
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         mSlots[i].mEglImage = EGL_NO_IMAGE_KHR;
@@ -153,7 +159,7 @@
     return OK;
 }
 
-status_t SurfaceTexture::queueBuffer(int buf) {
+status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) {
     LOGV("SurfaceTexture::queueBuffer");
     Mutex::Autolock lock(mMutex);
     if (buf < 0 || mBufferCount <= buf) {
@@ -172,6 +178,7 @@
     mLastQueued = buf;
     mLastQueuedCrop = mNextCrop;
     mLastQueuedTransform = mNextTransform;
+    mLastQueuedTimestamp = timestamp;
     if (mFrameAvailableListener != 0) {
         mFrameAvailableListener->onFrameAvailable();
     }
@@ -246,12 +253,13 @@
         mCurrentTextureBuf = mSlots[mCurrentTexture].mGraphicBuffer;
         mCurrentCrop = mLastQueuedCrop;
         mCurrentTransform = mLastQueuedTransform;
+        mCurrentTimestamp = mLastQueuedTimestamp;
     }
     return OK;
 }
 
 void SurfaceTexture::getTransformMatrix(float mtx[16]) {
-    LOGV("SurfaceTexture::updateTexImage");
+    LOGV("SurfaceTexture::getTransformMatrix");
     Mutex::Autolock lock(mMutex);
 
     float xform[16];
@@ -342,6 +350,12 @@
     mtxMul(mtx, mtxFlipV, mtxBeforeFlipV);
 }
 
+nsecs_t SurfaceTexture::getTimestamp() {
+    LOGV("SurfaceTexture::getTimestamp");
+    Mutex::Autolock lock(mMutex);
+    return mCurrentTimestamp;
+}
+
 void SurfaceTexture::setFrameAvailableListener(
         const sp<FrameAvailableListener>& l) {
     LOGV("SurfaceTexture::setFrameAvailableListener");
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 7f1d9cb..a4812d0 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -26,7 +26,8 @@
 SurfaceTextureClient::SurfaceTextureClient(
         const sp<ISurfaceTexture>& surfaceTexture):
         mSurfaceTexture(surfaceTexture), mAllocator(0), mReqWidth(1),
-        mReqHeight(1), mReqFormat(DEFAULT_FORMAT), mReqUsage(0), mMutex() {
+        mReqHeight(1), mReqFormat(DEFAULT_FORMAT), mReqUsage(0),
+        mTimestamp(NATIVE_WINDOW_TIMESTAMP_AUTO), mMutex() {
     // Initialize the ANativeWindow function pointers.
     ANativeWindow::setSwapInterval  = setSwapInterval;
     ANativeWindow::dequeueBuffer    = dequeueBuffer;
@@ -135,9 +136,17 @@
 int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
     LOGV("SurfaceTextureClient::queueBuffer");
     Mutex::Autolock lock(mMutex);
+    int64_t timestamp;
+    if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
+        timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
+        LOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
+             timestamp / 1000000.f);
+    } else {
+        timestamp = mTimestamp;
+    }
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         if (mSlots[i]->handle == buffer->handle) {
-            return mSurfaceTexture->queueBuffer(i);
+            return mSurfaceTexture->queueBuffer(i, timestamp);
         }
     }
     LOGE("queueBuffer: unknown buffer queued");
@@ -196,6 +205,9 @@
     case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
         res = dispatchSetBuffersTransform(args);
         break;
+    case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
+        res = dispatchSetBuffersTimestamp(args);
+        break;
     default:
         res = NAME_NOT_FOUND;
         break;
@@ -240,6 +252,11 @@
     return setBuffersTransform(transform);
 }
 
+int SurfaceTextureClient::dispatchSetBuffersTimestamp(va_list args) {
+    int64_t timestamp = va_arg(args, int64_t);
+    return setBuffersTimestamp(timestamp);
+}
+
 int SurfaceTextureClient::connect(int api) {
     LOGV("SurfaceTextureClient::connect");
     // XXX: Implement this!
@@ -323,6 +340,14 @@
     return err;
 }
 
+int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
+{
+    LOGV("SurfaceTextureClient::setBuffersTimestamp");
+    Mutex::Autolock lock(mMutex);
+    mTimestamp = timestamp;
+    return NO_ERROR;
+}
+
 void SurfaceTextureClient::freeAllBuffers() {
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         mSlots[i] = 0;
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 868290b..f2f983f 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -95,10 +95,6 @@
         delete mPaths.itemAt(i);
     }
     mPaths.clear();
-    for (size_t i = 0; i < mOriginalPaths.size(); i++) {
-        caches.resourceCache.decrementRefcount(mOriginalPaths.itemAt(i));
-    }
-    mOriginalPaths.clear();
 
     for (size_t i = 0; i < mMatrices.size(); i++) {
         delete mMatrices.itemAt(i);
@@ -150,13 +146,6 @@
         mPaths.add(paths.itemAt(i));
     }
 
-    const Vector<SkPath*> &originalPaths = recorder.getOriginalPaths();
-    for (size_t i = 0; i < originalPaths.size(); i++) {
-        SkPath* path = originalPaths.itemAt(i);
-        mOriginalPaths.add(path);
-        caches.resourceCache.incrementRefcount(path);
-    }
-
     const Vector<SkMatrix*> &matrices = recorder.getMatrices();
     for (size_t i = 0; i < matrices.size(); i++) {
         mMatrices.add(matrices.itemAt(i));
@@ -533,12 +522,6 @@
     }
     mBitmapResources.clear();
 
-    for (size_t i = 0; i < mOriginalPaths.size(); i++) {
-        SkPath* resource = mOriginalPaths.itemAt(i);
-        caches.resourceCache.decrementRefcount(resource);
-    }
-    mOriginalPaths.clear();
-
     for (size_t i = 0; i < mShaders.size(); i++) {
        caches.resourceCache.decrementRefcount(mShaders.itemAt(i));
     }
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 6fc315c..8773cb5 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -193,7 +193,6 @@
 
     Vector<SkPaint*> mPaints;
     Vector<SkPath*> mPaths;
-    Vector<SkPath*> mOriginalPaths;
     Vector<SkMatrix*> mMatrices;
     Vector<SkiaShader*> mShaders;
 
@@ -298,10 +297,6 @@
         return mPaths;
     }
 
-    const Vector<SkPath*>& getOriginalPaths() const {
-        return mOriginalPaths;
-    }
-
     const Vector<SkMatrix*>& getMatrices() const {
         return mMatrices;
     }
@@ -383,16 +378,9 @@
 
         SkPath* pathCopy = mPathMap.valueFor(path);
         if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
-            if (pathCopy == NULL) {
-                pathCopy = path;
-                mOriginalPaths.add(path);
-                Caches& caches = Caches::getInstance();
-                caches.resourceCache.incrementRefcount(path);
-            } else {
-                pathCopy = new SkPath(*path);
-                mPaths.add(pathCopy);
-            }
+            pathCopy = new SkPath(*path);
             mPathMap.add(path, pathCopy);
+            mPaths.add(pathCopy);
         }
 
         addInt((int) pathCopy);
@@ -469,7 +457,6 @@
     Vector<SkPaint*> mPaints;
     DefaultKeyedVector<SkPaint*, SkPaint*> mPaintMap;
 
-    Vector<SkPath*> mOriginalPaths;
     Vector<SkPath*> mPaths;
     DefaultKeyedVector<SkPath*, SkPath*> mPathMap;
 
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index bb284379..26e240f 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -103,6 +103,11 @@
      * have been drawn.
      */
     Region region;
+    /**
+     * If the region is a rectangle, coordinates of the
+     * region are stored here.
+     */
+    Rect regionRect;
 
     /**
      * Color filter used to draw this layer. Optional.
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index b1eb164..ba110ec 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -101,6 +101,20 @@
             mLayer->meshIndices = NULL;
             mLayer->meshElementCount = 0;
         }
+
+        const android::Rect& bounds = mLayer->region.getBounds();
+        mLayer->regionRect.set(bounds.leftTop().x, bounds.leftTop().y,
+                bounds.rightBottom().x, bounds.rightBottom().y);
+
+        const float texX = 1.0f / float(mLayer->width);
+        const float texY = 1.0f / float(mLayer->height);
+        const float height = mLayer->layer.getHeight();
+        mLayer->texCoords.set(
+                mLayer->regionRect.left * texX,
+                (height - mLayer->regionRect.top) * texY,
+                mLayer->regionRect.right * texX,
+                (height - mLayer->regionRect.bottom) * texY);
+
         return;
     }
 
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index b8bd7d6..a711289 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -26,6 +26,8 @@
 #include <utils/Log.h>
 #include <utils/StopWatch.h>
 
+#include <private/hwui/DrawGlInfo.h>
+
 #include <ui/Rect.h>
 
 #include "OpenGLRenderer.h"
@@ -216,21 +218,29 @@
         setScissorFromClip();
     }
 
+    Rect clip(*mSnapshot->clipRect);
+    clip.snapToPixelBoundaries();
+
 #if RENDER_LAYERS_AS_REGIONS
     // Since we don't know what the functor will draw, let's dirty
     // tne entire clip region
     if (hasLayer()) {
-        Rect clip(*mSnapshot->clipRect);
-        clip.snapToPixelBoundaries();
         dirtyLayerUnchecked(clip, getRegion());
     }
 #endif
 
-    float bounds[4];
-    status_t result = (*functor)(&bounds[0], 4);
+    DrawGlInfo info;
+    info.clipLeft = clip.left;
+    info.clipTop = clip.top;
+    info.clipRight = clip.right;
+    info.clipBottom = clip.bottom;
+    info.isLayer = hasLayer();
+    getSnapshot()->transform->copyTo(&info.transform[0]);
+
+    status_t result = (*functor)(0, &info);
 
     if (result != 0) {
-        Rect localDirty(bounds[0], bounds[1], bounds[2], bounds[3]);
+        Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom);
         dirty.unionWith(localDirty);
     }
 
@@ -637,7 +647,7 @@
 void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) {
 #if RENDER_LAYERS_AS_REGIONS
     if (layer->region.isRect()) {
-        composeLayerRect(layer, rect);
+        composeLayerRect(layer, layer->regionRect);
         layer->region.clear();
         return;
     }
@@ -1060,6 +1070,42 @@
     return false;
 }
 
+void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, SkPaint* paint) {
+    int alpha;
+    SkXfermode::Mode mode;
+    getAlphaAndMode(paint, &alpha, &mode);
+
+    setTextureWrapModes(texture, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
+
+    float x = left;
+    float y = top;
+
+    bool ignoreTransform = false;
+    if (mSnapshot->transform->isPureTranslate()) {
+        x = (int) floorf(left + mSnapshot->transform->getTranslateX() + 0.5f);
+        y = (int) floorf(top + mSnapshot->transform->getTranslateY() + 0.5f);
+        ignoreTransform = true;
+    }
+
+    setupDraw();
+    setupDrawWithTexture(true);
+    setupDrawAlpha8Color(paint->getColor(), alpha);
+    setupDrawColorFilter();
+    setupDrawShader();
+    setupDrawBlending(true, mode);
+    setupDrawProgram();
+    setupDrawModelView(x, y, x + texture->width, y + texture->height, ignoreTransform);
+    setupDrawTexture(texture->id);
+    setupDrawPureColorUniforms();
+    setupDrawColorFilterUniforms();
+    setupDrawShaderUniforms();
+    setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
+
+    finishDrawTexture();
+}
+
 void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint) {
     const float right = left + bitmap->width();
     const float bottom = top + bitmap->height();
@@ -1073,7 +1119,11 @@
     if (!texture) return;
     const AutoTexture autoCleanup(texture);
 
-    drawTextureRect(left, top, right, bottom, texture, paint);
+    if (bitmap->getConfig() == SkBitmap::kA8_Config) {
+        drawAlphaBitmap(texture, left, top, paint);
+    } else {
+        drawTextureRect(left, top, right, bottom, texture, paint);
+    }
 }
 
 void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint) {
@@ -1376,25 +1426,23 @@
     } else {
         // TODO: Handle the AA case
         for (int i = 0; i < count; i += 4) {
-            const float left = fmin(points[i], points[i + 1]);
-            const float right = fmax(points[i], points[i + 1]);
-            const float top = fmin(points[i + 2], points[i + 3]);
-            const float bottom = fmax(points[i + 2], points[i + 3]);
+            TextureVertex::set(vertex++, points[i], points[i + 1], 0.0f, 0.0f);
+            TextureVertex::set(vertex++, points[i + 2], points[i + 3], 0.0f, 0.0f);
 
-            if (!quickReject(left, top, right, bottom)) {
-                TextureVertex::set(vertex++, points[i], points[i + 1], 0.0f, 0.0f);
-                TextureVertex::set(vertex++, points[i + 2], points[i + 3], 0.0f, 0.0f);
+            generatedVerticesCount += 2;
 
-                generatedVerticesCount += 2;
+            const float left = fmin(points[i], points[i + 2]);
+            const float right = fmax(points[i], points[i + 2]);
+            const float top = fmin(points[i + 1], points[i + 3]);
+            const float bottom = fmax(points[i + 1], points[i + 3]);
 
-                dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
-            }
+            dirtyLayer(left, top,
+                    right == left ? left + 1 : right, bottom == top ? top + 1 : bottom,
+                    *mSnapshot->transform);
         }
 
-        if (generatedVerticesCount > 0) {
-            glLineWidth(1.0f);
-            glDrawArrays(GL_LINES, 0, generatedVerticesCount);
-        }
+        glLineWidth(1.0f);
+        glDrawArrays(GL_LINES, 0, generatedVerticesCount);
     }
 }
 
@@ -1647,8 +1695,7 @@
 #if RENDER_LAYERS_AS_REGIONS
     if (!layer->region.isEmpty()) {
         if (layer->region.isRect()) {
-            const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());
-            composeLayerRect(layer, r);
+            composeLayerRect(layer, layer->regionRect);
         } else if (layer->mesh) {
             const float a = alpha / 255.0f;
             const Rect& rect = layer->layer;
@@ -1659,13 +1706,11 @@
             setupDrawColorFilter();
             setupDrawBlending(layer->blend || layer->alpha < 255, layer->mode, false);
             setupDrawProgram();
+            setupDrawModelViewTranslate(x, y,
+                    x + layer->layer.getWidth(), y + layer->layer.getHeight());
             setupDrawPureColorUniforms();
             setupDrawColorFilterUniforms();
             setupDrawTexture(layer->texture);
-            // TODO: The current layer, if any, will be dirtied with the bounding box
-            //       of the layer we are drawing. Since the layer we are drawing has
-            //       a mesh, we know the dirty region, we should use it instead
-            setupDrawModelViewTranslate(rect.left, rect.top, rect.right, rect.bottom);
             setupDrawMesh(&layer->mesh[0].position[0], &layer->mesh[0].texture[0]);
 
             glDrawElements(GL_TRIANGLES, layer->meshElementCount,
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 7362473..402563c 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -279,6 +279,8 @@
     void drawShape(float left, float top, const PathTexture* texture, SkPaint* paint);
     void drawRectAsShape(float left, float top, float right, float bottom, SkPaint* p);
 
+    void drawAlphaBitmap(Texture* texture, float left, float top, SkPaint* paint);
+
     /**
      * Draws a textured rectangle with the specified texture. The specified coordinates
      * are transformed by the current snapshot's transform matrix.
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h
index dc67e16..7ff8b74 100644
--- a/libs/hwui/PathCache.h
+++ b/libs/hwui/PathCache.h
@@ -41,8 +41,7 @@
         path = NULL;
     }
 
-    PathCacheEntry(const PathCacheEntry& entry):
-            ShapeCacheEntry(entry) {
+    PathCacheEntry(const PathCacheEntry& entry): ShapeCacheEntry(entry) {
         path = entry.path;
     }
 
@@ -55,6 +54,7 @@
     }
 
     SkPath* path;
+
 }; // PathCacheEntry
 
 /**
diff --git a/libs/hwui/ShapeCache.h b/libs/hwui/ShapeCache.h
index 4c626dd..859e503 100644
--- a/libs/hwui/ShapeCache.h
+++ b/libs/hwui/ShapeCache.h
@@ -96,7 +96,7 @@
     ShapeCacheEntry(const ShapeCacheEntry& entry):
         shapeType(entry.shapeType), join(entry.join), cap(entry.cap),
         style(entry.style), miter(entry.miter),
-        strokeWidth(entry.strokeWidth) {
+        strokeWidth(entry.strokeWidth), pathEffect(entry.pathEffect) {
     }
 
     ShapeCacheEntry(ShapeType type, SkPaint* paint) {
@@ -108,18 +108,19 @@
         v = paint->getStrokeWidth();
         strokeWidth = *(uint32_t*) &v;
         style = paint->getStyle();
+        pathEffect = paint->getPathEffect();
     }
 
     virtual ~ShapeCacheEntry() {
     }
 
-    // shapeType must be checked in subclasses operator<
     ShapeType shapeType;
     SkPaint::Join join;
     SkPaint::Cap cap;
     SkPaint::Style style;
     uint32_t miter;
     uint32_t strokeWidth;
+    SkPathEffect* pathEffect;
 
     bool operator<(const ShapeCacheEntry& rhs) const {
         LTE_INT(shapeType) {
@@ -128,7 +129,9 @@
                     LTE_INT(style) {
                         LTE_INT(miter) {
                             LTE_INT(strokeWidth) {
-                                return lessThan(rhs);
+                                LTE_INT(pathEffect) {
+                                    return lessThan(rhs);
+                                }
                             }
                         }
                     }
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 5520315..14152d8 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -113,7 +113,9 @@
 	rsStream.cpp \
 	rsThreadIO.cpp \
 	rsType.cpp \
-	rsVertexArray.cpp
+	rsVertexArray.cpp \
+	driver/rsdBcc.cpp \
+	driver/rsdCore.cpp
 
 
 LOCAL_SHARED_LIBRARIES += libz libcutils libutils libEGL libGLESv1_CM libGLESv2 libui libbcc
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index bb5e4aa..cb6d7e0 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -24,313 +24,23 @@
 extern "C" {
 #endif
 
-//////////////////////////////////////////////////////
-//
-
-typedef void * RsAsyncVoidPtr;
-
-typedef void * RsAdapter1D;
-typedef void * RsAdapter2D;
-typedef void * RsAllocation;
-typedef void * RsAnimation;
-typedef void * RsContext;
-typedef void * RsDevice;
-typedef void * RsElement;
-typedef void * RsFile;
-typedef void * RsFont;
-typedef void * RsSampler;
-typedef void * RsScript;
-typedef void * RsMesh;
-typedef void * RsType;
-typedef void * RsObjectBase;
-
-typedef void * RsProgram;
-typedef void * RsProgramVertex;
-typedef void * RsProgramFragment;
-typedef void * RsProgramStore;
-typedef void * RsProgramRaster;
-
-typedef void (* RsBitmapCallback_t)(void *);
-
-enum RsDeviceParam {
-    RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
-    RS_DEVICE_PARAM_COUNT
-};
-
-typedef struct {
-    uint32_t colorMin;
-    uint32_t colorPref;
-    uint32_t alphaMin;
-    uint32_t alphaPref;
-    uint32_t depthMin;
-    uint32_t depthPref;
-    uint32_t stencilMin;
-    uint32_t stencilPref;
-    uint32_t samplesMin;
-    uint32_t samplesPref;
-    float samplesQ;
-} RsSurfaceConfig;
+#include "RenderScriptDefines.h"
 
 RsDevice rsDeviceCreate();
 void rsDeviceDestroy(RsDevice);
 void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value);
 
 RsContext rsContextCreate(RsDevice, uint32_t version);
-RsContext rsContextCreateGL(RsDevice, uint32_t version, RsSurfaceConfig sc);
+RsContext rsContextCreateGL(RsDevice, uint32_t version,
+                            RsSurfaceConfig sc, uint32_t dpi);
 void rsContextDestroy(RsContext);
 
-enum RsMessageToClientType {
-    RS_MESSAGE_TO_CLIENT_NONE = 0,
-    RS_MESSAGE_TO_CLIENT_EXCEPTION = 1,
-    RS_MESSAGE_TO_CLIENT_RESIZE = 2,
-    RS_MESSAGE_TO_CLIENT_ERROR = 3,
-    RS_MESSAGE_TO_CLIENT_USER = 4
-};
-
 RsMessageToClientType rsContextGetMessage(RsContext vrsc, void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen, bool wait);
 RsMessageToClientType rsContextPeekMessage(RsContext vrsc, size_t *receiveLen, uint32_t *subID, bool wait);
 void rsContextInitToClient(RsContext);
 void rsContextDeinitToClient(RsContext);
 
-#define RS_MAX_TEXTURE 2
-#define RS_MAX_ATTRIBS 16
-
-
-enum RsAllocationUsageType {
-    RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
-    RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
-    RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
-    RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
-
-    RS_ALLOCATION_USAGE_ALL = 0x000F
-};
-
-enum RsAllocationMipmapControl {
-    RS_ALLOCATION_MIPMAP_NONE = 0,
-    RS_ALLOCATION_MIPMAP_FULL = 1,
-    RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
-};
-
-enum RsAllocationCubemapFace {
-    RS_ALLOCATION_CUBMAP_FACE_POSITVE_X = 0,
-    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_X = 1,
-    RS_ALLOCATION_CUBMAP_FACE_POSITVE_Y = 2,
-    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_Y = 3,
-    RS_ALLOCATION_CUBMAP_FACE_POSITVE_Z = 4,
-    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_Z = 5
-};
-
-enum RsDataType {
-    RS_TYPE_NONE,
-    RS_TYPE_FLOAT_16,
-    RS_TYPE_FLOAT_32,
-    RS_TYPE_FLOAT_64,
-    RS_TYPE_SIGNED_8,
-    RS_TYPE_SIGNED_16,
-    RS_TYPE_SIGNED_32,
-    RS_TYPE_SIGNED_64,
-    RS_TYPE_UNSIGNED_8,
-    RS_TYPE_UNSIGNED_16,
-    RS_TYPE_UNSIGNED_32,
-    RS_TYPE_UNSIGNED_64,
-
-    RS_TYPE_BOOLEAN,
-
-    RS_TYPE_UNSIGNED_5_6_5,
-    RS_TYPE_UNSIGNED_5_5_5_1,
-    RS_TYPE_UNSIGNED_4_4_4_4,
-
-    RS_TYPE_MATRIX_4X4,
-    RS_TYPE_MATRIX_3X3,
-    RS_TYPE_MATRIX_2X2,
-
-    RS_TYPE_ELEMENT = 1000,
-    RS_TYPE_TYPE,
-    RS_TYPE_ALLOCATION,
-    RS_TYPE_SAMPLER,
-    RS_TYPE_SCRIPT,
-    RS_TYPE_MESH,
-    RS_TYPE_PROGRAM_FRAGMENT,
-    RS_TYPE_PROGRAM_VERTEX,
-    RS_TYPE_PROGRAM_RASTER,
-    RS_TYPE_PROGRAM_STORE,
-};
-
-enum RsDataKind {
-    RS_KIND_USER,
-
-    RS_KIND_PIXEL_L = 7,
-    RS_KIND_PIXEL_A,
-    RS_KIND_PIXEL_LA,
-    RS_KIND_PIXEL_RGB,
-    RS_KIND_PIXEL_RGBA,
-};
-
-enum RsSamplerParam {
-    RS_SAMPLER_MIN_FILTER,
-    RS_SAMPLER_MAG_FILTER,
-    RS_SAMPLER_WRAP_S,
-    RS_SAMPLER_WRAP_T,
-    RS_SAMPLER_WRAP_R,
-    RS_SAMPLER_ANISO
-};
-
-enum RsSamplerValue {
-    RS_SAMPLER_NEAREST,
-    RS_SAMPLER_LINEAR,
-    RS_SAMPLER_LINEAR_MIP_LINEAR,
-    RS_SAMPLER_WRAP,
-    RS_SAMPLER_CLAMP,
-    RS_SAMPLER_LINEAR_MIP_NEAREST,
-};
-
-enum RsTextureTarget {
-    RS_TEXTURE_2D,
-    RS_TEXTURE_CUBE
-};
-
-enum RsDimension {
-    RS_DIMENSION_X,
-    RS_DIMENSION_Y,
-    RS_DIMENSION_Z,
-    RS_DIMENSION_LOD,
-    RS_DIMENSION_FACE,
-
-    RS_DIMENSION_ARRAY_0 = 100,
-    RS_DIMENSION_ARRAY_1,
-    RS_DIMENSION_ARRAY_2,
-    RS_DIMENSION_ARRAY_3,
-    RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
-};
-
-enum RsDepthFunc {
-    RS_DEPTH_FUNC_ALWAYS,
-    RS_DEPTH_FUNC_LESS,
-    RS_DEPTH_FUNC_LEQUAL,
-    RS_DEPTH_FUNC_GREATER,
-    RS_DEPTH_FUNC_GEQUAL,
-    RS_DEPTH_FUNC_EQUAL,
-    RS_DEPTH_FUNC_NOTEQUAL
-};
-
-enum RsBlendSrcFunc {
-    RS_BLEND_SRC_ZERO,                  // 0
-    RS_BLEND_SRC_ONE,                   // 1
-    RS_BLEND_SRC_DST_COLOR,             // 2
-    RS_BLEND_SRC_ONE_MINUS_DST_COLOR,   // 3
-    RS_BLEND_SRC_SRC_ALPHA,             // 4
-    RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA,   // 5
-    RS_BLEND_SRC_DST_ALPHA,             // 6
-    RS_BLEND_SRC_ONE_MINUS_DST_ALPHA,   // 7
-    RS_BLEND_SRC_SRC_ALPHA_SATURATE     // 8
-};
-
-enum RsBlendDstFunc {
-    RS_BLEND_DST_ZERO,                  // 0
-    RS_BLEND_DST_ONE,                   // 1
-    RS_BLEND_DST_SRC_COLOR,             // 2
-    RS_BLEND_DST_ONE_MINUS_SRC_COLOR,   // 3
-    RS_BLEND_DST_SRC_ALPHA,             // 4
-    RS_BLEND_DST_ONE_MINUS_SRC_ALPHA,   // 5
-    RS_BLEND_DST_DST_ALPHA,             // 6
-    RS_BLEND_DST_ONE_MINUS_DST_ALPHA    // 7
-};
-
-enum RsTexEnvMode {
-    RS_TEX_ENV_MODE_NONE,
-    RS_TEX_ENV_MODE_REPLACE,
-    RS_TEX_ENV_MODE_MODULATE,
-    RS_TEX_ENV_MODE_DECAL
-};
-
-enum RsProgramParam {
-    RS_PROGRAM_PARAM_INPUT,
-    RS_PROGRAM_PARAM_OUTPUT,
-    RS_PROGRAM_PARAM_CONSTANT,
-    RS_PROGRAM_PARAM_TEXTURE_TYPE,
-};
-
-enum RsPrimitive {
-    RS_PRIMITIVE_POINT,
-    RS_PRIMITIVE_LINE,
-    RS_PRIMITIVE_LINE_STRIP,
-    RS_PRIMITIVE_TRIANGLE,
-    RS_PRIMITIVE_TRIANGLE_STRIP,
-    RS_PRIMITIVE_TRIANGLE_FAN
-};
-
-enum RsError {
-    RS_ERROR_NONE = 0,
-    RS_ERROR_BAD_SHADER = 1,
-    RS_ERROR_BAD_SCRIPT = 2,
-    RS_ERROR_BAD_VALUE = 3,
-    RS_ERROR_OUT_OF_MEMORY = 4,
-    RS_ERROR_DRIVER = 5,
-
-    RS_ERROR_FATAL_UNKNOWN = 0x1000,
-    RS_ERROR_FATAL_DRIVER = 0x1001,
-    RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
-};
-
-enum RsAnimationInterpolation {
-    RS_ANIMATION_INTERPOLATION_STEP,
-    RS_ANIMATION_INTERPOLATION_LINEAR,
-    RS_ANIMATION_INTERPOLATION_BEZIER,
-    RS_ANIMATION_INTERPOLATION_CARDINAL,
-    RS_ANIMATION_INTERPOLATION_HERMITE,
-    RS_ANIMATION_INTERPOLATION_BSPLINE
-};
-
-enum RsAnimationEdge {
-    RS_ANIMATION_EDGE_UNDEFINED,
-    RS_ANIMATION_EDGE_CONSTANT,
-    RS_ANIMATION_EDGE_GRADIENT,
-    RS_ANIMATION_EDGE_CYCLE,
-    RS_ANIMATION_EDGE_OSCILLATE,
-    RS_ANIMATION_EDGE_CYLE_RELATIVE
-};
-
-enum RsA3DClassID {
-    RS_A3D_CLASS_ID_UNKNOWN,
-    RS_A3D_CLASS_ID_MESH,
-    RS_A3D_CLASS_ID_TYPE,
-    RS_A3D_CLASS_ID_ELEMENT,
-    RS_A3D_CLASS_ID_ALLOCATION,
-    RS_A3D_CLASS_ID_PROGRAM_VERTEX,
-    RS_A3D_CLASS_ID_PROGRAM_RASTER,
-    RS_A3D_CLASS_ID_PROGRAM_FRAGMENT,
-    RS_A3D_CLASS_ID_PROGRAM_STORE,
-    RS_A3D_CLASS_ID_SAMPLER,
-    RS_A3D_CLASS_ID_ANIMATION,
-    RS_A3D_CLASS_ID_ADAPTER_1D,
-    RS_A3D_CLASS_ID_ADAPTER_2D,
-    RS_A3D_CLASS_ID_SCRIPT_C
-};
-
-enum RsCullMode {
-    RS_CULL_BACK,
-    RS_CULL_FRONT,
-    RS_CULL_NONE
-};
-
-typedef struct {
-    RsA3DClassID classID;
-    const char* objectName;
-} RsFileIndexEntry;
-
-// Script to Script
-typedef struct {
-    uint32_t xStart;
-    uint32_t xEnd;
-    uint32_t yStart;
-    uint32_t yEnd;
-    uint32_t zStart;
-    uint32_t zEnd;
-    uint32_t arrayStart;
-    uint32_t arrayEnd;
-
-} RsScriptCall;
-
+//
 // A3D loading and object update code.
 // Should only be called at object creation, not thread safe
 RsObjectBase rsaFileA3DGetEntryByIndex(RsContext, uint32_t idx, RsFile);
diff --git a/libs/rs/RenderScriptDefines.h b/libs/rs/RenderScriptDefines.h
new file mode 100644
index 0000000..4e1ac88
--- /dev/null
+++ b/libs/rs/RenderScriptDefines.h
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RENDER_SCRIPT_DEFINES_H
+#define RENDER_SCRIPT_DEFINES_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////
+//
+
+typedef void * RsAsyncVoidPtr;
+
+typedef void * RsAdapter1D;
+typedef void * RsAdapter2D;
+typedef void * RsAllocation;
+typedef void * RsAnimation;
+typedef void * RsContext;
+typedef void * RsDevice;
+typedef void * RsElement;
+typedef void * RsFile;
+typedef void * RsFont;
+typedef void * RsSampler;
+typedef void * RsScript;
+typedef void * RsMesh;
+typedef void * RsType;
+typedef void * RsObjectBase;
+
+typedef void * RsProgram;
+typedef void * RsProgramVertex;
+typedef void * RsProgramFragment;
+typedef void * RsProgramStore;
+typedef void * RsProgramRaster;
+
+typedef void (* RsBitmapCallback_t)(void *);
+
+enum RsDeviceParam {
+    RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
+    RS_DEVICE_PARAM_COUNT
+};
+
+typedef struct {
+    uint32_t colorMin;
+    uint32_t colorPref;
+    uint32_t alphaMin;
+    uint32_t alphaPref;
+    uint32_t depthMin;
+    uint32_t depthPref;
+    uint32_t stencilMin;
+    uint32_t stencilPref;
+    uint32_t samplesMin;
+    uint32_t samplesPref;
+    float samplesQ;
+} RsSurfaceConfig;
+
+enum RsMessageToClientType {
+    RS_MESSAGE_TO_CLIENT_NONE = 0,
+    RS_MESSAGE_TO_CLIENT_EXCEPTION = 1,
+    RS_MESSAGE_TO_CLIENT_RESIZE = 2,
+    RS_MESSAGE_TO_CLIENT_ERROR = 3,
+    RS_MESSAGE_TO_CLIENT_USER = 4
+};
+
+enum RsAllocationUsageType {
+    RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
+    RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
+    RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
+    RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
+
+    RS_ALLOCATION_USAGE_ALL = 0x000F
+};
+
+enum RsAllocationMipmapControl {
+    RS_ALLOCATION_MIPMAP_NONE = 0,
+    RS_ALLOCATION_MIPMAP_FULL = 1,
+    RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
+};
+
+enum RsAllocationCubemapFace {
+    RS_ALLOCATION_CUBMAP_FACE_POSITVE_X = 0,
+    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_X = 1,
+    RS_ALLOCATION_CUBMAP_FACE_POSITVE_Y = 2,
+    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_Y = 3,
+    RS_ALLOCATION_CUBMAP_FACE_POSITVE_Z = 4,
+    RS_ALLOCATION_CUBMAP_FACE_NEGATIVE_Z = 5
+};
+
+enum RsDataType {
+    RS_TYPE_NONE,
+    RS_TYPE_FLOAT_16,
+    RS_TYPE_FLOAT_32,
+    RS_TYPE_FLOAT_64,
+    RS_TYPE_SIGNED_8,
+    RS_TYPE_SIGNED_16,
+    RS_TYPE_SIGNED_32,
+    RS_TYPE_SIGNED_64,
+    RS_TYPE_UNSIGNED_8,
+    RS_TYPE_UNSIGNED_16,
+    RS_TYPE_UNSIGNED_32,
+    RS_TYPE_UNSIGNED_64,
+
+    RS_TYPE_BOOLEAN,
+
+    RS_TYPE_UNSIGNED_5_6_5,
+    RS_TYPE_UNSIGNED_5_5_5_1,
+    RS_TYPE_UNSIGNED_4_4_4_4,
+
+    RS_TYPE_MATRIX_4X4,
+    RS_TYPE_MATRIX_3X3,
+    RS_TYPE_MATRIX_2X2,
+
+    RS_TYPE_ELEMENT = 1000,
+    RS_TYPE_TYPE,
+    RS_TYPE_ALLOCATION,
+    RS_TYPE_SAMPLER,
+    RS_TYPE_SCRIPT,
+    RS_TYPE_MESH,
+    RS_TYPE_PROGRAM_FRAGMENT,
+    RS_TYPE_PROGRAM_VERTEX,
+    RS_TYPE_PROGRAM_RASTER,
+    RS_TYPE_PROGRAM_STORE,
+};
+
+enum RsDataKind {
+    RS_KIND_USER,
+
+    RS_KIND_PIXEL_L = 7,
+    RS_KIND_PIXEL_A,
+    RS_KIND_PIXEL_LA,
+    RS_KIND_PIXEL_RGB,
+    RS_KIND_PIXEL_RGBA,
+};
+
+enum RsSamplerParam {
+    RS_SAMPLER_MIN_FILTER,
+    RS_SAMPLER_MAG_FILTER,
+    RS_SAMPLER_WRAP_S,
+    RS_SAMPLER_WRAP_T,
+    RS_SAMPLER_WRAP_R,
+    RS_SAMPLER_ANISO
+};
+
+enum RsSamplerValue {
+    RS_SAMPLER_NEAREST,
+    RS_SAMPLER_LINEAR,
+    RS_SAMPLER_LINEAR_MIP_LINEAR,
+    RS_SAMPLER_WRAP,
+    RS_SAMPLER_CLAMP,
+    RS_SAMPLER_LINEAR_MIP_NEAREST,
+};
+
+enum RsTextureTarget {
+    RS_TEXTURE_2D,
+    RS_TEXTURE_CUBE
+};
+
+enum RsDimension {
+    RS_DIMENSION_X,
+    RS_DIMENSION_Y,
+    RS_DIMENSION_Z,
+    RS_DIMENSION_LOD,
+    RS_DIMENSION_FACE,
+
+    RS_DIMENSION_ARRAY_0 = 100,
+    RS_DIMENSION_ARRAY_1,
+    RS_DIMENSION_ARRAY_2,
+    RS_DIMENSION_ARRAY_3,
+    RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
+};
+
+enum RsDepthFunc {
+    RS_DEPTH_FUNC_ALWAYS,
+    RS_DEPTH_FUNC_LESS,
+    RS_DEPTH_FUNC_LEQUAL,
+    RS_DEPTH_FUNC_GREATER,
+    RS_DEPTH_FUNC_GEQUAL,
+    RS_DEPTH_FUNC_EQUAL,
+    RS_DEPTH_FUNC_NOTEQUAL
+};
+
+enum RsBlendSrcFunc {
+    RS_BLEND_SRC_ZERO,                  // 0
+    RS_BLEND_SRC_ONE,                   // 1
+    RS_BLEND_SRC_DST_COLOR,             // 2
+    RS_BLEND_SRC_ONE_MINUS_DST_COLOR,   // 3
+    RS_BLEND_SRC_SRC_ALPHA,             // 4
+    RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA,   // 5
+    RS_BLEND_SRC_DST_ALPHA,             // 6
+    RS_BLEND_SRC_ONE_MINUS_DST_ALPHA,   // 7
+    RS_BLEND_SRC_SRC_ALPHA_SATURATE     // 8
+};
+
+enum RsBlendDstFunc {
+    RS_BLEND_DST_ZERO,                  // 0
+    RS_BLEND_DST_ONE,                   // 1
+    RS_BLEND_DST_SRC_COLOR,             // 2
+    RS_BLEND_DST_ONE_MINUS_SRC_COLOR,   // 3
+    RS_BLEND_DST_SRC_ALPHA,             // 4
+    RS_BLEND_DST_ONE_MINUS_SRC_ALPHA,   // 5
+    RS_BLEND_DST_DST_ALPHA,             // 6
+    RS_BLEND_DST_ONE_MINUS_DST_ALPHA    // 7
+};
+
+enum RsTexEnvMode {
+    RS_TEX_ENV_MODE_NONE,
+    RS_TEX_ENV_MODE_REPLACE,
+    RS_TEX_ENV_MODE_MODULATE,
+    RS_TEX_ENV_MODE_DECAL
+};
+
+enum RsProgramParam {
+    RS_PROGRAM_PARAM_INPUT,
+    RS_PROGRAM_PARAM_OUTPUT,
+    RS_PROGRAM_PARAM_CONSTANT,
+    RS_PROGRAM_PARAM_TEXTURE_TYPE,
+};
+
+enum RsPrimitive {
+    RS_PRIMITIVE_POINT,
+    RS_PRIMITIVE_LINE,
+    RS_PRIMITIVE_LINE_STRIP,
+    RS_PRIMITIVE_TRIANGLE,
+    RS_PRIMITIVE_TRIANGLE_STRIP,
+    RS_PRIMITIVE_TRIANGLE_FAN
+};
+
+enum RsError {
+    RS_ERROR_NONE = 0,
+    RS_ERROR_BAD_SHADER = 1,
+    RS_ERROR_BAD_SCRIPT = 2,
+    RS_ERROR_BAD_VALUE = 3,
+    RS_ERROR_OUT_OF_MEMORY = 4,
+    RS_ERROR_DRIVER = 5,
+
+    RS_ERROR_FATAL_UNKNOWN = 0x1000,
+    RS_ERROR_FATAL_DRIVER = 0x1001,
+    RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
+};
+
+enum RsAnimationInterpolation {
+    RS_ANIMATION_INTERPOLATION_STEP,
+    RS_ANIMATION_INTERPOLATION_LINEAR,
+    RS_ANIMATION_INTERPOLATION_BEZIER,
+    RS_ANIMATION_INTERPOLATION_CARDINAL,
+    RS_ANIMATION_INTERPOLATION_HERMITE,
+    RS_ANIMATION_INTERPOLATION_BSPLINE
+};
+
+enum RsAnimationEdge {
+    RS_ANIMATION_EDGE_UNDEFINED,
+    RS_ANIMATION_EDGE_CONSTANT,
+    RS_ANIMATION_EDGE_GRADIENT,
+    RS_ANIMATION_EDGE_CYCLE,
+    RS_ANIMATION_EDGE_OSCILLATE,
+    RS_ANIMATION_EDGE_CYLE_RELATIVE
+};
+
+enum RsA3DClassID {
+    RS_A3D_CLASS_ID_UNKNOWN,
+    RS_A3D_CLASS_ID_MESH,
+    RS_A3D_CLASS_ID_TYPE,
+    RS_A3D_CLASS_ID_ELEMENT,
+    RS_A3D_CLASS_ID_ALLOCATION,
+    RS_A3D_CLASS_ID_PROGRAM_VERTEX,
+    RS_A3D_CLASS_ID_PROGRAM_RASTER,
+    RS_A3D_CLASS_ID_PROGRAM_FRAGMENT,
+    RS_A3D_CLASS_ID_PROGRAM_STORE,
+    RS_A3D_CLASS_ID_SAMPLER,
+    RS_A3D_CLASS_ID_ANIMATION,
+    RS_A3D_CLASS_ID_ADAPTER_1D,
+    RS_A3D_CLASS_ID_ADAPTER_2D,
+    RS_A3D_CLASS_ID_SCRIPT_C
+};
+
+enum RsCullMode {
+    RS_CULL_BACK,
+    RS_CULL_FRONT,
+    RS_CULL_NONE
+};
+
+typedef struct {
+    RsA3DClassID classID;
+    const char* objectName;
+} RsFileIndexEntry;
+
+// Script to Script
+typedef struct {
+    uint32_t xStart;
+    uint32_t xEnd;
+    uint32_t yStart;
+    uint32_t yEnd;
+    uint32_t zStart;
+    uint32_t zEnd;
+    uint32_t arrayStart;
+    uint32_t arrayEnd;
+
+} RsScriptCall;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // RENDER_SCRIPT_DEFINES_H
+
+
+
+
diff --git a/libs/rs/driver/rsdBcc.cpp b/libs/rs/driver/rsdBcc.cpp
new file mode 100644
index 0000000..6e4edce
--- /dev/null
+++ b/libs/rs/driver/rsdBcc.cpp
@@ -0,0 +1,545 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "rsdCore.h"
+#include "rsdBcc.h"
+
+#include "rsContext.h"
+#include "rsScriptC.h"
+
+#include "utils/Timers.h"
+#include "utils/StopWatch.h"
+extern "C" {
+#include "libdex/ZipArchive.h"
+}
+
+
+using namespace android;
+using namespace android::renderscript;
+
+struct DrvScript {
+    int (*mRoot)();
+    void (*mInit)();
+
+    BCCScriptRef mBccScript;
+
+    uint32_t mInvokeFunctionCount;
+    InvokeFunc_t *mInvokeFunctions;
+    uint32_t mFieldCount;
+    void ** mFieldAddress;
+    bool * mFieldIsObject;
+
+    const uint8_t * mScriptText;
+    uint32_t mScriptTextLength;
+
+    //uint32_t * mObjectSlots;
+    //uint32_t mObjectSlotCount;
+
+    uint32_t mPragmaCount;
+    const char ** mPragmaKeys;
+    const char ** mPragmaValues;
+
+};
+
+static Script * setTLS(Script *sc) {
+    ScriptTLSStruct * tls = (ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey);
+    rsAssert(tls);
+    Script *old = tls->mScript;
+    tls->mScript = sc;
+    return old;
+}
+
+
+// Input: cacheDir
+// Input: resName
+// Input: extName
+//
+// Note: cacheFile = resName + extName
+//
+// Output: Returns cachePath == cacheDir + cacheFile
+static char *genCacheFileName(const char *cacheDir,
+                              const char *resName,
+                              const char *extName) {
+    char cachePath[512];
+    char cacheFile[sizeof(cachePath)];
+    const size_t kBufLen = sizeof(cachePath) - 1;
+
+    cacheFile[0] = '\0';
+    // Note: resName today is usually something like
+    //       "/com.android.fountain:raw/fountain"
+    if (resName[0] != '/') {
+        // Get the absolute path of the raw/***.bc file.
+
+        // Generate the absolute path.  This doesn't do everything it
+        // should, e.g. if resName is "./out/whatever" it doesn't crunch
+        // the leading "./" out because this if-block is not triggered,
+        // but it'll make do.
+        //
+        if (getcwd(cacheFile, kBufLen) == NULL) {
+            LOGE("Can't get CWD while opening raw/***.bc file\n");
+            return NULL;
+        }
+        // Append "/" at the end of cacheFile so far.
+        strncat(cacheFile, "/", kBufLen);
+    }
+
+    // cacheFile = resName + extName
+    //
+    strncat(cacheFile, resName, kBufLen);
+    if (extName != NULL) {
+        // TODO(srhines): strncat() is a bit dangerous
+        strncat(cacheFile, extName, kBufLen);
+    }
+
+    // Turn the path into a flat filename by replacing
+    // any slashes after the first one with '@' characters.
+    char *cp = cacheFile + 1;
+    while (*cp != '\0') {
+        if (*cp == '/') {
+            *cp = '@';
+        }
+        cp++;
+    }
+
+    // Tack on the file name for the actual cache file path.
+    strncpy(cachePath, cacheDir, kBufLen);
+    strncat(cachePath, cacheFile, kBufLen);
+
+    LOGV("Cache file for '%s' '%s' is '%s'\n", resName, extName, cachePath);
+    return strdup(cachePath);
+}
+
+bool rsdScriptInit(const Context *rsc,
+                     ScriptC *script,
+                     char const *resName,
+                     char const *cacheDir,
+                     uint8_t const *bitcode,
+                     size_t bitcodeSize,
+                     uint32_t flags,
+                     RsHalSymbolLookupFunc lookupFunc) {
+    //LOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc);
+
+    char *cachePath = NULL;
+    uint32_t objectSlotCount = 0;
+
+    DrvScript *drv = (DrvScript *)calloc(1, sizeof(DrvScript));
+    if (drv == NULL) {
+        return false;
+    }
+    script->mHal.drv = drv;
+
+    drv->mBccScript = bccCreateScript();
+    script->mHal.info.isThreadable = true;
+    drv->mScriptText = bitcode;
+    drv->mScriptTextLength = bitcodeSize;
+
+    //LOGE("mBccScript %p", script->mBccScript);
+
+    if (bccRegisterSymbolCallback(drv->mBccScript, lookupFunc, script) != 0) {
+        LOGE("bcc: FAILS to register symbol callback");
+        goto error;
+    }
+
+    if (bccReadBC(drv->mBccScript,
+                  resName,
+                  (char const *)drv->mScriptText,
+                  drv->mScriptTextLength, 0) != 0) {
+        LOGE("bcc: FAILS to read bitcode");
+        return NULL;
+    }
+
+#if 1
+    if (bccLinkFile(drv->mBccScript, "/system/lib/libclcore.bc", 0) != 0) {
+        LOGE("bcc: FAILS to link bitcode");
+        return NULL;
+    }
+#endif
+    cachePath = genCacheFileName(cacheDir, resName, ".oBCC");
+
+    if (bccPrepareExecutable(drv->mBccScript, cachePath, 0) != 0) {
+        LOGE("bcc: FAILS to prepare executable");
+        return NULL;
+    }
+
+    free(cachePath);
+
+    drv->mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(drv->mBccScript, "root"));
+    drv->mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, "init"));
+
+    drv->mInvokeFunctionCount = bccGetExportFuncCount(drv->mBccScript);
+    if (drv->mInvokeFunctionCount <= 0)
+        drv->mInvokeFunctions = NULL;
+    else {
+        drv->mInvokeFunctions = (InvokeFunc_t*) calloc(drv->mInvokeFunctionCount, sizeof(InvokeFunc_t));
+        bccGetExportFuncList(drv->mBccScript, drv->mInvokeFunctionCount, (void **) drv->mInvokeFunctions);
+    }
+
+    drv->mFieldCount = bccGetExportVarCount(drv->mBccScript);
+    if (drv->mFieldCount <= 0) {
+        drv->mFieldAddress = NULL;
+        drv->mFieldIsObject = NULL;
+    } else {
+        drv->mFieldAddress = (void **) calloc(drv->mFieldCount, sizeof(void *));
+        drv->mFieldIsObject = (bool *) calloc(drv->mFieldCount, sizeof(bool));
+        bccGetExportVarList(drv->mBccScript, drv->mFieldCount, (void **) drv->mFieldAddress);
+    }
+
+    objectSlotCount = bccGetObjectSlotCount(drv->mBccScript);
+    if (objectSlotCount) {
+        uint32_t * slots = new uint32_t[objectSlotCount];
+        bccGetObjectSlotList(drv->mBccScript, objectSlotCount, slots);
+        for (uint32_t ct=0; ct < objectSlotCount; ct++) {
+            drv->mFieldIsObject[slots[ct]] = true;
+        }
+        delete [] slots;
+    }
+
+    uint32_t mPragmaCount;
+    const char ** mPragmaKeys;
+    const char ** mPragmaValues;
+
+    const static int pragmaMax = 16;
+    drv->mPragmaCount = bccGetPragmaCount(drv->mBccScript);
+    if (drv->mPragmaCount <= 0) {
+        drv->mPragmaKeys = NULL;
+        drv->mPragmaValues = NULL;
+    } else {
+        drv->mPragmaKeys = (const char **) calloc(drv->mFieldCount, sizeof(const char *));
+        drv->mPragmaValues = (const char **) calloc(drv->mFieldCount, sizeof(const char *));
+        bccGetPragmaList(drv->mBccScript, drv->mPragmaCount, drv->mPragmaKeys, drv->mPragmaValues);
+    }
+
+
+
+    // Copy info over to runtime
+    script->mHal.info.exportedFunctionCount = drv->mInvokeFunctionCount;
+    script->mHal.info.exportedVariableCount = drv->mFieldCount;
+    script->mHal.info.exportedPragmaCount = drv->mPragmaCount;
+    script->mHal.info.exportedPragmaKeyList = drv->mPragmaKeys;
+    script->mHal.info.exportedPragmaValueList = drv->mPragmaValues;
+    script->mHal.info.root = drv->mRoot;
+
+
+    return true;
+
+error:
+
+    free(drv);
+    return false;
+
+}
+
+typedef struct {
+    Context *rsc;
+    Script *script;
+    const Allocation * ain;
+    Allocation * aout;
+    const void * usr;
+
+    uint32_t mSliceSize;
+    volatile int mSliceNum;
+
+    const uint8_t *ptrIn;
+    uint32_t eStrideIn;
+    uint8_t *ptrOut;
+    uint32_t eStrideOut;
+
+    uint32_t xStart;
+    uint32_t xEnd;
+    uint32_t yStart;
+    uint32_t yEnd;
+    uint32_t zStart;
+    uint32_t zEnd;
+    uint32_t arrayStart;
+    uint32_t arrayEnd;
+
+    uint32_t dimX;
+    uint32_t dimY;
+    uint32_t dimZ;
+    uint32_t dimArray;
+} MTLaunchStruct;
+typedef int (*rs_t)(const void *, void *, const void *, uint32_t, uint32_t, uint32_t, uint32_t);
+
+static void wc_xy(void *usr, uint32_t idx) {
+    MTLaunchStruct *mtls = (MTLaunchStruct *)usr;
+
+    while (1) {
+        uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum);
+        uint32_t yStart = mtls->yStart + slice * mtls->mSliceSize;
+        uint32_t yEnd = yStart + mtls->mSliceSize;
+        yEnd = rsMin(yEnd, mtls->yEnd);
+        if (yEnd <= yStart) {
+            return;
+        }
+
+        //LOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
+        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        for (uint32_t y = yStart; y < yEnd; y++) {
+            uint32_t offset = mtls->dimX * y;
+            uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * offset);
+            const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * offset);
+
+            for (uint32_t x = mtls->xStart; x < mtls->xEnd; x++) {
+                ((rs_t)mtls->script->mHal.info.root) (xPtrIn, xPtrOut, mtls->usr, x, y, 0, 0);
+                xPtrIn += mtls->eStrideIn;
+                xPtrOut += mtls->eStrideOut;
+            }
+        }
+    }
+}
+
+static void wc_x(void *usr, uint32_t idx) {
+    MTLaunchStruct *mtls = (MTLaunchStruct *)usr;
+
+    while (1) {
+        uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum);
+        uint32_t xStart = mtls->xStart + slice * mtls->mSliceSize;
+        uint32_t xEnd = xStart + mtls->mSliceSize;
+        xEnd = rsMin(xEnd, mtls->xEnd);
+        if (xEnd <= xStart) {
+            return;
+        }
+
+        //LOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
+        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
+        uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * xStart);
+        const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * xStart);
+        for (uint32_t x = xStart; x < xEnd; x++) {
+            ((rs_t)mtls->script->mHal.info.root) (xPtrIn, xPtrOut, mtls->usr, x, 0, 0, 0);
+            xPtrIn += mtls->eStrideIn;
+            xPtrOut += mtls->eStrideOut;
+        }
+    }
+}
+
+void rsdScriptInvokeForEach(const Context *rsc,
+                            Script *s,
+                            const Allocation * ain,
+                            Allocation * aout,
+                            const void * usr,
+                            uint32_t usrLen,
+                            const RsScriptCall *sc) {
+
+    RsHal * dc = (RsHal *)rsc->mHal.drv;
+
+    MTLaunchStruct mtls;
+    memset(&mtls, 0, sizeof(mtls));
+
+    if (ain) {
+        mtls.dimX = ain->getType()->getDimX();
+        mtls.dimY = ain->getType()->getDimY();
+        mtls.dimZ = ain->getType()->getDimZ();
+        //mtls.dimArray = ain->getType()->getDimArray();
+    } else if (aout) {
+        mtls.dimX = aout->getType()->getDimX();
+        mtls.dimY = aout->getType()->getDimY();
+        mtls.dimZ = aout->getType()->getDimZ();
+        //mtls.dimArray = aout->getType()->getDimArray();
+    } else {
+        rsc->setError(RS_ERROR_BAD_SCRIPT, "rsForEach called with null allocations");
+        return;
+    }
+
+    if (!sc || (sc->xEnd == 0)) {
+        mtls.xEnd = mtls.dimX;
+    } else {
+        rsAssert(sc->xStart < mtls.dimX);
+        rsAssert(sc->xEnd <= mtls.dimX);
+        rsAssert(sc->xStart < sc->xEnd);
+        mtls.xStart = rsMin(mtls.dimX, sc->xStart);
+        mtls.xEnd = rsMin(mtls.dimX, sc->xEnd);
+        if (mtls.xStart >= mtls.xEnd) return;
+    }
+
+    if (!sc || (sc->yEnd == 0)) {
+        mtls.yEnd = mtls.dimY;
+    } else {
+        rsAssert(sc->yStart < mtls.dimY);
+        rsAssert(sc->yEnd <= mtls.dimY);
+        rsAssert(sc->yStart < sc->yEnd);
+        mtls.yStart = rsMin(mtls.dimY, sc->yStart);
+        mtls.yEnd = rsMin(mtls.dimY, sc->yEnd);
+        if (mtls.yStart >= mtls.yEnd) return;
+    }
+
+    mtls.xEnd = rsMax((uint32_t)1, mtls.xEnd);
+    mtls.yEnd = rsMax((uint32_t)1, mtls.yEnd);
+    mtls.zEnd = rsMax((uint32_t)1, mtls.zEnd);
+    mtls.arrayEnd = rsMax((uint32_t)1, mtls.arrayEnd);
+
+    rsAssert(ain->getType()->getDimZ() == 0);
+
+    Context *mrsc = (Context *)rsc;
+    Script * oldTLS = setTLS(s);
+
+    mtls.rsc = mrsc;
+    mtls.ain = ain;
+    mtls.aout = aout;
+    mtls.script = s;
+    mtls.usr = usr;
+    mtls.mSliceSize = 10;
+    mtls.mSliceNum = 0;
+
+    mtls.ptrIn = NULL;
+    mtls.eStrideIn = 0;
+    if (ain) {
+        mtls.ptrIn = (const uint8_t *)ain->getPtr();
+        mtls.eStrideIn = ain->getType()->getElementSizeBytes();
+    }
+
+    mtls.ptrOut = NULL;
+    mtls.eStrideOut = 0;
+    if (aout) {
+        mtls.ptrOut = (uint8_t *)aout->getPtr();
+        mtls.eStrideOut = aout->getType()->getElementSizeBytes();
+    }
+
+    if ((dc->mWorkers.mCount > 1) && s->mHal.info.isThreadable) {
+        if (mtls.dimY > 1) {
+            rsdLaunchThreads(mrsc, wc_xy, &mtls);
+        } else {
+            rsdLaunchThreads(mrsc, wc_x, &mtls);
+        }
+
+        //LOGE("launch 1");
+    } else {
+        //LOGE("launch 3");
+        for (uint32_t ar = mtls.arrayStart; ar < mtls.arrayEnd; ar++) {
+            for (uint32_t z = mtls.zStart; z < mtls.zEnd; z++) {
+                for (uint32_t y = mtls.yStart; y < mtls.yEnd; y++) {
+                    uint32_t offset = mtls.dimX * mtls.dimY * mtls.dimZ * ar +
+                                      mtls.dimX * mtls.dimY * z +
+                                      mtls.dimX * y;
+                    uint8_t *xPtrOut = mtls.ptrOut + (mtls.eStrideOut * offset);
+                    const uint8_t *xPtrIn = mtls.ptrIn + (mtls.eStrideIn * offset);
+
+                    for (uint32_t x = mtls.xStart; x < mtls.xEnd; x++) {
+                        ((rs_t)s->mHal.info.root) (xPtrIn, xPtrOut, usr, x, y, z, ar);
+                        xPtrIn += mtls.eStrideIn;
+                        xPtrOut += mtls.eStrideOut;
+                    }
+                }
+            }
+        }
+    }
+
+    setTLS(oldTLS);
+}
+
+
+int rsdScriptInvokeRoot(const Context *dc, Script *script) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+
+    Script * oldTLS = setTLS(script);
+    int ret = drv->mRoot();
+    setTLS(oldTLS);
+
+    return ret;
+}
+
+void rsdScriptInvokeInit(const Context *dc, Script *script) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+
+    if (drv->mInit) {
+        drv->mInit();
+    }
+}
+
+
+void rsdScriptInvokeFunction(const Context *dc, Script *script,
+                            uint32_t slot,
+                            const void *params,
+                            size_t paramLength) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+    //LOGE("invoke %p %p %i %p %i", dc, script, slot, params, paramLength);
+
+    Script * oldTLS = setTLS(script);
+    ((void (*)(const void *, uint32_t))
+        drv->mInvokeFunctions[slot])(params, paramLength);
+    setTLS(oldTLS);
+}
+
+void rsdScriptSetGlobalVar(const Context *dc, const Script *script,
+                           uint32_t slot, void *data, size_t dataLength) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+    //rsAssert(!script->mFieldIsObject[slot]);
+    //LOGE("setGlobalVar %p %p %i %p %i", dc, script, slot, data, dataLength);
+
+    int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
+    if (!destPtr) {
+        //LOGV("Calling setVar on slot = %i which is null", slot);
+        return;
+    }
+
+    memcpy(destPtr, data, dataLength);
+}
+
+void rsdScriptSetGlobalBind(const Context *dc, const Script *script, uint32_t slot, void *data) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+    //rsAssert(!script->mFieldIsObject[slot]);
+    //LOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
+
+    int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
+    if (!destPtr) {
+        //LOGV("Calling setVar on slot = %i which is null", slot);
+        return;
+    }
+
+    memcpy(destPtr, &data, sizeof(void *));
+}
+
+void rsdScriptSetGlobalObj(const Context *dc, const Script *script, uint32_t slot, ObjectBase *data) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+    //rsAssert(script->mFieldIsObject[slot]);
+    //LOGE("setGlobalObj %p %p %i %p", dc, script, slot, data);
+
+    int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
+    if (!destPtr) {
+        //LOGV("Calling setVar on slot = %i which is null", slot);
+        return;
+    }
+
+    rsiSetObject((ObjectBase **)destPtr, data);
+}
+
+void rsdScriptDestroy(const Context *dc, Script *script) {
+    DrvScript *drv = (DrvScript *)script->mHal.drv;
+
+    if (drv->mFieldAddress) {
+        for (size_t ct=0; ct < drv->mFieldCount; ct++) {
+            if (drv->mFieldIsObject[ct]) {
+                rsiClearObject((ObjectBase **)drv->mFieldAddress[ct]);
+            }
+        }
+        delete [] drv->mFieldAddress;
+        delete [] drv->mFieldIsObject;
+        drv->mFieldAddress = NULL;
+        drv->mFieldIsObject = NULL;
+        drv->mFieldCount = 0;
+    }
+
+    if (drv->mInvokeFunctions) {
+        delete [] drv->mInvokeFunctions;
+        drv->mInvokeFunctions = NULL;
+        drv->mInvokeFunctionCount = 0;
+    }
+    free(drv);
+    script->mHal.drv = NULL;
+
+}
+
+
diff --git a/libs/rs/driver/rsdBcc.h b/libs/rs/driver/rsdBcc.h
new file mode 100644
index 0000000..6723a36
--- /dev/null
+++ b/libs/rs/driver/rsdBcc.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RSD_BCC_H
+#define RSD_BCC_H
+
+#include <rs_hal.h>
+
+
+bool rsdScriptInit(const android::renderscript::Context *, android::renderscript::ScriptC *,
+                   char const *resName, char const *cacheDir,
+                   uint8_t const *bitcode, size_t bitcodeSize,
+                   uint32_t flags, android::renderscript::RsHalSymbolLookupFunc lookupFunc);
+void rsdScriptInvokeFunction(const android::renderscript::Context *dc,
+                             android::renderscript::Script *script,
+                             uint32_t slot,
+                             const void *params,
+                             size_t paramLength);
+
+void rsdScriptInvokeForEach(const android::renderscript::Context *rsc,
+                            android::renderscript::Script *s,
+                            const android::renderscript::Allocation * ain,
+                            android::renderscript::Allocation * aout,
+                            const void * usr,
+                            uint32_t usrLen,
+                            const RsScriptCall *sc);
+
+int rsdScriptInvokeRoot(const android::renderscript::Context *dc,
+                        android::renderscript::Script *script);
+void rsdScriptInvokeInit(const android::renderscript::Context *dc,
+                         android::renderscript::Script *script);
+
+void rsdScriptSetGlobalVar(const android::renderscript::Context *,
+                           const android::renderscript::Script *,
+                           uint32_t slot, void *data, size_t dataLen);
+void rsdScriptSetGlobalBind(const android::renderscript::Context *,
+                            const android::renderscript::Script *,
+                            uint32_t slot, void *data);
+void rsdScriptSetGlobalObj(const android::renderscript::Context *,
+                           const android::renderscript::Script *,
+                           uint32_t slot, android::renderscript::ObjectBase *data);
+
+void rsdScriptSetGlobal(const android::renderscript::Context *dc,
+                        const android::renderscript::Script *script,
+                        uint32_t slot,
+                        void *data,
+                        size_t dataLength);
+void rsdScriptGetGlobal(const android::renderscript::Context *dc,
+                        const android::renderscript::Script *script,
+                        uint32_t slot,
+                        void *data,
+                        size_t dataLength);
+void rsdScriptDestroy(const android::renderscript::Context *dc,
+                      android::renderscript::Script *script);
+
+
+#endif
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
new file mode 100644
index 0000000..6546110
--- /dev/null
+++ b/libs/rs/driver/rsdCore.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rsdCore.h"
+#include "rsdBcc.h"
+
+#include <malloc.h>
+#include "rsContext.h"
+
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sched.h>
+#include <cutils/properties.h>
+#include <cutils/sched_policy.h>
+#include <sys/syscall.h>
+#include <string.h>
+
+using namespace android;
+using namespace android::renderscript;
+
+static void Shutdown(Context *rsc);
+static void SetPriority(const Context *rsc, int32_t priority);
+
+static RsdHalFunctions FunctionTable = {
+    Shutdown,
+    NULL,
+    SetPriority,
+    {
+        rsdScriptInit,
+        rsdScriptInvokeFunction,
+        rsdScriptInvokeRoot,
+        rsdScriptInvokeForEach,
+        rsdScriptInvokeInit,
+        rsdScriptSetGlobalVar,
+        rsdScriptSetGlobalBind,
+        rsdScriptSetGlobalObj,
+        rsdScriptDestroy
+    }
+};
+
+
+
+static void * HelperThreadProc(void *vrsc) {
+    Context *rsc = static_cast<Context *>(vrsc);
+    RsHal *dc = (RsHal *)rsc->mHal.drv;
+
+
+    uint32_t idx = (uint32_t)android_atomic_inc(&dc->mWorkers.mLaunchCount);
+
+    //LOGV("RS helperThread starting %p idx=%i", rsc, idx);
+
+    dc->mWorkers.mLaunchSignals[idx].init();
+    dc->mWorkers.mNativeThreadId[idx] = gettid();
+
+#if 0
+    typedef struct {uint64_t bits[1024 / 64]; } cpu_set_t;
+    cpu_set_t cpuset;
+    memset(&cpuset, 0, sizeof(cpuset));
+    cpuset.bits[idx / 64] |= 1ULL << (idx % 64);
+    int ret = syscall(241, rsc->mWorkers.mNativeThreadId[idx],
+              sizeof(cpuset), &cpuset);
+    LOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
+#endif
+
+    int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct);
+    if (status) {
+        LOGE("pthread_setspecific %i", status);
+    }
+
+    while (!dc->mExit) {
+        dc->mWorkers.mLaunchSignals[idx].wait();
+        if (dc->mWorkers.mLaunchCallback) {
+           dc->mWorkers.mLaunchCallback(dc->mWorkers.mLaunchData, idx);
+        }
+        android_atomic_dec(&dc->mWorkers.mRunningCount);
+        dc->mWorkers.mCompleteSignal.set();
+    }
+
+    //LOGV("RS helperThread exited %p idx=%i", rsc, idx);
+    return NULL;
+}
+
+void rsdLaunchThreads(Context *rsc, WorkerCallback_t cbk, void *data) {
+    RsHal *dc = (RsHal *)rsc->mHal.drv;
+
+    dc->mWorkers.mLaunchData = data;
+    dc->mWorkers.mLaunchCallback = cbk;
+    android_atomic_release_store(dc->mWorkers.mCount, &dc->mWorkers.mRunningCount);
+    for (uint32_t ct = 0; ct < dc->mWorkers.mCount; ct++) {
+        dc->mWorkers.mLaunchSignals[ct].set();
+    }
+    while (android_atomic_acquire_load(&dc->mWorkers.mRunningCount) != 0) {
+        dc->mWorkers.mCompleteSignal.wait();
+    }
+}
+
+bool rsdHalInit(Context *rsc, uint32_t version_major, uint32_t version_minor) {
+    rsc->mHal.funcs = FunctionTable;
+
+    RsHal *dc = (RsHal *)calloc(1, sizeof(RsHal));
+    if (!dc) {
+        LOGE("Calloc for driver hal failed.");
+        return false;
+    }
+    rsc->mHal.drv = dc;
+
+
+    int cpu = sysconf(_SC_NPROCESSORS_ONLN);
+    LOGV("RS Launching thread(s), reported CPU count %i", cpu);
+    if (cpu < 2) cpu = 0;
+
+    dc->mWorkers.mCount = (uint32_t)cpu;
+    dc->mWorkers.mThreadId = (pthread_t *) calloc(dc->mWorkers.mCount, sizeof(pthread_t));
+    dc->mWorkers.mNativeThreadId = (pid_t *) calloc(dc->mWorkers.mCount, sizeof(pid_t));
+    dc->mWorkers.mLaunchSignals = new Signal[dc->mWorkers.mCount];
+    dc->mWorkers.mLaunchCallback = NULL;
+
+    dc->mWorkers.mCompleteSignal.init();
+
+    android_atomic_release_store(dc->mWorkers.mCount, &dc->mWorkers.mRunningCount);
+    android_atomic_release_store(0, &dc->mWorkers.mLaunchCount);
+
+    int status;
+    pthread_attr_t threadAttr;
+    status = pthread_attr_init(&threadAttr);
+    if (status) {
+        LOGE("Failed to init thread attribute.");
+        return false;
+    }
+
+    for (uint32_t ct=0; ct < dc->mWorkers.mCount; ct++) {
+        status = pthread_create(&dc->mWorkers.mThreadId[ct], &threadAttr, HelperThreadProc, rsc);
+        if (status) {
+            dc->mWorkers.mCount = ct;
+            LOGE("Created fewer than expected number of RS threads.");
+            break;
+        }
+    }
+    while (android_atomic_acquire_load(&dc->mWorkers.mRunningCount) != 0) {
+        usleep(100);
+    }
+
+    pthread_attr_destroy(&threadAttr);
+    return true;
+}
+
+
+void SetPriority(const Context *rsc, int32_t priority) {
+    RsHal *dc = (RsHal *)rsc->mHal.drv;
+    for (uint32_t ct=0; ct < dc->mWorkers.mCount; ct++) {
+        setpriority(PRIO_PROCESS, dc->mWorkers.mNativeThreadId[ct], priority);
+    }
+}
+
+void Shutdown(Context *rsc) {
+    RsHal *dc = (RsHal *)rsc->mHal.drv;
+
+    dc->mExit = true;
+    dc->mWorkers.mLaunchData = NULL;
+    dc->mWorkers.mLaunchCallback = NULL;
+    android_atomic_release_store(dc->mWorkers.mCount, &dc->mWorkers.mRunningCount);
+    for (uint32_t ct = 0; ct < dc->mWorkers.mCount; ct++) {
+        dc->mWorkers.mLaunchSignals[ct].set();
+    }
+    int status;
+    void *res;
+    for (uint32_t ct = 0; ct < dc->mWorkers.mCount; ct++) {
+        status = pthread_join(dc->mWorkers.mThreadId[ct], &res);
+    }
+    rsAssert(android_atomic_acquire_load(&dc->mWorkers.mRunningCount) == 0);
+}
+
+
diff --git a/libs/rs/driver/rsdCore.h b/libs/rs/driver/rsdCore.h
new file mode 100644
index 0000000..02b2fbc
--- /dev/null
+++ b/libs/rs/driver/rsdCore.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RSD_CORE_H
+#define RSD_CORE_H
+
+#include <rs_hal.h>
+#include <bcc/bcc.h>
+
+#include "rsMutex.h"
+#include "rsSignal.h"
+
+
+typedef void (* InvokeFunc_t)(void);
+typedef void (*WorkerCallback_t)(void *usr, uint32_t idx);
+
+typedef struct RsHalRec {
+    uint32_t version_major;
+    uint32_t version_minor;
+
+    struct Workers {
+        volatile int mRunningCount;
+        volatile int mLaunchCount;
+        uint32_t mCount;
+        pthread_t *mThreadId;
+        pid_t *mNativeThreadId;
+        android::renderscript::Signal mCompleteSignal;
+
+        android::renderscript::Signal *mLaunchSignals;
+        WorkerCallback_t mLaunchCallback;
+        void *mLaunchData;
+    };
+    Workers mWorkers;
+    bool mExit;
+} RsHal;
+
+
+
+void rsdLaunchThreads(android::renderscript::Context *rsc, WorkerCallback_t cbk, void *data);
+
+#endif
+
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 7e23cec..bbb6200 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -181,10 +181,6 @@
 	}
 
 
-ScriptCBegin {
-	}
-
-
 ScriptSetTimeZone {
 	param RsScript s
 	param const char * timeZone
@@ -246,15 +242,11 @@
 	}
 
 
-ScriptCSetText {
-	param const char * text
-	param uint32_t length
-	}
-
 ScriptCCreate {
-        param const char * packageName
         param const char * resName
         param const char * cacheDir
+	param const char * text
+	param uint32_t length
 	ret RsScript
 	}
 
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index ec03a15..b8ddb0b 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -29,21 +29,22 @@
     : ObjectBase(rsc) {
     init(rsc, type);
 
-    mUsageFlags = usages;
-    mMipmapControl = mc;
+    mHal.state.usageFlags = usages;
+    mHal.state.mipmapControl = mc;
 
     allocScriptMemory();
-    if (mType->getElement()->getHasReferences()) {
-        memset(mPtr, 0, mType->getSizeBytes());
+    if (mHal.state.type->getElement()->getHasReferences()) {
+        memset(mHal.state.mallocPtr, 0, mHal.state.type->getSizeBytes());
     }
-    if (!mPtr) {
+    if (!mHal.state.mallocPtr) {
         LOGE("Allocation::Allocation, alloc failure");
     }
 }
 
 
 void Allocation::init(Context *rsc, const Type *type) {
-    mPtr = NULL;
+    memset(&mHal, 0, sizeof(mHal));
+    mHal.state.mipmapControl = RS_ALLOCATION_MIPMAP_NONE;
 
     mCpuWrite = false;
     mCpuRead = false;
@@ -52,8 +53,6 @@
 
     mReadWriteRatio = 0;
     mUpdateSize = 0;
-    mUsageFlags = 0;
-    mMipmapControl = RS_ALLOCATION_MIPMAP_NONE;
 
     mTextureID = 0;
     mBufferID = 0;
@@ -62,16 +61,25 @@
     mUserBitmapCallback = NULL;
     mUserBitmapCallbackData = NULL;
 
-    mType.set(type);
-    rsAssert(type);
+    mHal.state.type.set(type);
+    updateCache();
+}
 
-    mPtr = NULL;
+void Allocation::updateCache() {
+    const Type *type = mHal.state.type.get();
+    mHal.state.dimensionX = type->getDimX();
+    mHal.state.dimensionY = type->getDimY();
+    mHal.state.dimensionZ = type->getDimZ();
+    mHal.state.hasFaces = type->getDimFaces();
+    mHal.state.hasMipmaps = type->getDimLOD();
+    mHal.state.elementSizeBytes = type->getElementSizeBytes();
+    mHal.state.hasReferences = mHal.state.type->getElement()->getHasReferences();
 }
 
 Allocation::~Allocation() {
     if (mUserBitmapCallback != NULL) {
         mUserBitmapCallback(mUserBitmapCallbackData);
-        mPtr = NULL;
+        mHal.state.mallocPtr = NULL;
     }
     freeScriptMemory();
 #ifndef ANDROID_RS_SERIALIZE
@@ -105,14 +113,14 @@
 }
 
 void Allocation::deferedUploadToTexture(const Context *rsc) {
-    mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
+    mHal.state.usageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
     mUploadDefered = true;
 }
 
 uint32_t Allocation::getGLTarget() const {
 #ifndef ANDROID_RS_SERIALIZE
     if (getIsTexture()) {
-        if (mType->getDimFaces()) {
+        if (mHal.state.type->getDimFaces()) {
             return GL_TEXTURE_CUBE_MAP;
         } else {
             return GL_TEXTURE_2D;
@@ -126,14 +134,14 @@
 }
 
 void Allocation::allocScriptMemory() {
-    rsAssert(!mPtr);
-    mPtr = malloc(mType->getSizeBytes());
+    rsAssert(!mHal.state.mallocPtr);
+    mHal.state.mallocPtr = malloc(mHal.state.type->getSizeBytes());
 }
 
 void Allocation::freeScriptMemory() {
-    if (mPtr) {
-        free(mPtr);
-        mPtr = NULL;
+    if (mHal.state.mallocPtr) {
+        free(mHal.state.mallocPtr);
+        mHal.state.mallocPtr = NULL;
     }
 }
 
@@ -153,15 +161,15 @@
 
 void Allocation::uploadToTexture(const Context *rsc) {
 #ifndef ANDROID_RS_SERIALIZE
-    mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
-    GLenum type = mType->getElement()->getComponent().getGLType();
-    GLenum format = mType->getElement()->getComponent().getGLFormat();
+    mHal.state.usageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
+    GLenum type = mHal.state.type->getElement()->getComponent().getGLType();
+    GLenum format = mHal.state.type->getElement()->getComponent().getGLFormat();
 
     if (!type || !format) {
         return;
     }
 
-    if (!mPtr) {
+    if (!mHal.state.mallocPtr) {
         return;
     }
 
@@ -184,7 +192,7 @@
 
     upload2DTexture(isFirstUpload);
 
-    if (!(mUsageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
+    if (!(mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
         freeScriptMemory();
     }
 
@@ -207,14 +215,14 @@
                                  uint32_t lod, RsAllocationCubemapFace face,
                                  uint32_t w, uint32_t h) {
 #ifndef ANDROID_RS_SERIALIZE
-    GLenum type = mType->getElement()->getComponent().getGLType();
-    GLenum format = mType->getElement()->getComponent().getGLFormat();
+    GLenum type = mHal.state.type->getElement()->getComponent().getGLType();
+    GLenum format = mHal.state.type->getElement()->getComponent().getGLFormat();
     GLenum target = (GLenum)getGLTarget();
     rsAssert(mTextureID);
     glBindTexture(target, mTextureID);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     GLenum t = GL_TEXTURE_2D;
-    if (mType->getDimFaces()) {
+    if (mHal.state.hasFaces) {
         t = gFaceOrder[face];
     }
     glTexSubImage2D(t, lod, xoff, yoff, w, h, format, type, ptr);
@@ -223,57 +231,57 @@
 
 void Allocation::upload2DTexture(bool isFirstUpload) {
 #ifndef ANDROID_RS_SERIALIZE
-    GLenum type = mType->getElement()->getComponent().getGLType();
-    GLenum format = mType->getElement()->getComponent().getGLFormat();
+    GLenum type = mHal.state.type->getElement()->getComponent().getGLType();
+    GLenum format = mHal.state.type->getElement()->getComponent().getGLFormat();
 
     GLenum target = (GLenum)getGLTarget();
     glBindTexture(target, mTextureID);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
     uint32_t faceCount = 1;
-    if (mType->getDimFaces()) {
+    if (mHal.state.hasFaces) {
         faceCount = 6;
     }
 
     for (uint32_t face = 0; face < faceCount; face ++) {
-        for (uint32_t lod = 0; lod < mType->getLODCount(); lod++) {
-            const uint8_t *p = (const uint8_t *)mPtr;
-            p += mType->getLODFaceOffset(lod, (RsAllocationCubemapFace)face, 0, 0);
+        for (uint32_t lod = 0; lod < mHal.state.type->getLODCount(); lod++) {
+            const uint8_t *p = (const uint8_t *)mHal.state.mallocPtr;
+            p += mHal.state.type->getLODFaceOffset(lod, (RsAllocationCubemapFace)face, 0, 0);
 
             GLenum t = GL_TEXTURE_2D;
-            if (mType->getDimFaces()) {
+            if (mHal.state.hasFaces) {
                 t = gFaceOrder[face];
             }
 
             if (isFirstUpload) {
                 glTexImage2D(t, lod, format,
-                             mType->getLODDimX(lod), mType->getLODDimY(lod),
+                             mHal.state.type->getLODDimX(lod), mHal.state.type->getLODDimY(lod),
                              0, format, type, p);
             } else {
                 glTexSubImage2D(t, lod, 0, 0,
-                                mType->getLODDimX(lod), mType->getLODDimY(lod),
+                                mHal.state.type->getLODDimX(lod), mHal.state.type->getLODDimY(lod),
                                 format, type, p);
             }
         }
     }
 
-    if (mMipmapControl == RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE) {
+    if (mHal.state.mipmapControl == RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE) {
         glGenerateMipmap(target);
     }
 #endif //ANDROID_RS_SERIALIZE
 }
 
 void Allocation::deferedUploadToBufferObject(const Context *rsc) {
-    mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_VERTEX;
+    mHal.state.usageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_VERTEX;
     mUploadDefered = true;
 }
 
 void Allocation::uploadToBufferObject(const Context *rsc) {
 #ifndef ANDROID_RS_SERIALIZE
-    rsAssert(!mType->getDimY());
-    rsAssert(!mType->getDimZ());
+    rsAssert(!mHal.state.type->getDimY());
+    rsAssert(!mHal.state.type->getDimZ());
 
-    mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_VERTEX;
+    mHal.state.usageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_VERTEX;
 
     if (!mBufferID) {
         glGenBuffers(1, &mBufferID);
@@ -285,7 +293,7 @@
     }
     GLenum target = (GLenum)getGLTarget();
     glBindBuffer(target, mBufferID);
-    glBufferData(target, mType->getSizeBytes(), getPtr(), GL_DYNAMIC_DRAW);
+    glBufferData(target, mHal.state.type->getSizeBytes(), getPtr(), GL_DYNAMIC_DRAW);
     glBindBuffer(target, 0);
     rsc->checkError("Allocation::uploadToBufferObject");
 #endif //ANDROID_RS_SERIALIZE
@@ -298,23 +306,23 @@
 }
 
 void Allocation::read(void *data) {
-    memcpy(data, mPtr, mType->getSizeBytes());
+    memcpy(data, mHal.state.mallocPtr, mHal.state.type->getSizeBytes());
 }
 
 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t lod,
                          uint32_t count, const void *data, uint32_t sizeBytes) {
-    uint32_t eSize = mType->getElementSizeBytes();
-    uint8_t * ptr = static_cast<uint8_t *>(mPtr);
+    uint32_t eSize = mHal.state.type->getElementSizeBytes();
+    uint8_t * ptr = static_cast<uint8_t *>(mHal.state.mallocPtr);
     ptr += eSize * xoff;
     uint32_t size = count * eSize;
 
     if (size != sizeBytes) {
         LOGE("Allocation::subData called with mismatched size expected %i, got %i", size, sizeBytes);
-        mType->dumpLOGV("type info");
+        mHal.state.type->dumpLOGV("type info");
         return;
     }
 
-    if (mType->getElement()->getHasReferences()) {
+    if (mHal.state.hasReferences) {
         incRefs(data, count);
         decRefs(ptr, count);
     }
@@ -326,9 +334,9 @@
 
 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
              uint32_t w, uint32_t h, const void *data, uint32_t sizeBytes) {
-    uint32_t eSize = mType->getElementSizeBytes();
+    uint32_t eSize = mHal.state.elementSizeBytes;
     uint32_t lineSize = eSize * w;
-    uint32_t destW = mType->getDimX();
+    uint32_t destW = mHal.state.dimensionX;
 
     //LOGE("data2d %p,  %i %i %i %i %i %i %p %i", this, xoff, yoff, lod, face, w, h, data, sizeBytes);
 
@@ -338,14 +346,14 @@
         return;
     }
 
-    if (mPtr) {
+    if (mHal.state.mallocPtr) {
         const uint8_t *src = static_cast<const uint8_t *>(data);
-        uint8_t *dst = static_cast<uint8_t *>(mPtr);
-        dst += mType->getLODFaceOffset(lod, face, xoff, yoff);
+        uint8_t *dst = static_cast<uint8_t *>(mHal.state.mallocPtr);
+        dst += mHal.state.type->getLODFaceOffset(lod, face, xoff, yoff);
 
         //LOGE("            %p  %p  %i  ", dst, src, eSize);
         for (uint32_t line=yoff; line < (yoff+h); line++) {
-            if (mType->getElement()->getHasReferences()) {
+            if (mHal.state.hasReferences) {
                 incRefs(src, w);
                 decRefs(dst, w);
             }
@@ -367,24 +375,24 @@
 
 void Allocation::elementData(Context *rsc, uint32_t x, const void *data,
                                 uint32_t cIdx, uint32_t sizeBytes) {
-    uint32_t eSize = mType->getElementSizeBytes();
-    uint8_t * ptr = static_cast<uint8_t *>(mPtr);
+    uint32_t eSize = mHal.state.elementSizeBytes;
+    uint8_t * ptr = static_cast<uint8_t *>(mHal.state.mallocPtr);
     ptr += eSize * x;
 
-    if (cIdx >= mType->getElement()->getFieldCount()) {
+    if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
         LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
 
-    if (x >= mType->getDimX()) {
+    if (x >= mHal.state.dimensionX) {
         LOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
-    const Element * e = mType->getElement()->getField(cIdx);
-    ptr += mType->getElement()->getFieldOffsetBytes(cIdx);
+    const Element * e = mHal.state.type->getElement()->getField(cIdx);
+    ptr += mHal.state.type->getElement()->getFieldOffsetBytes(cIdx);
 
     if (sizeBytes != e->getSizeBytes()) {
         LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
@@ -404,30 +412,30 @@
 
 void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
                                 const void *data, uint32_t cIdx, uint32_t sizeBytes) {
-    uint32_t eSize = mType->getElementSizeBytes();
-    uint8_t * ptr = static_cast<uint8_t *>(mPtr);
-    ptr += eSize * (x + y * mType->getDimX());
+    uint32_t eSize = mHal.state.elementSizeBytes;
+    uint8_t * ptr = static_cast<uint8_t *>(mHal.state.mallocPtr);
+    ptr += eSize * (x + y * mHal.state.dimensionX);
 
-    if (x >= mType->getDimX()) {
+    if (x >= mHal.state.dimensionX) {
         LOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
-    if (y >= mType->getDimY()) {
+    if (y >= mHal.state.dimensionY) {
         LOGE("Error Allocation::subElementData X offset %i out of range.", x);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
         return;
     }
 
-    if (cIdx >= mType->getElement()->getFieldCount()) {
+    if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
         LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
         rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
         return;
     }
 
-    const Element * e = mType->getElement()->getField(cIdx);
-    ptr += mType->getElement()->getFieldOffsetBytes(cIdx);
+    const Element * e = mHal.state.type->getElement()->getField(cIdx);
+    ptr += mHal.state.type->getElement()->getFieldOffsetBytes(cIdx);
 
     if (sizeBytes != e->getSizeBytes()) {
         LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
@@ -468,15 +476,15 @@
 
     String8 s(prefix);
     s.append(" type ");
-    if (mType.get()) {
-        mType->dumpLOGV(s.string());
+    if (mHal.state.type.get()) {
+        mHal.state.type->dumpLOGV(s.string());
     }
 
     LOGV("%s allocation ptr=%p mCpuWrite=%i, mCpuRead=%i, mGpuWrite=%i, mGpuRead=%i",
-          prefix, mPtr, mCpuWrite, mCpuRead, mGpuWrite, mGpuRead);
+          prefix, mHal.state.mallocPtr, mCpuWrite, mCpuRead, mGpuWrite, mGpuRead);
 
     LOGV("%s allocation mUsageFlags=0x04%x, mMipmapControl=0x%04x, mTextureID=%i, mBufferID=%i",
-          prefix, mUsageFlags, mMipmapControl, mTextureID, mBufferID);
+          prefix, mHal.state.usageFlags, mHal.state.mipmapControl, mTextureID, mBufferID);
 }
 
 void Allocation::serialize(OStream *stream) const {
@@ -488,13 +496,13 @@
 
     // First thing we need to serialize is the type object since it will be needed
     // to initialize the class
-    mType->serialize(stream);
+    mHal.state.type->serialize(stream);
 
-    uint32_t dataSize = mType->getSizeBytes();
+    uint32_t dataSize = mHal.state.type->getSizeBytes();
     // Write how much data we are storing
     stream->addU32(dataSize);
     // Now write the data
-    stream->addByteArray(mPtr, dataSize);
+    stream->addByteArray(mHal.state.mallocPtr, dataSize);
 }
 
 Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
@@ -544,7 +552,7 @@
 
 void Allocation::incRefs(const void *ptr, size_t ct, size_t startOff) const {
     const uint8_t *p = static_cast<const uint8_t *>(ptr);
-    const Element *e = mType->getElement();
+    const Element *e = mHal.state.type->getElement();
     uint32_t stride = e->getSizeBytes();
 
     p += stride * startOff;
@@ -557,7 +565,7 @@
 
 void Allocation::decRefs(const void *ptr, size_t ct, size_t startOff) const {
     const uint8_t *p = static_cast<const uint8_t *>(ptr);
-    const Element *e = mType->getElement();
+    const Element *e = mHal.state.type->getElement();
     uint32_t stride = e->getSizeBytes();
 
     p += stride * startOff;
@@ -572,24 +580,26 @@
 }
 
 void Allocation::resize1D(Context *rsc, uint32_t dimX) {
-    Type *t = mType->cloneAndResize1D(rsc, dimX);
+    Type *t = mHal.state.type->cloneAndResize1D(rsc, dimX);
 
-    uint32_t oldDimX = mType->getDimX();
+    uint32_t oldDimX = mHal.state.dimensionX;
     if (dimX == oldDimX) {
         return;
     }
 
     if (dimX < oldDimX) {
-        decRefs(mPtr, oldDimX - dimX, dimX);
+        decRefs(mHal.state.mallocPtr, oldDimX - dimX, dimX);
     }
-    mPtr = realloc(mPtr, t->getSizeBytes());
+    mHal.state.mallocPtr = realloc(mHal.state.mallocPtr, t->getSizeBytes());
 
     if (dimX > oldDimX) {
-        const Element *e = mType->getElement();
+        const Element *e = mHal.state.type->getElement();
         uint32_t stride = e->getSizeBytes();
-        memset(((uint8_t *)mPtr) + stride * oldDimX, 0, stride * (dimX - oldDimX));
+        memset(((uint8_t *)mHal.state.mallocPtr) + stride * oldDimX, 0, stride * (dimX - oldDimX));
     }
-    mType.set(t);
+
+    mHal.state.type.set(t);
+    updateCache();
 }
 
 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 4f5d5a8..e63140c 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -29,10 +29,35 @@
     // The graphics equilivent of malloc.  The allocation contains a structure of elements.
 
 public:
+    struct Hal {
+        void * drv;
+
+        struct State {
+            ObjectBaseRef<const Type> type;
+            void * mallocPtr;
+
+            uint32_t usageFlags;
+            RsAllocationMipmapControl mipmapControl;
+
+            // Cached fields from the Type and Element
+            // to prevent pointer chasing in critical loops.
+            uint32_t dimensionX;
+            uint32_t dimensionY;
+            uint32_t dimensionZ;
+            uint32_t elementSizeBytes;
+            bool hasMipmaps;
+            bool hasFaces;
+            bool hasReferences;
+        };
+        State state;
+    };
+    Hal mHal;
+
     Allocation(Context *rsc, const Type *, uint32_t usages,
                RsAllocationMipmapControl mc = RS_ALLOCATION_MIPMAP_NONE);
 
     virtual ~Allocation();
+    void updateCache();
 
     void setCpuWritable(bool);
     void setGpuWritable(bool);
@@ -41,8 +66,8 @@
 
     bool fixAllocation();
 
-    void * getPtr() const {return mPtr;}
-    const Type * getType() const {return mType.get();}
+    void * getPtr() const {return mHal.state.mallocPtr;}
+    const Type * getType() const {return mHal.state.type.get();}
 
     void syncAll(Context *rsc, RsAllocationUsageType src);
 
@@ -88,13 +113,13 @@
     virtual void uploadCheck(Context *rsc);
 
     bool getIsScript() const {
-        return (mUsageFlags & RS_ALLOCATION_USAGE_SCRIPT) != 0;
+        return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT) != 0;
     }
     bool getIsTexture() const {
-        return (mUsageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) != 0;
+        return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) != 0;
     }
     bool getIsBufferObject() const {
-        return (mUsageFlags & RS_ALLOCATION_USAGE_GRAPHICS_VERTEX) != 0;
+        return (mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_VERTEX) != 0;
     }
 
     void incRefs(const void *ptr, size_t ct, size_t startOff = 0) const;
@@ -102,14 +127,11 @@
 
     void sendDirty() const;
     bool getHasGraphicsMipmaps() const {
-        return mMipmapControl != RS_ALLOCATION_MIPMAP_NONE;
+        return mHal.state.mipmapControl != RS_ALLOCATION_MIPMAP_NONE;
     }
 
 
 protected:
-    ObjectBaseRef<const Type> mType;
-    void * mPtr;
-
     Vector<const Program *> mToDirtyList;
 
     // Is we have a non-null user bitmap callback we do not own the bits and
@@ -123,9 +145,6 @@
     bool mGpuWrite;
     bool mGpuRead;
 
-    uint32_t mUsageFlags;
-    RsAllocationMipmapControl mMipmapControl;
-
     // more usage hint data from the application
     // which can be used by a driver to pick the best memory type.
     // Likely ignored for now
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index f9e29f1..c761c75 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -429,6 +429,8 @@
     mStateFont.getFontColor(&oldR, &oldG, &oldB, &oldA);
     uint32_t bufferLen = strlen(buffer);
 
+    ObjectBaseRef<Font> lastFont(getFont());
+    setFont(NULL);
     float shadowCol = 0.1f;
     mStateFont.setFontColor(shadowCol, shadowCol, shadowCol, 1.0f);
     mStateFont.renderText(buffer, bufferLen, 5, getHeight() - 6);
@@ -436,6 +438,7 @@
     mStateFont.setFontColor(1.0f, 0.7f, 0.0f, 1.0f);
     mStateFont.renderText(buffer, bufferLen, 4, getHeight() - 7);
 
+    setFont(lastFont.get());
     mStateFont.setFontColor(oldR, oldG, oldB, oldA);
 }
 
@@ -551,56 +554,6 @@
     mExit = true;
 }
 
-void * Context::helperThreadProc(void *vrsc) {
-     Context *rsc = static_cast<Context *>(vrsc);
-     uint32_t idx = (uint32_t)android_atomic_inc(&rsc->mWorkers.mLaunchCount);
-
-     //LOGV("RS helperThread starting %p idx=%i", rsc, idx);
-
-     rsc->mWorkers.mLaunchSignals[idx].init();
-     rsc->mWorkers.mNativeThreadId[idx] = gettid();
-
-#if 0
-     typedef struct {uint64_t bits[1024 / 64]; } cpu_set_t;
-     cpu_set_t cpuset;
-     memset(&cpuset, 0, sizeof(cpuset));
-     cpuset.bits[idx / 64] |= 1ULL << (idx % 64);
-     int ret = syscall(241, rsc->mWorkers.mNativeThreadId[idx],
-               sizeof(cpuset), &cpuset);
-     LOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
-#endif
-
-     setpriority(PRIO_PROCESS, rsc->mWorkers.mNativeThreadId[idx], rsc->mThreadPriority);
-     int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct);
-     if (status) {
-         LOGE("pthread_setspecific %i", status);
-     }
-
-     while (!rsc->mExit) {
-         rsc->mWorkers.mLaunchSignals[idx].wait();
-         if (rsc->mWorkers.mLaunchCallback) {
-            rsc->mWorkers.mLaunchCallback(rsc->mWorkers.mLaunchData, idx);
-         }
-         android_atomic_dec(&rsc->mWorkers.mRunningCount);
-         rsc->mWorkers.mCompleteSignal.set();
-     }
-
-     //LOGV("RS helperThread exited %p idx=%i", rsc, idx);
-     return NULL;
-}
-
-void Context::launchThreads(WorkerCallback_t cbk, void *data) {
-    mWorkers.mLaunchData = data;
-    mWorkers.mLaunchCallback = cbk;
-    android_atomic_release_store(mWorkers.mCount, &mWorkers.mRunningCount);
-    for (uint32_t ct = 0; ct < mWorkers.mCount; ct++) {
-        mWorkers.mLaunchSignals[ct].set();
-    }
-    while (android_atomic_acquire_load(&mWorkers.mRunningCount) != 0) {
-        mWorkers.mCompleteSignal.wait();
-    }
-}
-
 void Context::setPriority(int32_t p) {
     // Note: If we put this in the proper "background" policy
     // the wallpapers can become completly unresponsive at times.
@@ -617,9 +570,6 @@
     }
 #else
     setpriority(PRIO_PROCESS, mNativeThreadId, p);
-    for (uint32_t ct=0; ct < mWorkers.mCount; ct++) {
-        setpriority(PRIO_PROCESS, mWorkers.mNativeThreadId[ct], p);
-    }
 #endif
 }
 
@@ -630,6 +580,7 @@
     mPaused = false;
     mObjHead = NULL;
     mError = RS_ERROR_NONE;
+    mDPI = 96;
 }
 
 Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
@@ -684,15 +635,12 @@
     timerInit();
     timerSet(RS_TIMER_INTERNAL);
 
-    int cpu = sysconf(_SC_NPROCESSORS_ONLN);
-    LOGV("RS Launching thread(s), reported CPU count %i", cpu);
-    if (cpu < 2) cpu = 0;
+    if (!rsdHalInit(this, 0, 0)) {
+        LOGE("Hal init failed");
+        return false;
+    }
+    mHal.funcs.setPriority(this, mThreadPriority);
 
-    mWorkers.mCount = (uint32_t)cpu;
-    mWorkers.mThreadId = (pthread_t *) calloc(mWorkers.mCount, sizeof(pthread_t));
-    mWorkers.mNativeThreadId = (pid_t *) calloc(mWorkers.mCount, sizeof(pid_t));
-    mWorkers.mLaunchSignals = new Signal[mWorkers.mCount];
-    mWorkers.mLaunchCallback = NULL;
     status = pthread_create(&mThreadId, &threadAttr, threadProc, this);
     if (status) {
         LOGE("Failed to start rs context thread.");
@@ -703,23 +651,10 @@
     }
 
     if (mError != RS_ERROR_NONE) {
+        LOGE("Errors during thread init");
         return false;
     }
 
-    mWorkers.mCompleteSignal.init();
-    android_atomic_release_store(mWorkers.mCount, &mWorkers.mRunningCount);
-    android_atomic_release_store(0, &mWorkers.mLaunchCount);
-    for (uint32_t ct=0; ct < mWorkers.mCount; ct++) {
-        status = pthread_create(&mWorkers.mThreadId[ct], &threadAttr, helperThreadProc, this);
-        if (status) {
-            mWorkers.mCount = ct;
-            LOGE("Created fewer than expected number of RS threads.");
-            break;
-        }
-    }
-    while (android_atomic_acquire_load(&mWorkers.mRunningCount) != 0) {
-        usleep(100);
-    }
     pthread_attr_destroy(&threadAttr);
     return true;
 }
@@ -736,17 +671,10 @@
     mIO.shutdown();
     int status = pthread_join(mThreadId, &res);
 
-    // Cleanup compute threads.
-    mWorkers.mLaunchData = NULL;
-    mWorkers.mLaunchCallback = NULL;
-    android_atomic_release_store(mWorkers.mCount, &mWorkers.mRunningCount);
-    for (uint32_t ct = 0; ct < mWorkers.mCount; ct++) {
-        mWorkers.mLaunchSignals[ct].set();
+
+    if (mHal.funcs.shutdownDriver) {
+        mHal.funcs.shutdownDriver(this);
     }
-    for (uint32_t ct = 0; ct < mWorkers.mCount; ct++) {
-        status = pthread_join(mWorkers.mThreadId[ct], &res);
-    }
-    rsAssert(android_atomic_acquire_load(&mWorkers.mRunningCount) == 0);
 
     // Global structure cleanup.
     pthread_mutex_lock(&gInitMutex);
@@ -1078,10 +1006,12 @@
     return rsc;
 }
 
-RsContext rsContextCreateGL(RsDevice vdev, uint32_t version, RsSurfaceConfig sc) {
+RsContext rsContextCreateGL(RsDevice vdev, uint32_t version,
+                            RsSurfaceConfig sc, uint32_t dpi) {
     LOGV("rsContextCreateGL %p", vdev);
     Device * dev = static_cast<Device *>(vdev);
     Context *rsc = Context::createContext(dev, &sc);
+    rsc->setDPI(dpi);
     LOGV("rsContextCreateGL ret %p ", rsc);
     return rsc;
 }
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index c5e32a6..72574a60 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -22,6 +22,8 @@
 #include "rsAllocation.h"
 #include "rsMesh.h"
 
+#include "rs_hal.h"
+
 #ifndef ANDROID_RS_SERIALIZE
 #include "rsMutex.h"
 #include "rsThreadIO.h"
@@ -71,6 +73,13 @@
 
 class Context {
 public:
+    struct Hal {
+        void * drv;
+
+        RsdHalFunctions funcs;
+    };
+    Hal mHal;
+
     static Context * createContext(Device *, const RsSurfaceConfig *sc);
     ~Context();
 
@@ -81,11 +90,6 @@
     // Library mutex (for providing thread-safe calls from the runtime)
     static pthread_mutex_t gLibMutex;
 
-    struct ScriptTLSStruct {
-        Context * mContext;
-        Script * mScript;
-    };
-
     class PushState {
     public:
         PushState(Context *);
@@ -103,9 +107,6 @@
     ScriptTLSStruct *mTlsStruct;
     RsSurfaceConfig mUserSurfaceConfig;
 
-    typedef void (*WorkerCallback_t)(void *usr, uint32_t idx);
-
-    //StructuredAllocationContext mStateAllocation;
     ElementState mStateElement;
     TypeState mStateType;
     SamplerState mStateSampler;
@@ -216,8 +217,8 @@
     uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
     uint32_t getMaxVertexAttributes() const {return mGL.mMaxVertexAttribs;}
 
-    void launchThreads(WorkerCallback_t cbk, void *data);
-    uint32_t getWorkerPoolSize() const {return (uint32_t)mWorkers.mCount;}
+    uint32_t getDPI() const {return mDPI;}
+    void setDPI(uint32_t dpi) {mDPI = dpi;}
 
 protected:
     Device *mDev;
@@ -258,6 +259,7 @@
         float EXT_texture_max_aniso;
     } mGL;
 
+    uint32_t mDPI;
     uint32_t mWidth;
     uint32_t mHeight;
     int32_t mThreadPriority;
@@ -271,20 +273,6 @@
     pthread_t mThreadId;
     pid_t mNativeThreadId;
 
-    struct Workers {
-        volatile int mRunningCount;
-        volatile int mLaunchCount;
-        uint32_t mCount;
-        pthread_t *mThreadId;
-        pid_t *mNativeThreadId;
-        Signal mCompleteSignal;
-
-        Signal *mLaunchSignals;
-        WorkerCallback_t mLaunchCallback;
-        void *mLaunchData;
-    };
-    Workers mWorkers;
-
     ObjectBaseRef<Script> mRootScript;
     ObjectBaseRef<ProgramFragment> mFragment;
     ObjectBaseRef<ProgramVertex> mVertex;
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 1c1bc98..01dbab8 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -733,7 +733,7 @@
             String8 fullPath(getenv("ANDROID_ROOT"));
             fullPath += fontsDir;
 
-            mDefault.set(Font::create(mRSC, fullPath.string(), 16, 96));
+            mDefault.set(Font::create(mRSC, fullPath.string(), 8, mRSC->getDPI()));
         }
         currentFont = mDefault.get();
     }
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index afee2a3..b84014f 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -21,6 +21,7 @@
 
 Script::Script(Context *rsc) : ObjectBase(rsc) {
     memset(&mEnviroment, 0, sizeof(mEnviroment));
+    memset(&mHal, 0, sizeof(mHal));
 
     mSlots = NULL;
     mTypes = NULL;
@@ -37,48 +38,38 @@
     }
 }
 
-void Script::initSlots() {
-    if (mEnviroment.mFieldCount > 0) {
-        mSlots = new ObjectBaseRef<Allocation>[mEnviroment.mFieldCount];
-        mTypes = new ObjectBaseRef<const Type>[mEnviroment.mFieldCount];
-    }
-}
-
 void Script::setSlot(uint32_t slot, Allocation *a) {
-    if (slot >= mEnviroment.mFieldCount) {
+    //LOGE("setSlot %i %p", slot, a);
+    if (slot >= mHal.info.exportedVariableCount) {
         LOGE("Script::setSlot unable to set allocation, invalid slot index");
         return;
     }
 
     mSlots[slot].set(a);
+    if (a != NULL) {
+        mRSC->mHal.funcs.script.setGlobalBind(mRSC, this, slot, a->getPtr());
+    } else {
+        mRSC->mHal.funcs.script.setGlobalBind(mRSC, this, slot, NULL);
+    }
 }
 
 void Script::setVar(uint32_t slot, const void *val, uint32_t len) {
-    int32_t *destPtr = ((int32_t **)mEnviroment.mFieldAddress)[slot];
-    if (destPtr) {
-        //LOGE("setVar f1  %f", ((const float *)destPtr)[0]);
-        //LOGE("setVar %p %i", destPtr, len);
-        memcpy(destPtr, val, len);
-        //LOGE("setVar f2  %f", ((const float *)destPtr)[0]);
-    } else {
-        //if (rsc->props.mLogScripts) {
-            LOGV("Calling setVar on slot = %i which is null", slot);
-        //}
+    //LOGE("setVar %i %p %i", slot, val, len);
+    if (slot >= mHal.info.exportedVariableCount) {
+        LOGE("Script::setVar unable to set allocation, invalid slot index");
+        return;
     }
+    mRSC->mHal.funcs.script.setGlobalVar(mRSC, this, slot, (void *)val, len);
 }
 
 void Script::setVarObj(uint32_t slot, ObjectBase *val) {
-    ObjectBase **destPtr = ((ObjectBase ***)mEnviroment.mFieldAddress)[slot];
-
-    if (destPtr) {
-        if (val != NULL) {
-            val->incSysRef();
-        }
-        if (*destPtr) {
-            (*destPtr)->decSysRef();
-        }
-        *destPtr = val;
+    //LOGE("setVarObj %i %p", slot, val);
+    if (slot >= mHal.info.exportedVariableCount) {
+        LOGE("Script::setVarObj unable to set allocation, invalid slot index");
+        return;
     }
+    //LOGE("setvarobj  %i %p", slot, val);
+    mRSC->mHal.funcs.script.setGlobalObj(mRSC, this, slot, val);
 }
 
 namespace android {
diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h
index bad095b..671fbe6 100644
--- a/libs/rs/rsScript.h
+++ b/libs/rs/rsScript.h
@@ -31,6 +31,45 @@
 
 class Script : public ObjectBase {
 public:
+    struct Hal {
+        void * drv;
+
+        struct State {
+            ObjectBaseRef<const Type> type;
+            void * mallocPtr;
+
+            uint32_t usageFlags;
+            RsAllocationMipmapControl mipmapControl;
+
+            // Cached fields from the Type and Element
+            // to prevent pointer chasing in critical loops.
+            uint32_t dimensionX;
+            uint32_t dimensionY;
+            uint32_t dimensionZ;
+            uint32_t elementSizeBytes;
+            bool hasMipmaps;
+            bool hasFaces;
+            bool hasReferences;
+        };
+        State state;
+
+        struct DriverInfo {
+            int mVersionMajor;
+            int mVersionMinor;
+
+            size_t exportedVariableCount;
+            size_t exportedFunctionCount;
+            size_t exportedPragmaCount;
+            char const **exportedPragmaKeyList;
+            char const **exportedPragmaValueList;
+
+            int (* root)();
+            bool isThreadable;
+        };
+        DriverInfo info;
+    };
+    Hal mHal;
+
     typedef void (* InvokeFunc_t)(void);
 
     Script(Context *);
@@ -45,16 +84,6 @@
         ObjectBaseRef<ProgramFragment> mFragment;
         ObjectBaseRef<ProgramRaster> mRaster;
         ObjectBaseRef<ProgramStore> mFragmentStore;
-
-        uint32_t mInvokeFunctionCount;
-        InvokeFunc_t *mInvokeFunctions;
-        uint32_t mFieldCount;
-        void ** mFieldAddress;
-
-        char * mScriptText;
-        uint32_t mScriptTextLength;
-
-        bool mIsThreadable;
     };
     Enviroment_t mEnviroment;
 
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index e12926b..d5c486b 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -19,9 +19,6 @@
 #include "rsMatrix.h"
 #include "utils/Timers.h"
 #include "utils/StopWatch.h"
-extern "C" {
-#include "libdex/ZipArchive.h"
-}
 
 #include <GLES/gl.h>
 #include <GLES/glext.h>
@@ -36,94 +33,18 @@
     Context * rsc = tls->mContext; \
     ScriptC * sc = (ScriptC *) tls->mScript
 
-// Input: cacheDir
-// Input: resName
-// Input: extName
-//
-// Note: cacheFile = resName + extName
-//
-// Output: Returns cachePath == cacheDir + cacheFile
-char *genCacheFileName(const char *cacheDir,
-                       const char *resName,
-                       const char *extName) {
-    char cachePath[512];
-    char cacheFile[sizeof(cachePath)];
-    const size_t kBufLen = sizeof(cachePath) - 1;
-
-    cacheFile[0] = '\0';
-    // Note: resName today is usually something like
-    //       "/com.android.fountain:raw/fountain"
-    if (resName[0] != '/') {
-        // Get the absolute path of the raw/***.bc file.
-
-        // Generate the absolute path.  This doesn't do everything it
-        // should, e.g. if resName is "./out/whatever" it doesn't crunch
-        // the leading "./" out because this if-block is not triggered,
-        // but it'll make do.
-        //
-        if (getcwd(cacheFile, kBufLen) == NULL) {
-            LOGE("Can't get CWD while opening raw/***.bc file\n");
-            return NULL;
-        }
-        // Append "/" at the end of cacheFile so far.
-        strncat(cacheFile, "/", kBufLen);
-    }
-
-    // cacheFile = resName + extName
-    //
-    strncat(cacheFile, resName, kBufLen);
-    if (extName != NULL) {
-        // TODO(srhines): strncat() is a bit dangerous
-        strncat(cacheFile, extName, kBufLen);
-    }
-
-    // Turn the path into a flat filename by replacing
-    // any slashes after the first one with '@' characters.
-    char *cp = cacheFile + 1;
-    while (*cp != '\0') {
-        if (*cp == '/') {
-            *cp = '@';
-        }
-        cp++;
-    }
-
-    // Tack on the file name for the actual cache file path.
-    strncpy(cachePath, cacheDir, kBufLen);
-    strncat(cachePath, cacheFile, kBufLen);
-
-    LOGV("Cache file for '%s' '%s' is '%s'\n", resName, extName, cachePath);
-    return strdup(cachePath);
-}
-
 ScriptC::ScriptC(Context *rsc) : Script(rsc) {
-    mBccScript = NULL;
-    memset(&mProgram, 0, sizeof(mProgram));
 }
 
 ScriptC::~ScriptC() {
-    if (mBccScript) {
-        if (mProgram.mObjectSlotList) {
-            for (size_t ct=0; ct < mProgram.mObjectSlotCount; ct++) {
-                setVarObj(mProgram.mObjectSlotList[ct], NULL);
-            }
-            delete [] mProgram.mObjectSlotList;
-            mProgram.mObjectSlotList = NULL;
-            mProgram.mObjectSlotCount = 0;
-        }
-
-
-        LOGD(">>>> ~ScriptC  bccDisposeScript(%p)", mBccScript);
-        bccDisposeScript(mBccScript);
-    }
-    free(mEnviroment.mScriptText);
-    mEnviroment.mScriptText = NULL;
+    mRSC->mHal.funcs.script.destroy(mRSC, this);
 }
 
 void ScriptC::setupScript(Context *rsc) {
     mEnviroment.mStartTimeMillis
                 = nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
 
-    for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) {
+    for (uint32_t ct=0; ct < mHal.info.exportedVariableCount; ct++) {
         if (mSlots[ct].get() && !mTypes[ct].get()) {
             mTypes[ct].set(mSlots[ct]->getType());
         }
@@ -134,27 +55,17 @@
         if (mSlots[ct].get()) {
             ptr = mSlots[ct]->getPtr();
         }
-        void **dest = ((void ***)mEnviroment.mFieldAddress)[ct];
 
-        if (rsc->props.mLogScripts) {
-            if (mSlots[ct].get() != NULL) {
-                LOGV("%p ScriptC::setupScript slot=%i  dst=%p  src=%p  type=%p", rsc, ct, dest, ptr, mSlots[ct]->getType());
-            } else {
-                LOGV("%p ScriptC::setupScript slot=%i  dst=%p  src=%p  type=null", rsc, ct, dest, ptr);
-            }
-        }
-
-        if (dest) {
-            *dest = ptr;
-        }
+        rsc->mHal.funcs.script.setGlobalBind(rsc, this, ct, ptr);
     }
 }
 
 const Allocation *ScriptC::ptrToAllocation(const void *ptr) const {
+    //LOGE("ptr to alloc %p", ptr);
     if (!ptr) {
         return NULL;
     }
-    for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) {
+    for (uint32_t ct=0; ct < mHal.info.exportedVariableCount; ct++) {
         if (!mSlots[ct].get())
             continue;
         if (mSlots[ct]->getPtr() == ptr) {
@@ -165,15 +76,6 @@
     return NULL;
 }
 
-Script * ScriptC::setTLS(Script *sc) {
-    Context::ScriptTLSStruct * tls = (Context::ScriptTLSStruct *)
-                                  pthread_getspecific(Context::gThreadTLSKey);
-    rsAssert(tls);
-    Script *old = tls->mScript;
-    tls->mScript = sc;
-    return old;
-}
-
 void ScriptC::setupGLState(Context *rsc) {
     if (mEnviroment.mFragmentStore.get()) {
         rsc->setProgramStore(mEnviroment.mFragmentStore.get());
@@ -190,7 +92,7 @@
 }
 
 uint32_t ScriptC::run(Context *rsc) {
-    if (mProgram.mRoot == NULL) {
+    if (mHal.info.root == NULL) {
         rsc->setError(RS_ERROR_BAD_SCRIPT, "Attempted to run bad script");
         return 0;
     }
@@ -199,235 +101,45 @@
     setupScript(rsc);
 
     uint32_t ret = 0;
-    Script * oldTLS = setTLS(this);
 
     if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::run invoking root,  ptr %p", rsc, mProgram.mRoot);
+        LOGV("%p ScriptC::run invoking root,  ptr %p", rsc, mHal.info.root);
     }
 
-    ret = mProgram.mRoot();
+    ret = rsc->mHal.funcs.script.invokeRoot(rsc, this);
 
     if (rsc->props.mLogScripts) {
         LOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret);
     }
 
-    setTLS(oldTLS);
     return ret;
 }
 
-typedef struct {
-    Context *rsc;
-    ScriptC *script;
-    const Allocation * ain;
-    Allocation * aout;
-    const void * usr;
-
-    uint32_t mSliceSize;
-    volatile int mSliceNum;
-
-    const uint8_t *ptrIn;
-    uint32_t eStrideIn;
-    uint8_t *ptrOut;
-    uint32_t eStrideOut;
-
-    uint32_t xStart;
-    uint32_t xEnd;
-    uint32_t yStart;
-    uint32_t yEnd;
-    uint32_t zStart;
-    uint32_t zEnd;
-    uint32_t arrayStart;
-    uint32_t arrayEnd;
-
-    uint32_t dimX;
-    uint32_t dimY;
-    uint32_t dimZ;
-    uint32_t dimArray;
-} MTLaunchStruct;
-typedef int (*rs_t)(const void *, void *, const void *, uint32_t, uint32_t, uint32_t, uint32_t);
-
-static void wc_xy(void *usr, uint32_t idx) {
-    MTLaunchStruct *mtls = (MTLaunchStruct *)usr;
-
-    while (1) {
-        uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum);
-        uint32_t yStart = mtls->yStart + slice * mtls->mSliceSize;
-        uint32_t yEnd = yStart + mtls->mSliceSize;
-        yEnd = rsMin(yEnd, mtls->yEnd);
-        if (yEnd <= yStart) {
-            return;
-        }
-
-        //LOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
-        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
-        for (uint32_t y = yStart; y < yEnd; y++) {
-            uint32_t offset = mtls->dimX * y;
-            uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * offset);
-            const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * offset);
-
-            for (uint32_t x = mtls->xStart; x < mtls->xEnd; x++) {
-                ((rs_t)mtls->script->mProgram.mRoot) (xPtrIn, xPtrOut, mtls->usr, x, y, 0, 0);
-                xPtrIn += mtls->eStrideIn;
-                xPtrOut += mtls->eStrideOut;
-            }
-        }
-    }
-}
-
-static void wc_x(void *usr, uint32_t idx) {
-    MTLaunchStruct *mtls = (MTLaunchStruct *)usr;
-
-    while (1) {
-        uint32_t slice = (uint32_t)android_atomic_inc(&mtls->mSliceNum);
-        uint32_t xStart = mtls->xStart + slice * mtls->mSliceSize;
-        uint32_t xEnd = xStart + mtls->mSliceSize;
-        xEnd = rsMin(xEnd, mtls->xEnd);
-        if (xEnd <= xStart) {
-            return;
-        }
-
-        //LOGE("usr idx %i, x %i,%i  y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
-        //LOGE("usr ptr in %p,  out %p", mtls->ptrIn, mtls->ptrOut);
-        uint8_t *xPtrOut = mtls->ptrOut + (mtls->eStrideOut * xStart);
-        const uint8_t *xPtrIn = mtls->ptrIn + (mtls->eStrideIn * xStart);
-        for (uint32_t x = xStart; x < xEnd; x++) {
-            ((rs_t)mtls->script->mProgram.mRoot) (xPtrIn, xPtrOut, mtls->usr, x, 0, 0, 0);
-            xPtrIn += mtls->eStrideIn;
-            xPtrOut += mtls->eStrideOut;
-        }
-    }
-}
 
 void ScriptC::runForEach(Context *rsc,
                          const Allocation * ain,
                          Allocation * aout,
                          const void * usr,
                          const RsScriptCall *sc) {
-    MTLaunchStruct mtls;
-    memset(&mtls, 0, sizeof(mtls));
+
     Context::PushState ps(rsc);
 
-    if (ain) {
-        mtls.dimX = ain->getType()->getDimX();
-        mtls.dimY = ain->getType()->getDimY();
-        mtls.dimZ = ain->getType()->getDimZ();
-        //mtls.dimArray = ain->getType()->getDimArray();
-    } else if (aout) {
-        mtls.dimX = aout->getType()->getDimX();
-        mtls.dimY = aout->getType()->getDimY();
-        mtls.dimZ = aout->getType()->getDimZ();
-        //mtls.dimArray = aout->getType()->getDimArray();
-    } else {
-        rsc->setError(RS_ERROR_BAD_SCRIPT, "rsForEach called with null allocations");
-        return;
-    }
-
-    if (!sc || (sc->xEnd == 0)) {
-        mtls.xEnd = mtls.dimX;
-    } else {
-        rsAssert(sc->xStart < mtls.dimX);
-        rsAssert(sc->xEnd <= mtls.dimX);
-        rsAssert(sc->xStart < sc->xEnd);
-        mtls.xStart = rsMin(mtls.dimX, sc->xStart);
-        mtls.xEnd = rsMin(mtls.dimX, sc->xEnd);
-        if (mtls.xStart >= mtls.xEnd) return;
-    }
-
-    if (!sc || (sc->yEnd == 0)) {
-        mtls.yEnd = mtls.dimY;
-    } else {
-        rsAssert(sc->yStart < mtls.dimY);
-        rsAssert(sc->yEnd <= mtls.dimY);
-        rsAssert(sc->yStart < sc->yEnd);
-        mtls.yStart = rsMin(mtls.dimY, sc->yStart);
-        mtls.yEnd = rsMin(mtls.dimY, sc->yEnd);
-        if (mtls.yStart >= mtls.yEnd) return;
-    }
-
-    mtls.xEnd = rsMax((uint32_t)1, mtls.xEnd);
-    mtls.yEnd = rsMax((uint32_t)1, mtls.yEnd);
-    mtls.zEnd = rsMax((uint32_t)1, mtls.zEnd);
-    mtls.arrayEnd = rsMax((uint32_t)1, mtls.arrayEnd);
-
-    rsAssert(ain->getType()->getDimZ() == 0);
-
     setupGLState(rsc);
     setupScript(rsc);
-    Script * oldTLS = setTLS(this);
-
-    mtls.rsc = rsc;
-    mtls.ain = ain;
-    mtls.aout = aout;
-    mtls.script = this;
-    mtls.usr = usr;
-    mtls.mSliceSize = 10;
-    mtls.mSliceNum = 0;
-
-    mtls.ptrIn = NULL;
-    mtls.eStrideIn = 0;
-    if (ain) {
-        mtls.ptrIn = (const uint8_t *)ain->getPtr();
-        mtls.eStrideIn = ain->getType()->getElementSizeBytes();
-    }
-
-    mtls.ptrOut = NULL;
-    mtls.eStrideOut = 0;
-    if (aout) {
-        mtls.ptrOut = (uint8_t *)aout->getPtr();
-        mtls.eStrideOut = aout->getType()->getElementSizeBytes();
-    }
-
-    if ((rsc->getWorkerPoolSize() > 1) && mEnviroment.mIsThreadable) {
-        if (mtls.dimY > 1) {
-            rsc->launchThreads(wc_xy, &mtls);
-        } else {
-            rsc->launchThreads(wc_x, &mtls);
-        }
-
-        //LOGE("launch 1");
-    } else {
-        //LOGE("launch 3");
-        for (uint32_t ar = mtls.arrayStart; ar < mtls.arrayEnd; ar++) {
-            for (uint32_t z = mtls.zStart; z < mtls.zEnd; z++) {
-                for (uint32_t y = mtls.yStart; y < mtls.yEnd; y++) {
-                    uint32_t offset = mtls.dimX * mtls.dimY * mtls.dimZ * ar +
-                                      mtls.dimX * mtls.dimY * z +
-                                      mtls.dimX * y;
-                    uint8_t *xPtrOut = mtls.ptrOut + (mtls.eStrideOut * offset);
-                    const uint8_t *xPtrIn = mtls.ptrIn + (mtls.eStrideIn * offset);
-
-                    for (uint32_t x = mtls.xStart; x < mtls.xEnd; x++) {
-                        ((rs_t)mProgram.mRoot) (xPtrIn, xPtrOut, usr, x, y, z, ar);
-                        xPtrIn += mtls.eStrideIn;
-                        xPtrOut += mtls.eStrideOut;
-                    }
-                }
-            }
-        }
-    }
-
-    setTLS(oldTLS);
+    rsc->mHal.funcs.script.invokeForEach(rsc, this, ain, aout, usr, 0, sc);
 }
 
 void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len) {
-    if ((slot >= mEnviroment.mInvokeFunctionCount) ||
-        (mEnviroment.mInvokeFunctions[slot] == NULL)) {
+    if (slot >= mHal.info.exportedFunctionCount) {
         rsc->setError(RS_ERROR_BAD_SCRIPT, "Calling invoke on bad script");
         return;
     }
     setupScript(rsc);
-    Script * oldTLS = setTLS(this);
 
     if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::Invoke invoking slot %i,  ptr %p", rsc, slot, mEnviroment.mInvokeFunctions[slot]);
+        LOGV("%p ScriptC::Invoke invoking slot %i,  ptr %p", rsc, slot, this);
     }
-    ((void (*)(const void *, uint32_t))
-        mEnviroment.mInvokeFunctions[slot])(data, len);
-    if (rsc->props.mLogScripts) {
-        LOGV("%p ScriptC::Invoke complete", rsc);
-    }
-
-    setTLS(oldTLS);
+    rsc->mHal.funcs.script.invokeFunction(rsc, this, slot, data, len);
 }
 
 ScriptCState::ScriptCState() {
@@ -440,9 +152,9 @@
     const ScriptCState::SymbolTable_t *sym;
     ScriptC *s = (ScriptC *)pContext;
     if (!strcmp(name, "__isThreadable")) {
-      return (void*) s->mEnviroment.mIsThreadable;
+      return (void*) s->mHal.info.isThreadable;
     } else if (!strcmp(name, "__clearThreadable")) {
-      s->mEnviroment.mIsThreadable = false;
+      s->mHal.info.isThreadable = false;
       return NULL;
     }
     sym = ScriptCState::lookupSymbol(name);
@@ -453,7 +165,7 @@
         sym = ScriptCState::lookupSymbolGL(name);
     }
     if (sym) {
-        s->mEnviroment.mIsThreadable &= sym->threadable;
+        s->mHal.info.isThreadable &= sym->threadable;
         return sym->mPtr;
     }
     LOGE("ScriptC sym lookup failed for %s", name);
@@ -465,144 +177,86 @@
 extern unsigned rs_runtime_lib_bc_size;
 #endif
 
-bool ScriptCState::runCompiler(Context *rsc,
-                               ScriptC *s,
-                               const char *resName,
-                               const char *cacheDir) {
-    s->mBccScript = bccCreateScript();
+bool ScriptC::runCompiler(Context *rsc,
+                          const char *resName,
+                          const char *cacheDir,
+                          const uint8_t *bitcode,
+                          size_t bitcodeLen) {
 
-    s->mEnviroment.mIsThreadable = true;
+    //LOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
 
-    if (bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s) != 0) {
-        LOGE("bcc: FAILS to register symbol callback");
-        return false;
-    }
+    rsc->mHal.funcs.script.scriptInit(rsc, this, resName, cacheDir, bitcode, bitcodeLen, 0, symbolLookup);
 
-    if (bccReadBC(s->mBccScript,
-                  resName,
-                  s->mEnviroment.mScriptText,
-                  s->mEnviroment.mScriptTextLength, 0) != 0) {
-        LOGE("bcc: FAILS to read bitcode");
-        return false;
-    }
+    mEnviroment.mFragment.set(rsc->getDefaultProgramFragment());
+    mEnviroment.mVertex.set(rsc->getDefaultProgramVertex());
+    mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore());
+    mEnviroment.mRaster.set(rsc->getDefaultProgramRaster());
 
-#if 1
-    if (bccLinkFile(s->mBccScript, "/system/lib/libclcore.bc", 0) != 0) {
-        LOGE("bcc: FAILS to link bitcode");
-        return false;
-    }
-#endif
-    char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC");
+    rsc->mHal.funcs.script.invokeInit(rsc, this);
 
-    if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) {
-        LOGE("bcc: FAILS to prepare executable");
-        return false;
-    }
-
-    free(cachePath);
-
-    s->mProgram.mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(s->mBccScript, "root"));
-    s->mProgram.mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(s->mBccScript, "init"));
-
-    if (s->mProgram.mInit) {
-        s->mProgram.mInit();
-    }
-
-    s->mEnviroment.mInvokeFunctionCount = bccGetExportFuncCount(s->mBccScript);
-    if (s->mEnviroment.mInvokeFunctionCount <= 0)
-        s->mEnviroment.mInvokeFunctions = NULL;
-    else {
-        s->mEnviroment.mInvokeFunctions = (Script::InvokeFunc_t*) calloc(s->mEnviroment.mInvokeFunctionCount, sizeof(Script::InvokeFunc_t));
-        bccGetExportFuncList(s->mBccScript, s->mEnviroment.mInvokeFunctionCount, (void **) s->mEnviroment.mInvokeFunctions);
-    }
-
-    s->mEnviroment.mFieldCount = bccGetExportVarCount(s->mBccScript);
-    if (s->mEnviroment.mFieldCount <= 0)
-        s->mEnviroment.mFieldAddress = NULL;
-    else {
-        s->mEnviroment.mFieldAddress = (void **) calloc(s->mEnviroment.mFieldCount, sizeof(void *));
-        bccGetExportVarList(s->mBccScript, s->mEnviroment.mFieldCount, (void **) s->mEnviroment.mFieldAddress);
-        s->initSlots();
-    }
-
-    s->mEnviroment.mFragment.set(rsc->getDefaultProgramFragment());
-    s->mEnviroment.mVertex.set(rsc->getDefaultProgramVertex());
-    s->mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore());
-    s->mEnviroment.mRaster.set(rsc->getDefaultProgramRaster());
-
-    const static int pragmaMax = 16;
-    size_t pragmaCount = bccGetPragmaCount(s->mBccScript);
-    char const *keys[pragmaMax];
-    char const *values[pragmaMax];
-    bccGetPragmaList(s->mBccScript, pragmaMax, keys, values);
-
-    for (size_t i=0; i < pragmaCount; ++i) {
+    for (size_t i=0; i < mHal.info.exportedPragmaCount; ++i) {
+        const char * key = mHal.info.exportedPragmaKeyList[i];
+        const char * value = mHal.info.exportedPragmaValueList[i];
         //LOGE("pragma %s %s", keys[i], values[i]);
-        if (!strcmp(keys[i], "version")) {
-            if (!strcmp(values[i], "1")) {
+        if (!strcmp(key, "version")) {
+            if (!strcmp(value, "1")) {
                 continue;
             }
-            LOGE("Invalid version pragma value: %s\n", values[i]);
+            LOGE("Invalid version pragma value: %s\n", value);
             return false;
         }
 
-        if (!strcmp(keys[i], "stateVertex")) {
-            if (!strcmp(values[i], "default")) {
+        if (!strcmp(key, "stateVertex")) {
+            if (!strcmp(value, "default")) {
                 continue;
             }
-            if (!strcmp(values[i], "parent")) {
-                s->mEnviroment.mVertex.clear();
+            if (!strcmp(value, "parent")) {
+                mEnviroment.mVertex.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateVertex", values[i]);
+            LOGE("Unrecognized value %s passed to stateVertex", value);
             return false;
         }
 
-        if (!strcmp(keys[i], "stateRaster")) {
-            if (!strcmp(values[i], "default")) {
+        if (!strcmp(key, "stateRaster")) {
+            if (!strcmp(value, "default")) {
                 continue;
             }
-            if (!strcmp(values[i], "parent")) {
-                s->mEnviroment.mRaster.clear();
+            if (!strcmp(value, "parent")) {
+                mEnviroment.mRaster.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateRaster", values[i]);
+            LOGE("Unrecognized value %s passed to stateRaster", value);
             return false;
         }
 
-        if (!strcmp(keys[i], "stateFragment")) {
-            if (!strcmp(values[i], "default")) {
+        if (!strcmp(key, "stateFragment")) {
+            if (!strcmp(value, "default")) {
                 continue;
             }
-            if (!strcmp(values[i], "parent")) {
-                s->mEnviroment.mFragment.clear();
+            if (!strcmp(value, "parent")) {
+                mEnviroment.mFragment.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateFragment", values[i]);
+            LOGE("Unrecognized value %s passed to stateFragment", value);
             return false;
         }
 
-        if (!strcmp(keys[i], "stateStore")) {
-            if (!strcmp(values[i], "default")) {
+        if (!strcmp(key, "stateStore")) {
+            if (!strcmp(value, "default")) {
                 continue;
             }
-            if (!strcmp(values[i], "parent")) {
-                s->mEnviroment.mFragmentStore.clear();
+            if (!strcmp(value, "parent")) {
+                mEnviroment.mFragmentStore.clear();
                 continue;
             }
-            LOGE("Unrecognized value %s passed to stateStore", values[i]);
+            LOGE("Unrecognized value %s passed to stateStore", value);
             return false;
         }
     }
 
-    size_t objectSlotCount = bccGetObjectSlotCount(s->mBccScript);
-    uint32_t *objectSlots = NULL;
-    if (objectSlotCount) {
-        objectSlots = new uint32_t[objectSlotCount];
-        bccGetObjectSlotList(s->mBccScript, objectSlotCount, objectSlots);
-        s->mProgram.mObjectSlotList = objectSlots;
-        s->mProgram.mObjectSlotCount = objectSlotCount;
-    }
+    mSlots = new ObjectBaseRef<Allocation>[mHal.info.exportedVariableCount];
+    mTypes = new ObjectBaseRef<const Type>[mHal.info.exportedVariableCount];
 
     return true;
 }
@@ -610,39 +264,19 @@
 namespace android {
 namespace renderscript {
 
-void rsi_ScriptCBegin(Context * rsc) {
-}
-
-void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) {
-    ScriptCState *ss = &rsc->mScriptC;
-
-    char *t = (char *)malloc(len + 1);
-    memcpy(t, text, len);
-    t[len] = 0;
-    ss->mScriptText = t;
-    ss->mScriptLen = len;
-}
-
-
 RsScript rsi_ScriptCCreate(Context *rsc,
-                           const char *packageName /* deprecated */,
-                           const char *resName,
-                           const char *cacheDir)
+                           const char *resName, const char *cacheDir,
+                           const char *text, uint32_t len)
 {
-    ScriptCState *ss = &rsc->mScriptC;
-
     ScriptC *s = new ScriptC(rsc);
-    s->mEnviroment.mScriptText = ss->mScriptText;
-    s->mEnviroment.mScriptTextLength = ss->mScriptLen;
-    ss->mScriptText = NULL;
-    ss->mScriptLen = 0;
-    s->incUserRef();
 
-    if (!ss->runCompiler(rsc, s, resName, cacheDir)) {
+    if (!s->runCompiler(rsc, resName, cacheDir, (uint8_t *)text, len)) {
         // Error during compile, destroy s and return null.
         delete s;
         return NULL;
     }
+
+    s->incUserRef();
     return s;
 }
 
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index 2c74b5b..2edeb9b 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -21,7 +21,6 @@
 
 #include "RenderScriptEnv.h"
 
-struct BCCOpaqueScript;
 
 // ---------------------------------------------------------------------------
 namespace android {
@@ -36,21 +35,6 @@
     ScriptC(Context *);
     virtual ~ScriptC();
 
-    struct Program_t {
-        int mVersionMajor;
-        int mVersionMinor;
-
-        RunScript_t mRoot;
-        VoidFunc_t mInit;
-
-        uint32_t * mObjectSlotList;
-        uint32_t mObjectSlotCount;
-    };
-
-
-    Program_t mProgram;
-
-    BCCOpaqueScript *mBccScript;
 
     const Allocation *ptrToAllocation(const void *) const;
 
@@ -69,7 +53,10 @@
     virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SCRIPT_C; }
     static Type *createFromStream(Context *rsc, IStream *stream) { return NULL; }
 
-protected:
+    bool runCompiler(Context *rsc, const char *resName, const char *cacheDir,
+                     const uint8_t *bitcode, size_t bitcodeLen);
+
+//protected:
     void setupScript(Context *);
     void setupGLState(Context *);
     Script * setTLS(Script *);
@@ -83,8 +70,6 @@
     char * mScriptText;
     size_t mScriptLen;
 
-    bool runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir);
-
     struct SymbolTable_t {
         const char * mName;
         void * mPtr;
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 23230a6..4e8cbdc 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -25,8 +25,8 @@
 using namespace android;
 using namespace android::renderscript;
 
-#define GET_TLS()  Context::ScriptTLSStruct * tls = \
-    (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \
+#define GET_TLS()  ScriptTLSStruct * tls = \
+    (ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \
     Context * rsc = tls->mContext; \
     ScriptC * sc = (ScriptC *) tls->mScript
 
@@ -141,90 +141,74 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-static uint32_t SC_allocGetDimX(RsAllocation va) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static uint32_t SC_allocGetDimX(Allocation *a) {
     CHECK_OBJ(a);
-    //LOGE("SC_allocGetDimX a=%p  type=%p", a, a->getType());
-    return a->getType()->getDimX();
+    return a->mHal.state.dimensionX;
 }
 
-static uint32_t SC_allocGetDimY(RsAllocation va) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static uint32_t SC_allocGetDimY(Allocation *a) {
     CHECK_OBJ(a);
-    return a->getType()->getDimY();
+    return a->mHal.state.dimensionY;
 }
 
-static uint32_t SC_allocGetDimZ(RsAllocation va) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static uint32_t SC_allocGetDimZ(Allocation *a) {
     CHECK_OBJ(a);
-    return a->getType()->getDimZ();
+    return a->mHal.state.dimensionZ;
 }
 
-static uint32_t SC_allocGetDimLOD(RsAllocation va) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static uint32_t SC_allocGetDimLOD(Allocation *a) {
     CHECK_OBJ(a);
-    return a->getType()->getDimLOD();
+    return a->mHal.state.hasMipmaps;
 }
 
-static uint32_t SC_allocGetDimFaces(RsAllocation va) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static uint32_t SC_allocGetDimFaces(Allocation *a) {
     CHECK_OBJ(a);
-    return a->getType()->getDimFaces();
+    return a->mHal.state.hasFaces;
 }
 
-static const void * SC_getElementAtX(RsAllocation va, uint32_t x) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static const void * SC_getElementAtX(Allocation *a, uint32_t x) {
     CHECK_OBJ(a);
-    const Type *t = a->getType();
-    CHECK_OBJ(t);
     const uint8_t *p = (const uint8_t *)a->getPtr();
-    return &p[t->getElementSizeBytes() * x];
+    return &p[a->mHal.state.elementSizeBytes * x];
 }
 
-static const void * SC_getElementAtXY(RsAllocation va, uint32_t x, uint32_t y) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static const void * SC_getElementAtXY(Allocation *a, uint32_t x, uint32_t y) {
     CHECK_OBJ(a);
-    const Type *t = a->getType();
-    CHECK_OBJ(t);
     const uint8_t *p = (const uint8_t *)a->getPtr();
-    return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
+    return &p[a->mHal.state.elementSizeBytes * (x + y * a->mHal.state.dimensionX)];
 }
 
-static const void * SC_getElementAtXYZ(RsAllocation va, uint32_t x, uint32_t y, uint32_t z) {
-    const Allocation *a = static_cast<const Allocation *>(va);
+static const void * SC_getElementAtXYZ(Allocation *a, uint32_t x, uint32_t y, uint32_t z) {
     CHECK_OBJ(a);
-    const Type *t = a->getType();
-    CHECK_OBJ(t);
     const uint8_t *p = (const uint8_t *)a->getPtr();
-    return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
+    return &p[a->mHal.state.elementSizeBytes * (x + y * a->mHal.state.dimensionX +
+              z * a->mHal.state.dimensionX * a->mHal.state.dimensionY)];
 }
 
-static void SC_setObject(void **vdst, void * vsrc) {
-    //LOGE("SC_setObject  %p,%p  %p", vdst, *vdst, vsrc);
-    if (vsrc) {
-        CHECK_OBJ(vsrc);
-        static_cast<ObjectBase *>(vsrc)->incSysRef();
+void android::renderscript::rsiSetObject(ObjectBase **dst, ObjectBase * src) {
+    //LOGE("rsiSetObject  %p,%p  %p", vdst, *vdst, vsrc);
+    if (src) {
+        CHECK_OBJ(src);
+        src->incSysRef();
     }
-    if (vdst[0]) {
-        CHECK_OBJ(vdst[0]);
-        static_cast<ObjectBase *>(vdst[0])->decSysRef();
+    if (dst[0]) {
+        CHECK_OBJ(dst[0]);
+        dst[0]->decSysRef();
     }
-    *vdst = vsrc;
-    //LOGE("SC_setObject *");
+    *dst = src;
 }
 
-static void SC_clearObject(void **vdst) {
-    //LOGE("SC_clearObject  %p,%p", vdst, *vdst);
-    if (vdst[0]) {
-        CHECK_OBJ(vdst[0]);
-        static_cast<ObjectBase *>(vdst[0])->decSysRef();
+void android::renderscript::rsiClearObject(ObjectBase **dst) {
+    //LOGE("rsiClearObject  %p,%p", vdst, *vdst);
+    if (dst[0]) {
+        CHECK_OBJ(dst[0]);
+        dst[0]->decSysRef();
     }
-    *vdst = NULL;
-    //LOGE("SC_clearObject *");
+    *dst = NULL;
 }
 
-static bool SC_isObject(RsAllocation vsrc) {
-    return vsrc != NULL;
+bool android::renderscript::rsiIsObject(const ObjectBase *src) {
+    return src != NULL;
 }
 
 static void SC_debugF(const char *s, float f) {
@@ -873,49 +857,49 @@
     { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_getElementAtXY, true },
     { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_getElementAtXYZ, true },
 
-    { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP10rs_element", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject10rs_element", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP10rs_elementS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP10rs_element", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject10rs_element", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP7rs_type", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject7rs_type", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP7rs_typeS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP7rs_type", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject7rs_type", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject13rs_allocation", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP13rs_allocationS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP13rs_allocation", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject13rs_allocation", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP10rs_sampler", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject10rs_sampler", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP10rs_samplerS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP10rs_sampler", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject10rs_sampler", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP9rs_script", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject9rs_script", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP9rs_scriptS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP9rs_script", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject9rs_script", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP7rs_meshS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP7rs_mesh", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject7rs_mesh", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP7rs_meshS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP7rs_mesh", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject7rs_mesh", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP19rs_program_fragment", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject19rs_program_fragment", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP19rs_program_fragment", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject19rs_program_fragment", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP17rs_program_vertex", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject17rs_program_vertex", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP17rs_program_vertex", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject17rs_program_vertex", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP17rs_program_raster", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject17rs_program_raster", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP17rs_program_raster", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject17rs_program_raster", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP16rs_program_store", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject16rs_program_store", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP16rs_program_store", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject16rs_program_store", (void *)&rsiIsObject, true },
 
-    { "_Z11rsSetObjectP7rs_fontS_", (void *)&SC_setObject, true },
-    { "_Z13rsClearObjectP7rs_font", (void *)&SC_clearObject, true },
-    { "_Z10rsIsObject7rs_font", (void *)&SC_isObject, true },
+    { "_Z11rsSetObjectP7rs_fontS_", (void *)&rsiSetObject, true },
+    { "_Z13rsClearObjectP7rs_font", (void *)&rsiClearObject, true },
+    { "_Z10rsIsObject7rs_font", (void *)&rsiIsObject, true },
 
 
     { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_allocationMarkDirty, true },
@@ -1000,7 +984,7 @@
     { "_Z17rsMatrixTransposeP12rs_matrix4x4", (void *)&SC_MatrixTranspose_2x2, true },
 
     { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach, false },
-    //{ "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach2, true },
+    //{ "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach2, false },
 
 ////////////////////////////////////////////////////////////////////
 
@@ -1021,3 +1005,4 @@
     }
     return NULL;
 }
+
diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp
index 15426bc..4047049 100644
--- a/libs/rs/rsScriptC_LibGL.cpp
+++ b/libs/rs/rsScriptC_LibGL.cpp
@@ -32,8 +32,8 @@
 using namespace android;
 using namespace android::renderscript;
 
-#define GET_TLS()  Context::ScriptTLSStruct * tls = \
-    (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \
+#define GET_TLS()  ScriptTLSStruct * tls = \
+    (ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \
     Context * rsc = tls->mContext; \
     ScriptC * sc = (ScriptC *) tls->mScript
 
diff --git a/libs/rs/rs_hal.h b/libs/rs/rs_hal.h
new file mode 100644
index 0000000..17983ce
--- /dev/null
+++ b/libs/rs/rs_hal.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RS_HAL_H
+#define RS_HAL_H
+
+#include <RenderScriptDefines.h>
+
+namespace android {
+namespace renderscript {
+
+class Context;
+class ObjectBase;
+class Element;
+class Type;
+class Allocation;
+class Script;
+class ScriptC;
+
+
+typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName);
+
+typedef struct ScriptTLSStructRec {
+    Context * mContext;
+    Script * mScript;
+} ScriptTLSStruct;
+
+
+/**
+ * Script management functions
+ */
+typedef struct {
+    void (*shutdownDriver)(Context *);
+    void (*getVersion)(unsigned int *major, unsigned int *minor);
+    void (*setPriority)(const Context *, int32_t priority);
+
+
+
+    struct {
+        bool (*scriptInit)(const Context *rsc, ScriptC *s,
+                           char const *resName,
+                           char const *cacheDir,
+                           uint8_t const *bitcode,
+                           size_t bitcodeSize,
+                           uint32_t flags,
+                           RsHalSymbolLookupFunc lookupFunc);
+
+        void (*invokeFunction)(const Context *rsc, Script *s,
+                               uint32_t slot,
+                               const void *params,
+                               size_t paramLength);
+        int (*invokeRoot)(const Context *rsc, Script *s);
+        void (*invokeForEach)(const Context *rsc,
+                              Script *s,
+                              const Allocation * ain,
+                              Allocation * aout,
+                              const void * usr,
+                              uint32_t usrLen,
+                              const RsScriptCall *sc);
+        void (*invokeInit)(const Context *rsc, Script *s);
+
+        void (*setGlobalVar)(const Context *rsc, const Script *s,
+                             uint32_t slot,
+                             void *data,
+                             size_t dataLength);
+        void (*setGlobalBind)(const Context *rsc, const Script *s,
+                              uint32_t slot,
+                              void *data);
+        void (*setGlobalObj)(const Context *rsc, const Script *s,
+                             uint32_t slot,
+                             ObjectBase *data);
+
+        void (*destroy)(const Context *rsc, Script *s);
+    } script;
+
+
+
+} RsdHalFunctions;
+
+void rsiSetObject(ObjectBase **vdst, ObjectBase * vsrc);
+void rsiClearObject(ObjectBase **vdst);
+bool rsiIsObject(const ObjectBase *vdst);
+
+}
+}
+
+
+bool rsdHalInit(android::renderscript::Context *, uint32_t version_major, uint32_t version_minor);
+
+#endif
+
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index 21d509a..0dfbf01 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -753,6 +753,9 @@
     case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
         res = dispatch_set_buffers_transform( args );
         break;
+    case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
+        res = dispatch_set_buffers_timestamp( args );
+        break;
     default:
         res = NAME_NOT_FOUND;
         break;
@@ -792,6 +795,11 @@
     return setBuffersTransform(transform);
 }
 
+int Surface::dispatch_set_buffers_timestamp(va_list args) {
+    int64_t timestamp = va_arg(args, int64_t);
+    return setBuffersTimestamp(timestamp);
+}
+
 void Surface::setUsage(uint32_t reqUsage)
 {
     Mutex::Autolock _l(mSurfaceLock);
@@ -910,6 +918,13 @@
     return NO_ERROR;
 }
 
+int Surface::setBuffersTimestamp(int64_t timestamp)
+{
+    // Surface doesn't really have anything meaningful to do with timestamps
+    // so they'll just be dropped here.
+    return NO_ERROR;
+}
+
 // ----------------------------------------------------------------------------
 
 int Surface::getConnectedApi() const
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index 1994f6a..a060a5f 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -56,6 +56,9 @@
 Region::Region(const Region& rhs)
     : mBounds(rhs.mBounds), mStorage(rhs.mStorage)
 {
+#if VALIDATE_REGIONS
+    validate(rhs, "rhs copy-ctor");
+#endif
 }
 
 Region::Region(const Rect& rhs)
@@ -76,7 +79,8 @@
 Region& Region::operator = (const Region& rhs)
 {
 #if VALIDATE_REGIONS
-    validate(rhs, "operator=");
+    validate(*this, "this->operator=");
+    validate(rhs, "rhs.operator=");
 #endif
     mBounds = rhs.mBounds;
     mStorage = rhs.mStorage;
@@ -366,6 +370,12 @@
         const Region& lhs,
         const Region& rhs, int dx, int dy)
 {
+#if VALIDATE_REGIONS
+    validate(lhs, "boolean_operation (before): lhs");
+    validate(rhs, "boolean_operation (before): rhs");
+    validate(dst, "boolean_operation (before): dst");
+#endif
+
     size_t lhs_count;
     Rect const * const lhs_rects = lhs.getArray(&lhs_count);
 
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 8b29ea84..fcbe59e 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -623,6 +623,11 @@
      * being played. Note that if a SurfaceTexture is used, the value
      * set via setScreenOnWhilePlaying has no effect.
      *
+     * The timestamps provided by {@link SurfaceTexture#getTimestamp()} for a
+     * SurfaceTexture set as the video sink have an unspecified zero point,
+     * and cannot be directly compared between different media sources or different
+     * instances of the same media source, or across multiple runs of the same
+     * program.
      * @hide
      */
     public void setTexture(SurfaceTexture st) {
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index 78557ee..2105deb 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -904,6 +904,10 @@
             throw new IllegalArgumentException("Surface could not be retrieved from Surface holder");
         }
 
+        if (surface.isValid() == false) {
+            throw new IllegalStateException("Surface is not valid");
+        }
+
         if (timeMs < 0) {
             throw new IllegalArgumentException("requested time not correct");
         } else if (timeMs > mDurationMs) {
@@ -1627,6 +1631,10 @@
             throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
         }
 
+        if (surface.isValid() == false) {
+            throw new IllegalStateException("Surface is not valid");
+        }
+
         if (listener == null) {
             throw new IllegalArgumentException();
         }
@@ -1863,6 +1871,10 @@
             throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
         }
 
+        if (surface.isValid() == false) {
+            throw new IllegalStateException("Surface is not valid");
+        }
+
         if (mMANativeHelper != null) {
             mMANativeHelper.clearPreviewSurface(surface);
         } else {
diff --git a/media/java/android/mtp/MtpServer.java b/media/java/android/mtp/MtpServer.java
index fe734e1..006fa6d 100644
--- a/media/java/android/mtp/MtpServer.java
+++ b/media/java/android/mtp/MtpServer.java
@@ -24,6 +24,9 @@
  */
 public class MtpServer {
 
+    private final Object mLock = new Object();
+    private boolean mStarted;
+
     private static final String TAG = "MtpServer";
 
     static {
@@ -35,11 +38,19 @@
     }
 
     public void start() {
-        native_start();
+        synchronized (mLock) {
+            native_start();
+            mStarted = true;
+        }
     }
 
     public void stop() {
-        native_stop();
+        synchronized (mLock) {
+            if (mStarted) {
+                native_stop();
+                mStarted = false;
+            }
+        }
     }
 
     public void sendObjectAdded(int handle) {
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 8cda14e..11e2a5e 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -557,6 +557,10 @@
 
     Surface* const p = (Surface*)pEnv->GetIntField(surface, surface_native);
     sp<Surface> previewSurface = sp<Surface>(p);
+    // Validate the mSurface's mNativeSurface field
+    videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+                                                (NULL == previewSurface.get()),
+                                                "mNativeSurface is null");
 
     frameStr.pBuffer = M4OSA_NULL;
     frameStr.timeMs = 0;
@@ -634,6 +638,10 @@
 
     Surface* const p = (Surface*)pEnv->GetIntField(mSurface, surface_native);
     sp<Surface> previewSurface = sp<Surface>(p);
+    // Validate the mSurface's mNativeSurface field
+    videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+                                                (NULL == previewSurface.get()),
+                                                "mNativeSurface is null");
 
     /* Determine the total number of clips, total duration*/
     uiNumberOfClipsInStoryBoard = pContext->pEditSettings->uiClipNumber;
@@ -2058,6 +2066,10 @@
     Surface* const p = (Surface*)pEnv->GetIntField(mSurface, surface_native);
 
     sp<Surface> previewSurface = sp<Surface>(p);
+    // Validate the mSurface's mNativeSurface field
+    videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+                                                (NULL == previewSurface.get()),
+                                                "mNativeSurface is null");
 
     result =  pContext->mPreviewController->setSurface(previewSurface);
     videoEditJava_checkAndThrowRuntimeException(&needToBeLoaded, pEnv,
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index a18bedb..cee1c75 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -722,9 +722,12 @@
     // Manage overrun callback
     if (mActive && (cblk->framesAvailable() == 0)) {
         LOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        AutoMutex _l(cblk->lock);
         if ((cblk->flags & CBLK_UNDERRUN_MSK) == CBLK_UNDERRUN_OFF) {
-            mCbf(EVENT_OVERRUN, mUserData, 0);
             cblk->flags |= CBLK_UNDERRUN_ON;
+            cblk->lock.unlock();
+            mCbf(EVENT_OVERRUN, mUserData, 0);
+            cblk->lock.lock();
         }
     }
 
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8d8f67b..02e1570 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -329,6 +329,7 @@
     if (mActive == 0) {
         mActive = 1;
         mNewPosition = cblk->server + mUpdatePeriod;
+        cblk->lock.lock();
         cblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS;
         cblk->waitTimeMs = 0;
         cblk->flags &= ~CBLK_DISABLED_ON;
@@ -339,7 +340,6 @@
         }
 
         LOGV("start %p before lock cblk %p", this, mCblk);
-        cblk->lock.lock();
         if (!(cblk->flags & CBLK_INVALID_MSK)) {
             cblk->lock.unlock();
             status = mAudioTrack->start();
@@ -893,9 +893,14 @@
 
     // restart track if it was disabled by audioflinger due to previous underrun
     if (mActive && (cblk->flags & CBLK_DISABLED_MSK)) {
-        cblk->flags &= ~CBLK_DISABLED_ON;
-        LOGW("obtainBuffer() track %p disabled, restarting", this);
-        mAudioTrack->start();
+        AutoMutex _l(cblk->lock);
+        if (mActive && (cblk->flags & CBLK_DISABLED_MSK)) {
+            cblk->flags &= ~CBLK_DISABLED_ON;
+            cblk->lock.unlock();
+            LOGW("obtainBuffer() track %p disabled, restarting", this);
+            mAudioTrack->start();
+            cblk->lock.lock();
+        }
     }
 
     cblk->waitTimeMs = 0;
@@ -957,9 +962,10 @@
     ssize_t written = 0;
     const int8_t *src = (const int8_t *)buffer;
     Buffer audioBuffer;
+    size_t frameSz = (size_t)frameSize();
 
     do {
-        audioBuffer.frameCount = userSize/frameSize();
+        audioBuffer.frameCount = userSize/frameSz;
 
         // Calling obtainBuffer() with a negative wait count causes
         // an (almost) infinite wait time.
@@ -991,7 +997,7 @@
         written += toWrite;
 
         releaseBuffer(&audioBuffer);
-    } while (userSize);
+    } while (userSize >= frameSz);
 
     return written;
 }
@@ -1015,12 +1021,15 @@
     // Manage underrun callback
     if (mActive && (cblk->framesReady() == 0)) {
         LOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        AutoMutex _l(cblk->lock);
         if ((cblk->flags & CBLK_UNDERRUN_MSK) == CBLK_UNDERRUN_OFF) {
+            cblk->flags |= CBLK_UNDERRUN_ON;
+            cblk->lock.unlock();
             mCbf(EVENT_UNDERRUN, mUserData, 0);
             if (cblk->server == cblk->frameCount) {
                 mCbf(EVENT_BUFFER_END, mUserData, 0);
             }
-            cblk->flags |= CBLK_UNDERRUN_ON;
+            cblk->lock.lock();
             if (mSharedBuffer != 0) return false;
         }
     }
@@ -1279,7 +1288,12 @@
     this->user = u;
 
     // Clear flow control error condition as new data has been written/read to/from buffer.
-    flags &= ~CBLK_UNDERRUN_MSK;
+    if (flags & CBLK_UNDERRUN_MSK) {
+        AutoMutex _l(lock);
+        if (flags & CBLK_UNDERRUN_MSK) {
+            flags &= ~CBLK_UNDERRUN_MSK;
+        }
+    }
 
     return u;
 }
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index d6a1757..d3aab08 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 //#define LOG_NDEBUG 0
 #define LOG_TAG "IOMX"
 #include <utils/Log.h>
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index ca5bc38..e6f3a33 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -722,8 +722,10 @@
     profiles->mCamcorderProfiles.add(highTimeLapseProfile);
     profiles->mCamcorderProfiles.add(highSpecificTimeLapseProfile);
 
-    // We only have the back-facing camera support by default.
-    profiles->mCameraIds.add(0);
+    // For emulator and other legacy devices which does not have a
+    // media_profiles.xml file, We assume that the default camera id
+    // is 0 and that is the only camera available.
+    profiles->mCameraIds.push(0);
 }
 
 /*static*/ void
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index e277121..c5cbd23 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 //#define LOG_NDEBUG 0
 #define LOG_TAG "StagefrightPlayer"
 #include <utils/Log.h>
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index d590ab9..346d0bb 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 //#define LOG_NDEBUG 0
 #define LOG_TAG "ACodec"
 
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
index 0db3d1d..69846eb 100644
--- a/media/libstagefright/AMRWriter.cpp
+++ b/media/libstagefright/AMRWriter.cpp
@@ -269,7 +269,7 @@
     }
 
     if (stoppedPrematurely) {
-        notify(MEDIA_RECORDER_EVENT_INFO, MEDIA_RECORDER_INFO_COMPLETION_STATUS, UNKNOWN_ERROR);
+        notify(MEDIA_RECORDER_EVENT_INFO, MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS, UNKNOWN_ERROR);
     }
 
     close(mFd);
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 0de1988..35bc0b8 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -750,8 +750,6 @@
     mFlags |= PLAYING;
     mFlags |= FIRST_FRAME;
 
-    bool deferredAudioSeek = false;
-
     if (mDecryptHandle != NULL) {
         int64_t position;
         getPosition(&position);
@@ -767,10 +765,11 @@
 
                 mTimeSource = mAudioPlayer;
 
-                deferredAudioSeek = true;
-
-                mWatchForAudioSeekComplete = false;
-                mWatchForAudioEOS = true;
+                // If there was a seek request before we ever started,
+                // honor the request now.
+                // Make sure to do this before starting the audio player
+                // to avoid a race condition.
+                seekAudioIfNecessary_l();
             }
         }
 
@@ -808,12 +807,6 @@
         }
     }
 
-    if (deferredAudioSeek) {
-        // If there was a seek request while we were paused
-        // and we're just starting up again, honor the request now.
-        seekAudioIfNecessary_l();
-    }
-
     if (mFlags & AT_EOS) {
         // Legacy behaviour, if a stream finishes playing and then
         // is started again, we play from the start...
@@ -883,6 +876,17 @@
              cropLeft, cropTop, cropRight, cropBottom);
     }
 
+    int32_t displayWidth;
+    if (meta->findInt32(kKeyDisplayWidth, &displayWidth)) {
+        LOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth);
+        mDisplayWidth = displayWidth;
+    }
+    int32_t displayHeight;
+    if (meta->findInt32(kKeyDisplayHeight, &displayHeight)) {
+        LOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight);
+        mDisplayHeight = displayHeight;
+    }
+
     int32_t usableWidth = cropRight - cropLeft + 1;
     int32_t usableHeight = cropBottom - cropTop + 1;
     if (mDisplayWidth != 0) {
@@ -1126,7 +1130,6 @@
 
         mWatchForAudioSeekComplete = true;
         mWatchForAudioEOS = true;
-        mSeekNotificationSent = false;
 
         if (mDecryptHandle != NULL) {
             mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
@@ -1251,11 +1254,11 @@
         // If we're playing video only, report seek complete now,
         // otherwise audio player will notify us later.
         notifyListener_l(MEDIA_SEEK_COMPLETE);
+        mSeekNotificationSent = true;
     }
 
     mFlags |= FIRST_FRAME;
     mSeeking = NO_SEEK;
-    mSeekNotificationSent = false;
 
     if (mDecryptHandle != NULL) {
         mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 5d6ea7c..edf76b5 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -52,7 +52,7 @@
 
 class MPEG4Writer::Track {
 public:
-    Track(MPEG4Writer *owner, const sp<MediaSource> &source);
+    Track(MPEG4Writer *owner, const sp<MediaSource> &source, size_t trackId);
 
     ~Track();
 
@@ -82,6 +82,7 @@
     bool mIsAvc;
     bool mIsAudio;
     bool mIsMPEG4;
+    int32_t mTrackId;
     int64_t mTrackDurationUs;
 
     // For realtime applications, we need to adjust the media clock
@@ -295,7 +296,12 @@
 }
 
 status_t MPEG4Writer::addSource(const sp<MediaSource> &source) {
-    Track *track = new Track(this, source);
+    Mutex::Autolock l(mLock);
+    if (mStarted) {
+        LOGE("Attempt to add source AFTER recording is started");
+        return UNKNOWN_ERROR;
+    }
+    Track *track = new Track(this, source, mTracks.size());
     mTracks.push_back(track);
 
     return OK;
@@ -945,7 +951,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 MPEG4Writer::Track::Track(
-        MPEG4Writer *owner, const sp<MediaSource> &source)
+        MPEG4Writer *owner, const sp<MediaSource> &source, size_t trackId)
     : mOwner(owner),
       mMeta(source->getFormat()),
       mSource(source),
@@ -953,6 +959,7 @@
       mPaused(false),
       mResumed(false),
       mStarted(false),
+      mTrackId(trackId),
       mTrackDurationUs(0),
       mEstimatedTrackSizeBytes(0),
       mSamplesHaveSameSize(true),
@@ -2030,7 +2037,7 @@
         (OK != checkCodecSpecificData())) {          // no codec specific data
         err = ERROR_MALFORMED;
     }
-    mOwner->trackProgressStatus(this, -1, err);
+    mOwner->trackProgressStatus(mTrackId, -1, err);
 
     // Last chunk
     if (mOwner->numTracks() == 1) {
@@ -2077,41 +2084,34 @@
     if (mTrackEveryTimeDurationUs > 0 &&
         timeUs - mPreviousTrackTimeUs >= mTrackEveryTimeDurationUs) {
         LOGV("Fire time tracking progress status at %lld us", timeUs);
-        mOwner->trackProgressStatus(this, timeUs - mPreviousTrackTimeUs, err);
+        mOwner->trackProgressStatus(mTrackId, timeUs - mPreviousTrackTimeUs, err);
         mPreviousTrackTimeUs = timeUs;
     }
 }
 
 void MPEG4Writer::trackProgressStatus(
-        const MPEG4Writer::Track* track, int64_t timeUs, status_t err) {
+        size_t trackId, int64_t timeUs, status_t err) {
     Mutex::Autolock lock(mLock);
-    int32_t nTracks = mTracks.size();
-    CHECK(nTracks >= 1);
-    CHECK(nTracks < 64);  // Arbitrary number
-
-    int32_t trackNum = 0;
-    CHECK(trackNum < nTracks);
-    trackNum <<= 16;
+    int32_t trackNum = (trackId << 28);
 
     // Error notification
     // Do not consider ERROR_END_OF_STREAM an error
     if (err != OK && err != ERROR_END_OF_STREAM) {
-        notify(MEDIA_RECORDER_EVENT_ERROR,
-               trackNum | MEDIA_RECORDER_ERROR_UNKNOWN,
+        notify(MEDIA_RECORDER_TRACK_EVENT_ERROR,
+               trackNum | MEDIA_RECORDER_TRACK_ERROR_GENERAL,
                err);
         return;
     }
 
     if (timeUs == -1) {
         // Send completion notification
-        notify(MEDIA_RECORDER_EVENT_INFO,
-               trackNum | MEDIA_RECORDER_INFO_COMPLETION_STATUS,
+        notify(MEDIA_RECORDER_TRACK_EVENT_INFO,
+               trackNum | MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS,
                err);
-        return;
     } else {
         // Send progress status
-        notify(MEDIA_RECORDER_EVENT_INFO,
-               trackNum | MEDIA_RECORDER_INFO_PROGRESS_TIME_STATUS,
+        notify(MEDIA_RECORDER_TRACK_EVENT_INFO,
+               trackNum | MEDIA_RECORDER_TRACK_INFO_PROGRESS_IN_TIME,
                timeUs / 1000);
     }
 }
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 3e26a95..a6a34b3 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -2215,13 +2215,15 @@
 
             if (data2 == 0 || data2 == OMX_IndexParamPortDefinition) {
                 onPortSettingsChanged(data1);
-            } else if (data1 == kPortIndexOutput
-                    && data2 == OMX_IndexConfigCommonOutputCrop) {
+            } else if (data1 == kPortIndexOutput &&
+                        (data2 == OMX_IndexConfigCommonOutputCrop ||
+                         data2 == OMX_IndexConfigCommonScale)) {
 
                 sp<MetaData> oldOutputFormat = mOutputFormat;
                 initOutputFormat(mSource->getFormat());
 
-                if (formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) {
+                if (data2 == OMX_IndexConfigCommonOutputCrop &&
+                    formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) {
                     mOutputPortSettingsHaveChanged = true;
 
                     if (mNativeWindow != NULL) {
@@ -2240,6 +2242,39 @@
                         // already invalid, we'll know soon enough.
                         native_window_set_crop(mNativeWindow.get(), &crop);
                     }
+                } else if (data2 == OMX_IndexConfigCommonScale) {
+                    OMX_CONFIG_SCALEFACTORTYPE scale;
+                    InitOMXParams(&scale);
+                    scale.nPortIndex = kPortIndexOutput;
+
+                    // Change display dimension only when necessary.
+                    if (OK == mOMX->getConfig(
+                                        mNode,
+                                        OMX_IndexConfigCommonScale,
+                                        &scale, sizeof(scale))) {
+                        int32_t left, top, right, bottom;
+                        CHECK(mOutputFormat->findRect(kKeyCropRect,
+                                                      &left, &top,
+                                                      &right, &bottom));
+
+                        // The scale is in 16.16 format.
+                        // scale 1.0 = 0x010000. When there is no
+                        // need to change the display, skip it.
+                        LOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx",
+                                scale.xWidth, scale.xHeight);
+
+                        if (scale.xWidth != 0x010000) {
+                            mOutputFormat->setInt32(kKeyDisplayWidth,
+                                    ((right - left +  1) * scale.xWidth)  >> 16);
+                            mOutputPortSettingsHaveChanged = true;
+                        }
+
+                        if (scale.xHeight != 0x010000) {
+                            mOutputFormat->setInt32(kKeyDisplayHeight,
+                                    ((bottom  - top + 1) * scale.xHeight) >> 16);
+                            mOutputPortSettingsHaveChanged = true;
+                        }
+                    }
                 }
             }
             break;
diff --git a/media/libstagefright/codecs/avc/common/include/avc_types.h b/media/libstagefright/codecs/avc/common/include/avc_types.h
index 73cad89..ec8b6de 100644
--- a/media/libstagefright/codecs/avc/common/include/avc_types.h
+++ b/media/libstagefright/codecs/avc/common/include/avc_types.h
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 #ifndef AVC_TYPES_H_
 
 #define AVC_TYPES_H_
diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
index 5bbba35..490129f 100644
--- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
+++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
@@ -534,7 +534,8 @@
             default:
             {
                 LOGE("Should not be here, unknown nalType %d", nalType);
-                CHECK(!"Should not be here");
+
+                err = ERROR_MALFORMED;
                 break;
             }
         }
diff --git a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
index 30286d8..3b3f786 100644
--- a/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
+++ b/media/libstagefright/foundation/AHierarchicalStateMachine.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <media/stagefright/foundation/AHierarchicalStateMachine.h>
 
 #include <media/stagefright/foundation/ADebug.h>
diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h
index efe7496..fe74a42 100644
--- a/media/libstagefright/include/MPEG2TSExtractor.h
+++ b/media/libstagefright/include/MPEG2TSExtractor.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef MPEG2_TS_EXTRACTOR_H_
 
 #define MPEG2_TS_EXTRACTOR_H_
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 733de92..b3e29b9 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -60,7 +60,10 @@
     virtual int Length(long long* total, long long* available) {
         off64_t size;
         if (mSource->getSize(&size) != OK) {
-            return -1;
+            *total = -1;
+            *available = (long long)((1ull << 63) - 1);
+
+            return 0;
         }
 
         if (total) {
@@ -84,7 +87,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct BlockIterator {
-    BlockIterator(mkvparser::Segment *segment, unsigned long trackNum);
+    BlockIterator(MatroskaExtractor *extractor, unsigned long trackNum);
 
     bool eos() const;
 
@@ -96,11 +99,14 @@
     int64_t blockTimeUs() const;
 
 private:
-    mkvparser::Segment *mSegment;
+    MatroskaExtractor *mExtractor;
     unsigned long mTrackNum;
 
-    mkvparser::Cluster *mCluster;
+    const mkvparser::Cluster *mCluster;
     const mkvparser::BlockEntry *mBlockEntry;
+    long mBlockEntryIndex;
+
+    void advance_l();
 
     BlockIterator(const BlockIterator &);
     BlockIterator &operator=(const BlockIterator &);
@@ -150,7 +156,7 @@
     : mExtractor(extractor),
       mTrackIndex(index),
       mType(OTHER),
-      mBlockIter(mExtractor->mSegment,
+      mBlockIter(mExtractor.get(),
                  mExtractor->mTracks.itemAt(index).mTrackNum),
       mNALSizeLen(0) {
     sp<MetaData> meta = mExtractor->mTracks.itemAt(index).mMeta;
@@ -199,11 +205,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 BlockIterator::BlockIterator(
-        mkvparser::Segment *segment, unsigned long trackNum)
-    : mSegment(segment),
+        MatroskaExtractor *extractor, unsigned long trackNum)
+    : mExtractor(extractor),
       mTrackNum(trackNum),
       mCluster(NULL),
-      mBlockEntry(NULL) {
+      mBlockEntry(NULL),
+      mBlockEntryIndex(0) {
     reset();
 }
 
@@ -212,45 +219,97 @@
 }
 
 void BlockIterator::advance() {
-    while (!eos()) {
-        if (mBlockEntry != NULL) {
-            mBlockEntry = mCluster->GetNext(mBlockEntry);
-        } else if (mCluster != NULL) {
-            mCluster = mSegment->GetNext(mCluster);
+    Mutex::Autolock autoLock(mExtractor->mLock);
+    advance_l();
+}
 
-            if (eos()) {
+void BlockIterator::advance_l() {
+    for (;;) {
+        long res = mCluster->GetEntry(mBlockEntryIndex, mBlockEntry);
+        LOGV("GetEntry returned %ld", res);
+
+        long long pos;
+        long len;
+        if (res < 0) {
+            // Need to parse this cluster some more
+
+            CHECK_EQ(res, mkvparser::E_BUFFER_NOT_FULL);
+
+            res = mCluster->Parse(pos, len);
+            LOGV("Parse returned %ld", res);
+
+            if (res < 0) {
+                // I/O error
+
+                LOGE("Cluster::Parse returned result %ld", res);
+
+                mCluster = NULL;
                 break;
             }
 
-            mBlockEntry = mCluster->GetFirst();
+            continue;
+        } else if (res == 0) {
+            // We're done with this cluster
+
+            const mkvparser::Cluster *nextCluster;
+            res = mExtractor->mSegment->ParseNext(
+                    mCluster, nextCluster, pos, len);
+            LOGV("ParseNext returned %ld", res);
+
+            if (res > 0) {
+                // EOF
+
+                mCluster = NULL;
+                break;
+            }
+
+            CHECK_EQ(res, 0);
+            CHECK(nextCluster != NULL);
+            CHECK(!nextCluster->EOS());
+
+            mCluster = nextCluster;
+
+            res = mCluster->Parse(pos, len);
+            LOGV("Parse (2) returned %ld", res);
+            CHECK_GE(res, 0);
+
+            mBlockEntryIndex = 0;
+            continue;
         }
 
-        if (mBlockEntry != NULL
-                && mBlockEntry->GetBlock()->GetTrackNumber() == mTrackNum) {
+        CHECK(mBlockEntry != NULL);
+        CHECK(mBlockEntry->GetBlock() != NULL);
+        ++mBlockEntryIndex;
+
+        if (mBlockEntry->GetBlock()->GetTrackNumber() == mTrackNum) {
             break;
         }
     }
 }
 
 void BlockIterator::reset() {
-    mCluster = mSegment->GetFirst();
-    mBlockEntry = mCluster->GetFirst();
+    Mutex::Autolock autoLock(mExtractor->mLock);
 
-    while (!eos() && block()->GetTrackNumber() != mTrackNum) {
-        advance();
-    }
+    mCluster = mExtractor->mSegment->GetFirst();
+    mBlockEntryIndex = 0;
+
+    do {
+        advance_l();
+    } while (!eos() && block()->GetTrackNumber() != mTrackNum);
 }
 
 void BlockIterator::seek(int64_t seekTimeUs) {
-    mCluster = mSegment->FindCluster(seekTimeUs * 1000ll);
-    mBlockEntry = mCluster != NULL ? mCluster->GetFirst() : NULL;
+    Mutex::Autolock autoLock(mExtractor->mLock);
+
+    mCluster = mExtractor->mSegment->FindCluster(seekTimeUs * 1000ll);
+    mBlockEntryIndex = 0;
 
     while (!eos() && block()->GetTrackNumber() != mTrackNum) {
-        advance();
+        advance_l();
     }
 
     while (!eos() && !mBlockEntry->GetBlock()->IsKey()) {
-        advance();
+        advance_l();
     }
 }
 
@@ -291,16 +350,6 @@
     }
 }
 
-#define BAIL(err) \
-    do {                        \
-        if (bigbuf) {           \
-            bigbuf->release();  \
-            bigbuf = NULL;      \
-        }                       \
-                                \
-        return err;             \
-    } while (0)
-
 status_t MatroskaSource::readBlock() {
     CHECK(mPendingFrames.empty());
 
@@ -310,181 +359,39 @@
 
     const mkvparser::Block *block = mBlockIter.block();
 
-    size_t size = block->GetSize();
     int64_t timeUs = mBlockIter.blockTimeUs();
-    int32_t isSync = block->IsKey();
 
-    MediaBuffer *bigbuf = new MediaBuffer(size);
+    for (int i = 0; i < block->GetFrameCount(); ++i) {
+        const mkvparser::Block::Frame &frame = block->GetFrame(i);
 
-    long res = block->Read(
-            mExtractor->mReader, (unsigned char *)bigbuf->data());
+        MediaBuffer *mbuf = new MediaBuffer(frame.len);
+        mbuf->meta_data()->setInt64(kKeyTime, timeUs);
+        mbuf->meta_data()->setInt32(kKeyIsSyncFrame, block->IsKey());
 
-    if (res != 0) {
-        bigbuf->release();
-        bigbuf = NULL;
+        long n = frame.Read(mExtractor->mReader, (unsigned char *)mbuf->data());
+        if (n != 0) {
+            mPendingFrames.clear();
 
-        return ERROR_END_OF_STREAM;
+            mBlockIter.advance();
+            return ERROR_IO;
+        }
+
+        mPendingFrames.push_back(mbuf);
     }
 
     mBlockIter.advance();
 
-    bigbuf->meta_data()->setInt64(kKeyTime, timeUs);
-    bigbuf->meta_data()->setInt32(kKeyIsSyncFrame, isSync);
-
-    unsigned lacing = (block->Flags() >> 1) & 3;
-
-    if (lacing == 0) {
-        mPendingFrames.push_back(bigbuf);
-        return OK;
-    }
-
-    LOGV("lacing = %u, size = %d", lacing, size);
-
-    const uint8_t *data = (const uint8_t *)bigbuf->data();
-    // hexdump(data, size);
-
-    if (size == 0) {
-        BAIL(ERROR_MALFORMED);
-    }
-
-    unsigned numFrames = (unsigned)data[0] + 1;
-    ++data;
-    --size;
-
-    Vector<uint64_t> frameSizes;
-
-    switch (lacing) {
-        case 1:  // Xiph
-        {
-            for (size_t i = 0; i < numFrames - 1; ++i) {
-                size_t frameSize = 0;
-                uint8_t byte;
-                do {
-                    if (size == 0) {
-                        BAIL(ERROR_MALFORMED);
-                    }
-                    byte = data[0];
-                    ++data;
-                    --size;
-
-                    frameSize += byte;
-                } while (byte == 0xff);
-
-                frameSizes.push(frameSize);
-            }
-
-            break;
-        }
-
-        case 2:  // fixed-size
-        {
-            if ((size % numFrames) != 0) {
-                BAIL(ERROR_MALFORMED);
-            }
-
-            size_t frameSize = size / numFrames;
-            for (size_t i = 0; i < numFrames - 1; ++i) {
-                frameSizes.push(frameSize);
-            }
-
-            break;
-        }
-
-        case 3:  // EBML
-        {
-            uint64_t lastFrameSize = 0;
-            for (size_t i = 0; i < numFrames - 1; ++i) {
-                uint8_t byte;
-
-                if (size == 0) {
-                    BAIL(ERROR_MALFORMED);
-                }
-                byte = data[0];
-                ++data;
-                --size;
-
-                size_t numLeadingZeroes = clz(byte);
-
-                uint64_t frameSize = byte & ~(0x80 >> numLeadingZeroes);
-                for (size_t j = 0; j < numLeadingZeroes; ++j) {
-                    if (size == 0) {
-                        BAIL(ERROR_MALFORMED);
-                    }
-
-                    frameSize = frameSize << 8;
-                    frameSize |= data[0];
-                    ++data;
-                    --size;
-                }
-
-                if (i == 0) {
-                    frameSizes.push(frameSize);
-                } else {
-                    size_t shift =
-                        7 - numLeadingZeroes + 8 * numLeadingZeroes;
-
-                    int64_t delta =
-                        (int64_t)frameSize - (1ll << (shift - 1)) + 1;
-
-                    frameSize = lastFrameSize + delta;
-
-                    frameSizes.push(frameSize);
-                }
-
-                lastFrameSize = frameSize;
-            }
-            break;
-        }
-
-        default:
-            TRESPASS();
-    }
-
-#if 0
-    AString out;
-    for (size_t i = 0; i < frameSizes.size(); ++i) {
-        if (i > 0) {
-            out.append(", ");
-        }
-        out.append(StringPrintf("%llu", frameSizes.itemAt(i)));
-    }
-    LOGV("sizes = [%s]", out.c_str());
-#endif
-
-    for (size_t i = 0; i < frameSizes.size(); ++i) {
-        uint64_t frameSize = frameSizes.itemAt(i);
-
-        if (size < frameSize) {
-            BAIL(ERROR_MALFORMED);
-        }
-
-        MediaBuffer *mbuf = new MediaBuffer(frameSize);
-        mbuf->meta_data()->setInt64(kKeyTime, timeUs);
-        mbuf->meta_data()->setInt32(kKeyIsSyncFrame, isSync);
-        memcpy(mbuf->data(), data, frameSize);
-        mPendingFrames.push_back(mbuf);
-
-        data += frameSize;
-        size -= frameSize;
-    }
-
-    size_t offset = bigbuf->range_length() - size;
-    bigbuf->set_range(offset, size);
-
-    mPendingFrames.push_back(bigbuf);
-
     return OK;
 }
 
-#undef BAIL
-
 status_t MatroskaSource::read(
         MediaBuffer **out, const ReadOptions *options) {
     *out = NULL;
 
     int64_t seekTimeUs;
     ReadOptions::SeekMode mode;
-    if (options && options->getSeekTo(&seekTimeUs, &mode)) {
+    if (options && options->getSeekTo(&seekTimeUs, &mode)
+            && !mExtractor->isLiveStreaming()) {
         clearPendingFrames();
         mBlockIter.seek(seekTimeUs);
     }
@@ -584,6 +491,13 @@
       mReader(new DataSourceReader(mDataSource)),
       mSegment(NULL),
       mExtractedThumbnails(false) {
+    off64_t size;
+    mIsLiveStreaming =
+        (mDataSource->flags()
+            & (DataSource::kWantsPrefetching
+                | DataSource::kIsCachingDataSource))
+        && mDataSource->getSize(&size) != OK;
+
     mkvparser::EBMLHeader ebmlHeader;
     long long pos;
     if (ebmlHeader.Parse(mReader, pos) < 0) {
@@ -598,7 +512,16 @@
         return;
     }
 
-    ret = mSegment->Load();
+    if (isLiveStreaming()) {
+        ret = mSegment->ParseHeaders();
+        CHECK_EQ(ret, 0);
+
+        long len;
+        ret = mSegment->LoadCluster(pos, len);
+        CHECK_EQ(ret, 0);
+    } else {
+        ret = mSegment->Load();
+    }
 
     if (ret < 0) {
         delete mSegment;
@@ -635,7 +558,8 @@
         return NULL;
     }
 
-    if ((flags & kIncludeExtensiveMetaData) && !mExtractedThumbnails) {
+    if ((flags & kIncludeExtensiveMetaData) && !mExtractedThumbnails
+            && !isLiveStreaming()) {
         findThumbnails();
         mExtractedThumbnails = true;
     }
@@ -643,6 +567,10 @@
     return mTracks.itemAt(index).mMeta;
 }
 
+bool MatroskaExtractor::isLiveStreaming() const {
+    return mIsLiveStreaming;
+}
+
 static void addESDSFromAudioSpecificInfo(
         const sp<MetaData> &meta, const void *asi, size_t asiSize) {
     static const uint8_t kStaticESDS[] = {
@@ -794,7 +722,7 @@
             continue;
         }
 
-        BlockIterator iter(mSegment, info->mTrackNum);
+        BlockIterator iter(this, info->mTrackNum);
         int32_t i = 0;
         int64_t thumbnailTimeUs = 0;
         size_t maxBlockSize = 0;
@@ -802,7 +730,11 @@
             if (iter.block()->IsKey()) {
                 ++i;
 
-                size_t blockSize = iter.block()->GetSize();
+                size_t blockSize = 0;
+                for (int i = 0; i < iter.block()->GetFrameCount(); ++i) {
+                    blockSize += iter.block()->GetFrame(i).len;
+                }
+
                 if (blockSize > maxBlockSize) {
                     maxBlockSize = blockSize;
                     thumbnailTimeUs = iter.blockTimeUs();
@@ -821,6 +753,15 @@
     return meta;
 }
 
+uint32_t MatroskaExtractor::flags() const {
+    uint32_t x = CAN_PAUSE;
+    if (!isLiveStreaming()) {
+        x |= CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_SEEK;
+    }
+
+    return x;
+}
+
 bool SniffMatroska(
         const sp<DataSource> &source, String8 *mimeType, float *confidence,
         sp<AMessage> *) {
diff --git a/media/libstagefright/matroska/MatroskaExtractor.h b/media/libstagefright/matroska/MatroskaExtractor.h
index fa20b84..38ebd61 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.h
+++ b/media/libstagefright/matroska/MatroskaExtractor.h
@@ -20,6 +20,7 @@
 
 #include <media/stagefright/MediaExtractor.h>
 #include <utils/Vector.h>
+#include <utils/threads.h>
 
 namespace mkvparser {
 struct Segment;
@@ -45,26 +46,34 @@
 
     virtual sp<MetaData> getMetaData();
 
+    virtual uint32_t flags() const;
+
 protected:
     virtual ~MatroskaExtractor();
 
 private:
     friend struct MatroskaSource;
+    friend struct BlockIterator;
 
     struct TrackInfo {
         unsigned long mTrackNum;
         sp<MetaData> mMeta;
     };
+
+    Mutex mLock;
     Vector<TrackInfo> mTracks;
 
     sp<DataSource> mDataSource;
     DataSourceReader *mReader;
     mkvparser::Segment *mSegment;
     bool mExtractedThumbnails;
+    bool mIsLiveStreaming;
 
     void addTracks();
     void findThumbnails();
 
+    bool isLiveStreaming() const;
+
     MatroskaExtractor(const MatroskaExtractor &);
     MatroskaExtractor &operator=(const MatroskaExtractor &);
 };
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
index 0183b5d..beb2927 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
@@ -17,9 +17,13 @@
 package com.android.mediaframeworktest;
 
 import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
 
 import android.os.Debug;
 import android.os.Environment;
+import android.util.Log;
 
 /**
  *
@@ -30,10 +34,13 @@
     private MediaTestUtil(){
     }
 
+    private static String TAG = "MediaTestUtil";
     private static final String STORAGE_PATH =
         Environment.getExternalStorageDirectory().toString();
+    private static int mMediaStartMemory = 0;
+    private static int mDrmStartMemory = 0;
 
-    //Catpure the heapdump for memory leaksage analysis\
+    //Catpure the heapdump for memory leaksage analysis
     public static void getNativeHeapDump (String name) throws Exception {
         System.gc();
         System.runFinalization();
@@ -42,4 +49,103 @@
         Debug.dumpNativeHeap(o.getFD());
         o.close();
     }
-}
\ No newline at end of file
+
+    public static String captureMemInfo(String type) {
+        String cm = "ps ";
+        cm += type;
+        String memoryUsage = null;
+
+        int ch;
+        try {
+            Process p = Runtime.getRuntime().exec(cm);
+            InputStream in = p.getInputStream();
+            StringBuffer sb = new StringBuffer(512);
+            while ((ch = in.read()) != -1) {
+                sb.append((char) ch);
+            }
+            memoryUsage = sb.toString();
+        } catch (IOException e) {
+            Log.v(TAG, e.toString());
+        }
+        String[] poList = memoryUsage.split("\r|\n|\r\n");
+        String memusage = poList[1].concat("\n");
+        return memusage;
+    }
+
+    public static int getMediaServerVsize() {
+        String memoryUsage = captureMemInfo("mediaserver");
+        String[] poList2 = memoryUsage.split("\t|\\s+");
+        String vsize = poList2[3];
+        int vsizevalue = Integer.parseInt(vsize);
+        Log.v(TAG, "VSIZE = " + vsizevalue);
+        return vsizevalue;
+    }
+
+    public static int getDrmServerVsize() {
+        String memoryUsage = captureMemInfo("drmserver");
+        String[] poList2 = memoryUsage.split("\t|\\s+");
+        String vsize = poList2[3];
+        int vsizevalue = Integer.parseInt(vsize);
+        Log.v(TAG, "VSIZE = " + vsizevalue);
+        return vsizevalue;
+    }
+
+    // Write the ps mediaserver output to the file
+    public static void getMediaServerMemoryLog(Writer output, int writeCount, int totalCount)
+            throws Exception {
+        String memusage = null;
+
+        if (writeCount == 0) {
+            mMediaStartMemory = getMediaServerVsize();
+            output.write("Start memory : " + mMediaStartMemory + "\n");
+        }
+        memusage = captureMemInfo("mediaserver");
+        output.write(memusage);
+    }
+
+    // Write the ps drmserver output to the file
+    public static void getDrmServerMemoryLog(Writer output, int writeCount, int totalCount)
+            throws Exception {
+        String memusage = null;
+
+        if (writeCount == 0) {
+            mDrmStartMemory = getDrmServerVsize();
+            output.write("Start memory : " + mDrmStartMemory + "\n");
+        }
+        memusage = captureMemInfo("drmserver");
+        output.write(memusage);
+    }
+
+    // Write the ps drmserver output to the file
+    public static void getDrmServerMemorySummary(Writer output, String tag) throws Exception {
+
+        getTestMemorySummary(output, tag, "drmMem");
+    }
+
+    // Write the ps drmserver output to the file
+    public static void getMediaServerMemorySummary(Writer output, String tag) throws Exception {
+
+        getTestMemorySummary(output, tag, "mediaMem");
+    }
+
+    public static void getTestMemorySummary(Writer output, String tag, String type)
+            throws Exception {
+
+        int endMemory = 0;
+        int memDiff = 0;
+
+        if (type == "mediaMem") {
+            endMemory = getMediaServerVsize();
+            memDiff = endMemory - mMediaStartMemory;
+        } else if (type == "drmMem") {
+            endMemory = getDrmServerVsize();
+            memDiff = endMemory - mDrmStartMemory;
+        }
+        output.write("End Memory :" + endMemory + "\n");
+        if (memDiff < 0) {
+            memDiff = 0;
+        }
+        output.write(tag + " total diff = " + memDiff);
+        output.write("\n\n");
+    }
+}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java
index 895ca25..154f691 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaItemThumbnailTest.java
@@ -585,7 +585,9 @@
         try{
         final MediaImageItem mii = new MediaImageItem(mVideoEditor, "m1",
             imageItemFileName, 3000, renderingMode);
-        }catch (IllegalArgumentException e){
+        } catch (IllegalArgumentException e) {
+            flagForException = true;
+        } catch (IOException e) {
             flagForException = true;
         }
         assertTrue(" Invalid File Path", flagForException);
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
index 3efa5b2..958bbb0 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPropertiesTest.java
@@ -513,6 +513,8 @@
                 MediaItem.RENDERING_MODE_BLACK_BORDER);
         } catch (IllegalArgumentException e) {
             flagForException = true;
+        } catch (IOException e) {
+            flagForException = true;
         }
         assertTrue("Media Properties for non exsisting file", flagForException);
      }
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
index 37b1f54..74d4766 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/VideoEditorExportTest.java
@@ -44,6 +44,7 @@
 
 import com.android.mediaframeworktest.MediaFrameworkTest;
 import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.Suppress;
 import com.android.mediaframeworktest.VideoEditorHelper;
 
 public class VideoEditorExportTest extends
@@ -701,6 +702,7 @@
      *
      * @throws Exception
      */
+    @Suppress
     @LargeTest
     public void testExportDuration1Hour() throws Exception {
         final String videoItemFilename1 = INPUT_FILE_PATH +
diff --git a/native/include/android/input.h b/native/include/android/input.h
index 86be54a..953ee10 100644
--- a/native/include/android/input.h
+++ b/native/include/android/input.h
@@ -657,7 +657,8 @@
  * and views.
  * Whole numbers are pixels; the value may have a fraction for input devices
  * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index);
+float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
+        size_t history_index);
 
 /* Get the historical raw Y coordinate of this event for the given pointer index that
  * occurred between this event and the previous motion event.
@@ -666,7 +667,8 @@
  * and views.
  * Whole numbers are pixels; the value may have a fraction for input devices
  * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index);
+float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
+        size_t history_index);
 
 /* Get the historical X coordinate of this event for the given pointer index that
  * occurred between this event and the previous motion event.
diff --git a/native/include/android/keycodes.h b/native/include/android/keycodes.h
index c4a7eff..5d49775 100644
--- a/native/include/android/keycodes.h
+++ b/native/include/android/keycodes.h
@@ -247,6 +247,9 @@
     AKEYCODE_BUTTON_14       = 201,
     AKEYCODE_BUTTON_15       = 202,
     AKEYCODE_BUTTON_16       = 203,
+    AKEYCODE_LANGUAGE_SWITCH = 204,
+    AKEYCODE_MANNER_MODE     = 205,
+    AKEYCODE_3D_MODE         = 206,
 
     // NOTE: If you add a new keycode here you must also add it to several other files.
     //       Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 7ce86b3..75f7078 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -340,7 +340,10 @@
     }
     
     if (gEGLDebugLevel > 0)
-        StartDebugServer();
+    {
+        property_get("debug.egl.debug_port", value, "5039");
+        StartDebugServer(atoi(value));
+    }
 }
 
 static void setGLHooksThreadSpecific(gl_hooks_t const *value) {
@@ -350,7 +353,6 @@
     } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
         setGlTraceThreadSpecific(value);
         setGlThreadSpecific(&gHooksDebug);
-        LOGD("\n* setGLHooksThreadSpecific gHooksDebug");
     } else {
         setGlThreadSpecific(value);
     }
@@ -2119,14 +2121,15 @@
     if (!validate_display_context(dpy, ctx))
         return EGL_FALSE;
 
+    EGLBoolean result = EGL_FALSE;
     egl_context_t * const c = get_context(ctx);
-
     if (c->cnx->egl.eglDestroySyncKHR) {
-        return c->cnx->egl.eglDestroySyncKHR(
+        result = c->cnx->egl.eglDestroySyncKHR(
                 dp->disp[c->impl].dpy, syncObject->sync);
+        if (result)
+            _s.terminate();
     }
-
-    return EGL_FALSE;
+    return result;
 }
 
 EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
diff --git a/opengl/libs/GLES2_dbg/generate_debugger_message_proto.py b/opengl/libs/GLES2_dbg/generate_debugger_message_proto.py
index b14885b..48a29da 100755
--- a/opengl/libs/GLES2_dbg/generate_debugger_message_proto.py
+++ b/opengl/libs/GLES2_dbg/generate_debugger_message_proto.py
@@ -98,9 +98,6 @@
     output.write("        SETPROP = %d;\n" % (i))
     i += 1
     
-    output.write("        CAPTURE = %d;\n" % (i))
-    i += 1
-
     output.write("""    }
     required Function function = 2 [default = NEG]; // type/function of message
     enum Type
diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index 68514df..5c418258 100644
--- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
+++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
@@ -65,8 +65,9 @@
 
 void DbgContext::glUseProgram(GLuint program)
 {
-    assert(GL_NO_ERROR == hooks->gl.glGetError());
-
+    while (GLenum error = hooks->gl.glGetError())
+        LOGD("DbgContext::glUseProgram: before glGetError() = 0x%.4X", error);
+        
     this->program = program;
 
     GLint activeAttributes = 0;
@@ -106,6 +107,9 @@
             maxAttrib = slot;
     }
     delete name;
+    
+    while (GLenum error = hooks->gl.glGetError())
+        LOGD("DbgContext::glUseProgram: after glGetError() = 0x%.4X", error);
 }
 
 static bool HasNonVBOAttribs(const DbgContext * const ctx)
diff --git a/opengl/libs/GLES2_dbg/src/debugger_message.pb.cpp b/opengl/libs/GLES2_dbg/src/debugger_message.pb.cpp
index 4083c44..1f404c2 100644
--- a/opengl/libs/GLES2_dbg/src/debugger_message.pb.cpp
+++ b/opengl/libs/GLES2_dbg/src/debugger_message.pb.cpp
@@ -229,7 +229,6 @@
     case 188:
     case 189:
     case 190:
-    case 191:
       return true;
     default:
       return false;
@@ -428,7 +427,6 @@
 const Message_Function Message::CONTINUE;
 const Message_Function Message::SKIP;
 const Message_Function Message::SETPROP;
-const Message_Function Message::CAPTURE;
 const Message_Function Message::Function_MIN;
 const Message_Function Message::Function_MAX;
 const int Message::Function_ARRAYSIZE;
diff --git a/opengl/libs/GLES2_dbg/src/debugger_message.pb.h b/opengl/libs/GLES2_dbg/src/debugger_message.pb.h
index 3f2b842..59e7bab 100644
--- a/opengl/libs/GLES2_dbg/src/debugger_message.pb.h
+++ b/opengl/libs/GLES2_dbg/src/debugger_message.pb.h
@@ -226,12 +226,11 @@
   Message_Function_NEG = 187,
   Message_Function_CONTINUE = 188,
   Message_Function_SKIP = 189,
-  Message_Function_SETPROP = 190,
-  Message_Function_CAPTURE = 191
+  Message_Function_SETPROP = 190
 };
 bool Message_Function_IsValid(int value);
 const Message_Function Message_Function_Function_MIN = Message_Function_glActiveTexture;
-const Message_Function Message_Function_Function_MAX = Message_Function_CAPTURE;
+const Message_Function Message_Function_Function_MAX = Message_Function_SETPROP;
 const int Message_Function_Function_ARRAYSIZE = Message_Function_Function_MAX + 1;
 
 enum Message_Type {
@@ -488,7 +487,6 @@
   static const Function CONTINUE = Message_Function_CONTINUE;
   static const Function SKIP = Message_Function_SKIP;
   static const Function SETPROP = Message_Function_SETPROP;
-  static const Function CAPTURE = Message_Function_CAPTURE;
   static inline bool Function_IsValid(int value) {
     return Message_Function_IsValid(value);
   }
diff --git a/opengl/libs/GLES2_dbg/src/egl.cpp b/opengl/libs/GLES2_dbg/src/egl.cpp
index b3979a3..27c7f7e 100644
--- a/opengl/libs/GLES2_dbg/src/egl.cpp
+++ b/opengl/libs/GLES2_dbg/src/egl.cpp
@@ -19,7 +19,7 @@
 EGLBoolean Debug_eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
 {
     glesv2debugger::Message msg;
-    const bool expectResponse = true;
+    const bool expectResponse = false;
     struct : public FunctionCall {
         EGLDisplay dpy;
         EGLSurface draw;
diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h
index cbd448a..b79cc0f 100644
--- a/opengl/libs/GLES2_dbg/src/header.h
+++ b/opengl/libs/GLES2_dbg/src/header.h
@@ -113,7 +113,7 @@
     virtual ~FunctionCall() {}
 };
 
-// move these into DbgContext
+// move these into DbgContext as static
 extern bool capture;
 extern int timeMode; // SYSTEM_TIME_
 
@@ -121,8 +121,10 @@
 
 unsigned GetBytesPerPixel(const GLenum format, const GLenum type);
 
+// every Debug_gl* function calls this to send message to client and possibly receive commands
 int * MessageLoop(FunctionCall & functionCall, glesv2debugger::Message & msg,
                   const bool expectResponse, const glesv2debugger::Message_Function function);
+
 void Receive(glesv2debugger::Message & cmd);
 float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd);
 void SetProp(const glesv2debugger::Message & cmd);
diff --git a/opengl/libs/GLES2_dbg/src/server.cpp b/opengl/libs/GLES2_dbg/src/server.cpp
index 820e9de..03c3dae 100644
--- a/opengl/libs/GLES2_dbg/src/server.cpp
+++ b/opengl/libs/GLES2_dbg/src/server.cpp
@@ -38,7 +38,7 @@
     exit(1);
 }
 
-void StartDebugServer()
+void StartDebugServer(unsigned short port)
 {
     LOGD("GLESv2_dbg: StartDebugServer");
     if (serverSock >= 0)
@@ -53,8 +53,8 @@
     }
     /* Construct the server sockaddr_in structure */
     server.sin_family = AF_INET;                  /* Internet/IP */
-    server.sin_addr.s_addr = htonl(INADDR_ANY);   /* Incoming addr */
-    server.sin_port = htons(5039);       /* server port */
+    server.sin_addr.s_addr = htonl(INADDR_LOOPBACK);   /* Incoming addr */
+    server.sin_port = htons(port);       /* server port */
 
     /* Bind the server socket */
     socklen_t sizeofSockaddr_in = sizeof(sockaddr_in);
@@ -79,13 +79,6 @@
 
     LOGD("Client connected: %s\n", inet_ntoa(client.sin_addr));
 //    fcntl(clientSock, F_SETFL, O_NONBLOCK);
-
-    glesv2debugger::Message msg, cmd;
-    msg.set_context_id(0);
-    msg.set_function(glesv2debugger::Message_Function_ACK);
-    msg.set_type(glesv2debugger::Message_Type_Response);
-    msg.set_expect_response(false);
-    Send(msg, cmd);
 }
 
 void StopDebugServer()
@@ -130,6 +123,27 @@
     cmd.ParseFromArray(buffer, len);
 }
 
+bool TryReceive(glesv2debugger::Message & cmd)
+{
+    fd_set readSet;
+    FD_ZERO(&readSet);
+    FD_SET(clientSock, &readSet);
+    timeval timeout;
+    timeout.tv_sec = timeout.tv_usec = 0;
+
+    int rc = select(clientSock + 1, &readSet, NULL, NULL, &timeout);
+    if (rc < 0)
+        Die("failed to select clientSock");
+
+    bool received = false;
+    if (FD_ISSET(clientSock, &readSet)) {
+        LOGD("TryReceive: avaiable for read");
+        Receive(cmd);
+        return true;
+    }
+    return false;
+}
+
 float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd)
 {
     static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -155,12 +169,18 @@
         Die("Failed to send message");
     }
 
+    // try to receive commands even though not expecting response,
+    // since client can send SETPROP commands anytime
     if (!msg.expect_response()) {
-        pthread_mutex_unlock(&mutex);
-        return t;
-    }
-
-    Receive(cmd);
+        if (TryReceive(cmd)) {
+            LOGD("Send: TryReceived");
+            if (glesv2debugger::Message_Function_SETPROP == cmd.function())
+                LOGD("Send: received SETPROP");
+            else
+                LOGD("Send: received something else");
+        }
+    } else
+        Receive(cmd);
 
     //LOGD("Message sent tid=%lu len=%d", pthread_self(), str.length());
     pthread_mutex_unlock(&mutex);
@@ -193,24 +213,26 @@
     msg.set_type(glesv2debugger::Message_Type_BeforeCall);
     msg.set_expect_response(expectResponse);
     msg.set_function(function);
-    Send(msg, cmd);
     if (!expectResponse)
         cmd.set_function(glesv2debugger::Message_Function_CONTINUE);
+    Send(msg, cmd);
     while (true) {
         msg.Clear();
         nsecs_t c0 = systemTime(timeMode);
         switch (cmd.function()) {
         case glesv2debugger::Message_Function_CONTINUE:
             ret = functionCall(&dbg->hooks->gl, msg);
+            while (GLenum error = dbg->hooks->gl.glGetError())
+                LOGD("Function=%u glGetError() = 0x%.4X", function, error);
             if (!msg.has_time()) // some has output data copy, so time inside call
                 msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
             msg.set_context_id(reinterpret_cast<int>(dbg));
             msg.set_function(function);
             msg.set_type(glesv2debugger::Message_Type_AfterCall);
             msg.set_expect_response(expectResponse);
-            Send(msg, cmd);
             if (!expectResponse)
                 cmd.set_function(glesv2debugger::Message_Function_SKIP);
+            Send(msg, cmd);
             break;
         case glesv2debugger::Message_Function_SKIP:
             return const_cast<int *>(ret);
diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp
index 52ce907..a73967f 100644
--- a/opengl/libs/GLES2_dbg/src/vertex.cpp
+++ b/opengl/libs/GLES2_dbg/src/vertex.cpp
@@ -41,10 +41,10 @@
     msg.set_arg6(reinterpret_cast<int>(pixels));
     //void * data = NULL;
     //unsigned encodedSize = 0;
-    Send(msg, cmd);
-    float t = 0;
     if (!expectResponse)
         cmd.set_function(glesv2debugger::Message_Function_CONTINUE);
+    Send(msg, cmd);
+    float t = 0;
     while (true) {
         msg.Clear();
         nsecs_t c0 = systemTime(timeMode);
@@ -61,6 +61,8 @@
             //msg.set_data(data, encodedSize);
             //free(data);
             c0 = systemTime(timeMode);
+            if (!expectResponse)
+                cmd.set_function(glesv2debugger::Message_Function_SKIP);
             t = Send(msg, cmd);
             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
             msg.set_clock(t);
@@ -69,11 +71,13 @@
             msg.set_expect_response(false);
             msg.set_type(glesv2debugger::Message_Type_AfterCall);
             //Send(msg, cmd);
-            if (!expectResponse)
-                cmd.set_function(glesv2debugger::Message_Function_SKIP);
             break;
         case glesv2debugger::Message_Function_SKIP:
             return;
+        case glesv2debugger::Message_Function_SETPROP:
+            SetProp(cmd);
+            Receive(cmd);
+            break;
         default:
             assert(0); //GenerateCall(msg, cmd);
             break;
@@ -104,9 +108,9 @@
     void * pixels = NULL;
     GLint readFormat = 0, readType = 0;
     int viewport[4] = {};
-    Send(msg, cmd);
     if (!expectResponse)
         cmd.set_function(glesv2debugger::Message_Function_CONTINUE);
+    Send(msg, cmd);
     while (true) {
         msg.Clear();
         nsecs_t c0 = systemTime(timeMode);
@@ -118,25 +122,26 @@
             msg.set_function(glesv2debugger::Message_Function_glDrawArrays);
             msg.set_type(glesv2debugger::Message_Type_AfterCall);
             msg.set_expect_response(expectResponse);
-            Send(msg, cmd);
-            if (capture)
-                cmd.set_function(glesv2debugger::Message_Function_CAPTURE);
-            else if (!expectResponse)
+            if (!expectResponse)
                 cmd.set_function(glesv2debugger::Message_Function_SKIP);
+            Send(msg, cmd);
+            if (capture) {
+                dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
+                dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
+                dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
+                LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
+                     viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType);
+                pixels = malloc(viewport[2] * viewport[3] * 4);
+                Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
+                                   readFormat, readType, pixels);
+                free(pixels);
+            }
             break;
         case glesv2debugger::Message_Function_SKIP:
             return;
-        case glesv2debugger::Message_Function_CAPTURE:
-            dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
-            dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
-            dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
-            LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
-                 viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType);
-            pixels = malloc(viewport[2] * viewport[3] * 4);
-            Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
-                               readFormat, readType, pixels);
-            free(pixels);
-            cmd.set_function(glesv2debugger::Message_Function_SKIP);
+        case glesv2debugger::Message_Function_SETPROP:
+            SetProp(cmd);
+            Receive(cmd);
             break;
         default:
             assert(0); //GenerateCall(msg, cmd);
@@ -189,9 +194,9 @@
     void * pixels = NULL;
     GLint readFormat = 0, readType = 0;
     int viewport[4] = {};
-    Send(msg, cmd);
     if (!expectResponse)
         cmd.set_function(glesv2debugger::Message_Function_CONTINUE);
+    Send(msg, cmd);
     while (true) {
         msg.Clear();
         nsecs_t c0 = systemTime(timeMode);
@@ -203,25 +208,26 @@
             msg.set_function(glesv2debugger::Message_Function_glDrawElements);
             msg.set_type(glesv2debugger::Message_Type_AfterCall);
             msg.set_expect_response(expectResponse);
-            Send(msg, cmd);
-            if (capture)
-                cmd.set_function(glesv2debugger::Message_Function_CAPTURE);
-            else if (!expectResponse)
+            if (!expectResponse)
                 cmd.set_function(glesv2debugger::Message_Function_SKIP);
+            Send(msg, cmd);
+            if (capture) {
+                dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
+                dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
+                dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
+                LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
+                     viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType);
+                pixels = malloc(viewport[2] * viewport[3] * 4);
+                Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
+                                   readFormat, readType, pixels);
+                free(pixels);
+            }
             break;
         case glesv2debugger::Message_Function_SKIP:
             return;
-        case glesv2debugger::Message_Function_CAPTURE:
-            dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport);
-            dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
-            dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
-            LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X",
-                 viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType);
-            pixels = malloc(viewport[2] * viewport[3] * 4);
-            Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
-                               readFormat, readType, pixels);
-            free(pixels);
-            cmd.set_function(glesv2debugger::Message_Function_SKIP);
+        case glesv2debugger::Message_Function_SETPROP:
+            SetProp(cmd);
+            Receive(cmd);
             break;
         default:
             assert(0); //GenerateCall(msg, cmd);
diff --git a/opengl/libs/glesv2dbg.h b/opengl/libs/glesv2dbg.h
index b988eb7..8029dce 100644
--- a/opengl/libs/glesv2dbg.h
+++ b/opengl/libs/glesv2dbg.h
@@ -24,7 +24,7 @@
     DbgContext * CreateDbgContext(const unsigned version, const gl_hooks_t * const hooks);
     void DestroyDbgContext(DbgContext * const dbg);
     
-    void StartDebugServer(); // create and bind socket if haven't already
+    void StartDebugServer(unsigned short port); // create and bind socket if haven't already
     void StopDebugServer(); // close socket if open
     
 }; // namespace android
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_notification_dnd.png b/packages/SystemUI/res/drawable-hdpi/ic_notification_dnd.png
new file mode 100644
index 0000000..eb783df
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_notification_dnd.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_notification_dnd.png b/packages/SystemUI/res/drawable-mdpi/ic_notification_dnd.png
index 6d4da7f..3f88968 100644
--- a/packages/SystemUI/res/drawable-mdpi/ic_notification_dnd.png
+++ b/packages/SystemUI/res/drawable-mdpi/ic_notification_dnd.png
Binary files differ
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index 5f29418c..0660a17 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"الإعدادات"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"وضع الطائرة"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"التدوير التلقائي للشاشة"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"كتم"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"تلقائي"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"التنبيهات"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"تم إنشاء الاتصال بالإنترنت عن طريق البلوتوث."</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"تهيئة طرق الإدخال"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"استخدام لوحة المفاتيح الفعلية"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index 174d024..4c9ecfc 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Настройки"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Самолетен режим"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Авт. завъртане на екрана"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"БЕЗ"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"АВТ."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Известия"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth има връзка с тетъринг"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Конфигуриране на въвеждането"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Използване на физ. клав."</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml
index 80979c0..9a4a360 100644
--- a/packages/SystemUI/res/values-ca/strings.xml
+++ b/packages/SystemUI/res/values-ca/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Configuració"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Mode d\'avió"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Gira pantalla automàticament"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"Silen."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificacions"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth sense fil"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configura mètodes d\'entrada"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utilitza un teclat físic"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 31bf102..31aa1a7 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Nastavení"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Režim V letadle"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Automatické otočení obrazovky"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ZTLUM."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Oznámení"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Datové připojení Bluetooth se sdílí"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Nakonfigurovat metody vstupu"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Použít fyz. klávesnici"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 3a08cc1..ddbcf25 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Indstillinger"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Flytilstand"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Automatisk skærmrotation"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"LYDLØS"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Meddelelser"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth-tethering anvendt"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurer inputmetoder"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Brug fysisk tastatur"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index 91e56d4..c7d9502 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Einstellungen"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"WLAN"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Flugmodus"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Bildschirm automatisch drehen"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"STUMM"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Benachrichtigungen"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth-Tethering aktiv"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Eingabemethoden konfigurieren"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Physische Tastatur"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml
index 3bc5636..7e15f7f 100644
--- a/packages/SystemUI/res/values-el/strings.xml
+++ b/packages/SystemUI/res/values-el/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Ρυθμίσεις"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Λειτουργία πτήσης"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Αυτόματη περιστροφή οθόνης"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ΣΙΓΑΣΗ"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"ΑΥΤΟΜ."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Ειδοποιήσεις"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Έγινε σύνδεση μέσω Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Διαμόρφωση μεθόδων εισαγωγής"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Χρήση κανονικού πληκτρολ."</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index 2e5a722..350913a 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Settings"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Airplane mode"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Auto-rotate screen"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"MUTE"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notifications"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth tethered"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configure input methods"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Use physical keyboard"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml
index 19d72c7..43d9337 100644
--- a/packages/SystemUI/res/values-es-rUS/strings.xml
+++ b/packages/SystemUI/res/values-es-rUS/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Configuración"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Modo avión"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Girar la pantalla automáticamente"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"SILENC"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificaciones"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth anclado"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configurar métodos de entrada"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Usar teclado físico"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml
index e410f6e..e6c1ce2 100644
--- a/packages/SystemUI/res/values-es/strings.xml
+++ b/packages/SystemUI/res/values-es/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Ajustes"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Modo avión"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Girar pantalla automáticamente"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"SILENC"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificaciones"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth anclado"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configurar métodos de introducción"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utilizar teclado físico"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml
index c9a1a7f..9e70d5a 100644
--- a/packages/SystemUI/res/values-fa/strings.xml
+++ b/packages/SystemUI/res/values-fa/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"تنظیمات"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"حالت هواپیما"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"چرخش خودکار صفحه"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"بیصدا"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"خودکار"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"اعلان ها"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"اتصال اینترنتی با بلوتوث تلفن همراه"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"پیکربندی روش های ورودی"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"از صفحه کلید فیزیکی استفاده کنید"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml
index 882261d..47b3220 100644
--- a/packages/SystemUI/res/values-fi/strings.xml
+++ b/packages/SystemUI/res/values-fi/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Asetukset"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"WiFi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Lentokonetila"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Kierrä näyttöä automaattisesti"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ÄÄNET."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Ilmoitukset"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth yhdistetty"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Määritä syöttötavat"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Käytä fyysistä näppäimistöä"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml
index 2b23276..a4a287e 100644
--- a/packages/SystemUI/res/values-fr/strings.xml
+++ b/packages/SystemUI/res/values-fr/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Paramètres"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Mode Avion"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Rotation automatique de l\'écran"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"MUET"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notifications"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Connexion Bluetooth partagée"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configurer les modes de saisie"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utiliser clavier physique"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml
index dad674b..680a3e3 100644
--- a/packages/SystemUI/res/values-hr/strings.xml
+++ b/packages/SystemUI/res/values-hr/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Postavke"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Način rada u zrakoplovu"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Automatski zakreni zaslon"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"Bez zv."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Obavijesti"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth posredno povezan"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfiguriraj načine ulaza"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Rabi fizičku tipkovnicu"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml
index 9da81ab..9a103f7 100644
--- a/packages/SystemUI/res/values-hu/strings.xml
+++ b/packages/SystemUI/res/values-hu/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Beállítások"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Repülőgép üzemmód"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Képernyő automatikus forgatása"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"NÉMÍT"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Értesítések"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth megosztva"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Beviteli módok konfigurálása"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Valódi bill. használata"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index 0ade50c..e7fbbbe 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -34,8 +34,7 @@
     <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>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Putar layar secara otomatis"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"BISUKAN"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Pemberitahuan"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth tertambat"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurasikan metode masukan"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Gunakan keyboard fisik"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index 71e86da..b541374 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Impostazioni"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Modalità aereo"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Rotazione automatica schermo"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"MUTE"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notifiche"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth con tethering"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configura metodi di input"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utilizza tastiera fisica"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml
index 4e78670..3194cf5 100644
--- a/packages/SystemUI/res/values-iw/strings.xml
+++ b/packages/SystemUI/res/values-iw/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"הגדרות"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"מצב טיסה"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"סיבוב אוטומטי של המסך"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"השתק"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"אוטומטי"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"התראות"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth קשור"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"הגדר שיטות קלט"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"השתמש במקלדת הפיזית"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index 86a5da5..ac82ed4 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"設定"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"機内モード"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"自動回転画面"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ミュート"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"オート"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"通知"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetoothテザリング接続"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"入力方法の設定"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"物理キーボードを使用"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml
index 440ebb6..2d4786d 100644
--- a/packages/SystemUI/res/values-ko/strings.xml
+++ b/packages/SystemUI/res/values-ko/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"설정"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"비행기 모드"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"자동 화면 회전"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"무시"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"자동"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"알림"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"블루투스 테더링됨"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"입력 방법 구성"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"물리적 키보드 사용"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml
index 9bf5f74..db06596 100644
--- a/packages/SystemUI/res/values-lt/strings.xml
+++ b/packages/SystemUI/res/values-lt/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Nustatymai"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Lėktuvo režimas"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Automatiškai sukti ekraną"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"NUTILD."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Pranešimai"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"„Bluetooth“ susieta"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigūruoti įvesties metodus"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Naudoti fizinę klaviatūrą"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml
index 5c14342..079591e 100644
--- a/packages/SystemUI/res/values-lv/strings.xml
+++ b/packages/SystemUI/res/values-lv/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Iestatījumi"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Lidmašīnas režīms"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Ekrāna automātiska pagriešana"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"IZ. SK."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Paziņojumi"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth piesaiste"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurēt ievades metodes"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Izmantot fizisku tastatūru"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index 1671dcf..b7e7711 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Innstillinger"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Trådløse nettverk"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Flymodus"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Roter skjerm automatisk"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"DEMPET"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Varslinger"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth tilknyttet"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurer inndatametoder"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Bruk fysisk tastatur"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml
index ac3255f..cc9e7a3 100644
--- a/packages/SystemUI/res/values-nl/strings.xml
+++ b/packages/SystemUI/res/values-nl/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Instellingen"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Vliegmodus"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Scherm automatisch draaien"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"DEMPEN"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Meldingen"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth getetherd"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Invoermethoden configureren"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Fysiek toetsenbord gebruiken"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index 1af9d68..67d9cc1 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Ustawienia"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Tryb samolotowy"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Autoobracanie ekranu"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"WYGAŚ"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Powiadomienia"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth – podłączono"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfiguruj metody wprowadzania"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Używaj klawiatury fizycznej"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index 2f0e269..5ee79a0 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Definições"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Modo de avião"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Rodar ecrã automaticamente"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"D. SOM"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificações"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth ligado"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configurar métodos de entrada"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utilizar teclado físico"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index d9e68e8..a91d406 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Configurações"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Modo para avião"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Girar automaticamente a tela"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"MUDO"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificações"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth vinculado"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configurar métodos de entrada"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Usar o teclado físico"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-rm/strings.xml b/packages/SystemUI/res/values-rm/strings.xml
index aa35dd4..b41b9bd 100644
--- a/packages/SystemUI/res/values-rm/strings.xml
+++ b/packages/SystemUI/res/values-rm/strings.xml
@@ -61,20 +61,22 @@
     <skip />
     <!-- no translation found for status_bar_use_physical_keyboard (3695516942412442936) -->
     <skip />
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index 4c14b7d..36628aa 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Setări"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Mod Avion"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Rotire automată a ecranului"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"DEZAC."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTOM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Notificări"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Conectat prin tethering prin Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Configuraţi metode de intrare"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Utilizaţi tastat. fizică"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index 2e2de6e..13da8a3 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Настройки"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Режим полета"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Автоповорот экрана"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ВЫКЛ."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"АВТО"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Уведомления"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Общий модем доступен через Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Настроить способ ввода"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Использовать физическую клавиатуру"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml
index 12d40ae..c08eb21 100644
--- a/packages/SystemUI/res/values-sk/strings.xml
+++ b/packages/SystemUI/res/values-sk/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Nastavenia"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Režim V lietadle"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Automatické otočenie obrazovky"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"STLMIŤ"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Upozornenia"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Zdieľané dátové pripojenie cez Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurovať metódy vstupu"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Použiť fyzickú klávesnicu"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml
index 62d946a..d7cb726 100644
--- a/packages/SystemUI/res/values-sl/strings.xml
+++ b/packages/SystemUI/res/values-sl/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Nastavitve"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Način za letalo"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Samodejno zasukaj zaslon"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"TIHO"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"SAMOD."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Obvestila"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Internetna povezava prek Bluetootha"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Nastavitev načinov vnosa"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Uporabi fizično tipkovn."</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml
index e319132..6e67293 100644
--- a/packages/SystemUI/res/values-sr/strings.xml
+++ b/packages/SystemUI/res/values-sr/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Подешавања"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Режим рада у авиону"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Аутоматско ротирање екрана"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"УГАСИ"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"АУТОM."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Обавештења"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Веза преко Bluetooth-а"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Конфигуриши методе уноса"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Користи физичку тастатуру"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index ba9f55e..e2905b6 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Inställningar"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Flygplansläge"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Rotera skärmen automatiskt"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"TYST"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Aviseringar"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Internetdelning via Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Konfigurera inmatningsmetoder"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Använd fysiska tangenter"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml
index 192fe2c..1e7af69 100644
--- a/packages/SystemUI/res/values-th/strings.xml
+++ b/packages/SystemUI/res/values-th/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"การตั้งค่า"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"โหมดใช้งานบนเครื่องบิน"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"หมุนหน้าจออัตโนมัติ"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ปิดเสียง"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"อัตโนมัติ"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"การแจ้งเตือน"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"บลูทูธที่ปล่อยสัญญาณ"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"กำหนดค่าวิธีการป้อนข้อมูล"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"ใช้แป้นพิมพ์จริง"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml
index a99014d..9fadf73 100644
--- a/packages/SystemUI/res/values-tl/strings.xml
+++ b/packages/SystemUI/res/values-tl/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Mga Setting"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Airplane mode"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"I-auto-rotate ang screen"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"MUTE"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"AUTO"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Mga Notification"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Na-tether ang bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"I-configure paraan ng input"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Gamitin ang pisikal na keyboard"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml
index 2019a38..7c3585a 100644
--- a/packages/SystemUI/res/values-tr/strings.xml
+++ b/packages/SystemUI/res/values-tr/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Ayarlar"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Kablosuz"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Uçak modu"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Ekranı otomatik döndür"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"KAPAT"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"OTOMTK"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Bildirimler"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth paylaşımı tamam"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Giriş yöntemlerini yapılandır"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Fiziksel klavyeyi kullan"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index 999ea9a..a17e59d 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Налаштування"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Режим польоту"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Повертати екран автоматично"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"ІГНОР."</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"АВТОМ."</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Сповіщення"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Створено прив\'язку Bluetooth"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Налаштувати методи введення"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Викор. реальну клавіатуру"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml
index dd286800..a994ee0 100644
--- a/packages/SystemUI/res/values-vi/strings.xml
+++ b/packages/SystemUI/res/values-vi/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"Cài đặt"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"Chế độ trên máy bay"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"Tự động xoay màn hình"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"TẮT TIẾNG"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"TỰ ĐỘNG"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"Thông báo"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"Bluetooth được dùng làm điểm truy cập Internet"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"Định cấu hình phương pháp nhập liệu"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"Sử dụng bàn phím vật lý"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index d2a5578..baae9e1 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"设置"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"飞行模式"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"自动旋转屏幕"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"静音"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"自动"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"通知"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"蓝牙已绑定"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"配置输入法"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"使用物理键盘"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml
index f165bee..0d83d44 100644
--- a/packages/SystemUI/res/values-zh-rTW/strings.xml
+++ b/packages/SystemUI/res/values-zh-rTW/strings.xml
@@ -34,8 +34,7 @@
     <string name="status_bar_settings_settings_button" msgid="3023889916699270224">"設定"</string>
     <string name="status_bar_settings_wifi_button" msgid="1733928151698311923">"Wi-Fi"</string>
     <string name="status_bar_settings_airplane" msgid="4879879698500955300">"飛行模式"</string>
-    <!-- no translation found for status_bar_settings_auto_rotation (3790482541357798421) -->
-    <skip />
+    <string name="status_bar_settings_auto_rotation" msgid="3790482541357798421">"自動旋轉螢幕"</string>
     <string name="status_bar_settings_mute_label" msgid="554682549917429396">"關閉"</string>
     <string name="status_bar_settings_auto_brightness_label" msgid="511453614962324674">"自動"</string>
     <string name="status_bar_settings_notifications" msgid="397146176280905137">"通知"</string>
@@ -45,20 +44,22 @@
     <string name="bluetooth_tethered" msgid="7094101612161133267">"已透過藍牙進行網際網路共用"</string>
     <string name="status_bar_input_method_settings_configure_input_methods" msgid="737483394044014246">"設定輸入方式"</string>
     <string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"使用實體鍵盤"</string>
-    <!-- no translation found for usb_device_permission_prompt (5340926456453429244) -->
+    <!-- no translation found for usb_device_permission_prompt (3816016361969816903) -->
     <skip />
-    <!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
+    <!-- no translation found for usb_accessory_permission_prompt (6888598803988889959) -->
     <skip />
-    <!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
+    <!-- no translation found for usb_device_confirm_prompt (5161205258635253206) -->
     <skip />
-    <!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
+    <!-- no translation found for usb_accessory_confirm_prompt (3808984931830229888) -->
     <skip />
-    <!-- no translation found for usb_accessory_uri_prompt (1896291816269399727) -->
+    <!-- no translation found for usb_accessory_uri_prompt (6332150684964235705) -->
     <skip />
     <!-- no translation found for title_usb_accessory (4966265263465181372) -->
     <skip />
     <!-- no translation found for label_view (6304565553218192990) -->
     <skip />
-    <!-- no translation found for label_ignore (5473234388203739668) -->
+    <!-- no translation found for always_use_device (1450287437017315906) -->
+    <skip />
+    <!-- no translation found for always_use_accessory (1210954576979621596) -->
     <skip />
 </resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index b4eea6e..446827b 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -117,19 +117,19 @@
     <string name="status_bar_use_physical_keyboard">Use physical keyboard</string>
 
     <!-- Prompt for the USB device permission dialog [CHAR LIMIT=80] -->
-    <string name="usb_device_permission_prompt">Allow the application %1$s to access the USB device?</string>
+    <string name="usb_device_permission_prompt">Allow the application <xliff:g id="application">%1$s</xliff:g> to access the USB device?</string>
 
     <!-- Prompt for the USB accessory permission dialog [CHAR LIMIT=80] -->
-    <string name="usb_accessory_permission_prompt">Allow the application %1$s to access the USB accessory?</string>
+    <string name="usb_accessory_permission_prompt">Allow the application <xliff:g id="application">%1$s</xliff:g> to access the USB accessory?</string>
 
     <!-- Prompt for the USB device confirm dialog [CHAR LIMIT=80] -->
-    <string name="usb_device_confirm_prompt">Open %1$s when this USB device is connected?</string>
+    <string name="usb_device_confirm_prompt">Open <xliff:g id="activity">%1$s</xliff:g> when this USB device is connected?</string>
 
     <!-- Prompt for the USB accessory confirm dialog [CHAR LIMIT=80] -->
-    <string name="usb_accessory_confirm_prompt">Open %1$s when this USB accessory is connected?</string>
+    <string name="usb_accessory_confirm_prompt">Open <xliff:g id="activity">%1$s</xliff:g> when this USB accessory is connected?</string>
 
     <!-- Prompt for the USB accessory URI dialog [CHAR LIMIT=80] -->
-    <string name="usb_accessory_uri_prompt">Additional information for this USB accessory may be found at: %1$s</string>
+    <string name="usb_accessory_uri_prompt">No installed applications work with this USB accessory. Learn more about this accessory at <xliff:g id="url">%1$s</xliff:g></string>
 
     <!-- Title for USB accessory dialog.  Used when the name of the accessory cannot be determined.  [CHAR LIMIT=50] -->
     <string name="title_usb_accessory">USB accessory</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 6b9551b..70a78df 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -812,7 +812,9 @@
 
         // the data direction overlay
         if (mLastDataDirectionOverlayIconId != dataDirectionOverlayIconId) {
-            Slog.d(TAG, "changing data overlay icon id to " + dataDirectionOverlayIconId);
+            if (DEBUG) {
+                Slog.d(TAG, "changing data overlay icon id to " + dataDirectionOverlayIconId);
+            }
             mLastDataDirectionOverlayIconId = dataDirectionOverlayIconId;
             N = mDataDirectionOverlayIconViews.size();
             for (int i=0; i<N; i++) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 64857ed..36e6b8e6 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -903,7 +903,7 @@
     }
 
     private void reopenMenu(boolean toggleMenuMode) {
-        if (mActionBar != null) {
+        if (mActionBar != null && mActionBar.isOverflowReserved()) {
             final Callback cb = getCallback();
             if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
                 if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 2b08ab5..2702242 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1738,7 +1738,10 @@
                     LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
                     tracksToRemove->add(track);
                     // indicate to client process that the track was disabled because of underrun
-                    cblk->flags |= CBLK_DISABLED_ON;
+                    {
+                        AutoMutex _l(cblk->lock);
+                        cblk->flags |= CBLK_DISABLED_ON;
+                    }
                 } else if (mixerStatus != MIXER_TRACKS_READY) {
                     mixerStatus = MIXER_TRACKS_ENABLED;
                 }
@@ -1787,10 +1790,9 @@
     for (size_t i = 0; i < size; i++) {
         sp<Track> t = mTracks[i];
         if (t->type() == streamType) {
-            t->mCblk->lock.lock();
+            AutoMutex _lcblk(t->mCblk->lock);
             t->mCblk->flags |= CBLK_INVALID_ON;
             t->mCblk->cv.signal();
-            t->mCblk->lock.unlock();
         }
     }
 }
@@ -2948,6 +2950,7 @@
 
     if (mCblk->framesReady() >= mCblk->frameCount ||
             (mCblk->flags & CBLK_FORCEREADY_MSK)) {
+        AutoMutex _l(mCblk->lock);
         mFillingUpStatus = FS_FILLED;
         mCblk->flags &= ~CBLK_FORCEREADY_MSK;
         return true;
@@ -3063,19 +3066,18 @@
         // STOPPED state
         mState = STOPPED;
 
-        mCblk->lock.lock();
         // NOTE: reset() will reset cblk->user and cblk->server with
         // the risk that at the same time, the AudioMixer is trying to read
         // data. In this case, getNextBuffer() would return a NULL pointer
         // as audio buffer => the AudioMixer code MUST always test that pointer
         // returned by getNextBuffer() is not NULL!
         reset();
-        mCblk->lock.unlock();
     }
 }
 
 void AudioFlinger::PlaybackThread::Track::reset()
 {
+    AutoMutex _l(mCblk->lock);
     // Do not reset twice to avoid discarding data written just after a flush and before
     // the audioflinger thread detects the track is stopped.
     if (!mResetDone) {
@@ -3209,10 +3211,13 @@
     if (thread != 0) {
         RecordThread *recordThread = (RecordThread *)thread.get();
         recordThread->stop(this);
-        TrackBase::reset();
-        // Force overerrun condition to avoid false overrun callback until first data is
-        // read from buffer
-        mCblk->flags |= CBLK_UNDERRUN_ON;
+        {
+            AutoMutex _l(mCblk->lock);
+            TrackBase::reset();
+            // Force overerrun condition to avoid false overrun callback until first data is
+            // read from buffer
+            mCblk->flags |= CBLK_UNDERRUN_ON;
+        }
     }
 }
 
diff --git a/services/audioflinger/AudioPolicyManagerBase.cpp b/services/audioflinger/AudioPolicyManagerBase.cpp
index 74be4e0..f653dc5 100644
--- a/services/audioflinger/AudioPolicyManagerBase.cpp
+++ b/services/audioflinger/AudioPolicyManagerBase.cpp
@@ -339,6 +339,7 @@
             LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
             return;
         }
+        forceVolumeReeval = true;
         mForceUse[usage] = config;
         break;
     case AudioSystem::FOR_MEDIA:
@@ -384,7 +385,7 @@
     updateDeviceForStrategy();
     setOutputDevice(mHardwareOutput, newDevice);
     if (forceVolumeReeval) {
-        applyStreamVolumes(mHardwareOutput, newDevice);
+        applyStreamVolumes(mHardwareOutput, newDevice, 0, true);
     }
 
     audio_io_handle_t activeInput = getActiveInput();
@@ -1973,7 +1974,13 @@
             // offset value to reflect actual hardware volume that never reaches 0
             // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
             volume = 0.01 + 0.99 * volume;
+            // Force VOICE_CALL to track BLUETOOTH_SCO stream volume when bluetooth audio is
+            // enabled
+            if (stream == AudioSystem::BLUETOOTH_SCO) {
+                mpClientInterface->setStreamVolume(AudioSystem::VOICE_CALL, volume, output, delayMs);
+            }
         }
+
         mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
     }
 
@@ -1986,6 +1993,7 @@
         } else {
             voiceVolume = 1.0;
         }
+
         if (voiceVolume != mLastVoiceVolume && output == mHardwareOutput) {
             mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
             mLastVoiceVolume = voiceVolume;
@@ -1995,12 +2003,12 @@
     return NO_ERROR;
 }
 
-void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs)
+void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs, bool force)
 {
     LOGV("applyStreamVolumes() for output %d and device %x", output, device);
 
     for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
-        checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs);
+        checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs, force);
     }
 }
 
diff --git a/services/camera/libcameraservice/CannedJpeg.h b/services/camera/libcameraservice/CannedJpeg.h
index b6266fb..6dd99c1 100644
--- a/services/camera/libcameraservice/CannedJpeg.h
+++ b/services/camera/libcameraservice/CannedJpeg.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 const int kCannedJpegWidth = 320;
 const int kCannedJpegHeight = 240;
 const int kCannedJpegSize = 8733;
diff --git a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
index 3c8d553..8a228fd 100644
--- a/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
+++ b/services/camera/tests/CameraServiceTest/CameraServiceTest.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #define LOG_TAG "CameraServiceTest"
 
 #include <stdio.h>
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 65bc1b9..7625adb 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -1094,8 +1094,34 @@
     mDevices.removeAt(index);
     device->close();
 
-    device->next = mClosingDevices;
-    mClosingDevices = device;
+    // Unlink for opening devices list if it is present.
+    Device* pred = NULL;
+    bool found = false;
+    for (Device* entry = mOpeningDevices; entry != NULL; ) {
+        if (entry == device) {
+            found = true;
+            break;
+        }
+        pred = entry;
+        entry = entry->next;
+    }
+    if (found) {
+        // Unlink the device from the opening devices list then delete it.
+        // We don't need to tell the client that the device was closed because
+        // it does not even know it was opened in the first place.
+        LOGI("Device %s was immediately closed after opening.", device->path.string());
+        if (pred) {
+            pred->next = device->next;
+        } else {
+            mOpeningDevices = device->next;
+        }
+        delete device;
+    } else {
+        // Link into closing devices list.
+        // The device will be deleted later after we have informed the client.
+        device->next = mClosingDevices;
+        mClosingDevices = device;
+    }
     return 0;
 }
 
diff --git a/services/input/tests/InputDispatcher_test.cpp b/services/input/tests/InputDispatcher_test.cpp
index bb3449b..2f846c4 100644
--- a/services/input/tests/InputDispatcher_test.cpp
+++ b/services/input/tests/InputDispatcher_test.cpp
@@ -1,6 +1,18 @@
-//
-// Copyright 2010 The Android Open Source Project
-//
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include "../InputDispatcher.h"
 
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index b9174bf..60549c6 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -1,6 +1,18 @@
-//
-// Copyright 2010 The Android Open Source Project
-//
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include "../InputReader.h"
 
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index f28e2b1..a4a95a0 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -135,7 +135,7 @@
                 IRemoteViewsAdapterConnection.Stub.asInterface(mConnectionCb);
             try {
                 cb.onServiceConnected(service);
-            } catch (RemoteException e) {
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -147,7 +147,7 @@
                 IRemoteViewsAdapterConnection.Stub.asInterface(mConnectionCb);
             try {
                 cb.onServiceDisconnected();
-            } catch (RemoteException e) {
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -541,7 +541,7 @@
                     IRemoteViewsFactory.Stub.asInterface(service);
                 try {
                     cb.onDestroy(intent);
-                } catch (RemoteException e) {
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
                 mContext.unbindService(this);
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 3aebb5c..7553c2b 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -7058,8 +7058,8 @@
                 if (pkgSetting.notLaunched) {
                     if (pkgSetting.installerPackageName != null) {
                         sendPackageBroadcast(Intent.ACTION_PACKAGE_FIRST_LAUNCH,
-                                pkgSetting.installerPackageName, null,
-                                pkgSetting.name, null);
+                                pkgSetting.name, null,
+                                pkgSetting.installerPackageName, null);
                     }
                     pkgSetting.notLaunched = false;
                 }
diff --git a/services/java/com/android/server/am/LaunchWarningWindow.java b/services/java/com/android/server/am/LaunchWarningWindow.java
index 1114a31..cb2b7bb 100644
--- a/services/java/com/android/server/am/LaunchWarningWindow.java
+++ b/services/java/com/android/server/am/LaunchWarningWindow.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.android.server.am;
 
 import com.android.internal.R;
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 3561862..63ce0bd 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -203,7 +203,7 @@
     // flags to trigger NTP or XTRA data download when network becomes available
     // initialized to true so we do NTP and XTRA when the network comes up after booting
     private boolean mInjectNtpTimePending = true;
-    private boolean mDownloadXtraDataPending = false;
+    private boolean mDownloadXtraDataPending = true;
 
     // true if GPS is navigating
     private boolean mNavigating;
diff --git a/services/jni/onload.cpp b/services/jni/onload.cpp
index 37b520b..0c46eee 100644
--- a/services/jni/onload.cpp
+++ b/services/jni/onload.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include "JNIHelp.h"
 #include "jni.h"
 #include "utils/Log.h"
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 7a69097..c4027e0 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -811,7 +811,7 @@
 
     { // scope for strong mUserClient reference
         sp<UserClient> userClient(mUserClient.promote());
-        if (mUserClient != 0 && mControlBlock != 0) {
+        if (userClient != 0 && mControlBlock != 0) {
             mControlBlock->setStatus(NO_INIT);
         }
     }
@@ -860,11 +860,13 @@
     Mutex::Autolock _l(mLock);
 
     if (size < mNumBuffers) {
-        // Move the active texture into slot 0
-        BufferData activeBufferData = mBufferData[mActiveBufferIndex];
-        mBufferData[mActiveBufferIndex] = mBufferData[0];
-        mBufferData[0] = activeBufferData;
-        mActiveBufferIndex = 0;
+        // If there is an active texture, move it into slot 0 if needed
+        if (mActiveBufferIndex > 0) {
+            BufferData activeBufferData = mBufferData[mActiveBufferIndex];
+            mBufferData[mActiveBufferIndex] = mBufferData[0];
+            mBufferData[0] = activeBufferData;
+            mActiveBufferIndex = 0;
+        }
 
         // Free the buffers that are no longer needed.
         for (size_t i = size; i < mNumBuffers; i++) {
diff --git a/services/surfaceflinger/tests/resize/resize.cpp b/services/surfaceflinger/tests/resize/resize.cpp
index 99f4b4f..0ccca77 100644
--- a/services/surfaceflinger/tests/resize/resize.cpp
+++ b/services/surfaceflinger/tests/resize/resize.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <cutils/memory.h>
 
 #include <utils/Log.h>
diff --git a/services/surfaceflinger/tests/surface/surface.cpp b/services/surfaceflinger/tests/surface/surface.cpp
index 194fbb6..67ecf7e 100644
--- a/services/surfaceflinger/tests/surface/surface.cpp
+++ b/services/surfaceflinger/tests/surface/surface.cpp
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #include <cutils/memory.h>
 
 #include <utils/Log.h>
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 98ab3d1..1767dd9 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -556,7 +556,7 @@
      * @hide
      */
     public int getLteDbm() {
-        log("STOPSHIP teach getLteDbm to compute dBm properly");
+        log("TODO: teach getLteDbm to compute dBm properly");
         int level = -1;
         if (DBG) log("getLteDbm=" + level);
         return level;
@@ -568,7 +568,7 @@
      * @hide
      */
     public int getLteLevel() {
-        log("STOPSHIP teach getLteLevel to compute Level properly");
+        log("TODO: teach getLteLevel to compute Level properly");
         int level = SIGNAL_STRENGTH_MODERATE;
         if (DBG) log("getLteLevel=" + level);
         return level;
@@ -580,7 +580,7 @@
      * @hide
      */
     public int getLteAsuLevel() {
-        log("STOPSHIP teach getLteAsuLevel to compute asu Level properly");
+        log("TODO: teach getLteAsuLevel to compute asu Level properly");
         int level = 4;
         if (DBG) log("getLteAsuLevel=" + level);
         return level;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index 138a455..b9f769f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -491,18 +491,11 @@
         if (ResourceHelper.stringToFloat(s, mValue)) {
             float f = mValue.getDimension(mBridgeResources.mMetrics);
 
-            if (f < 0) {
-                // negative values are not allowed in pixel dimensions
-                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
-                        "Negative pixel dimension: " + s,
-                        null, null /*data*/);
-                return defValue;
-            }
-
+            final int res = (int)(f+0.5f);
+            if (res != 0) return res;
             if (f == 0) return 0;
-            if (f < 1) return 1;
-
-            return (int)(f+0.5f);
+            if (f > 0) return 1;
+            return defValue; // this is basically unreachable.
         }
 
         // looks like we were unable to resolve the dimension value
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 2e49a77..d40f146 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1193,16 +1193,19 @@
      * Acquiring a WifiLock will keep the radio on until the lock is released.  Multiple
      * applications may hold WifiLocks, and the radio will only be allowed to turn off when no
      * WifiLocks are held in any application.
-     *
+     * <p>
      * Before using a WifiLock, consider carefully if your application requires Wi-Fi access, or
      * could function over a mobile network, if available.  A program that needs to download large
      * files should hold a WifiLock to ensure that the download will complete, but a program whose
      * network usage is occasional or low-bandwidth should not hold a WifiLock to avoid adversely
      * affecting battery life.
-     *
+     * <p>
      * Note that WifiLocks cannot override the user-level "Wi-Fi Enabled" setting, nor Airplane
      * Mode.  They simply keep the radio from turning off when Wi-Fi is already on but the device
      * is idle.
+     * <p>
+     * Any application using a WifiLock must request the {@code android.permission.WAKE_LOCK}
+     * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
      */
     public class WifiLock {
         private String mTag;