Merge "Add screen layout size as one of the resource filtering axes."
diff --git a/Android.mk b/Android.mk
index a28bde2..de0112c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -123,10 +123,10 @@
 	core/java/android/nfc/ILlcpServiceSocket.aidl \
 	core/java/android/nfc/ILlcpSocket.aidl \
 	core/java/android/nfc/INfcAdapter.aidl \
+	core/java/android/nfc/INfcAdapterExtras.aidl \
 	core/java/android/nfc/INfcTag.aidl \
 	core/java/android/nfc/IP2pInitiator.aidl \
 	core/java/android/nfc/IP2pTarget.aidl \
-    core/java/android/nfc/INfcSecureElement.aidl \
 	core/java/android/os/IHardwareService.aidl \
 	core/java/android/os/IMessenger.aidl \
 	core/java/android/os/INetworkManagementService.aidl \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 2eee813..023ce59 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -95,7 +95,7 @@
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PerfTest_intermediates/)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/RSTest_intermediates/)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware/IUsbManager.java)
-
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/api/current.xml b/api/current.xml
index eaa750e..41daf5c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -72665,6 +72665,17 @@
 <parameter name="message" type="java.lang.String">
 </parameter>
 </constructor>
+<field name="TYPE_ACQUIRE_DRM_INFO_FAILED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2008"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="TYPE_NOT_SUPPORTED"
  type="int"
  transient="false"
@@ -73018,6 +73029,17 @@
  visibility="public"
 >
 </field>
+<field name="TYPE_RIGHTS_REMOVED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="TYPE_WAIT_FOR_RIGHTS"
  type="int"
  transient="false"
@@ -94459,6 +94481,17 @@
  visibility="public"
 >
 </method>
+<method name="getSerial"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getUri"
  return="java.lang.String"
  abstract="false"
@@ -267097,7 +267130,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/core/java/android/hardware/usb/UsbAccessory.java b/core/java/android/hardware/usb/UsbAccessory.java
index cc174d4..5e9ead0 100644
--- a/core/java/android/hardware/usb/UsbAccessory.java
+++ b/core/java/android/hardware/usb/UsbAccessory.java
@@ -33,18 +33,20 @@
     private final String mDescription;
     private final String mVersion;
     private final String mUri;
+    private final String mSerial;
 
     /**
      * UsbAccessory should only be instantiated by UsbService implementation
      * @hide
      */
     public UsbAccessory(String manufacturer, String model, String description,
-            String version, String uri) {
+            String version, String uri, String serial) {
         mManufacturer = manufacturer;
         mModel = model;
         mDescription = description;
         mVersion = version;
         mUri = uri;
+        mSerial = serial;
     }
 
     /**
@@ -57,6 +59,7 @@
         mDescription = strings[2];
         mVersion = strings[3];
         mUri = strings[4];
+        mSerial = strings[5];
     }
 
     /**
@@ -106,6 +109,17 @@
         return mUri;
     }
 
+    /**
+     * Returns the unique serial number for the accessory.
+     * This is an optional serial number that can be used to differentiate
+     * between individual accessories of the same model and manufacturer
+     *
+     * @return the unique serial number
+     */
+    public String getSerial() {
+        return mSerial;
+    }
+
     private static boolean compare(String s1, String s2) {
         if (s1 == null) return (s2 == null);
         return s1.equals(s2);
@@ -119,7 +133,8 @@
                     compare(mModel, accessory.getModel()) &&
                     compare(mDescription, accessory.getDescription()) &&
                     compare(mVersion, accessory.getVersion()) &&
-                    compare(mUri, accessory.getUri()));
+                    compare(mUri, accessory.getUri()) &&
+                    compare(mSerial, accessory.getSerial()));
         }
         return false;
     }
@@ -130,7 +145,8 @@
                 (mModel == null ? 0 : mModel.hashCode()) ^
                 (mDescription == null ? 0 : mDescription.hashCode()) ^
                 (mVersion == null ? 0 : mVersion.hashCode()) ^
-                (mUri == null ? 0 : mUri.hashCode()));
+                (mUri == null ? 0 : mUri.hashCode()) ^
+                (mSerial == null ? 0 : mSerial.hashCode()));
     }
 
     @Override
@@ -139,7 +155,8 @@
                             ", mModel=" + mModel +
                             ", mDescription=" + mDescription +
                             ", mVersion=" + mVersion +
-                            ", mUri=" + mUri + "]";
+                            ", mUri=" + mUri +
+                            ", mSerial=" + mSerial + "]";
     }
 
     public static final Parcelable.Creator<UsbAccessory> CREATOR =
@@ -150,7 +167,8 @@
             String description = in.readString();
             String version = in.readString();
             String uri = in.readString();
-            return new UsbAccessory(manufacturer, model, description, version, uri);
+            String serial = in.readString();
+            return new UsbAccessory(manufacturer, model, description, version, uri, serial);
         }
 
         public UsbAccessory[] newArray(int size) {
@@ -168,5 +186,6 @@
         parcel.writeString(mDescription);
         parcel.writeString(mVersion);
         parcel.writeString(mUri);
+        parcel.writeString(mSerial);
    }
 }
diff --git a/core/java/android/nfc/INfcAdapter.aidl b/core/java/android/nfc/INfcAdapter.aidl
index d439a48..870127c 100644
--- a/core/java/android/nfc/INfcAdapter.aidl
+++ b/core/java/android/nfc/INfcAdapter.aidl
@@ -28,7 +28,7 @@
 import android.nfc.INfcTag;
 import android.nfc.IP2pTarget;
 import android.nfc.IP2pInitiator;
-import android.nfc.INfcSecureElement;
+import android.nfc.INfcAdapterExtras;
 
 /**
  * @hide
@@ -41,13 +41,12 @@
     INfcTag getNfcTagInterface();
     IP2pTarget getP2pTargetInterface();
     IP2pInitiator getP2pInitiatorInterface();
-    INfcSecureElement getNfcSecureElementInterface();
+    INfcAdapterExtras getNfcAdapterExtrasInterface();
 
     // NfcAdapter-class related methods
     boolean isEnabled();
     NdefMessage localGet();
     void localSet(in NdefMessage message);
-    void openTagConnection(in Tag tag);
     void enableForegroundDispatch(in ComponentName activity, in PendingIntent intent,
             in IntentFilter[] filters, in TechListParcel techLists);
     void disableForegroundDispatch(in ComponentName activity);
@@ -59,12 +58,8 @@
     int createLlcpConnectionlessSocket(int sap);
     int createLlcpServiceSocket(int sap, String sn, int miu, int rw, int linearBufferLength);
     int createLlcpSocket(int sap, int miu, int rw, int linearBufferLength);
-    int deselectSecureElement();
     boolean disable();
     boolean enable();
     String getProperties(String param);
-    int[] getSecureElementList();
-    int getSelectedSecureElement();
-    int selectSecureElement(int seId);
     int setProperties(String param, String value);
-}
\ No newline at end of file
+}
diff --git a/core/java/android/nfc/INfcSecureElement.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl
similarity index 63%
rename from core/java/android/nfc/INfcSecureElement.aidl
rename to core/java/android/nfc/INfcAdapterExtras.aidl
index aa98dd2..ab5c1a6 100755
--- a/core/java/android/nfc/INfcSecureElement.aidl
+++ b/core/java/android/nfc/INfcAdapterExtras.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 The Android Open Source Project
+ * 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.
@@ -16,13 +16,15 @@
 
 package android.nfc;
 
+import android.os.Bundle;
+
 /**
  * {@hide}
  */
-interface INfcSecureElement {
-    int openSecureElementConnection();
-    int closeSecureElementConnection(int nativeHandle);
-    byte[] exchangeAPDU(int nativeHandle, in byte[] data);
-    int[] getSecureElementTechList(int nativeHandle);
-    byte[] getSecureElementUid(int nativeHandle);
-}
\ No newline at end of file
+interface INfcAdapterExtras {
+    Bundle open(IBinder b);
+    Bundle close();
+    Bundle transceive(in byte[] data_in);
+    int getCardEmulationRoute();
+    void setCardEmulationRoute(int route);    
+}
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index 8c56fda..4689804 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -157,31 +157,6 @@
     public static final String EXTRA_ID = "android.nfc.extra.ID";
 
     /**
-     * Broadcast Action: a transaction with a secure element has been detected.
-     * <p>
-     * Always contains the extra field
-     * {@link android.nfc.NfcAdapter#EXTRA_AID}
-     * @hide
-     */
-    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String ACTION_TRANSACTION_DETECTED =
-            "android.nfc.action.TRANSACTION_DETECTED";
-
-    /**
-     * Broadcast Action: an RF field ON has been detected.
-     * @hide
-     */
-    public static final String ACTION_RF_FIELD_ON_DETECTED =
-            "android.nfc.action.RF_FIELD_ON_DETECTED";
-
-    /**
-     * Broadcast Action: an RF Field OFF has been detected.
-     * @hide
-     */
-    public static final String ACTION_RF_FIELD_OFF_DETECTED =
-            "android.nfc.action.RF_FIELD_OFF_DETECTED";
-
-    /**
      * Broadcast Action: an adapter's state changed between enabled and disabled.
      *
      * The new value is stored in the extra EXTRA_NEW_BOOLEAN_STATE and just contains
@@ -201,15 +176,6 @@
     public static final String EXTRA_NEW_BOOLEAN_STATE = "android.nfc.isEnabled";
 
     /**
-     * Mandatory byte array extra field in
-     * {@link android.nfc.NfcAdapter#ACTION_TRANSACTION_DETECTED}.
-     * <p>
-     * Contains the AID of the applet involved in the transaction.
-     * @hide
-     */
-    public static final String EXTRA_AID = "android.nfc.extra.AID";
-
-    /**
      * LLCP link status: The LLCP link is activated.
      * @hide
      */
@@ -691,39 +657,14 @@
     }
 
     /**
-     * Create an Nfc Secure Element Connection
      * @hide
      */
-    public NfcSecureElement createNfcSecureElementConnection() {
+    public INfcAdapterExtras getNfcAdapterExtrasInterface() {
         try {
-            return new NfcSecureElement(sService.getNfcSecureElementInterface());
+            return sService.getNfcAdapterExtrasInterface();
         } catch (RemoteException e) {
-            Log.e(TAG, "createNfcSecureElementConnection failed", e);
+            attemptDeadServiceRecovery(e);
             return null;
         }
     }
-
-    /**
-     * To change the Secure Element Card Emulation state (ON/OFF)
-     * @hide
-     */
-    public void changeNfcSecureElementCardEmulationState(boolean state)
-    {
-        int seId = 11259375;
-        if(state){
-            /* Enable card emulation */
-            try {
-                sService.selectSecureElement(seId);
-            } catch (RemoteException e) {
-                Log.e(TAG, "Enable card emulation failed", e);
-            }
-        }else{
-            /* Disable card emulation */
-            try {
-                sService.deselectSecureElement();
-            } catch (RemoteException e) {
-                Log.e(TAG, " card emulation failed", e);
-            }
-        }
-    }
 }
diff --git a/core/java/android/nfc/NfcSecureElement.java b/core/java/android/nfc/NfcSecureElement.java
deleted file mode 100755
index 3b5f39e..0000000
--- a/core/java/android/nfc/NfcSecureElement.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.nfc;
-
-import android.nfc.tech.TagTechnology;
-import android.os.RemoteException;
-import android.util.Log;
-
-import java.io.IOException;
-
-//import android.util.Log;
-
-/**
- * This class provides the primary API for managing all aspects Secure Element.
- * Get an instance of this class by calling
- * Context.getSystemService(Context.NFC_SERVICE).
- * @hide
- */
-public final class NfcSecureElement {
-
-    private static final String TAG = "NfcSecureElement";
-
-    private INfcSecureElement mService;
-
-
-    /**
-     * @hide
-     */
-    public NfcSecureElement(INfcSecureElement mSecureElementService) {
-        mService = mSecureElementService;
-    }
-
-    public int openSecureElementConnection(String seType) throws IOException {
-        if (seType.equals("SmartMX")) {
-            try {
-                int handle = mService.openSecureElementConnection();
-                // Handle potential errors
-                if (handle != 0) {
-                    return handle;
-                } else {
-                    throw new IOException("SmartMX connection not allowed");
-                }
-            } catch (RemoteException e) {
-                Log.e(TAG, "RemoteException in openSecureElementConnection(): ", e);
-                return 0;
-            }
-
-        } else if (seType.equals("UICC")) {
-            return 0;
-        } else {
-        	throw new IOException("Wrong Secure Element type");
-        }
-    }
-
-
-    public byte [] exchangeAPDU(int handle,byte [] data) throws IOException {
-
-
-        // Perform exchange APDU
-        try {
-            byte[] response = mService.exchangeAPDU(handle, data);
-            // Handle potential errors
-            if (response == null) {
-            	throw new IOException("Exchange APDU failed");
-            }
-            return response;
-        } catch (RemoteException e) {
-            Log.e(TAG, "RemoteException in exchangeAPDU(): ", e);
-            return null;
-        }
-    }
-
-    public void closeSecureElementConnection(int handle) throws IOException {
-
-        try {
-            int status = mService.closeSecureElementConnection(handle);
-            // Handle potential errors
-            if (ErrorCodes.isError(status)) {
-            	throw new IOException("Error during the conection close");
-            };
-        } catch (RemoteException e) {
-            Log.e(TAG, "RemoteException in closeSecureElement(): ", e);
-        }
-    }
-
-
-    /**
-     * Returns target type. constants.
-     *
-     * @return Secure Element technology type. The possible values are defined in
-     * {@link TagTechnology}
-     *
-     */
-    public int[] getSecureElementTechList(int handle) throws IOException {
-        try {
-            return mService.getSecureElementTechList(handle);
-        } catch (RemoteException e) {
-            Log.e(TAG, "RemoteException in getType(): ", e);
-            return null;
-        }
-    }
-
-    /**
-     * Returns Secure Element UID.
-     *
-     * @return Secure Element UID.
-     */
-    public byte[] getSecureElementUid(int handle) throws IOException {
-
-        byte[] uid = null;
-        try {
-            uid = mService.getSecureElementUid(handle);
-            // Handle potential errors
-            if (uid == null) {
-                throw new IOException("Get Secure Element UID failed");
-            }
-            return uid;
-        } catch (RemoteException e) {
-            Log.e(TAG, "RemoteException in getType(): ", e);
-            return null;
-        }
-    }
-
-}
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index fa5479b..14f2e9d 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -245,12 +245,13 @@
     private static native void nDestroyDisplayList(int displayList);
 
     @Override
-    public boolean drawDisplayList(DisplayList displayList, Rect dirty) {
+    public boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty) {
         return nDrawDisplayList(mRenderer,
-                ((GLES20DisplayList) displayList).mNativeDisplayList, dirty);
+                ((GLES20DisplayList) displayList).mNativeDisplayList, width, height, dirty);
     }
 
-    private static native boolean nDrawDisplayList(int renderer, int displayList, Rect dirty);
+    private static native boolean nDrawDisplayList(int renderer, int displayList,
+            int width, int height, Rect dirty);
 
     ///////////////////////////////////////////////////////////////////////////
     // Hardware layer
diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java
index cb1003a..caa7b74 100644
--- a/core/java/android/view/HardwareCanvas.java
+++ b/core/java/android/view/HardwareCanvas.java
@@ -53,13 +53,15 @@
      * Draws the specified display list onto this canvas.
      * 
      * @param displayList The display list to replay.
+     * @param width The width of the display list.
+     * @param height The height of the display list.
      * @param dirty The dirty region to redraw in the next pass, matters only
      *        if this method returns true, can be null.
      * 
      * @return True if the content of the display list requires another
      *         drawing pass (invalidate()), false otherwise
      */
-    abstract boolean drawDisplayList(DisplayList displayList, Rect dirty);
+    abstract boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty);
 
     /**
      * Draws the specified layer onto this canvas.
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 0cf7ae6..8584bf2 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -608,7 +608,8 @@
 
                         DisplayList displayList = view.getDisplayList();
                         if (displayList != null) {
-                            if (canvas.drawDisplayList(displayList, mRedrawClip)) {
+                            if (canvas.drawDisplayList(displayList, view.getWidth(),
+                                    view.getHeight(), mRedrawClip)) {
                                 if (mRedrawClip.isEmpty() || view.getParent() == null) {
                                     view.invalidate();
                                 } else {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 32c9e27..5a96efd 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -59,7 +59,6 @@
 import android.util.SparseArray;
 import android.util.TypedValue;
 import android.view.ContextMenu.ContextMenuInfo;
-import android.view.View.MeasureSpec;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityEventSource;
 import android.view.accessibility.AccessibilityManager;
@@ -4651,6 +4650,7 @@
      * @return True if the event was handled by the view, false otherwise.
      */
     public boolean dispatchGenericMotionEvent(MotionEvent event) {
+        //noinspection SimplifiableIfStatement
         if (mOnGenericMotionListener != null && (mViewFlags & ENABLED_MASK) == ENABLED
                 && mOnGenericMotionListener.onGenericMotion(this, event)) {
             return true;
@@ -9326,7 +9326,8 @@
         }
 
         final ScrollabilityCache scrollabilityCache = mScrollCache;
-        int length = scrollabilityCache.fadingEdgeLength;
+        final float fadeHeight = scrollabilityCache.fadingEdgeLength;        
+        int length = (int) fadeHeight;
 
         // clip the fade length if top and bottom fades overlap
         // overlapping fades produce odd-looking artifacts
@@ -9341,16 +9342,16 @@
 
         if (verticalEdges) {
             topFadeStrength = Math.max(0.0f, Math.min(1.0f, getTopFadingEdgeStrength()));
-            drawTop = topFadeStrength > 0.0f;
+            drawTop = topFadeStrength * fadeHeight > 1.0f;
             bottomFadeStrength = Math.max(0.0f, Math.min(1.0f, getBottomFadingEdgeStrength()));
-            drawBottom = bottomFadeStrength > 0.0f;
+            drawBottom = bottomFadeStrength * fadeHeight > 1.0f;
         }
 
         if (horizontalEdges) {
             leftFadeStrength = Math.max(0.0f, Math.min(1.0f, getLeftFadingEdgeStrength()));
-            drawLeft = leftFadeStrength > 0.0f;
+            drawLeft = leftFadeStrength * fadeHeight > 1.0f;
             rightFadeStrength = Math.max(0.0f, Math.min(1.0f, getRightFadingEdgeStrength()));
-            drawRight = rightFadeStrength > 0.0f;
+            drawRight = rightFadeStrength * fadeHeight > 1.0f;
         }
 
         saveCount = canvas.getSaveCount();
@@ -9388,7 +9389,6 @@
         final Paint p = scrollabilityCache.paint;
         final Matrix matrix = scrollabilityCache.matrix;
         final Shader fade = scrollabilityCache.shader;
-        final float fadeHeight = scrollabilityCache.fadingEdgeLength;
 
         if (drawTop) {
             matrix.setScale(1, fadeHeight * topFadeStrength);
@@ -9438,6 +9438,7 @@
      *
      * @return The known solid color background for this view, or 0 if the color may vary
      */
+    @ViewDebug.ExportedProperty(category = "drawing")
     public int getSolidColor() {
         return 0;
     }
@@ -11644,6 +11645,7 @@
      * @return true if scrolling was clamped to an over-scroll boundary along either
      *          axis, false otherwise.
      */
+    @SuppressWarnings({"UnusedParameters"})
     protected boolean overScrollBy(int deltaX, int deltaY,
             int scrollX, int scrollY,
             int scrollRangeX, int scrollRangeY,
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index f9692da..8dc86ac 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2585,7 +2585,7 @@
                     }
                 } else {
                     child.mPrivateFlags &= ~DIRTY_MASK;
-                    ((HardwareCanvas) canvas).drawDisplayList(displayList, null);
+                    ((HardwareCanvas) canvas).drawDisplayList(displayList, cr - cl, cb - ct, null);
                 }
             }
         } else if (cache != null) {
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 2a5c45f..dfdae53 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -5369,7 +5369,8 @@
     private boolean shouldForwardTouchEvent() {
         return mFullScreenHolder != null || (mForwardTouchEvents
                 && !mSelectingText
-                && mPreventDefault != PREVENT_DEFAULT_IGNORE);
+                && mPreventDefault != PREVENT_DEFAULT_IGNORE
+                && mPreventDefault != PREVENT_DEFAULT_NO);
     }
 
     private boolean inFullScreenMode() {
@@ -5949,6 +5950,10 @@
             int y = viewToContentY((int) ev.getY(c) + mScrollY);
             ted.mPoints[c] = new Point(x, y);
         }
+        if (ted.mAction == MotionEvent.ACTION_POINTER_DOWN
+            || ted.mAction == MotionEvent.ACTION_POINTER_UP) {
+            ted.mActionIndex = ev.getActionIndex();
+        }
         ted.mMetaState = ev.getMetaState();
         ted.mReprocess = true;
         ted.mMotionEvent = MotionEvent.obtain(ev);
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 979eb2b..bed77ef 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -572,7 +572,7 @@
             int framePtr, int nodePtr, int x, int y);
 
     private native boolean nativeHandleTouchEvent(int action, int[] idArray,
-            int[] xArray, int[] yArray, int count, int metaState);
+            int[] xArray, int[] yArray, int count, int actionIndex, int metaState);
 
     private native void nativeUpdateFrameCache();
 
@@ -829,6 +829,7 @@
         int mAction;
         int[] mIds;  // Ids of the touch points
         Point[] mPoints;
+        int mActionIndex;  // Associated pointer index for ACTION_POINTER_DOWN/UP
         int mMetaState;
         boolean mReprocess;
         MotionEvent mMotionEvent;
@@ -1344,7 +1345,7 @@
                                         ted.mNativeLayerRect);
                             }
                             ted.mNativeResult = nativeHandleTouchEvent(ted.mAction, ted.mIds,
-                                    xArray, yArray, count, ted.mMetaState);
+                                    xArray, yArray, count, ted.mActionIndex, ted.mMetaState);
                             Message.obtain(
                                     mWebView.mPrivateHandler,
                                     WebView.PREVENT_TOUCH_ID,
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index eca39fc..d39271e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -5226,6 +5226,7 @@
      *
      * @return The cache color hint
      */
+    @ViewDebug.ExportedProperty(category = "drawing")
     public int getCacheColorHint() {
         return mCacheColorHint;
     }
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 6088654..9933d68 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -54,18 +54,16 @@
 import java.util.WeakHashMap;
 
 /**
- * Provides the user interface elements for the user to enter a search query and submit a
+ * A widget that provides a user interface for the user to enter a search query and submit a
  * request to a search provider. Shows a list of query suggestions or results, if
- * available and allows the user to pick a suggestion or result to launch into.
+ * available, and allows the user to pick a suggestion or result to launch into.
  *
- * <p>
- * <b>XML attributes</b>
- * <p>
- * See {@link android.R.styleable#SearchView SearchView Attributes},
- * {@link android.R.styleable#View View Attributes}
+ * <p>For more information, see the <a href="{@docRoot}guide/topics/search/index.html">Search</a>
+ * documentation.<p>
  *
  * @attr ref android.R.styleable#SearchView_iconifiedByDefault
  * @attr ref android.R.styleable#SearchView_maxWidth
+ * @attr ref android.R.styleable#SearchView_queryHint
  */
 public class SearchView extends LinearLayout {
 
@@ -387,6 +385,8 @@
      * in the SearchableInfo.
      *
      * @param hint the hint text to display
+     *
+     * @attr ref android.R.styleable#SearchView_queryHint
      */
     public void setQueryHint(CharSequence hint) {
         mQueryHint = hint;
@@ -402,6 +402,8 @@
      * <p>The default value is true.</p>
      *
      * @param iconified whether the search field should be iconified by default
+     *
+     * @attr ref android.R.styleable#SearchView_iconifiedByDefault
      */
     public void setIconifiedByDefault(boolean iconified) {
         if (mIconifiedByDefault == iconified) return;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 00124e1..a3ea6a9 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4210,6 +4210,12 @@
 
     @Override
     protected void onDraw(Canvas canvas) {
+        if (mPreDrawState == PREDRAW_DONE) {
+            final ViewTreeObserver observer = getViewTreeObserver();
+            observer.removeOnPreDrawListener(this);
+            mPreDrawState = PREDRAW_NOT_REGISTERED;
+        }
+
         if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return;
 
         restartMarqueeIfNeeded();
@@ -4281,12 +4287,6 @@
             }
         }
 
-        if (mPreDrawState == PREDRAW_DONE) {
-            final ViewTreeObserver observer = getViewTreeObserver();
-            observer.removeOnPreDrawListener(this);
-            mPreDrawState = PREDRAW_NOT_REGISTERED;
-        }
-
         int color = mCurTextColor;
 
         if (mLayout == null) {
@@ -5227,6 +5227,7 @@
      * @param text The auto complete text the user has selected.
      */
     public void onCommitCompletion(CompletionInfo text) {
+        // intentionally empty
     }
 
     /**
@@ -5413,6 +5414,7 @@
      * of edit operations through a call to link {@link #beginBatchEdit()}.
      */
     public void onBeginBatchEdit() {
+        // intentionally empty
     }
     
     /**
@@ -5420,6 +5422,7 @@
      * of edit operations through a call to link {@link #endBatchEdit}.
      */
     public void onEndBatchEdit() {
+        // intentionally empty
     }
     
     /**
@@ -6762,6 +6765,7 @@
      * @param lengthAfter The length of the replacement modified text
      */
     protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
+        // intentionally empty
     }
 
     /**
@@ -6772,6 +6776,7 @@
      * @param selEnd The new selection end location.
      */
     protected void onSelectionChanged(int selStart, int selEnd) {
+        // intentionally empty
     }
     
     /**
@@ -9203,7 +9208,7 @@
 
         @Override
         public void onDetached() {
-            if (mHandle == null) mHandle.onDetached();
+            if (mHandle != null) mHandle.onDetached();
         }
     }
 
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 0ea8225..7fdad10 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -119,7 +119,7 @@
     const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
 
     SkAutoSTMalloc<8, SkScalar> storage(posArray ? count : 0);
-    SkScalar*                   pos = NULL;
+    SkScalar* pos = NULL;
 
     if (posArray) {
         AutoJavaFloatArray autoPos(env, posArray, count);
@@ -164,7 +164,11 @@
         }
     } else {
         storedPositions[0] = 0.0f;
-        storedPositions[1] = 1.0f;
+        const jfloat step = 1.0f / (count - 1);
+        for (size_t i = 1; i < count - 1; i++) {
+            storedPositions[i] = step * i;
+        }
+        storedPositions[count - 1] = 1.0f;
     }
 
     SkiaShader* skiaShader = new SkiaLinearGradientShader(storedBounds, storedColors,
@@ -289,7 +293,11 @@
         }
     } else {
         storedPositions[0] = 0.0f;
-        storedPositions[1] = 1.0f;
+        const jfloat step = 1.0f / (count - 1);
+        for (size_t i = 1; i < count - 1; i++) {
+            storedPositions[i] = step * i;
+        }
+        storedPositions[count - 1] = 1.0f;
     }
 
     SkiaShader* skiaShader = new SkiaCircularGradientShader(x, y, radius, storedColors,
@@ -384,7 +392,11 @@
         }
     } else {
         storedPositions[0] = 0.0f;
-        storedPositions[1] = 1.0f;
+        const jfloat step = 1.0f / (count - 1);
+        for (size_t i = 1; i < count - 1; i++) {
+            storedPositions[i] = step * i;
+        }
+        storedPositions[count - 1] = 1.0f;
     }
 
     SkiaShader* skiaShader = new SkiaSweepGradientShader(x, y, storedColors, storedPositions, count,
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 26c915f..ed93d64 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -497,9 +497,10 @@
 }
 
 static bool android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
-        jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList, jobject dirty) {
+        jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList,
+        jint width, jint height, jobject dirty) {
     android::uirenderer::Rect bounds;
-    bool redraw = renderer->drawDisplayList(displayList, bounds);
+    bool redraw = renderer->drawDisplayList(displayList, width, height, bounds);
     if (redraw && dirty != NULL) {
         env->CallVoidMethod(dirty, gRectClassInfo.set,
                 int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom));
@@ -663,7 +664,7 @@
     { "nGetDisplayList",         "(I)I",       (void*) android_view_GLES20Canvas_getDisplayList },
     { "nDestroyDisplayList",     "(I)V",       (void*) android_view_GLES20Canvas_destroyDisplayList },
     { "nGetDisplayListRenderer", "(I)I",       (void*) android_view_GLES20Canvas_getDisplayListRenderer },
-    { "nDrawDisplayList",        "(IILandroid/graphics/Rect;)Z",
+    { "nDrawDisplayList",        "(IIIILandroid/graphics/Rect;)Z",
                                                (void*) android_view_GLES20Canvas_drawDisplayList },
 
     { "nInterrupt",              "(I)V",       (void*) android_view_GLES20Canvas_interrupt },
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c684e7e..0c9a2ef 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -91,10 +91,15 @@
     <protected-broadcast android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
 
     <protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" />
+    <protected-broadcast android:name="com.android.nfc_extras.action.RF_FIELD_ON_DETECTED" />
+    <protected-broadcast android:name="com.android.nfc_extras.action.RF_FIELD_OFF_DETECTED" />
+    <protected-broadcast android:name="com.android.nfc_extras.action.AID_SELECTED" />
+
     <protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" />
     <protected-broadcast android:name="android.intent.action.CLEAR_DNS_CACHE" />
     <protected-broadcast android:name="android.intent.action.PROXY_CHANGE" />
 
+
     <!-- ====================================== -->
     <!-- Permissions for things that cost money -->
     <!-- ====================================== -->
diff --git a/core/res/res/drawable-hdpi/ic_media_embed_play.png b/core/res/res/drawable-hdpi/ic_media_embed_play.png
new file mode 100644
index 0000000..23ac7e4
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_media_embed_play.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_ff.png b/core/res/res/drawable-hdpi/ic_media_ff.png
index b0dc05b..a892ba2 100644
--- a/core/res/res/drawable-hdpi/ic_media_ff.png
+++ b/core/res/res/drawable-hdpi/ic_media_ff.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_fullscreen.png b/core/res/res/drawable-hdpi/ic_media_fullscreen.png
new file mode 100644
index 0000000..0cdbf77
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_media_fullscreen.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_next.png b/core/res/res/drawable-hdpi/ic_media_next.png
index 2552f4e..2285670 100644
--- a/core/res/res/drawable-hdpi/ic_media_next.png
+++ b/core/res/res/drawable-hdpi/ic_media_next.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_pause.png b/core/res/res/drawable-hdpi/ic_media_pause.png
index d4670c2..ffb55cd 100644
--- a/core/res/res/drawable-hdpi/ic_media_pause.png
+++ b/core/res/res/drawable-hdpi/ic_media_pause.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_play.png b/core/res/res/drawable-hdpi/ic_media_play.png
index e67ec80..e525bd2 100644
--- a/core/res/res/drawable-hdpi/ic_media_play.png
+++ b/core/res/res/drawable-hdpi/ic_media_play.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_previous.png b/core/res/res/drawable-hdpi/ic_media_previous.png
index 05eba71..3333711 100644
--- a/core/res/res/drawable-hdpi/ic_media_previous.png
+++ b/core/res/res/drawable-hdpi/ic_media_previous.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_media_rew.png b/core/res/res/drawable-hdpi/ic_media_rew.png
index 88eed2e..b14e9b9 100644
--- a/core/res/res/drawable-hdpi/ic_media_rew.png
+++ b/core/res/res/drawable-hdpi/ic_media_rew.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_paste_bubble_disabled_holo.png b/core/res/res/drawable-hdpi/ic_paste_bubble_disabled_holo.png
new file mode 100644
index 0000000..42ac16b
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_paste_bubble_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/ic_media_embed_play.png b/core/res/res/drawable-ldpi/ic_media_embed_play.png
new file mode 100644
index 0000000..e7c1972
--- /dev/null
+++ b/core/res/res/drawable-ldpi/ic_media_embed_play.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/ic_media_fullscreen.png b/core/res/res/drawable-ldpi/ic_media_fullscreen.png
new file mode 100644
index 0000000..1a38c38
--- /dev/null
+++ b/core/res/res/drawable-ldpi/ic_media_fullscreen.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_embed_play.png b/core/res/res/drawable-mdpi/ic_media_embed_play.png
new file mode 100644
index 0000000..fc5d8c6
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_media_embed_play.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_ff.png b/core/res/res/drawable-mdpi/ic_media_ff.png
index d99779d..892772e 100644
--- a/core/res/res/drawable-mdpi/ic_media_ff.png
+++ b/core/res/res/drawable-mdpi/ic_media_ff.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_fullscreen.png b/core/res/res/drawable-mdpi/ic_media_fullscreen.png
new file mode 100644
index 0000000..1c60e15
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_media_fullscreen.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_next.png b/core/res/res/drawable-mdpi/ic_media_next.png
index cee4930..bbe311b 100644
--- a/core/res/res/drawable-mdpi/ic_media_next.png
+++ b/core/res/res/drawable-mdpi/ic_media_next.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_pause.png b/core/res/res/drawable-mdpi/ic_media_pause.png
index 9e8b675..e4e8d86 100644
--- a/core/res/res/drawable-mdpi/ic_media_pause.png
+++ b/core/res/res/drawable-mdpi/ic_media_pause.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_play.png b/core/res/res/drawable-mdpi/ic_media_play.png
index 41cd65f..8eaf962 100644
--- a/core/res/res/drawable-mdpi/ic_media_play.png
+++ b/core/res/res/drawable-mdpi/ic_media_play.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_previous.png b/core/res/res/drawable-mdpi/ic_media_previous.png
index 1be95b4..e9abc7f 100644
--- a/core/res/res/drawable-mdpi/ic_media_previous.png
+++ b/core/res/res/drawable-mdpi/ic_media_previous.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_media_rew.png b/core/res/res/drawable-mdpi/ic_media_rew.png
index 8311508..a5eb94a 100644
--- a/core/res/res/drawable-mdpi/ic_media_rew.png
+++ b/core/res/res/drawable-mdpi/ic_media_rew.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_paste_bubble_disabled_holo.png b/core/res/res/drawable-mdpi/ic_paste_bubble_disabled_holo.png
new file mode 100644
index 0000000..ce6bd86
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_paste_bubble_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
index b7413b3..62e3274 100644
--- a/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
index 82e7a03..b7512fa 100644
--- a/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
index 4b0ea21..bfc6f83 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
index e87591c..708ba90 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
index 14f69b1..0da1e9c 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
index 85329ca..2e93557 100644
--- a/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_right_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png b/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
index 7e130d9..7aeaad6 100644
--- a/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_selected_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png b/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
index 050d1c0..cf46f32 100644
--- a/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/textfield_search_selected_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/text_edit_no_paste_window.xml b/core/res/res/layout/text_edit_no_paste_window.xml
index fa50275..98b16e2 100644
--- a/core/res/res/layout/text_edit_no_paste_window.xml
+++ b/core/res/res/layout/text_edit_no_paste_window.xml
@@ -25,7 +25,7 @@
         android:paddingRight="16dip"
         android:paddingTop="8dip"
         android:paddingBottom="8dip"
-        android:drawableLeft="@android:drawable/ic_menu_paste_dark"
+        android:drawableLeft="@android:drawable/ic_paste_bubble_disabled_holo"
         android:drawablePadding="8dip"
         android:gravity="center"
         android:textAppearance="?android:attr/textAppearanceMediumInverse"
diff --git a/core/res/res/layout/text_edit_side_no_paste_window.xml b/core/res/res/layout/text_edit_side_no_paste_window.xml
index 0ed3849..3eb41fb 100644
--- a/core/res/res/layout/text_edit_side_no_paste_window.xml
+++ b/core/res/res/layout/text_edit_side_no_paste_window.xml
@@ -25,7 +25,7 @@
         android:paddingRight="16dip"
         android:paddingTop="8dip"
         android:paddingBottom="8dip"
-        android:drawableLeft="@android:drawable/ic_menu_paste_dark"
+        android:drawableLeft="@android:drawable/ic_paste_bubble_disabled_holo"
         android:drawablePadding="8dip"
         android:gravity="center"
         android:textAppearance="?android:attr/textAppearanceMediumInverse"
diff --git a/core/res/res/raw-ar-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ar-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..002be41
--- /dev/null
+++ b/core/res/res/raw-ar-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>نافذة جديدة للتصفح المتخفي</title>
+  </head>
+  <body>
+    <p><strong>أنت الآن في وضع التصفح المتخفي</strong> الصفحات التي تشاهدها في هذه النافذة لن تظهر في سجل المتصفح أو سجلّ البحث، ولن تترك آثارًا أخرى للتتبع، مثل ملفات تعريف الارتباط على جهازك بعد أن تغلق نافذة التصفح المتخفي. ورغم ذلك، سيتم الاحتفاظ بأي ملفات تنزلها أو أية إشارات مرجعية تقوم بإنشائها.</p>
+
+    <p><strong>العمل في وضع التصفح المخفي لا يؤثر على طريقة عمل الأشخاص الآخرين أو الخوادم أو البرامج الأخرى. كن على حذر مما يلي:</strong></p>
+
+    <ul>
+      <li>مواقع الويب التي تجمع معلومات عنك أو تشارك الآخرين فيها</li>
+      <li>مزوّدو خدمة الإنترنت أو الموظفون الذين يتتبعون الصفحات التي تزورها</li>
+      <li>البرامج الضارة التي تتبع ضغطات المفاتيح التي تقوم بها مقابل تنزيل وجوه رمزية مجانًا</li>
+      <li>المراقبة من قبل العملاء السريين</li>
+      <li>الأشخاص الذين يقفون خلفك</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ar/incognito_mode_start_page.html b/core/res/res/raw-ar/incognito_mode_start_page.html
new file mode 100644
index 0000000..002be41
--- /dev/null
+++ b/core/res/res/raw-ar/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>نافذة جديدة للتصفح المتخفي</title>
+  </head>
+  <body>
+    <p><strong>أنت الآن في وضع التصفح المتخفي</strong> الصفحات التي تشاهدها في هذه النافذة لن تظهر في سجل المتصفح أو سجلّ البحث، ولن تترك آثارًا أخرى للتتبع، مثل ملفات تعريف الارتباط على جهازك بعد أن تغلق نافذة التصفح المتخفي. ورغم ذلك، سيتم الاحتفاظ بأي ملفات تنزلها أو أية إشارات مرجعية تقوم بإنشائها.</p>
+
+    <p><strong>العمل في وضع التصفح المخفي لا يؤثر على طريقة عمل الأشخاص الآخرين أو الخوادم أو البرامج الأخرى. كن على حذر مما يلي:</strong></p>
+
+    <ul>
+      <li>مواقع الويب التي تجمع معلومات عنك أو تشارك الآخرين فيها</li>
+      <li>مزوّدو خدمة الإنترنت أو الموظفون الذين يتتبعون الصفحات التي تزورها</li>
+      <li>البرامج الضارة التي تتبع ضغطات المفاتيح التي تقوم بها مقابل تنزيل وجوه رمزية مجانًا</li>
+      <li>المراقبة من قبل العملاء السريين</li>
+      <li>الأشخاص الذين يقفون خلفك</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-bg-xlarge/incognito_mode_start_page.html b/core/res/res/raw-bg-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..ee25ae4
--- /dev/null
+++ b/core/res/res/raw-bg-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нов прозорец „инкогнито“</title>
+  </head>
+  <body>
+    <p><strong>Влязохте в режим „инкогнито“</strong>. Страниците, които разглеждате в този прозорец, няма да се показват в историята на браузъра ви, нито в историята на търсенията ви. Те също няма да оставят други следи като „бисквитки“ в устройството ви, след като затворите прозореца в режим „инкогнито“. Ще се съхранят обаче всички файлове, които изтеглите, или отметки, които създадете.</p>
+
+    <p><strong>Преминаването в режим „инкогнито“ не засяга поведението на други хора, сървъри или софтуер. </strong>Внимавайте за:</p>
+
+    <ul>
+      <li>уебсайтове, които събират или споделят информация за вас;</li>
+      <li>доставчици на интернет услуги или служители, които проследяват посещаваните от вас страници;</li>
+      <li>злонамерен софтуер, който ви дава безплатни емотикони, но в замяна проследява натисканията на клавишите от вас;</li>
+      <li>наблюдение от тайните служби;</li>
+      <li>хора, които стоят зад вас.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-bg/incognito_mode_start_page.html b/core/res/res/raw-bg/incognito_mode_start_page.html
new file mode 100644
index 0000000..ee25ae4
--- /dev/null
+++ b/core/res/res/raw-bg/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нов прозорец „инкогнито“</title>
+  </head>
+  <body>
+    <p><strong>Влязохте в режим „инкогнито“</strong>. Страниците, които разглеждате в този прозорец, няма да се показват в историята на браузъра ви, нито в историята на търсенията ви. Те също няма да оставят други следи като „бисквитки“ в устройството ви, след като затворите прозореца в режим „инкогнито“. Ще се съхранят обаче всички файлове, които изтеглите, или отметки, които създадете.</p>
+
+    <p><strong>Преминаването в режим „инкогнито“ не засяга поведението на други хора, сървъри или софтуер. </strong>Внимавайте за:</p>
+
+    <ul>
+      <li>уебсайтове, които събират или споделят информация за вас;</li>
+      <li>доставчици на интернет услуги или служители, които проследяват посещаваните от вас страници;</li>
+      <li>злонамерен софтуер, който ви дава безплатни емотикони, но в замяна проследява натисканията на клавишите от вас;</li>
+      <li>наблюдение от тайните служби;</li>
+      <li>хора, които стоят зад вас.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ca-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ca-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..bec3dac
--- /dev/null
+++ b/core/res/res/raw-ca-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova finestra d'incògnit</title>
+  </head>
+  <body>
+    <p><strong>Has passat a l'estat d'incògnit</strong>. Les pàgines que visualitzis en aquesta finestra no apareixeran a l'historial del navegador ni a l'historial de cerques, i no deixaran cap pista, com ara galetes, al dispositiu després de tancar la finestra d'incògnit. Tanmateix, es conservaran tots els fitxers que baixis o les adreces d'interès que creïs.</p>
+
+    <p><strong>Utilitzar el mode d'incògnit no afecta el comportament d'altres usuaris, servidors ni programari. Vés amb compte amb:</strong></p>
+
+    <ul>
+      <li>llocs web que recopilen o comparteixen informació sobre la teva identitat,</li>
+      <li>proveïdors de serveis d'Internet o treballadors que segueixen les pàgines que visites,</li>
+      <li>programari maliciós que segueix les teves pulsacions del teclat a canvi d'emoticones,</li>
+      <li>vigilància per part d'agents secrets,</li>
+      <li>persones que estan darrere teu.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ca/incognito_mode_start_page.html b/core/res/res/raw-ca/incognito_mode_start_page.html
new file mode 100644
index 0000000..bec3dac
--- /dev/null
+++ b/core/res/res/raw-ca/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova finestra d'incògnit</title>
+  </head>
+  <body>
+    <p><strong>Has passat a l'estat d'incògnit</strong>. Les pàgines que visualitzis en aquesta finestra no apareixeran a l'historial del navegador ni a l'historial de cerques, i no deixaran cap pista, com ara galetes, al dispositiu després de tancar la finestra d'incògnit. Tanmateix, es conservaran tots els fitxers que baixis o les adreces d'interès que creïs.</p>
+
+    <p><strong>Utilitzar el mode d'incògnit no afecta el comportament d'altres usuaris, servidors ni programari. Vés amb compte amb:</strong></p>
+
+    <ul>
+      <li>llocs web que recopilen o comparteixen informació sobre la teva identitat,</li>
+      <li>proveïdors de serveis d'Internet o treballadors que segueixen les pàgines que visites,</li>
+      <li>programari maliciós que segueix les teves pulsacions del teclat a canvi d'emoticones,</li>
+      <li>vigilància per part d'agents secrets,</li>
+      <li>persones que estan darrere teu.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-cs-xlarge/incognito_mode_start_page.html b/core/res/res/raw-cs-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..7420393
--- /dev/null
+++ b/core/res/res/raw-cs-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nové anonymní okno</title>
+  </head>
+  <body>
+    <p><strong>Spustili jste anonymní režim</strong>. Stránky, které zobrazíte v tomto okně, se nezahrnou do historie prohlížeče ani historie vyhledávání a dokonce po zavření tohoto anonymního okna ve vašem zařízení nezanechají ani žádné jiné stopy například v podobě souborů cookie. Veškeré stažené soubory nebo vytvořené záložky však budou zachovány.</p>
+
+    <p><strong>Použití anonymního režimu nemá vliv na chování jiných osob, serverů nebo softwaru. Dejte si pozor na:</strong></p>
+
+    <ul>
+      <li>Weby, které sbírají nebo sdílejí informace o vás</li>
+      <li>Poskytovatele internetových služeb nebo zaměstnavatele, kteří sledují stránky, které navštěvujete</li>
+      <li>Škodlivý software, který sleduje stisknuté klávesy a výměnou nabízí nové emotikony</li>
+      <li>Tajné agenty</li>
+      <li>Lidi, kteří vám koukají přes rameno</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-cs/incognito_mode_start_page.html b/core/res/res/raw-cs/incognito_mode_start_page.html
new file mode 100644
index 0000000..7420393
--- /dev/null
+++ b/core/res/res/raw-cs/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nové anonymní okno</title>
+  </head>
+  <body>
+    <p><strong>Spustili jste anonymní režim</strong>. Stránky, které zobrazíte v tomto okně, se nezahrnou do historie prohlížeče ani historie vyhledávání a dokonce po zavření tohoto anonymního okna ve vašem zařízení nezanechají ani žádné jiné stopy například v podobě souborů cookie. Veškeré stažené soubory nebo vytvořené záložky však budou zachovány.</p>
+
+    <p><strong>Použití anonymního režimu nemá vliv na chování jiných osob, serverů nebo softwaru. Dejte si pozor na:</strong></p>
+
+    <ul>
+      <li>Weby, které sbírají nebo sdílejí informace o vás</li>
+      <li>Poskytovatele internetových služeb nebo zaměstnavatele, kteří sledují stránky, které navštěvujete</li>
+      <li>Škodlivý software, který sleduje stisknuté klávesy a výměnou nabízí nové emotikony</li>
+      <li>Tajné agenty</li>
+      <li>Lidi, kteří vám koukají přes rameno</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-da-xlarge/incognito_mode_start_page.html b/core/res/res/raw-da-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..eae989f
--- /dev/null
+++ b/core/res/res/raw-da-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nyt inkognitovindue</title>
+  </head>
+  <body>
+    <p><strong>Nu er du inkognito</strong>. De sider, du besøger i dette vindue, vises ikke i din browser- eller søgeoversigt, og de efterlader ikke andre spor, såsom cookies, på din enhed, når du lukker incognitovinduet. Filer, som du downloader eller bogmærker, som du opretter, gemmes dog.</p>
+
+    <p><strong>At være inkognito er ikke noget, der påvirker andre folk, servere eller software. Vær opmærksom på:</strong></p>
+
+    <ul>
+      <li>Websider, der indsamler eller deler oplysninger om dig</li>
+      <li>Internetserviceudbydere eller arbejdsgivere, der registrerer de sider, du besøger</li>
+      <li>Ondsindet software, der registrerer dine tasteslag til gengæld for gratis smileys</li>
+      <li>Overvågning af hemmelige agenter</li>
+      <li>Folk, der kigger dig over skulderen</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-da/incognito_mode_start_page.html b/core/res/res/raw-da/incognito_mode_start_page.html
new file mode 100644
index 0000000..eae989f
--- /dev/null
+++ b/core/res/res/raw-da/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nyt inkognitovindue</title>
+  </head>
+  <body>
+    <p><strong>Nu er du inkognito</strong>. De sider, du besøger i dette vindue, vises ikke i din browser- eller søgeoversigt, og de efterlader ikke andre spor, såsom cookies, på din enhed, når du lukker incognitovinduet. Filer, som du downloader eller bogmærker, som du opretter, gemmes dog.</p>
+
+    <p><strong>At være inkognito er ikke noget, der påvirker andre folk, servere eller software. Vær opmærksom på:</strong></p>
+
+    <ul>
+      <li>Websider, der indsamler eller deler oplysninger om dig</li>
+      <li>Internetserviceudbydere eller arbejdsgivere, der registrerer de sider, du besøger</li>
+      <li>Ondsindet software, der registrerer dine tasteslag til gengæld for gratis smileys</li>
+      <li>Overvågning af hemmelige agenter</li>
+      <li>Folk, der kigger dig over skulderen</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-de-xlarge/incognito_mode_start_page.html b/core/res/res/raw-de-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..1d2cb69
--- /dev/null
+++ b/core/res/res/raw-de-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Neues Inkognito-Fenster</title>
+  </head>
+  <body>
+    <p><strong>Sie haben den Modus für anonymes Browsen aktiviert</strong>. In diesem Fenster aufgerufene Seiten erscheinen nicht in Ihrem Browser- oder Suchverlauf. Zudem werden nach dem Schließen des Inkognito-Fensters keine anderen Spuren wie etwa Cookies auf Ihrem Gerät gespeichert. Heruntergeladene Dateien oder hinzugefügte Lesezeichen werden jedoch beibehalten.</p>
+
+    <p><strong>Das anonyme Browsen wirkt sich nicht auf das Verhalten von Menschen, Servern oder Software aus. </strong>Vorsicht ist geboten bei:</p>
+
+    <ul>
+      <li>Websites, auf denen Informationen über Sie gesammelt oder weitergegeben werden</li>
+      <li>Internetanbietern oder Arbeitgebern, die die von Ihnen aufgerufenen Seiten protokollieren</li>
+      <li>Bösartiger Software, die Ihnen kostenlose Smileys bietet, dafür aber Ihre Tastatureingaben speichert</li>
+      <li>Geheimagenten</li>
+      <li>Personen, die hinter Ihnen stehen</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-de/incognito_mode_start_page.html b/core/res/res/raw-de/incognito_mode_start_page.html
new file mode 100644
index 0000000..1d2cb69
--- /dev/null
+++ b/core/res/res/raw-de/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Neues Inkognito-Fenster</title>
+  </head>
+  <body>
+    <p><strong>Sie haben den Modus für anonymes Browsen aktiviert</strong>. In diesem Fenster aufgerufene Seiten erscheinen nicht in Ihrem Browser- oder Suchverlauf. Zudem werden nach dem Schließen des Inkognito-Fensters keine anderen Spuren wie etwa Cookies auf Ihrem Gerät gespeichert. Heruntergeladene Dateien oder hinzugefügte Lesezeichen werden jedoch beibehalten.</p>
+
+    <p><strong>Das anonyme Browsen wirkt sich nicht auf das Verhalten von Menschen, Servern oder Software aus. </strong>Vorsicht ist geboten bei:</p>
+
+    <ul>
+      <li>Websites, auf denen Informationen über Sie gesammelt oder weitergegeben werden</li>
+      <li>Internetanbietern oder Arbeitgebern, die die von Ihnen aufgerufenen Seiten protokollieren</li>
+      <li>Bösartiger Software, die Ihnen kostenlose Smileys bietet, dafür aber Ihre Tastatureingaben speichert</li>
+      <li>Geheimagenten</li>
+      <li>Personen, die hinter Ihnen stehen</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-el-xlarge/incognito_mode_start_page.html b/core/res/res/raw-el-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..5641650
--- /dev/null
+++ b/core/res/res/raw-el-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Νέο παράθυρο για ανώνυμη περιήγηση</title>
+  </head>
+  <body>
+    <p><strong>Είστε σε κατάσταση ανώνυμης περιήγησης</strong>. Οι σελίδες που θα προβάλλετε σε αυτό το παράθυρο δεν θα εμφανιστούν στο ιστορικό του πρόγράμματος περιήγησης ή στο ιστορικό αναζήτησης. Επίσης, δεν θα αφήσουν ίχνη, όπως cookie, στη συσκευή σας αφού κλείσετε το παράθυρο ανώνυμης περιήγησης. Ωστόσο, τα αρχεία και οι σελιδοδείκτες που θα δημιουργήσετε θα διατηρηθούν.</p>
+
+    <p><strong>Η κατάσταση ανώνυμης περιήγησης δεν επηρεάζει την συμπεριφορά άλλων, διακομιστών ή λογισμικού. Αλλά προσοχή σε:</strong></p>
+
+    <ul>
+      <li>Ιστοτόπους που συλλέγουν ή μοιράζονται πληροφορίες για εσάς</li>
+      <li>Πάροχους υπηρεσιών διαδικτύου ή εργοδότες που παρακολουθούν τις ιστοσελίδες που επισκέπτεστε</li>
+      <li>Κακόβουλο λογισμικό που καταγράφει ότι πληκτρολογείτε με αντάλλαγμα δωρεάν "φατσούλες"</li>
+      <li>Παρακολούθηση από μυστικούς πράκτορες</li>
+      <li>Άτομα που στέκονται πίσω σας</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-el/incognito_mode_start_page.html b/core/res/res/raw-el/incognito_mode_start_page.html
new file mode 100644
index 0000000..5641650
--- /dev/null
+++ b/core/res/res/raw-el/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Νέο παράθυρο για ανώνυμη περιήγηση</title>
+  </head>
+  <body>
+    <p><strong>Είστε σε κατάσταση ανώνυμης περιήγησης</strong>. Οι σελίδες που θα προβάλλετε σε αυτό το παράθυρο δεν θα εμφανιστούν στο ιστορικό του πρόγράμματος περιήγησης ή στο ιστορικό αναζήτησης. Επίσης, δεν θα αφήσουν ίχνη, όπως cookie, στη συσκευή σας αφού κλείσετε το παράθυρο ανώνυμης περιήγησης. Ωστόσο, τα αρχεία και οι σελιδοδείκτες που θα δημιουργήσετε θα διατηρηθούν.</p>
+
+    <p><strong>Η κατάσταση ανώνυμης περιήγησης δεν επηρεάζει την συμπεριφορά άλλων, διακομιστών ή λογισμικού. Αλλά προσοχή σε:</strong></p>
+
+    <ul>
+      <li>Ιστοτόπους που συλλέγουν ή μοιράζονται πληροφορίες για εσάς</li>
+      <li>Πάροχους υπηρεσιών διαδικτύου ή εργοδότες που παρακολουθούν τις ιστοσελίδες που επισκέπτεστε</li>
+      <li>Κακόβουλο λογισμικό που καταγράφει ότι πληκτρολογείτε με αντάλλαγμα δωρεάν "φατσούλες"</li>
+      <li>Παρακολούθηση από μυστικούς πράκτορες</li>
+      <li>Άτομα που στέκονται πίσω σας</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-en-rGB-xlarge/incognito_mode_start_page.html b/core/res/res/raw-en-rGB-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..7436f98
--- /dev/null
+++ b/core/res/res/raw-en-rGB-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>New incognito window</title>
+  </head>
+  <body>
+    <p><strong>You've gone incognito</strong>. Pages that you view in this window won't appear in your browser history or search history, and they won't leave other traces, such as cookies, on your device after you close the incognito window. However, any files that you download or bookmarks that you create will be preserved.</p>
+
+    <p><strong>Going incognito doesn't affect the behaviour of other people, servers or software. Be cautious of:</strong></p>
+
+    <ul>
+      <li>Websites that collect or share information about you</li>
+      <li>Internet service providers or employers that track the pages that you visit</li>
+      <li>Malicious software that tracks your keystrokes in exchange for free smileys</li>
+      <li>Surveillance by secret agents</li>
+      <li>People standing behind you</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-en-rGB/incognito_mode_start_page.html b/core/res/res/raw-en-rGB/incognito_mode_start_page.html
new file mode 100644
index 0000000..7436f98
--- /dev/null
+++ b/core/res/res/raw-en-rGB/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>New incognito window</title>
+  </head>
+  <body>
+    <p><strong>You've gone incognito</strong>. Pages that you view in this window won't appear in your browser history or search history, and they won't leave other traces, such as cookies, on your device after you close the incognito window. However, any files that you download or bookmarks that you create will be preserved.</p>
+
+    <p><strong>Going incognito doesn't affect the behaviour of other people, servers or software. Be cautious of:</strong></p>
+
+    <ul>
+      <li>Websites that collect or share information about you</li>
+      <li>Internet service providers or employers that track the pages that you visit</li>
+      <li>Malicious software that tracks your keystrokes in exchange for free smileys</li>
+      <li>Surveillance by secret agents</li>
+      <li>People standing behind you</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-es-rUS-xlarge/incognito_mode_start_page.html b/core/res/res/raw-es-rUS-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..d283df5
--- /dev/null
+++ b/core/res/res/raw-es-rUS-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nueva ventana de incógnito</title>
+  </head>
+  <body>
+    <p><strong>Estás de incógnito</strong>. Las páginas que veas en esta ventana no aparecerán en el historial de tu navegador ni en el historial de búsquedas, y cuando cierres la ventana de incógnito, tampoco quedará ningún otro rastro, como cookies, en tu dispositivo. Sin embargo, sí se preservarán los archivos que descargues o los favoritos que marques.</p>
+
+    <p><strong>Estar de incógnito no afecta el comportamiento de otras personas, servidores o programas. Ten cuidado con:</strong></p>
+
+    <ul>
+      <li>Sitios web que recaban o comparten tu información</li>
+      <li>Proveedores de servicio de Internet o empleadores que hacen un seguimiento de las páginas que visitas</li>
+      <li>Programas de software maliciosos que hacen un seguimiento de la actividad de tu teclado a cambio de emoticones gratuitos</li>
+      <li>Vigilancia a cargo de agentes secretos</li>
+      <li>Personas paradas atrás tuyo</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-es-rUS/incognito_mode_start_page.html b/core/res/res/raw-es-rUS/incognito_mode_start_page.html
new file mode 100644
index 0000000..d283df5
--- /dev/null
+++ b/core/res/res/raw-es-rUS/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nueva ventana de incógnito</title>
+  </head>
+  <body>
+    <p><strong>Estás de incógnito</strong>. Las páginas que veas en esta ventana no aparecerán en el historial de tu navegador ni en el historial de búsquedas, y cuando cierres la ventana de incógnito, tampoco quedará ningún otro rastro, como cookies, en tu dispositivo. Sin embargo, sí se preservarán los archivos que descargues o los favoritos que marques.</p>
+
+    <p><strong>Estar de incógnito no afecta el comportamiento de otras personas, servidores o programas. Ten cuidado con:</strong></p>
+
+    <ul>
+      <li>Sitios web que recaban o comparten tu información</li>
+      <li>Proveedores de servicio de Internet o empleadores que hacen un seguimiento de las páginas que visitas</li>
+      <li>Programas de software maliciosos que hacen un seguimiento de la actividad de tu teclado a cambio de emoticones gratuitos</li>
+      <li>Vigilancia a cargo de agentes secretos</li>
+      <li>Personas paradas atrás tuyo</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-es-xlarge/incognito_mode_start_page.html b/core/res/res/raw-es-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..6d9b501
--- /dev/null
+++ b/core/res/res/raw-es-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nueva ventana de incógnito</title>
+  </head>
+  <body>
+    <p><strong>Estás navegando de incógnito</strong>. Las páginas que consultes a través de esta ventana no quedarán registradas en el historial del navegador ni en el historial de búsquedas, y tampoco dejarán otros rastros en el ordenador (como cookies) una vez cerrada. Los archivos que descargues y los marcadores que guardes sí se almacenarán. </p>
+
+    <p><strong>La función de navegación de incógnito no afecta al comportamiento de los servidores o programas de software. Ten cuidado con:</strong></p>
+
+    <ul>
+      <li>sitios web que recopilan o comparten información personal</li>
+      <li>proveedores de servicios de Internet o trabajadores de estas empresas que supervisan las páginas que visitas</li>
+      <li>software malicioso que realiza un seguimiento de las teclas que pulsas a cambio de emoticonos gratuitos</li>
+      <li>actividades de seguimiento por parte de terceros</li>
+      <li>personas merodeando cerca de tu ordenador</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-es/incognito_mode_start_page.html b/core/res/res/raw-es/incognito_mode_start_page.html
index 43fd37f..6d9b501 100644
--- a/core/res/res/raw-es/incognito_mode_start_page.html
+++ b/core/res/res/raw-es/incognito_mode_start_page.html
@@ -1,26 +1,19 @@
-<html>
+<html DIR="LTR">
   <head>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
     <title>Nueva ventana de incógnito</title>
   </head>
   <body>
-    <p><strong>Has entrado en el modo &quot;Navegar de incógnito&quot;</strong>. Las páginas
-    que consultes a través de esta ventana no quedarán registradas en el historial del navegador
-    ni en el historial de búsquedas, y tampoco dejarán otros rastros en el equipo (como cookies)
-    una vez cerrada. Aunque sí quedarán almacenados los archivos que descargues y los marcadores
-    que guardes durante la sesión.</p>
+    <p><strong>Estás navegando de incógnito</strong>. Las páginas que consultes a través de esta ventana no quedarán registradas en el historial del navegador ni en el historial de búsquedas, y tampoco dejarán otros rastros en el ordenador (como cookies) una vez cerrada. Los archivos que descargues y los marcadores que guardes sí se almacenarán. </p>
 
-    <p><strong>La función &quot;Navegar de incógnito&quot; no afecta al comportamiento de
-    otros usuarios, servidores o programas. Atención con:</strong></p>
+    <p><strong>La función de navegación de incógnito no afecta al comportamiento de los servidores o programas de software. Ten cuidado con:</strong></p>
 
     <ul>
-      <li>sitios web que recopilan o comparten información personal,</li>
-      <li>proveedores de servicios de Internet o trabajadores de estas empresas que
-      supervisan las páginas que visita el usuario,</li>
-      <li>software malicioso que realiza un seguimiento de las teclas que pulsa el usuario a
-      cambio de unos emoticones gratuitos,</li>
-      <li>el seguimiento por parte de detectives privados,</li>
-      <li>personas merodeando cerca de tu equipo.</li>
+      <li>sitios web que recopilan o comparten información personal</li>
+      <li>proveedores de servicios de Internet o trabajadores de estas empresas que supervisan las páginas que visitas</li>
+      <li>software malicioso que realiza un seguimiento de las teclas que pulsas a cambio de emoticonos gratuitos</li>
+      <li>actividades de seguimiento por parte de terceros</li>
+      <li>personas merodeando cerca de tu ordenador</li>
     </ul>
   </body>
 </html>
diff --git a/core/res/res/raw-fa-xlarge/incognito_mode_start_page.html b/core/res/res/raw-fa-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..f004120
--- /dev/null
+++ b/core/res/res/raw-fa-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>پنجره ناشناس جدید</title>
+  </head>
+  <body>
+    <p><strong>شما به صورت ناشناس وارد شده اید</strong> صفحاتی که شما در این پنجره مشاهده میکنید در سابقه مرورگر یا سابقه جستجوی شما ظاهر نمیشوند، و پس از بستن پنجره ناشناس، دنباله ای از خود مانند کوکی ها روی دستگاه شما بر جای نمیگذارند. به هر حال، فایل های دانلود شده و نشانکهای صفحه ای که ایجاد کرده اید باقی خواهند ماند.</p>
+
+    <p><strong>وارد شدن به صورت ناشناس، تاثیری بر روی رفتار افراد دیگر، سرورها و یا نرم افزارها ندارد. در خصوص موارد زیر هشیار باشید:</strong></p>
+
+    <ul>
+      <li>وبسایت هایی که اطلاعاتی را در مورد شما جمع آوری کرده و به اشتراک میگذارند</li>
+      <li>تامین کننده های خدمات اینترنتی شما یا کارمندانی که صفحاتی که شما بازدید کرده اید را پیگیری میکنند</li>
+      <li>نرم افزارهای مخربی که در ازای نشانک های رایگان، ضربات کلیدهای شما را ذخیره میکنند</li>
+      <li>نظارت توسط نمایندگان سری</li>
+      <li>افرادی که پشت سرتان ایستاده اند</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-fa/incognito_mode_start_page.html b/core/res/res/raw-fa/incognito_mode_start_page.html
new file mode 100644
index 0000000..f004120
--- /dev/null
+++ b/core/res/res/raw-fa/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>پنجره ناشناس جدید</title>
+  </head>
+  <body>
+    <p><strong>شما به صورت ناشناس وارد شده اید</strong> صفحاتی که شما در این پنجره مشاهده میکنید در سابقه مرورگر یا سابقه جستجوی شما ظاهر نمیشوند، و پس از بستن پنجره ناشناس، دنباله ای از خود مانند کوکی ها روی دستگاه شما بر جای نمیگذارند. به هر حال، فایل های دانلود شده و نشانکهای صفحه ای که ایجاد کرده اید باقی خواهند ماند.</p>
+
+    <p><strong>وارد شدن به صورت ناشناس، تاثیری بر روی رفتار افراد دیگر، سرورها و یا نرم افزارها ندارد. در خصوص موارد زیر هشیار باشید:</strong></p>
+
+    <ul>
+      <li>وبسایت هایی که اطلاعاتی را در مورد شما جمع آوری کرده و به اشتراک میگذارند</li>
+      <li>تامین کننده های خدمات اینترنتی شما یا کارمندانی که صفحاتی که شما بازدید کرده اید را پیگیری میکنند</li>
+      <li>نرم افزارهای مخربی که در ازای نشانک های رایگان، ضربات کلیدهای شما را ذخیره میکنند</li>
+      <li>نظارت توسط نمایندگان سری</li>
+      <li>افرادی که پشت سرتان ایستاده اند</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-fi-xlarge/incognito_mode_start_page.html b/core/res/res/raw-fi-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..feb9f4f
--- /dev/null
+++ b/core/res/res/raw-fi-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Uusi incognito-ikkuna</title>
+  </head>
+  <body>
+    <p><strong>Olet nyt incognito-tilassa</strong>. Incognito-tilassa katsellut sivut eivät näy selainhistoriassa eikä hakuhistoriassa. Ne eivät myöskään jätä muita jälkiä, kuten evästeitä, sivun sulkemisen jälkeen. Lataamasi tiedostot tai luomasi kirjanmerkit tosin tallentuvat.</p>
+
+    <p><strong>Incognito-tilaan siirtyminen ei vaikuta muiden ihmisten, palvelimien tai tietokoneohjelmien toimintaan. Varo:</strong></p>
+
+    <ul>
+      <li>Verkkosivustoja jotka keräävät sinusta tietoa ja/tai jakavat sitä eteenpäin</li>
+      <li>Internet-palveluntarjoajia ja työnantajia jotka seuraavat sivuja, joilla käyt</li>
+      <li>Haittaohjelmia jotka seuraavat näppäimistön toimintaa ja tarjoavat vastineeksi ilmaisia hymiöitä</li>
+      <li>Salaisten agenttien seurantaa</li>
+      <li>Ihmisiä jotka seisovat takanasi</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-fi/incognito_mode_start_page.html b/core/res/res/raw-fi/incognito_mode_start_page.html
new file mode 100644
index 0000000..feb9f4f
--- /dev/null
+++ b/core/res/res/raw-fi/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Uusi incognito-ikkuna</title>
+  </head>
+  <body>
+    <p><strong>Olet nyt incognito-tilassa</strong>. Incognito-tilassa katsellut sivut eivät näy selainhistoriassa eikä hakuhistoriassa. Ne eivät myöskään jätä muita jälkiä, kuten evästeitä, sivun sulkemisen jälkeen. Lataamasi tiedostot tai luomasi kirjanmerkit tosin tallentuvat.</p>
+
+    <p><strong>Incognito-tilaan siirtyminen ei vaikuta muiden ihmisten, palvelimien tai tietokoneohjelmien toimintaan. Varo:</strong></p>
+
+    <ul>
+      <li>Verkkosivustoja jotka keräävät sinusta tietoa ja/tai jakavat sitä eteenpäin</li>
+      <li>Internet-palveluntarjoajia ja työnantajia jotka seuraavat sivuja, joilla käyt</li>
+      <li>Haittaohjelmia jotka seuraavat näppäimistön toimintaa ja tarjoavat vastineeksi ilmaisia hymiöitä</li>
+      <li>Salaisten agenttien seurantaa</li>
+      <li>Ihmisiä jotka seisovat takanasi</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-fr-xlarge/incognito_mode_start_page.html b/core/res/res/raw-fr-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..8962cdf
--- /dev/null
+++ b/core/res/res/raw-fr-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nouvelle fenêtre de navigation privée</title>
+  </head>
+  <body>
+    <p><strong>Vous êtes passé en navigation privée</strong>. Les pages que vous consultez dans cette fenêtre n'apparaîtront ni dans l'historique de votre navigateur, ni dans l'historique des recherches, et ne laisseront aucune trace (comme les cookies) sur votre appareil une fois que vous aurez fermé la fenêtre de navigation privée. Tous les fichiers téléchargés et les favoris créés seront toutefois conservés.</p>
+
+    <p><strong>Passer en navigation privée n'a aucun effet sur les autres utilisateurs, serveurs ou logiciels. Méfiez-vous :</strong></p>
+
+    <ul>
+      <li>Des sites Web qui collectent ou partagent des informations vous concernant</li>
+      <li>Des fournisseurs d'accès Internet ou des employeurs qui conservent une trace des pages que vous visitez</li>
+      <li>Des programmes indésirables qui enregistrent vos frappes en échange d'émoticônes gratuites</li>
+      <li>Des personnes qui pourraient surveiller vos activités</li>
+      <li>Des personnes qui se tiennent derrière vous</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-fr/incognito_mode_start_page.html b/core/res/res/raw-fr/incognito_mode_start_page.html
new file mode 100644
index 0000000..8962cdf
--- /dev/null
+++ b/core/res/res/raw-fr/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nouvelle fenêtre de navigation privée</title>
+  </head>
+  <body>
+    <p><strong>Vous êtes passé en navigation privée</strong>. Les pages que vous consultez dans cette fenêtre n'apparaîtront ni dans l'historique de votre navigateur, ni dans l'historique des recherches, et ne laisseront aucune trace (comme les cookies) sur votre appareil une fois que vous aurez fermé la fenêtre de navigation privée. Tous les fichiers téléchargés et les favoris créés seront toutefois conservés.</p>
+
+    <p><strong>Passer en navigation privée n'a aucun effet sur les autres utilisateurs, serveurs ou logiciels. Méfiez-vous :</strong></p>
+
+    <ul>
+      <li>Des sites Web qui collectent ou partagent des informations vous concernant</li>
+      <li>Des fournisseurs d'accès Internet ou des employeurs qui conservent une trace des pages que vous visitez</li>
+      <li>Des programmes indésirables qui enregistrent vos frappes en échange d'émoticônes gratuites</li>
+      <li>Des personnes qui pourraient surveiller vos activités</li>
+      <li>Des personnes qui se tiennent derrière vous</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hi-xlarge/incognito_mode_start_page.html b/core/res/res/raw-hi-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..f73c41d
--- /dev/null
+++ b/core/res/res/raw-hi-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>नई गुप्त विंडो</title>
+  </head>
+  <body>
+    <p><strong>आप गुप्त मोड में हैं</strong>. इस विंडो में देखे गए पृष्ठ आपके ब्राउज़र इतिहास  या खोज इतिहास में प्रकट नहीं होंगे, और वे आपके डिवाइस पर गुप्त विंडो बंद करने के बाद और कोई चिह्न जैसे कुकीज़, नहीं छोड़ते. हालांकि डाउनलोड की गई या बुकमार्क की गई कोई भी फ़ाइल संरक्षित रखी जाएगी.</p>
+
+    <p><strong>गुप्त मोड में होने से दूसरे लोगों, सर्वर. या सॉफ़्टवेयर पर कोई प्रभाव नहीं होता. इनका ध्यान रखें</strong></p>
+
+    <ul>
+      <li>वे वेबसाइट जो आपके बारे में जानकारी एकत्र या शेयर करती हैं</li>
+      <li>इंटरनेट सेवा प्रदाता या नियोक्ता जो आपके द्वारा विज़िट किए गए पृष्ठों पर नज़र रखते हैं</li>
+      <li>दुर्भावनापूर्ण सॉफ़्टवेयर जो मुफ़्त स्माइली के बदले आपके कीस्ट्रोक पर नज़र रखते हैं.</li>
+      <li>गुप्तचरों द्वारा निगरानी</li>
+      <li>आपके पीछे खड़े लोग</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hi/incognito_mode_start_page.html b/core/res/res/raw-hi/incognito_mode_start_page.html
new file mode 100644
index 0000000..f73c41d
--- /dev/null
+++ b/core/res/res/raw-hi/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>नई गुप्त विंडो</title>
+  </head>
+  <body>
+    <p><strong>आप गुप्त मोड में हैं</strong>. इस विंडो में देखे गए पृष्ठ आपके ब्राउज़र इतिहास  या खोज इतिहास में प्रकट नहीं होंगे, और वे आपके डिवाइस पर गुप्त विंडो बंद करने के बाद और कोई चिह्न जैसे कुकीज़, नहीं छोड़ते. हालांकि डाउनलोड की गई या बुकमार्क की गई कोई भी फ़ाइल संरक्षित रखी जाएगी.</p>
+
+    <p><strong>गुप्त मोड में होने से दूसरे लोगों, सर्वर. या सॉफ़्टवेयर पर कोई प्रभाव नहीं होता. इनका ध्यान रखें</strong></p>
+
+    <ul>
+      <li>वे वेबसाइट जो आपके बारे में जानकारी एकत्र या शेयर करती हैं</li>
+      <li>इंटरनेट सेवा प्रदाता या नियोक्ता जो आपके द्वारा विज़िट किए गए पृष्ठों पर नज़र रखते हैं</li>
+      <li>दुर्भावनापूर्ण सॉफ़्टवेयर जो मुफ़्त स्माइली के बदले आपके कीस्ट्रोक पर नज़र रखते हैं.</li>
+      <li>गुप्तचरों द्वारा निगरानी</li>
+      <li>आपके पीछे खड़े लोग</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hr-xlarge/incognito_mode_start_page.html b/core/res/res/raw-hr-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..6f20fe0
--- /dev/null
+++ b/core/res/res/raw-hr-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Novi anonimni prozor</title>
+  </head>
+  <body>
+    <p><strong>Sada ste anonimni</strong>. Stranice koje pregledavate u ovom prozoru neće se pojaviti u povijesti preglednika ili povijesti pretraživanja, neće ostaviti tragove, poput kolačića, na vašem uređaju nakon što zatvorite anonimni prozor. Međutim, sve datoteke koje preuzmete ili oznake koje stvorite bit će sačuvane.</p>
+
+    <p><strong>Anonimno pregledavanje neće utjecati na ponašanje drugih osoba, poslužitelja ili softvera. Pazite na sljedeće:</strong></p>
+
+    <ul>
+      <li>Web-lokacije koje prikupljaju ili dijele informacije o vama</li>
+      <li>Davatelje internetskih usluga ili poslodavce koji prate stranice koje posjećujete</li>
+      <li>Zlonamjerni softver koji prati koje tipke pritišćete u zamjenu za besplatne emotikone</li>
+      <li>Nadzor tajnih službi</li>
+      <li>Osobe koje stoje iza vas</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hr/incognito_mode_start_page.html b/core/res/res/raw-hr/incognito_mode_start_page.html
new file mode 100644
index 0000000..6f20fe0
--- /dev/null
+++ b/core/res/res/raw-hr/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Novi anonimni prozor</title>
+  </head>
+  <body>
+    <p><strong>Sada ste anonimni</strong>. Stranice koje pregledavate u ovom prozoru neće se pojaviti u povijesti preglednika ili povijesti pretraživanja, neće ostaviti tragove, poput kolačića, na vašem uređaju nakon što zatvorite anonimni prozor. Međutim, sve datoteke koje preuzmete ili oznake koje stvorite bit će sačuvane.</p>
+
+    <p><strong>Anonimno pregledavanje neće utjecati na ponašanje drugih osoba, poslužitelja ili softvera. Pazite na sljedeće:</strong></p>
+
+    <ul>
+      <li>Web-lokacije koje prikupljaju ili dijele informacije o vama</li>
+      <li>Davatelje internetskih usluga ili poslodavce koji prate stranice koje posjećujete</li>
+      <li>Zlonamjerni softver koji prati koje tipke pritišćete u zamjenu za besplatne emotikone</li>
+      <li>Nadzor tajnih službi</li>
+      <li>Osobe koje stoje iza vas</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hu-xlarge/incognito_mode_start_page.html b/core/res/res/raw-hu-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..38b0806
--- /dev/null
+++ b/core/res/res/raw-hu-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Új inkognitóablak</title>
+  </head>
+  <body>
+    <p><strong>Ön inkognitó módra váltott</strong>. Az inkognitóablakban megtekintett oldalak nem jelennek meg böngészője előzményeiben, illetve keresési előzményeiben, és nem hagynak más nyomot pl. cookie-t sem a számítógépén az inkognitóablak bezárását követően. A letöltött fájlok, valamint a létrehozott könyvjelzők azonban megmaradnak.</p>
+
+    <p><strong>Az inkognitó üzemmód nem befolyásolja a többi felhasználó, szerver vagy szoftver viselkedését. Ügyeljen a következőkre:</strong></p>
+
+    <ul>
+      <li>Olyan webhelyek, amelyek információt gyűjtenek vagy osztanak meg Önről</li>
+      <li>Olyan internetszolgáltatók vagy alkalmazottaik, akik nyomon követik az Ön által látogatott oldalakat</li>
+      <li>Olyan kártékony szoftverek, amelyek ingyenes hangulatjelekért cserébe nyomon követik billentyűbeviteleit</li>
+      <li>Titkos ügynökök megfigyelése</li>
+      <li>Az Ön mögött álló emberek</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-hu/incognito_mode_start_page.html b/core/res/res/raw-hu/incognito_mode_start_page.html
new file mode 100644
index 0000000..38b0806
--- /dev/null
+++ b/core/res/res/raw-hu/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Új inkognitóablak</title>
+  </head>
+  <body>
+    <p><strong>Ön inkognitó módra váltott</strong>. Az inkognitóablakban megtekintett oldalak nem jelennek meg böngészője előzményeiben, illetve keresési előzményeiben, és nem hagynak más nyomot pl. cookie-t sem a számítógépén az inkognitóablak bezárását követően. A letöltött fájlok, valamint a létrehozott könyvjelzők azonban megmaradnak.</p>
+
+    <p><strong>Az inkognitó üzemmód nem befolyásolja a többi felhasználó, szerver vagy szoftver viselkedését. Ügyeljen a következőkre:</strong></p>
+
+    <ul>
+      <li>Olyan webhelyek, amelyek információt gyűjtenek vagy osztanak meg Önről</li>
+      <li>Olyan internetszolgáltatók vagy alkalmazottaik, akik nyomon követik az Ön által látogatott oldalakat</li>
+      <li>Olyan kártékony szoftverek, amelyek ingyenes hangulatjelekért cserébe nyomon követik billentyűbeviteleit</li>
+      <li>Titkos ügynökök megfigyelése</li>
+      <li>Az Ön mögött álló emberek</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-id-xlarge/incognito_mode_start_page.html b/core/res/res/raw-id-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..788c088
--- /dev/null
+++ b/core/res/res/raw-id-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Jendela penyamaran baru</title>
+  </head>
+  <body>
+    <p><strong>Anda menggunakan penyamaran</strong>. Laman yang Anda lihat di jendela ini tidak akan ditampilkan dalam riwayat peramban atau riwayat penelusuran, dan tidak akan meninggalkan jejak, seperti kuki, di perangkat setelah jendela penyamaran ditutup. Namun, berkas yang diunduh atau bookmark yang dibuat akan disimpan.</p>
+
+    <p><strong>Menggunakan penyamaran tidak mempengaruhi perilaku orang lain, server, atau perangkat lunak. Waspadai:</strong></p>
+
+    <ul>
+      <li>Situs web yang mengumpulkan atau berbagi informasi tentang Anda</li>
+      <li>Penyedia layanan internet atau tempat kerja yang melacak laman yang Anda kunjungi</li>
+      <li>Perangkat lunak jahat yang melacak penekanan tombol dengan imbalan smiley gratis</li>
+      <li>Pemantauan oleh agen rahasia</li>
+      <li>Orang yang berdiri di belakang Anda</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-id/incognito_mode_start_page.html b/core/res/res/raw-id/incognito_mode_start_page.html
new file mode 100644
index 0000000..788c088
--- /dev/null
+++ b/core/res/res/raw-id/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Jendela penyamaran baru</title>
+  </head>
+  <body>
+    <p><strong>Anda menggunakan penyamaran</strong>. Laman yang Anda lihat di jendela ini tidak akan ditampilkan dalam riwayat peramban atau riwayat penelusuran, dan tidak akan meninggalkan jejak, seperti kuki, di perangkat setelah jendela penyamaran ditutup. Namun, berkas yang diunduh atau bookmark yang dibuat akan disimpan.</p>
+
+    <p><strong>Menggunakan penyamaran tidak mempengaruhi perilaku orang lain, server, atau perangkat lunak. Waspadai:</strong></p>
+
+    <ul>
+      <li>Situs web yang mengumpulkan atau berbagi informasi tentang Anda</li>
+      <li>Penyedia layanan internet atau tempat kerja yang melacak laman yang Anda kunjungi</li>
+      <li>Perangkat lunak jahat yang melacak penekanan tombol dengan imbalan smiley gratis</li>
+      <li>Pemantauan oleh agen rahasia</li>
+      <li>Orang yang berdiri di belakang Anda</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-it-xlarge/incognito_mode_start_page.html b/core/res/res/raw-it-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..4a34874
--- /dev/null
+++ b/core/res/res/raw-it-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nuova finestra di navigazione in incognito</title>
+  </head>
+  <body>
+    <p><strong>Sei passato alla navigazione in incognito</strong>. Le pagine aperte in questa finestra non vengono registrate nella cronologia di navigazione o di ricerca, e non lasciano traccia sul tuo computer, ad esempio sotto forma di cookie, una volta chiusa la finestra. Tuttavia, qualsiasi file scaricato o preferito creato verrà conservato.</p>
+
+    <p><strong>La navigazione in incognito non influisce sul comportamento di altri utenti, server o software. Diffida di:</strong></p>
+
+    <ul>
+      <li>Siti web che raccolgono o condividono informazioni su di te</li>
+      <li>Provider di servizi Internet o datori di lavoro che registrano le pagine da te visitate</li>
+      <li>Software dannosi che registrano le sequenze di tasti da te utilizzate in cambio di smiley gratuiti</li>
+      <li>Agenti segreti</li>
+      <li>Persone che ti stanno alle spalle</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-it/incognito_mode_start_page.html b/core/res/res/raw-it/incognito_mode_start_page.html
new file mode 100644
index 0000000..4a34874
--- /dev/null
+++ b/core/res/res/raw-it/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nuova finestra di navigazione in incognito</title>
+  </head>
+  <body>
+    <p><strong>Sei passato alla navigazione in incognito</strong>. Le pagine aperte in questa finestra non vengono registrate nella cronologia di navigazione o di ricerca, e non lasciano traccia sul tuo computer, ad esempio sotto forma di cookie, una volta chiusa la finestra. Tuttavia, qualsiasi file scaricato o preferito creato verrà conservato.</p>
+
+    <p><strong>La navigazione in incognito non influisce sul comportamento di altri utenti, server o software. Diffida di:</strong></p>
+
+    <ul>
+      <li>Siti web che raccolgono o condividono informazioni su di te</li>
+      <li>Provider di servizi Internet o datori di lavoro che registrano le pagine da te visitate</li>
+      <li>Software dannosi che registrano le sequenze di tasti da te utilizzate in cambio di smiley gratuiti</li>
+      <li>Agenti segreti</li>
+      <li>Persone che ti stanno alle spalle</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-iw-xlarge/incognito_mode_start_page.html b/core/res/res/raw-iw-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..368dea0
--- /dev/null
+++ b/core/res/res/raw-iw-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>חלון חדש של גלישה בסתר</title>
+  </head>
+  <body>
+    <p><strong>עברת למצב של גלישה בסתר</strong>. דפים שאתה רואה בחלון זה לא יופיעו בהיסטוריית הדפדפן או בהיסטוריית החיפושים שלך, והם לא ישאירו עקבות אחרים, כמו קובצי cookie, לאחר שתסגור את חלון הגלישה בסתר. עם זאת, כל קובץ שאתה מוריד או כוכביות שאתה יוצר יישמרו.</p>
+
+    <p><strong> גלישה בסתר לא משפיעה על התנהגותם של אנשים אחרים, שרתים  אחרים או תוכנות אחרות. היזהר מ:</strong></p>
+
+    <ul>
+      <li>אתרים שאוספים נתונים או משתפים מידע לגביך</li>
+      <li>ספקי שירות אינטרנט או עובדים שעוקבים אחר הדפים שבהם אתה מבקר</li>
+      <li>תוכנה זדונית שעוקבת אחר ההקשות שלך על המקשים בתמורה לסימני סמיילי בחינם</li>
+      <li>מעקב של סוכנים חשאיים</li>
+      <li>אנשים שעומדים מאחוריך</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-iw/incognito_mode_start_page.html b/core/res/res/raw-iw/incognito_mode_start_page.html
new file mode 100644
index 0000000..368dea0
--- /dev/null
+++ b/core/res/res/raw-iw/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="RTL">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>חלון חדש של גלישה בסתר</title>
+  </head>
+  <body>
+    <p><strong>עברת למצב של גלישה בסתר</strong>. דפים שאתה רואה בחלון זה לא יופיעו בהיסטוריית הדפדפן או בהיסטוריית החיפושים שלך, והם לא ישאירו עקבות אחרים, כמו קובצי cookie, לאחר שתסגור את חלון הגלישה בסתר. עם זאת, כל קובץ שאתה מוריד או כוכביות שאתה יוצר יישמרו.</p>
+
+    <p><strong> גלישה בסתר לא משפיעה על התנהגותם של אנשים אחרים, שרתים  אחרים או תוכנות אחרות. היזהר מ:</strong></p>
+
+    <ul>
+      <li>אתרים שאוספים נתונים או משתפים מידע לגביך</li>
+      <li>ספקי שירות אינטרנט או עובדים שעוקבים אחר הדפים שבהם אתה מבקר</li>
+      <li>תוכנה זדונית שעוקבת אחר ההקשות שלך על המקשים בתמורה לסימני סמיילי בחינם</li>
+      <li>מעקב של סוכנים חשאיים</li>
+      <li>אנשים שעומדים מאחוריך</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ja-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ja-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..a58ad05
--- /dev/null
+++ b/core/res/res/raw-ja-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新しいシークレットウィンドウ</title>
+  </head>
+  <body>
+    <p><strong>シークレットモードを使用中です</strong>。このウィンドウで開いたページはブラウザの履歴や検索履歴に残りません。このウィンドウを閉じるとCookieなどの記録も端末から消去されます。ただし、ダウンロードしたファイルやブックマークしたページは保存されます。</p>
+
+    <p><strong>シークレットモードが他のユーザーやサーバー、ソフトウェアの動作に影響することはありません。なお、下記のようなケースにご注意ください。</strong></p>
+
+    <ul>
+      <li>ユーザーの情報を収集、共有するウェブサイト</li>
+      <li>アクセスしたページをトラッキングするインターネットサービスプロバイダや雇用主</li>
+      <li>無料ダウンロードなどと一緒にインストールされ、キーストロークを記録するマルウェア</li>
+      <li>スパイ、諜報活動</li>
+      <li>背後にいる人</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ja/incognito_mode_start_page.html b/core/res/res/raw-ja/incognito_mode_start_page.html
new file mode 100644
index 0000000..a58ad05
--- /dev/null
+++ b/core/res/res/raw-ja/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新しいシークレットウィンドウ</title>
+  </head>
+  <body>
+    <p><strong>シークレットモードを使用中です</strong>。このウィンドウで開いたページはブラウザの履歴や検索履歴に残りません。このウィンドウを閉じるとCookieなどの記録も端末から消去されます。ただし、ダウンロードしたファイルやブックマークしたページは保存されます。</p>
+
+    <p><strong>シークレットモードが他のユーザーやサーバー、ソフトウェアの動作に影響することはありません。なお、下記のようなケースにご注意ください。</strong></p>
+
+    <ul>
+      <li>ユーザーの情報を収集、共有するウェブサイト</li>
+      <li>アクセスしたページをトラッキングするインターネットサービスプロバイダや雇用主</li>
+      <li>無料ダウンロードなどと一緒にインストールされ、キーストロークを記録するマルウェア</li>
+      <li>スパイ、諜報活動</li>
+      <li>背後にいる人</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ko-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ko-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..0e703b1
--- /dev/null
+++ b/core/res/res/raw-ko-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>새 시크릿 창</title>
+  </head>
+  <body>
+    <p><strong>시크릿 모드로 들어오셨습니다.</strong> 이 창에서 보는 페이지는 브라우저 기록이나 검색기록에 남지 않으며, 시크릿 창을 닫은 뒤 기기에 쿠기와 같은 흔적도 남기지 않습니다. 다운로드한 파일이나 생성한 북마크는 보관됩니다. </p>
+
+    <p><strong>시크릿 모드를 이용해도 다른 사용자, 서버, 소프트웨어에 영향을 주지는 않습니다. 다음을 주의하세요.</strong></p>
+
+    <ul>
+      <li>사용자에 대한 정보를 모으고 공유하는 웹사이트</li>
+      <li>방문 페이지를 추적하는 인터넷 서비스 제공업체나 직원 </li>
+      <li>스마일 이모티콘을 제공한다는 명목으로 입력 내용을 추적하는 악성 소프트웨어</li>
+      <li>비밀 개체를 통한 감시</li>
+      <li>뒤에서 사용자의 작업내용을 지켜보는 사람</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ko/incognito_mode_start_page.html b/core/res/res/raw-ko/incognito_mode_start_page.html
new file mode 100644
index 0000000..0e703b1
--- /dev/null
+++ b/core/res/res/raw-ko/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>새 시크릿 창</title>
+  </head>
+  <body>
+    <p><strong>시크릿 모드로 들어오셨습니다.</strong> 이 창에서 보는 페이지는 브라우저 기록이나 검색기록에 남지 않으며, 시크릿 창을 닫은 뒤 기기에 쿠기와 같은 흔적도 남기지 않습니다. 다운로드한 파일이나 생성한 북마크는 보관됩니다. </p>
+
+    <p><strong>시크릿 모드를 이용해도 다른 사용자, 서버, 소프트웨어에 영향을 주지는 않습니다. 다음을 주의하세요.</strong></p>
+
+    <ul>
+      <li>사용자에 대한 정보를 모으고 공유하는 웹사이트</li>
+      <li>방문 페이지를 추적하는 인터넷 서비스 제공업체나 직원 </li>
+      <li>스마일 이모티콘을 제공한다는 명목으로 입력 내용을 추적하는 악성 소프트웨어</li>
+      <li>비밀 개체를 통한 감시</li>
+      <li>뒤에서 사용자의 작업내용을 지켜보는 사람</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-lt-xlarge/incognito_mode_start_page.html b/core/res/res/raw-lt-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..9244ae4
--- /dev/null
+++ b/core/res/res/raw-lt-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Naujas inkognito langas</title>
+  </head>
+  <body>
+    <p><strong>Naršote inkognito režimu</strong>. Šiame lange peržiūrimi puslapiai nebus išsaugomi naršyklės istorijoje ar paieškos istorijoje ir uždarius inkognito langą nepaliks jokių kitų žymių, pvz., slapukų. Tačiau bus išsaugoti atsisiųsti failai ar sukurtos žymos.</p>
+
+    <p><strong>Naršymas inkognito režimu nedaro jokios įtakos kitiems asmenims, serveriams ar programinei įrangai. Saugokitės:</strong></p>
+
+    <ul>
+      <li>svetainių, kurios renka ar platina informaciją apie jus</li>
+      <li>interneto paslaugos teikėjų ar darbdavių, kurie stebi, kuriuos puslapius peržiūrite</li>
+      <li>kenkėjiškos programinės įrangos, kuri siūlydama nemokamų šypsniukų fiksuoja klavišų paspaudimus</li>
+      <li>jus galinčių sekti slaptųjų agentų</li>
+      <li>už nugaros stovinčių asmenų</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-lt/incognito_mode_start_page.html b/core/res/res/raw-lt/incognito_mode_start_page.html
new file mode 100644
index 0000000..9244ae4
--- /dev/null
+++ b/core/res/res/raw-lt/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Naujas inkognito langas</title>
+  </head>
+  <body>
+    <p><strong>Naršote inkognito režimu</strong>. Šiame lange peržiūrimi puslapiai nebus išsaugomi naršyklės istorijoje ar paieškos istorijoje ir uždarius inkognito langą nepaliks jokių kitų žymių, pvz., slapukų. Tačiau bus išsaugoti atsisiųsti failai ar sukurtos žymos.</p>
+
+    <p><strong>Naršymas inkognito režimu nedaro jokios įtakos kitiems asmenims, serveriams ar programinei įrangai. Saugokitės:</strong></p>
+
+    <ul>
+      <li>svetainių, kurios renka ar platina informaciją apie jus</li>
+      <li>interneto paslaugos teikėjų ar darbdavių, kurie stebi, kuriuos puslapius peržiūrite</li>
+      <li>kenkėjiškos programinės įrangos, kuri siūlydama nemokamų šypsniukų fiksuoja klavišų paspaudimus</li>
+      <li>jus galinčių sekti slaptųjų agentų</li>
+      <li>už nugaros stovinčių asmenų</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-lv-xlarge/incognito_mode_start_page.html b/core/res/res/raw-lv-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..f325ef5
--- /dev/null
+++ b/core/res/res/raw-lv-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Jauns inkognito logs</title>
+  </head>
+  <body>
+    <p><strong>Jūs esat ieslēdzis inkognito režīmu</strong>. Šajā logā aplūkotās lapas neparādīsies jūsu pārlūkprogrammas vēsturē vai meklēšanas vēsturē, tās arī neatstās citas pēdas, piemēram, sīkfailus, jūsu ierīcē pēc inkognito režīma loga aizvēršanas. Tomēr visi jūsu lejupielādētie faili vai izveidotās grāmatzīmes tiks saglabātas.</p>
+
+    <p><strong>Inkognito režīma ieslēgšana neietekmēs citu personu, serveru vai programmatūras darbību. Uzmanieties no</strong></p>
+
+    <ul>
+      <li>vietnēm, kas apkopo vai koplieto informāciju par jums;</li>
+      <li>interneta pakalpojumu sniedzējiem vai darba devējiem, kas izseko jūsu apmeklētajām lapām;</li>
+      <li>maldprogrammatūras, kas izseko jūsu taustiņsitieniem apmaiņā par bezmaksas smaidiņiem;</li>
+      <li>slepeno aģentu veiktas izmeklēšanas;</li>
+      <li>personām, kas stāv aiz jums.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-lv/incognito_mode_start_page.html b/core/res/res/raw-lv/incognito_mode_start_page.html
new file mode 100644
index 0000000..f325ef5
--- /dev/null
+++ b/core/res/res/raw-lv/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Jauns inkognito logs</title>
+  </head>
+  <body>
+    <p><strong>Jūs esat ieslēdzis inkognito režīmu</strong>. Šajā logā aplūkotās lapas neparādīsies jūsu pārlūkprogrammas vēsturē vai meklēšanas vēsturē, tās arī neatstās citas pēdas, piemēram, sīkfailus, jūsu ierīcē pēc inkognito režīma loga aizvēršanas. Tomēr visi jūsu lejupielādētie faili vai izveidotās grāmatzīmes tiks saglabātas.</p>
+
+    <p><strong>Inkognito režīma ieslēgšana neietekmēs citu personu, serveru vai programmatūras darbību. Uzmanieties no</strong></p>
+
+    <ul>
+      <li>vietnēm, kas apkopo vai koplieto informāciju par jums;</li>
+      <li>interneta pakalpojumu sniedzējiem vai darba devējiem, kas izseko jūsu apmeklētajām lapām;</li>
+      <li>maldprogrammatūras, kas izseko jūsu taustiņsitieniem apmaiņā par bezmaksas smaidiņiem;</li>
+      <li>slepeno aģentu veiktas izmeklēšanas;</li>
+      <li>personām, kas stāv aiz jums.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-nb-xlarge/incognito_mode_start_page.html b/core/res/res/raw-nb-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..724e734
--- /dev/null
+++ b/core/res/res/raw-nb-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nytt inkognitovindu</title>
+  </head>
+  <body>
+    <p><strong></strong>Du er nå inkognito Sider du besøker i dette vinduet blir ikke lagret i nettleser- eller søkelogg, og etterlater ikke andre spor, f. eks. informasjonskapsler, på enheten din etter at du har lukket vinduet. Filer du laster ned eller bokmerker du lager blir derimot lagret.</p>
+
+    <p><strong>Det at du er inkognito endrer ikke hvordan andre mennesker, tjenere eller programmer oppfører seg. Pass deg for:</strong></p>
+
+    <ul>
+      <li>Nettsider som samler eller deler informasjon om deg</li>
+      <li>Nettleverandører eller arbeidsgivere som overvåker hvilke sider du besøker</li>
+      <li>Skadelige programmer som følger med på tastetrykk i bytte mot smilefjes</li>
+      <li>Hemmelige agenter som spionerer på deg</li>
+      <li>Folk som titter over skulderen din</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-nb/incognito_mode_start_page.html b/core/res/res/raw-nb/incognito_mode_start_page.html
new file mode 100644
index 0000000..724e734
--- /dev/null
+++ b/core/res/res/raw-nb/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nytt inkognitovindu</title>
+  </head>
+  <body>
+    <p><strong></strong>Du er nå inkognito Sider du besøker i dette vinduet blir ikke lagret i nettleser- eller søkelogg, og etterlater ikke andre spor, f. eks. informasjonskapsler, på enheten din etter at du har lukket vinduet. Filer du laster ned eller bokmerker du lager blir derimot lagret.</p>
+
+    <p><strong>Det at du er inkognito endrer ikke hvordan andre mennesker, tjenere eller programmer oppfører seg. Pass deg for:</strong></p>
+
+    <ul>
+      <li>Nettsider som samler eller deler informasjon om deg</li>
+      <li>Nettleverandører eller arbeidsgivere som overvåker hvilke sider du besøker</li>
+      <li>Skadelige programmer som følger med på tastetrykk i bytte mot smilefjes</li>
+      <li>Hemmelige agenter som spionerer på deg</li>
+      <li>Folk som titter over skulderen din</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-nl-xlarge/incognito_mode_start_page.html b/core/res/res/raw-nl-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..92fedd7
--- /dev/null
+++ b/core/res/res/raw-nl-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nieuw incognitovenster</title>
+  </head>
+  <body>
+    <p><strong>U bent nu incognito</strong> De pagina's die u in dit venster bekijkt worden niet opgenomen in de browsergeschiedenis en de zoekgeschiedenis en laten geen cookies of andere sporen na op uw apparaat nadat u het incognitovenster hebt gesloten. Alle bestanden die u downloadt en bladwijzers die u maakt, blijven echter behouden.</p>
+
+    <p><strong>Incognito zijn heeft geen invloed op het gedrag van andere personen, servers of software. Wees op uw hoede voor:</strong></p>
+
+    <ul>
+      <li>Websites die informatie over u verzamelen of delen</li>
+      <li>Internetproviders of werkgevers die bijhouden welke pagina's u bezoekt</li>
+      <li>Schadelijke software die uw toetsaanslagen registreert in ruil voor gratis emoticons</li>
+      <li>Spionage door geheim agenten</li>
+      <li>Mensen die achter u staan</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-nl/incognito_mode_start_page.html b/core/res/res/raw-nl/incognito_mode_start_page.html
new file mode 100644
index 0000000..92fedd7
--- /dev/null
+++ b/core/res/res/raw-nl/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nieuw incognitovenster</title>
+  </head>
+  <body>
+    <p><strong>U bent nu incognito</strong> De pagina's die u in dit venster bekijkt worden niet opgenomen in de browsergeschiedenis en de zoekgeschiedenis en laten geen cookies of andere sporen na op uw apparaat nadat u het incognitovenster hebt gesloten. Alle bestanden die u downloadt en bladwijzers die u maakt, blijven echter behouden.</p>
+
+    <p><strong>Incognito zijn heeft geen invloed op het gedrag van andere personen, servers of software. Wees op uw hoede voor:</strong></p>
+
+    <ul>
+      <li>Websites die informatie over u verzamelen of delen</li>
+      <li>Internetproviders of werkgevers die bijhouden welke pagina's u bezoekt</li>
+      <li>Schadelijke software die uw toetsaanslagen registreert in ruil voor gratis emoticons</li>
+      <li>Spionage door geheim agenten</li>
+      <li>Mensen die achter u staan</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pl-xlarge/incognito_mode_start_page.html b/core/res/res/raw-pl-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..9748ead
--- /dev/null
+++ b/core/res/res/raw-pl-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nowe okno incognito</title>
+  </head>
+  <body>
+    <p><strong>Jesteś teraz incognito</strong> Strony przeglądane w tym oknie nie będą wyświetlane w historii przeglądarki ani w historii wyszukiwania. Po zamknięciu okna incognito na komputerze nie zostanie po nich żaden ślad np. w postaci plików cookie. Zachowane zostaną jednak pobrane pliki lub utworzone zakładki.</p>
+
+    <p><strong>Przejście do trybu incognito nie ma wpływu na działania innych osób, serwery ani oprogramowanie. Należy uważać na:</strong></p>
+
+    <ul>
+      <li>witryny zbierające lub udostępniające dane na temat użytkowników</li>
+      <li>dostawców usług internetowych oraz pracowników monitorujących strony odwiedzane przez użytkowników</li>
+      <li>złośliwe oprogramowanie śledzące naciśnięcia klawiszy (np. w zamian za darmowe emotikony)</li>
+      <li>aktywność wywiadowczą tajnych agentów</li>
+      <li>osoby stojące za plecami</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pl/incognito_mode_start_page.html b/core/res/res/raw-pl/incognito_mode_start_page.html
new file mode 100644
index 0000000..9748ead
--- /dev/null
+++ b/core/res/res/raw-pl/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nowe okno incognito</title>
+  </head>
+  <body>
+    <p><strong>Jesteś teraz incognito</strong> Strony przeglądane w tym oknie nie będą wyświetlane w historii przeglądarki ani w historii wyszukiwania. Po zamknięciu okna incognito na komputerze nie zostanie po nich żaden ślad np. w postaci plików cookie. Zachowane zostaną jednak pobrane pliki lub utworzone zakładki.</p>
+
+    <p><strong>Przejście do trybu incognito nie ma wpływu na działania innych osób, serwery ani oprogramowanie. Należy uważać na:</strong></p>
+
+    <ul>
+      <li>witryny zbierające lub udostępniające dane na temat użytkowników</li>
+      <li>dostawców usług internetowych oraz pracowników monitorujących strony odwiedzane przez użytkowników</li>
+      <li>złośliwe oprogramowanie śledzące naciśnięcia klawiszy (np. w zamian za darmowe emotikony)</li>
+      <li>aktywność wywiadowczą tajnych agentów</li>
+      <li>osoby stojące za plecami</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pt-rPT-xlarge/incognito_mode_start_page.html b/core/res/res/raw-pt-rPT-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..89a5ab0
--- /dev/null
+++ b/core/res/res/raw-pt-rPT-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova janela de navegação anónima</title>
+  </head>
+  <body>
+    <p><strong>Está no modo de navegação anónima</strong>. As páginas que visualizar nesta janela não vão aparecer nos históricos de pesquisa ou de navegação e não deixarão quaisquer vestígios (por exemplo cookies) no computador depois de fechar a janela. No entanto se transferir ficheiros ou criar marcadores, estes serão preservados.</p>
+
+    <p><strong>Navegar no modo de navegação anónima não afecta o comportamento de outras pessoas, nem o comportamento de servidores ou programas. Tenha cuidado com:</strong></p>
+
+    <ul>
+      <li>Web sites que recolhem ou partilham informações sobre si</li>
+      <li>Serviços de fornecimento de internet ou empregadores que monitorizam as páginas que você visita</li>
+      <li>Programas maliciosos que monitorizam as teclas em que carrega em troca de ícones expressivos ("smileys")</li>
+      <li>Vigilância de agentes secretos</li>
+      <li>Pessoas que estejam perto de si</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pt-rPT/incognito_mode_start_page.html b/core/res/res/raw-pt-rPT/incognito_mode_start_page.html
new file mode 100644
index 0000000..89a5ab0
--- /dev/null
+++ b/core/res/res/raw-pt-rPT/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova janela de navegação anónima</title>
+  </head>
+  <body>
+    <p><strong>Está no modo de navegação anónima</strong>. As páginas que visualizar nesta janela não vão aparecer nos históricos de pesquisa ou de navegação e não deixarão quaisquer vestígios (por exemplo cookies) no computador depois de fechar a janela. No entanto se transferir ficheiros ou criar marcadores, estes serão preservados.</p>
+
+    <p><strong>Navegar no modo de navegação anónima não afecta o comportamento de outras pessoas, nem o comportamento de servidores ou programas. Tenha cuidado com:</strong></p>
+
+    <ul>
+      <li>Web sites que recolhem ou partilham informações sobre si</li>
+      <li>Serviços de fornecimento de internet ou empregadores que monitorizam as páginas que você visita</li>
+      <li>Programas maliciosos que monitorizam as teclas em que carrega em troca de ícones expressivos ("smileys")</li>
+      <li>Vigilância de agentes secretos</li>
+      <li>Pessoas que estejam perto de si</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pt-xlarge/incognito_mode_start_page.html b/core/res/res/raw-pt-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..b301eda
--- /dev/null
+++ b/core/res/res/raw-pt-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova janela anônima</title>
+  </head>
+  <body>
+    <p><strong>Você ficou anônimo</strong>. As páginas que você vê nesta janela não aparecerão no histórico do seu navegador ou da sua pesquisa e não deixarão rastros, como cookies, no seu dispositivo depois que você fechar a janela anônima. Quaisquer arquivos que você fizer o download ou favoritos que criar serão preservados.</p>
+
+    <p><strong>Tornar-se anônimo não afeta o comportamento de outras pessoas, servidores ou software. Esteja atento a:</strong></p>
+
+    <ul>
+      <li>Websites que coletam ou compartilham informações sobre você</li>
+      <li>Provedores de serviços de internet ou funcionários que rastreiam as páginas que você visita</li>
+      <li>Softwares maliciosos que rastreiam os seus toques de teclado em troca de ícones gratuitos</li>
+      <li>Vigilância por agentes secretos</li>
+      <li>Pessoas paradas detrás de você</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-pt/incognito_mode_start_page.html b/core/res/res/raw-pt/incognito_mode_start_page.html
new file mode 100644
index 0000000..b301eda
--- /dev/null
+++ b/core/res/res/raw-pt/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nova janela anônima</title>
+  </head>
+  <body>
+    <p><strong>Você ficou anônimo</strong>. As páginas que você vê nesta janela não aparecerão no histórico do seu navegador ou da sua pesquisa e não deixarão rastros, como cookies, no seu dispositivo depois que você fechar a janela anônima. Quaisquer arquivos que você fizer o download ou favoritos que criar serão preservados.</p>
+
+    <p><strong>Tornar-se anônimo não afeta o comportamento de outras pessoas, servidores ou software. Esteja atento a:</strong></p>
+
+    <ul>
+      <li>Websites que coletam ou compartilham informações sobre você</li>
+      <li>Provedores de serviços de internet ou funcionários que rastreiam as páginas que você visita</li>
+      <li>Softwares maliciosos que rastreiam os seus toques de teclado em troca de ícones gratuitos</li>
+      <li>Vigilância por agentes secretos</li>
+      <li>Pessoas paradas detrás de você</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ro-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ro-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..3e499d3
--- /dev/null
+++ b/core/res/res/raw-ro-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Fereastră incognito nouă</title>
+  </head>
+  <body>
+    <p><strong>Navigaţi incognito</strong>. Paginile pe care le afişaţi în această fereastră nu vor apărea în istoricul browserului sau al căutărilor şi nu vor lăsa alte urme, precum cookie-uri, pe dispozitivul dvs. după ce închideţi fereastra incognito. Dar fişierele descărcate şi marcajele create vor fi păstrate.</p>
+
+    <p><strong>Navigarea incognito nu influenţează comportamentul altor persoane, servere sau aplicaţii software. Fiţi atent(ă) la:</strong></p>
+
+    <ul>
+      <li>site-urile web care colectează sau distribuie informaţii despre dvs.;</li>
+      <li>furnizorii de servicii de internet sau angajatorii care urmăresc paginile pe care le accesaţi;</li>
+      <li>aplicaţiile software rău intenţionate care vă urmăresc apăsările pe taste promiţându-vă că vă oferă emoticonuri gratuite;</li>
+      <li>acţiunile de monitorizare efectuate de agenţi secreţi;</li>
+      <li>persoanele din spatele dvs.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ro/incognito_mode_start_page.html b/core/res/res/raw-ro/incognito_mode_start_page.html
new file mode 100644
index 0000000..3e499d3
--- /dev/null
+++ b/core/res/res/raw-ro/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Fereastră incognito nouă</title>
+  </head>
+  <body>
+    <p><strong>Navigaţi incognito</strong>. Paginile pe care le afişaţi în această fereastră nu vor apărea în istoricul browserului sau al căutărilor şi nu vor lăsa alte urme, precum cookie-uri, pe dispozitivul dvs. după ce închideţi fereastra incognito. Dar fişierele descărcate şi marcajele create vor fi păstrate.</p>
+
+    <p><strong>Navigarea incognito nu influenţează comportamentul altor persoane, servere sau aplicaţii software. Fiţi atent(ă) la:</strong></p>
+
+    <ul>
+      <li>site-urile web care colectează sau distribuie informaţii despre dvs.;</li>
+      <li>furnizorii de servicii de internet sau angajatorii care urmăresc paginile pe care le accesaţi;</li>
+      <li>aplicaţiile software rău intenţionate care vă urmăresc apăsările pe taste promiţându-vă că vă oferă emoticonuri gratuite;</li>
+      <li>acţiunile de monitorizare efectuate de agenţi secreţi;</li>
+      <li>persoanele din spatele dvs.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ru-xlarge/incognito_mode_start_page.html b/core/res/res/raw-ru-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..ae7b59c
--- /dev/null
+++ b/core/res/res/raw-ru-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Новое окно в режиме инкогнито</title>
+  </head>
+  <body>
+    <p><strong>Вы перешли в режим инкогнито</strong>. Страницы, которые вы просматриваете в окне в режиме инкогнито, не появятся в истории вашего браузера или истории поиска, а также не оставят на вашем компьютере других следов, таких как файлы cookie, когда вы закроете это окно. Тем не менее, все файлы, которые вы загружаете, или закладки, которые вы создаете, останутся в целости и сохранности. </p>
+
+    <p><strong>Переход в режим инкогнито не влияет на поведение других пользователей, серверов или программ. Опасайтесь:</strong></p>
+
+    <ul>
+      <li>Веб-сайтов, которые собирают информацию о вас или передают ее другим</li>
+      <li>Поставщиков услуг Интернета или их сотрудников, которые отслеживают, какие страницы вы посещаете</li>
+      <li>Вредоносного ПО, которое отслеживает нажатие клавиш клавиатуры в обмен на бесплатные смайлики</li>
+      <li>Слежки тайными агентами</li>
+      <li>Людей, которые стоят у вас за спиной</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-ru/incognito_mode_start_page.html b/core/res/res/raw-ru/incognito_mode_start_page.html
new file mode 100644
index 0000000..ae7b59c
--- /dev/null
+++ b/core/res/res/raw-ru/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Новое окно в режиме инкогнито</title>
+  </head>
+  <body>
+    <p><strong>Вы перешли в режим инкогнито</strong>. Страницы, которые вы просматриваете в окне в режиме инкогнито, не появятся в истории вашего браузера или истории поиска, а также не оставят на вашем компьютере других следов, таких как файлы cookie, когда вы закроете это окно. Тем не менее, все файлы, которые вы загружаете, или закладки, которые вы создаете, останутся в целости и сохранности. </p>
+
+    <p><strong>Переход в режим инкогнито не влияет на поведение других пользователей, серверов или программ. Опасайтесь:</strong></p>
+
+    <ul>
+      <li>Веб-сайтов, которые собирают информацию о вас или передают ее другим</li>
+      <li>Поставщиков услуг Интернета или их сотрудников, которые отслеживают, какие страницы вы посещаете</li>
+      <li>Вредоносного ПО, которое отслеживает нажатие клавиш клавиатуры в обмен на бесплатные смайлики</li>
+      <li>Слежки тайными агентами</li>
+      <li>Людей, которые стоят у вас за спиной</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sk-xlarge/incognito_mode_start_page.html b/core/res/res/raw-sk-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..5b138f1
--- /dev/null
+++ b/core/res/res/raw-sk-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nové okno inkognito</title>
+  </head>
+  <body>
+    <p><strong>Ste v režime inkognito</strong> Stránky, ktoré si pozriete v tomto okne, sa nezobrazia v histórii prehliadača ani v histórii vyhľadávania. Po zavretí okna inkognito na zariadení nezostanú ani žiadne iné stopy, ako sú napr. súbory cookie. Napriek tomu však zostanú zachované všetky prevzaté súbory aj záložky, ktoré ste vytvorili.</p>
+
+    <p><strong>Režim inkognito neovplyvňuje správanie iných ľudí, serverov ani softvéru. Dávajte si pozor na:</strong></p>
+
+    <ul>
+      <li>webové stránky, ktoré zbierajú alebo zdieľajú vaše informácie;</li>
+      <li>poskytovateľov internetových služieb alebo zamestnancov, ktorí sledujú vaše navštívené stránky;</li>
+      <li>škodlivý softvér, ktorý sleduje ktoré klávesy stláčate výmenou za smajlíkov zadarmo;</li>
+      <li>sledovanie tajnými agentmi;</li>
+      <li>ľudí, ktorí stoja za vami.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sk/incognito_mode_start_page.html b/core/res/res/raw-sk/incognito_mode_start_page.html
new file mode 100644
index 0000000..5b138f1
--- /dev/null
+++ b/core/res/res/raw-sk/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nové okno inkognito</title>
+  </head>
+  <body>
+    <p><strong>Ste v režime inkognito</strong> Stránky, ktoré si pozriete v tomto okne, sa nezobrazia v histórii prehliadača ani v histórii vyhľadávania. Po zavretí okna inkognito na zariadení nezostanú ani žiadne iné stopy, ako sú napr. súbory cookie. Napriek tomu však zostanú zachované všetky prevzaté súbory aj záložky, ktoré ste vytvorili.</p>
+
+    <p><strong>Režim inkognito neovplyvňuje správanie iných ľudí, serverov ani softvéru. Dávajte si pozor na:</strong></p>
+
+    <ul>
+      <li>webové stránky, ktoré zbierajú alebo zdieľajú vaše informácie;</li>
+      <li>poskytovateľov internetových služieb alebo zamestnancov, ktorí sledujú vaše navštívené stránky;</li>
+      <li>škodlivý softvér, ktorý sleduje ktoré klávesy stláčate výmenou za smajlíkov zadarmo;</li>
+      <li>sledovanie tajnými agentmi;</li>
+      <li>ľudí, ktorí stoja za vami.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sl-xlarge/incognito_mode_start_page.html b/core/res/res/raw-sl-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..33a8b08
--- /dev/null
+++ b/core/res/res/raw-sl-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Novo okno brez beleženja zgodovine</title>
+  </head>
+  <body>
+    <p><strong>Ste v načinu brez beleženja zgodovine.</strong> Strani, ki si jih ogledate v tem oknu, ne bodo prikazane v zgodovini brskalnika ali zgodovini iskanja, prav tako v vaši napravi ne bodo pustile sledi, kot npr. piškotkov, ko zaprete stran, ki jo imate odprto v tem načinu. Datoteke, ki jih prenesete ali zaznamki, ki jih ustvarite, bodo ohranjeni.</p>
+
+    <p><strong>Funkcije brez beleženja zgodovine ne vplivajo na obnašanje drugih oseb, strežnikov ali programske opreme. Pazite na:</strong></p>
+
+    <ul>
+      <li>Spletna mesta, ki zbirajo informacije o vas ali jih dajejo v skupno rabo.</li>
+      <li>Ponudnike internetnih storitev ali zaposlene, ki spremljajo spletna mesta, ki ste jih obiskali.</li>
+      <li>Zlonamerno programsko opremo, ki spremlja vaše tipkanje, v zameno pa vam ponuja brezplačne čustvene simbole.</li>
+      <li>Nadzor tajnih agentov.</li>
+      <li>Osebe, ki stojijo za vašim hrbtom.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sl/incognito_mode_start_page.html b/core/res/res/raw-sl/incognito_mode_start_page.html
new file mode 100644
index 0000000..33a8b08
--- /dev/null
+++ b/core/res/res/raw-sl/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Novo okno brez beleženja zgodovine</title>
+  </head>
+  <body>
+    <p><strong>Ste v načinu brez beleženja zgodovine.</strong> Strani, ki si jih ogledate v tem oknu, ne bodo prikazane v zgodovini brskalnika ali zgodovini iskanja, prav tako v vaši napravi ne bodo pustile sledi, kot npr. piškotkov, ko zaprete stran, ki jo imate odprto v tem načinu. Datoteke, ki jih prenesete ali zaznamki, ki jih ustvarite, bodo ohranjeni.</p>
+
+    <p><strong>Funkcije brez beleženja zgodovine ne vplivajo na obnašanje drugih oseb, strežnikov ali programske opreme. Pazite na:</strong></p>
+
+    <ul>
+      <li>Spletna mesta, ki zbirajo informacije o vas ali jih dajejo v skupno rabo.</li>
+      <li>Ponudnike internetnih storitev ali zaposlene, ki spremljajo spletna mesta, ki ste jih obiskali.</li>
+      <li>Zlonamerno programsko opremo, ki spremlja vaše tipkanje, v zameno pa vam ponuja brezplačne čustvene simbole.</li>
+      <li>Nadzor tajnih agentov.</li>
+      <li>Osebe, ki stojijo za vašim hrbtom.</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sr-xlarge/incognito_mode_start_page.html b/core/res/res/raw-sr-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..b1fbcb1
--- /dev/null
+++ b/core/res/res/raw-sr-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нов прозор без архивирања</title>
+  </head>
+  <body>
+    <p><strong>Ушли сте у режим без архивирања</strong> Странице које гледате у овом прозору се неће појавити у историји прегледања ни историји претраге, нити ће оставити друге трагове, попут колачића, на вашем уређају када затворите овај прозор. Међутим, ако преузмете датотеке или направите обележиваче, они ће бити сачувани.</p>
+
+    <p><strong>Режим без архивирања не утиче на понашање других људи, сервера нити софтвера. Чувајте се:</strong></p>
+
+    <ul>
+      <li>Веб сајтова који прикупљају и деле податке о вама</li>
+      <li>Добављача интернет услуга или запослених који прате странице које посетите</li>
+      <li>Злонамерног софтвера који прати шта куцате</li>
+      <li>Надзора тајних агената</li>
+      <li>Људи који вам стоје иза леђа</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sr/incognito_mode_start_page.html b/core/res/res/raw-sr/incognito_mode_start_page.html
new file mode 100644
index 0000000..b1fbcb1
--- /dev/null
+++ b/core/res/res/raw-sr/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нов прозор без архивирања</title>
+  </head>
+  <body>
+    <p><strong>Ушли сте у режим без архивирања</strong> Странице које гледате у овом прозору се неће појавити у историји прегледања ни историји претраге, нити ће оставити друге трагове, попут колачића, на вашем уређају када затворите овај прозор. Међутим, ако преузмете датотеке или направите обележиваче, они ће бити сачувани.</p>
+
+    <p><strong>Режим без архивирања не утиче на понашање других људи, сервера нити софтвера. Чувајте се:</strong></p>
+
+    <ul>
+      <li>Веб сајтова који прикупљају и деле податке о вама</li>
+      <li>Добављача интернет услуга или запослених који прате странице које посетите</li>
+      <li>Злонамерног софтвера који прати шта куцате</li>
+      <li>Надзора тајних агената</li>
+      <li>Људи који вам стоје иза леђа</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sv-xlarge/incognito_mode_start_page.html b/core/res/res/raw-sv-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..5ebbb22
--- /dev/null
+++ b/core/res/res/raw-sv-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nytt inkognitofönster</title>
+  </head>
+  <body>
+    <p><strong>Du använder inkognitoläget</strong>. Sidor som du har läst i detta fönster visas inte i din webbläsarhistorik eller sökhistorik. De lämnar inga spår efter sig, till exempel cookies, i din enhet efter att du stängt inkognitofönstret. Alla filer som du hämtar eller bokmärken du skapar sparas dock.</p>
+
+    <p><strong>Att använda datorn inkognito påverkar inte användare, servrar eller program. Se upp för:</strong></p>
+
+    <ul>
+      <li>Webbplatser som samlar eller delar information om dig</li>
+      <li>Internetleverantörer eller arbetsgivare som spårar var du surfar</li>
+      <li>Skadlig programvara som spårar dina tangenttryckningar som nyckelloggare</li>
+      <li>Övervakning av hemliga agenter</li>
+      <li>Personer som står bakom dig</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-sv/incognito_mode_start_page.html b/core/res/res/raw-sv/incognito_mode_start_page.html
new file mode 100644
index 0000000..5ebbb22
--- /dev/null
+++ b/core/res/res/raw-sv/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Nytt inkognitofönster</title>
+  </head>
+  <body>
+    <p><strong>Du använder inkognitoläget</strong>. Sidor som du har läst i detta fönster visas inte i din webbläsarhistorik eller sökhistorik. De lämnar inga spår efter sig, till exempel cookies, i din enhet efter att du stängt inkognitofönstret. Alla filer som du hämtar eller bokmärken du skapar sparas dock.</p>
+
+    <p><strong>Att använda datorn inkognito påverkar inte användare, servrar eller program. Se upp för:</strong></p>
+
+    <ul>
+      <li>Webbplatser som samlar eller delar information om dig</li>
+      <li>Internetleverantörer eller arbetsgivare som spårar var du surfar</li>
+      <li>Skadlig programvara som spårar dina tangenttryckningar som nyckelloggare</li>
+      <li>Övervakning av hemliga agenter</li>
+      <li>Personer som står bakom dig</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-th-xlarge/incognito_mode_start_page.html b/core/res/res/raw-th-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..29c64eb
--- /dev/null
+++ b/core/res/res/raw-th-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>หน้าต่างใหม่ที่ไม่ระบุตัวตน</title>
+  </head>
+  <body>
+    <p><strong>คุณได้เข้าสู่โหมดไม่ระบุตัวตนแล้ว</strong> หน้าเว็บที่คุณดูในหน้าต่างนี้จะไม่ปรากฏในประวัติของเบราว์เซอร์หรือประวัติการค้นหาของคุณ และจะไม่ทิ้งร่องรอยอื่นๆ เช่น คุกกี้ ไว้บนอุปกรณ์หลังจากที่คุณปิดหน้าต่างที่ไม่ระบุตัวตนนี้แล้ว อย่างไรก็ตาม ไฟล์ที่คุณดาวน์โหลดหรือบุ๊กมาร์กที่สร้างขึ้นจะถูกเก็บไว้</p>
+
+    <p><strong>การเข้าสู่โหมดไม่ระบุตัวตนจะไม่กระทบต่อการทำงานของบุคคล เซิร์ฟเวอร์ หรือซอฟต์แวร์อื่น โปรดระวัง:</strong></p>
+
+    <ul>
+      <li>เว็บไซต์ที่เก็บหรือแบ่งปันข้อมูลเกี่ยวกับคุณ</li>
+      <li>ผู้ให้บริการอินเทอร์เน็ตหรือนายจ้างที่ติดตามหน้าเว็บที่คุณเข้าชม</li>
+      <li>ซอฟต์แวร์มุ่งร้ายที่ติดตามการกดแป้นพิมพ์โดยมากับของฟรี</li>
+      <li>การตรวจสอบของหน่วยสืบราชการลับ</li>
+      <li>บุคคลที่ยืนอยู่ข้างหลังคุณ</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-th/incognito_mode_start_page.html b/core/res/res/raw-th/incognito_mode_start_page.html
new file mode 100644
index 0000000..29c64eb
--- /dev/null
+++ b/core/res/res/raw-th/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>หน้าต่างใหม่ที่ไม่ระบุตัวตน</title>
+  </head>
+  <body>
+    <p><strong>คุณได้เข้าสู่โหมดไม่ระบุตัวตนแล้ว</strong> หน้าเว็บที่คุณดูในหน้าต่างนี้จะไม่ปรากฏในประวัติของเบราว์เซอร์หรือประวัติการค้นหาของคุณ และจะไม่ทิ้งร่องรอยอื่นๆ เช่น คุกกี้ ไว้บนอุปกรณ์หลังจากที่คุณปิดหน้าต่างที่ไม่ระบุตัวตนนี้แล้ว อย่างไรก็ตาม ไฟล์ที่คุณดาวน์โหลดหรือบุ๊กมาร์กที่สร้างขึ้นจะถูกเก็บไว้</p>
+
+    <p><strong>การเข้าสู่โหมดไม่ระบุตัวตนจะไม่กระทบต่อการทำงานของบุคคล เซิร์ฟเวอร์ หรือซอฟต์แวร์อื่น โปรดระวัง:</strong></p>
+
+    <ul>
+      <li>เว็บไซต์ที่เก็บหรือแบ่งปันข้อมูลเกี่ยวกับคุณ</li>
+      <li>ผู้ให้บริการอินเทอร์เน็ตหรือนายจ้างที่ติดตามหน้าเว็บที่คุณเข้าชม</li>
+      <li>ซอฟต์แวร์มุ่งร้ายที่ติดตามการกดแป้นพิมพ์โดยมากับของฟรี</li>
+      <li>การตรวจสอบของหน่วยสืบราชการลับ</li>
+      <li>บุคคลที่ยืนอยู่ข้างหลังคุณ</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-tl-xlarge/incognito_mode_start_page.html b/core/res/res/raw-tl-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..6ce5853
--- /dev/null
+++ b/core/res/res/raw-tl-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Bagong incognito window</title>
+  </head>
+  <body>
+    <p><strong>Nag-incognito ka</strong>. Hindi lalabas sa iyong kasaysayan ng pag-browse at kasaysayan ng paghahanap ang mga pahinang tiningnan mo sa window na ito, at hindi sila mag-iiwan ng ibang bakas, gaya ng cookies, sa iyong device matapos mong isara ang window na incognito. Gayunpaman, pananatiliin ang anumang mga file na iyong na-download o ang iyong mga ginawang bookmark.</p>
+
+    <p><strong>Hindi nakakaapekto ang pagiging incognito sa gawi ng ibang mga tao, server, o software. Maging maingat sa:</strong></p>
+
+    <ul>
+      <li>Mga website na kumokolekta o nagbabahagi ng impormasyong tungkol sa iyo</li>
+      <li>Mga internet service provider o mga employer na  sinusubaybayan ang mga pahinang binibisita mo</li>
+      <li>Malicious software na sinusubaybayan ang iyong mga keystroke kapalit ng mga libreng smiley</li>
+      <li>Pagmamasid ng mga secret agent</li>
+      <li>Mga tao na nakatayo sa likuran mo</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-tl/incognito_mode_start_page.html b/core/res/res/raw-tl/incognito_mode_start_page.html
new file mode 100644
index 0000000..6ce5853
--- /dev/null
+++ b/core/res/res/raw-tl/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Bagong incognito window</title>
+  </head>
+  <body>
+    <p><strong>Nag-incognito ka</strong>. Hindi lalabas sa iyong kasaysayan ng pag-browse at kasaysayan ng paghahanap ang mga pahinang tiningnan mo sa window na ito, at hindi sila mag-iiwan ng ibang bakas, gaya ng cookies, sa iyong device matapos mong isara ang window na incognito. Gayunpaman, pananatiliin ang anumang mga file na iyong na-download o ang iyong mga ginawang bookmark.</p>
+
+    <p><strong>Hindi nakakaapekto ang pagiging incognito sa gawi ng ibang mga tao, server, o software. Maging maingat sa:</strong></p>
+
+    <ul>
+      <li>Mga website na kumokolekta o nagbabahagi ng impormasyong tungkol sa iyo</li>
+      <li>Mga internet service provider o mga employer na  sinusubaybayan ang mga pahinang binibisita mo</li>
+      <li>Malicious software na sinusubaybayan ang iyong mga keystroke kapalit ng mga libreng smiley</li>
+      <li>Pagmamasid ng mga secret agent</li>
+      <li>Mga tao na nakatayo sa likuran mo</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-tr-xlarge/incognito_mode_start_page.html b/core/res/res/raw-tr-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..c570cc7
--- /dev/null
+++ b/core/res/res/raw-tr-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Yeni gizli pencere</title>
+  </head>
+  <body>
+    <p><strong>Gizli moda geçtiniz</strong> Bu pencerede görüntülediğiniz sayfalar tarayıcı geçmişinizde veya arama geçmişinizde görünmez ve gizli pencereyi kapatmanızın ardından cihazınızda çerezler gibi izler bırakmaz. Ancak, indirdiğiniz dosyalar ve oluşturduğunuz favoriler korunur.</p>
+
+    <p><strong>Gizli moda geçmeniz diğer kişilerin, sunucuların veya yazılımların davranışlarını etkilemez. Şu konularda dikkatli olun:</strong></p>
+
+    <ul>
+      <li>Hakkınızda bilgi toplayan veya paylaşan web siteleri</li>
+      <li>Ziyaret ettiğiniz sayfaları izleyen şirket çalışanları veya servis sağlayıcıları</li>
+      <li>Ücretsiz ifade simgeleri karşılığında tuş vuruşlarınızı takip eden kötü niyetli yazılımlar</li>
+      <li>Gizli ajanlar tarafından takip edilme</li>
+      <li>Arkanızda dikilip ne yaptığınıza bakan kişiler</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-tr/incognito_mode_start_page.html b/core/res/res/raw-tr/incognito_mode_start_page.html
new file mode 100644
index 0000000..c570cc7
--- /dev/null
+++ b/core/res/res/raw-tr/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Yeni gizli pencere</title>
+  </head>
+  <body>
+    <p><strong>Gizli moda geçtiniz</strong> Bu pencerede görüntülediğiniz sayfalar tarayıcı geçmişinizde veya arama geçmişinizde görünmez ve gizli pencereyi kapatmanızın ardından cihazınızda çerezler gibi izler bırakmaz. Ancak, indirdiğiniz dosyalar ve oluşturduğunuz favoriler korunur.</p>
+
+    <p><strong>Gizli moda geçmeniz diğer kişilerin, sunucuların veya yazılımların davranışlarını etkilemez. Şu konularda dikkatli olun:</strong></p>
+
+    <ul>
+      <li>Hakkınızda bilgi toplayan veya paylaşan web siteleri</li>
+      <li>Ziyaret ettiğiniz sayfaları izleyen şirket çalışanları veya servis sağlayıcıları</li>
+      <li>Ücretsiz ifade simgeleri karşılığında tuş vuruşlarınızı takip eden kötü niyetli yazılımlar</li>
+      <li>Gizli ajanlar tarafından takip edilme</li>
+      <li>Arkanızda dikilip ne yaptığınıza bakan kişiler</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-uk-xlarge/incognito_mode_start_page.html b/core/res/res/raw-uk-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..8852854
--- /dev/null
+++ b/core/res/res/raw-uk-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нове анонімне вікно</title>
+  </head>
+  <body>
+    <p><strong>Ви в анонімному режимі</strong>. Сторінки, які ви переглядаєте в цьому вікні, не з’являться в історії веб-переглядача чи в історії пошуку. Вони також не залишать жодних слідів, як-от файлів cookie, у вашому пристрої після того, як ви закриєте анонімне вікно. Однак, завантажені файли та збережені закладки залишаться.</p>
+
+    <p><strong>Анонімний режим не впливає на поведінку інших людей, серверів чи програмного забезпечення. Остерігайтеся:</strong></p>
+
+    <ul>
+      <li>веб-сайтів, які збирають чи поширюють інформацію про вас</li>
+      <li>постачальників інтернет-послуг або роботодавців, які відстежують сторінки, які ви відвідуєте</li>
+      <li>зловмисного програмного забезпечення, яке пропонує безкоштовні смайли, натомість реєструючи клавіші, які ви натискаєте</li>
+      <li>нагляду збоку секретних служб</li>
+      <li>людей за вашою спиною</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-uk/incognito_mode_start_page.html b/core/res/res/raw-uk/incognito_mode_start_page.html
new file mode 100644
index 0000000..8852854
--- /dev/null
+++ b/core/res/res/raw-uk/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Нове анонімне вікно</title>
+  </head>
+  <body>
+    <p><strong>Ви в анонімному режимі</strong>. Сторінки, які ви переглядаєте в цьому вікні, не з’являться в історії веб-переглядача чи в історії пошуку. Вони також не залишать жодних слідів, як-от файлів cookie, у вашому пристрої після того, як ви закриєте анонімне вікно. Однак, завантажені файли та збережені закладки залишаться.</p>
+
+    <p><strong>Анонімний режим не впливає на поведінку інших людей, серверів чи програмного забезпечення. Остерігайтеся:</strong></p>
+
+    <ul>
+      <li>веб-сайтів, які збирають чи поширюють інформацію про вас</li>
+      <li>постачальників інтернет-послуг або роботодавців, які відстежують сторінки, які ви відвідуєте</li>
+      <li>зловмисного програмного забезпечення, яке пропонує безкоштовні смайли, натомість реєструючи клавіші, які ви натискаєте</li>
+      <li>нагляду збоку секретних служб</li>
+      <li>людей за вашою спиною</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-vi-xlarge/incognito_mode_start_page.html b/core/res/res/raw-vi-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..9902cde
--- /dev/null
+++ b/core/res/res/raw-vi-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Cửa sổ ẩn danh mới</title>
+  </head>
+  <body>
+    <p><strong>Bạn đã sử dụng cửa sổ ẩn danh</strong>. Các trang bạn xem trong cửa sổ này sẽ không xuất hiện trong lịch sử của trình duyệt hoặc lịch sử tìm kiếm và chúng cũng không để lại dấu vết như cookie trên thiết bị sau khi bạn đóng cửa sổ ẩn danh. Tuy nhiên, mọi tệp bạn tải xuống hoặc mọi dấu trang bạn tạo sẽ được giữ nguyên.</p>
+
+    <p><strong>Sử dụng cửa sổ ẩn danh không ảnh hưởng đến hành vi của người khác, của máy chủ hoặc phần mềm. Hãy cảnh giác với:</strong></p>
+
+    <ul>
+      <li>Các trang web thu thập hoặc chia sẻ thông tin về bạn</li>
+      <li>Nhà cung cấp dịch vụ Internet hoặc ông chủ muốn theo dõi những trang bạn đã truy cập</li>
+      <li>Phần mềm độc hại theo dõi thao tác gõ phím khi nhập các mặt cười</li>
+      <li>Sự theo dõi của các cơ quan tình báo</li>
+      <li>Những người đứng đằng sau bạn</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-vi/incognito_mode_start_page.html b/core/res/res/raw-vi/incognito_mode_start_page.html
new file mode 100644
index 0000000..9902cde
--- /dev/null
+++ b/core/res/res/raw-vi/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>Cửa sổ ẩn danh mới</title>
+  </head>
+  <body>
+    <p><strong>Bạn đã sử dụng cửa sổ ẩn danh</strong>. Các trang bạn xem trong cửa sổ này sẽ không xuất hiện trong lịch sử của trình duyệt hoặc lịch sử tìm kiếm và chúng cũng không để lại dấu vết như cookie trên thiết bị sau khi bạn đóng cửa sổ ẩn danh. Tuy nhiên, mọi tệp bạn tải xuống hoặc mọi dấu trang bạn tạo sẽ được giữ nguyên.</p>
+
+    <p><strong>Sử dụng cửa sổ ẩn danh không ảnh hưởng đến hành vi của người khác, của máy chủ hoặc phần mềm. Hãy cảnh giác với:</strong></p>
+
+    <ul>
+      <li>Các trang web thu thập hoặc chia sẻ thông tin về bạn</li>
+      <li>Nhà cung cấp dịch vụ Internet hoặc ông chủ muốn theo dõi những trang bạn đã truy cập</li>
+      <li>Phần mềm độc hại theo dõi thao tác gõ phím khi nhập các mặt cười</li>
+      <li>Sự theo dõi của các cơ quan tình báo</li>
+      <li>Những người đứng đằng sau bạn</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-zh-rCN-xlarge/incognito_mode_start_page.html b/core/res/res/raw-zh-rCN-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..2caf8f8b
--- /dev/null
+++ b/core/res/res/raw-zh-rCN-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新建隐身窗口</title>
+  </head>
+  <body>
+    <p><strong>您已进入隐身模式</strong>。当关闭隐身窗口后,您在此窗口中查看的网页将不会出现在您的浏览器历史记录或搜索记录中,也不会在您的设备留下任何踪迹(如 cookie)。但是,您下载的任何文件或您创建的书签会予以保留。</p>
+
+    <p><strong>进入隐身模式不会影响他人、其他服务器或软件的行为。敬请提防:</strong></p>
+
+    <ul>
+      <li>搜集并分享有关您的信息的网站</li>
+      <li>跟踪您所访问的网页的互联网服务提供商或雇主</li>
+      <li>跟踪您的键盘输入内容以换取免费表情符号的恶意软件</li>
+      <li>对您进行监视的秘密代理</li>
+      <li>站在您身后的人</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-zh-rCN/incognito_mode_start_page.html b/core/res/res/raw-zh-rCN/incognito_mode_start_page.html
new file mode 100644
index 0000000..2caf8f8b
--- /dev/null
+++ b/core/res/res/raw-zh-rCN/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新建隐身窗口</title>
+  </head>
+  <body>
+    <p><strong>您已进入隐身模式</strong>。当关闭隐身窗口后,您在此窗口中查看的网页将不会出现在您的浏览器历史记录或搜索记录中,也不会在您的设备留下任何踪迹(如 cookie)。但是,您下载的任何文件或您创建的书签会予以保留。</p>
+
+    <p><strong>进入隐身模式不会影响他人、其他服务器或软件的行为。敬请提防:</strong></p>
+
+    <ul>
+      <li>搜集并分享有关您的信息的网站</li>
+      <li>跟踪您所访问的网页的互联网服务提供商或雇主</li>
+      <li>跟踪您的键盘输入内容以换取免费表情符号的恶意软件</li>
+      <li>对您进行监视的秘密代理</li>
+      <li>站在您身后的人</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-zh-rTW-xlarge/incognito_mode_start_page.html b/core/res/res/raw-zh-rTW-xlarge/incognito_mode_start_page.html
new file mode 100644
index 0000000..54eb40b
--- /dev/null
+++ b/core/res/res/raw-zh-rTW-xlarge/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新的無痕式視窗</title>
+  </head>
+  <body>
+    <p><strong>您已開啟無痕式視窗</strong>。透過這個視窗開啟的網頁都不會出現在瀏覽器記錄和搜尋記錄中,而且您關閉此類視窗之後,裝置上並不會保留任何相關記錄 (例如 cookie)。不過系統會保存您的下載檔案和書籤。</p>
+
+    <p><strong>無痕式視窗無法掌控人、伺服器和軟體的行為,所以請小心下列的人事物:</strong></p>
+
+    <ul>
+      <li>會收集或分享您的相關資訊的網站</li>
+      <li>會追蹤您造訪網頁的網路服務供應商或雇主</li>
+      <li>以免費下載為誘因引誘您點擊的連結,其中通常隱藏鍵盤記錄惡意軟體</li>
+      <li>情報特務的監控</li>
+      <li>站在您身後的人</li>
+    </ul>
+  </body>
+</html>
diff --git a/core/res/res/raw-zh-rTW/incognito_mode_start_page.html b/core/res/res/raw-zh-rTW/incognito_mode_start_page.html
new file mode 100644
index 0000000..54eb40b
--- /dev/null
+++ b/core/res/res/raw-zh-rTW/incognito_mode_start_page.html
@@ -0,0 +1,19 @@
+<html DIR="LTR">
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <title>新的無痕式視窗</title>
+  </head>
+  <body>
+    <p><strong>您已開啟無痕式視窗</strong>。透過這個視窗開啟的網頁都不會出現在瀏覽器記錄和搜尋記錄中,而且您關閉此類視窗之後,裝置上並不會保留任何相關記錄 (例如 cookie)。不過系統會保存您的下載檔案和書籤。</p>
+
+    <p><strong>無痕式視窗無法掌控人、伺服器和軟體的行為,所以請小心下列的人事物:</strong></p>
+
+    <ul>
+      <li>會收集或分享您的相關資訊的網站</li>
+      <li>會追蹤您造訪網頁的網路服務供應商或雇主</li>
+      <li>以免費下載為誘因引誘您點擊的連結,其中通常隱藏鍵盤記錄惡意軟體</li>
+      <li>情報特務的監控</li>
+      <li>站在您身後的人</li>
+    </ul>
+  </body>
+</html>
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index c258949..fa588cb 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -310,7 +310,7 @@
             <span class="en">Search</span>
           </a></div>
           <ul>
-            <li><a href="<?cs var:toroot?>guide/topics/search/search-dialog.html">Using the Android Search Dialog</a></li>
+            <li><a href="<?cs var:toroot?>guide/topics/search/search-dialog.html">Creating a Search Interface</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/searchable-config.html">Searchable Configuration</a></li>
diff --git a/docs/html/guide/practices/optimizing-for-3.0.jd b/docs/html/guide/practices/optimizing-for-3.0.jd
index a22e69a..5cd519b 100644
--- a/docs/html/guide/practices/optimizing-for-3.0.jd
+++ b/docs/html/guide/practices/optimizing-for-3.0.jd
@@ -5,20 +5,32 @@
 <div id="qv">
 <h2>In this document</h2>
 <ol>
-<li><a href="#Setup">Set Up Your SDK with Android 3.0</a></li>
-<li><a href="#SearchableConfiguration">Optimize Your App for Tablets and Similar Devices</a></li>
-<li><a href="#SearchableActivity">Upgrade or Develop a New App for Tablets and Similar
-Devices</a></li>
+<li><a href="#Setup">Setting Up Your SDK with Android 3.0</a></li>
+<li><a href="#Optimizing">Optimizing Your App for Tablets</a></li>
+<li><a href="#Upgrading">Upgrading or Developing a New App for Tablets</a></li>
+<li><a href="#ManagingAppDist">Managing App Distribution Based on Screen Configuration</a>
+  <ol>
+    <li><a href="#FilteringTabletApps">Filtering a tablet app from mobile devices</a></li>
+    <li><a href="#FilteringMobileApps">Filtering a mobile device app from tablets</a></li>
+  </ol>
+</li>
+<li><a href="#Issues">Other Issues</a>
+  <ol>
+    <li><a href="#Landscape">Adding support for landscape screens</a></li>
+    <li><a href="#Telephony">Using telephony or other variable features</a></li>
+  </ol>
+</li>
 </ol>
 
 </div>
 </div>
 
-<p>If you're developing an Android application, Android 3.0 introduces several features that allow
+<p>Android 3.0 introduces several features that allow
 you to enhance your user's experience on tablets and similar devices. Any application you've already
 published is compatible with devices running Android 3.0, by default, because Android applications
-are forward-compatible. However, there are some simple changes you should make to optimize your
-application for tablet-type devices.</p>
+are forward-compatible. However, new tablet devices running Android 3.0 are now available to the
+public and provide users a new Android experience on a larger screen, so you should make sure
+your application looks and works great on the new platform and new device form-factors.</p>
 
 <p>This document shows how you can optimize your existing application for Android 3.0 and
 maintain compatibility with older versions or upgrade your application completely with new APIs.</p>
@@ -27,18 +39,28 @@
 <p><b>To get started:</b></p>
 
 <ol>
-  <li><a href="#Setup">Set up your SDK with Android 3.0</a>.</li>
-  <li>Then choose to either optimize or upgrade:
+  <li><a href="#Setup">Set up your SDK with Android 3.0</a>.
+    <p>Install the Android 3.0 platform, new tools, and set up a new AVD.</p></li>
+  <li>Choose to either optimize or upgrade:
     <ol type="a">
-      <li><a href="#Optimize">Optimize Your App for Tablets and Similar Devices</a>.
-        <p>When you have an existing application and want to maintain compatibility with
-older versions of Android.</p>
+      <li><a href="#Optimizing">Optimize your app for tablets and similar devices</a>.
+        <p>Read this section if you have an existing application and want to
+maintain compatibility with older versions of Android. All you need to do is update your
+manifest file to declare support for Android 3.0, test your application on the new platform, and
+add extra resources to support extra large screens, as appropriate.</p>
       </li>
-      <li><a href="#Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</a>.
-        <p>When you want to upgrade your application to use APIs introduced in Android 3.0 or
-    create a new application targeted to tablets and similar devices.</p></li>
+      <li><a href="#Upgrading">Upgrade or develop a new app for tablets and similar devices</a>.
+        <p>Read this section if you want to upgrade your application to use APIs introduced in
+Android 3.0 or create a new application targeted to tablets and similar devices. Compared to
+upgrading to previous versions of Android, there's nothing different about upgrading to Android 3.0.
+This section introduces some of the key features and APIs you should use to make an
+application that's fully enhanced for tablets.</p></li>
     </ol>
   </li>
+  <li>Consider whether you need to <a href="#ManagingAppDist">manage the distribution of your
+application based on screen configuration</a>.</li>
+  <li>Then review some <a href="#Issue">other issues</a> you might encounter when developing
+for tablets and similar devices.</li>
 </ol>
 
 
@@ -66,14 +88,16 @@
   <p>Set the target to "Android 3.0" and the skin to "WXGA" (the default skin).</p></li>
 </ol>
 
+<p>The best way to test your application on Android 3.0 is to use real hardware running Android 3.0,
+such as the <a href="http://www.motorola.com/staticfiles/Consumers/XOOM/index.html">Motorola
+Xoom</a>. Of course, you can also use the Android emulator on your development machine, but because
+the Android emulator must simulate the ARM instruction set on your computer and the WXGA screen is
+significantly larger than a typical virtual device, emulator performance is much slower than a real
+device.</p>
 
 <h3>About emulator performance</h3>
 
-<p>Because the Android emulator must simulate the ARM instruction set on your computer
-and the WXGA screen is significantly larger than a typical virtual device, emulator performance is
-much slower than a real device.</p>
-
-<p>In particular, initializing the emulator can be slow and can take several minutes, depending on
+<p>Initializing the emulator can be slow and can take several minutes, depending on
 your hardware. When the emulator is booting, there is limited user feedback, so please be patient
 and wait until you see the home screen (or lock screen) appear. </p>
 
@@ -82,9 +106,10 @@
 Also see the tip below for information about using a snapshot to drastically reduce startup time
 after the first initialization. </p>
 
-<p>We're working hard to resolve the performance issues and it will improve in future tools
-releases. For the time being, the emulator is still best way to evaluate your application's
-appearance and functionality on Android 3.0 without a real device.</p>
+<p>General performance in the emulator is also slow. We're working hard to resolve the performance
+issues and it will improve in future tools releases. If you don't yet have a real device running
+Android 3.0, the emulator is still best way to evaluate your application's appearance and
+functionality on Android 3.0.</p>
 
 <p class="note"><strong>Tip:</strong> To improve the startup time for the emulator, enable snapshots
 for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in the AVD creator
@@ -97,7 +122,7 @@
 
 
 
-<h2 id="Optimize">Optimize Your Application for Tablets and Similar Devices</h2>
+<h2 id="Optimizing">Optimizing Your App for Tablets</h2>
 
 <p>If you've already developed an application for an earlier version of Android, there are a few
 things you can do to optimize it for a tablet-style experience on Android 3.0 without changing the
@@ -142,21 +167,24 @@
 </pre>
     <p>By targeting the Android 3.0 platform, the system automatically applies the holographic theme
 to each activity when your application runs on an Android 3.0 device. The holographic theme
-provides a new design for widgets, such as buttons and text boxes, and restyles other
-visual elements. This is the standard theme in applications built for Android 3.0, so your
-application will look more at home by enabling the theme.</p>
-    <p>Additionally, the holographic theme enables the <a
-href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> in your activities when running on an
-Android 3.0 device. The Action Bar replaces the traditional title bar at the top of the activity
-window and provides the user access to the activity's Options Menu.</p>
+provides a new design for widgets, such as buttons and text boxes, and new styles for other
+visual elements. This is the standard theme for applications built for Android 3.0, so your
+application will look and feel consistent with the system and other applications when it is
+enabled.</p>
+    <p>Additionally, when an activity uses the holographic theme, the system enables the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> for the activity. The Action Bar
+replaces the traditional title bar at the top of the activity window and provides the user access to
+the activity's Options Menu.</p>
       </li>
-      <li>Continue to build your application against the minimum version specified by <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>,
-but install it on the Android 3.0 AVD. Repeat your tests to be sure that your user interface works
-well with the holographic theme.
+      <li>Build your application against the same version of the Android platform you have been
+using previously (such as the version declared in your <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>),
+but install it on the Android 3.0 AVD. (You should not build against Android 3.0 unless you are
+using new APIs.) Repeat your tests to be sure that your user interface works well with the
+holographic theme.
         <p class="note"><strong>Note:</strong> If you have applied other themes directly to your
 activities, they will override the inherited holographic theme. To resolve this, you can use
-the <a href="{@docRoot}guide/topics/resources/providing-resources.html#VersionQualifier">system
+the <a href="{@docRoot}guide/topics/resources/providing-resources.html#VersionQualifier">platform
 version qualifier</a> to provide an alternative theme for Android 3.0 devices that's based on the
 holographic theme. For more information, read how to <a
 href="{@docRoot}guide/topics/ui/themes.html#SelectATheme">select a theme based on platform
@@ -177,15 +205,24 @@
 (wide), so you should be sure that your activities offer a layout that's optimized for a wide
 viewing area. <p>You can specify landscape resources with the <code>land</code> resource
 qualifier, but if you want alternative resources for an extra large landscape screen, you
-should use both <code>xlarge</code> and <code>land</code> qualifiers. For example, {@code
+should use both the <code>xlarge</code> and <code>land</code> qualifiers. For example, {@code
 res/layout-xlarge-land/}. The order of the qualifier names is important; see <a
 href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">
 Providing Alternative Resources</a> for more information.</p></li>
-      <li>Button position: Consider whether the position of the most common buttons in your UI are
-easily accessible while holding a tablet with two hands.</li>
+      <li>Button position and size: Consider whether the position and size of the most common
+buttons in your UI make them easily accessible while holding a tablet with two hands. In some
+cases, you might need to resize buttons, especially if they use {@code "wrap_content"}
+as the width value. To enlarge the buttons, if necessary, you should either: add
+extra padding to the button; specify dimension values with {@code dp} units; or use {@code
+android:layout_weight} when the button is in a <a
+href="{@docRoot}guide/topics/ui/layout-objects.html#linearlayout">linear layout</a>. Use your
+best judgment of proportions for each screen size&mdash;you don't want the buttons to be too big,
+either.</li>
       <li>Font sizes: Be sure your application uses {@code sp} units when setting font
-sizes. This alone should ensure a readable experience on tablet-style devices. In some cases,
-however, you might want to consider larger font sizes for <code>xlarge</code> configurations.</li>
+sizes. This alone should ensure a readable experience on tablet-style devices, because it is a
+scale-independent pixel unit, which will resize as appropriate for the current screen configuration.
+In some cases, however, you still might want to consider larger font sizes for <code>xlarge</code>
+configurations.</li>
     </ul>
     <p>In general, always be sure that your application follows the <a
 href="{@docRoot}guide/practices/screens_support.html#screen-independence">Best Practices
@@ -197,7 +234,29 @@
 
 
 
-<h2 id="Upgrade">Upgrade or Develop a New App for Tablets and Similar Devices</h2>
+
+<h2 id="Upgrading">Upgrading or Developing a New App for Tablets</h2>
+
+<div class="sidebox-wrapper">
+<div class="sidebox">
+  <h3>Use new APIs and remain backward-compatible</h3>
+<p>It is possible for you to upgrade your application with some new
+APIs <em>and</em> remain compatible with older versions of Android. Usually, this requires that you
+use techniques such as reflection to check for the availability of certain APIs at runtime. However,
+to help you add features from Android 3.0 without requiring you to change your <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
+or build target, we're providing a static library called the "Android Compatibility package"
+(downloadable from the AVD and SDK Manager).</p>
+<p>This library includes APIs for <a
+href="{@docRoot}guide/topics/fundamentals/fragments.html">fragments</a>, <a
+href="{@docRoot}guide/topics/fundamentals/loaders.html">loaders</a>, and some updated classes. By
+simply adding this library to your Android project, you can use these APIs in your application and
+remain compatible with Android 1.6. For more information, see the blog post, <a
+href="http://android-developers.blogspot.com/2011/03/fragments-for-all.html">Fragments for
+All</a>.</p>
+</div>
+</div>
+
 
 <p>If you want to develop an application that's fully enhanced for tablet-type devices running
 Android 3.0, then you need to use new APIs in Android 3.0. This section introduces some of
@@ -206,9 +265,11 @@
 
 <h3>Declare the minimum system version</h3>
 
-<p>The first thing to do when you create a project for Android 3.0 is set your manifest's <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
-to {@code "11"}. For example:</p>
+<p>The first thing to do when you upgrade or create a project for Android 3.0 is set your manifest's
+<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> to {@code "11"}. This declares that your application uses APIs available
+in Android 3.0 and greater, so it should not be available to devices running an older version of
+Android. For example:</p>
 
 <pre>
 &lt;manifest ... >
@@ -218,9 +279,11 @@
     &lt;application>
 &lt;/manifest>
 </pre>
-   
-<p>By targeting the Android 3.0 platform, the system automatically applies the new holographic theme
-to each of your activities.</p>
+
+<p>Not only is this necessary in order to declare the minimum API level your application requires,
+but it enables the new holographic theme to each of your activities. The holographic theme is the
+standard theme for the Android 3.0 system and all applications designed for it. It includes new
+designs for the system widgets and overall appearance.</p>
 
 <p>Additionally, the holographic theme enables the Action Bar for each activity.</p>
 
@@ -229,13 +292,14 @@
 
 <p>The Action Bar is a widget for activities that replaces the traditional title bar at the top of
 the screen. By default, the Action Bar includes the application logo on the left side, followed by
-the activity title, and any available items from the Options Menu on the right side.</p>
+the activity title, and access to items from the Options Menu in a drop-down list on the right
+side.</p>
 
-<p>You can enable items from your activity's Options Menu to appear directly in the Action Bar as
-"action items" by adding {@code showAsAction="ifRoom"} to specific items in your <a
+<p>You can enable items from the Options Menu to appear directly in the Action Bar as
+"action items" by adding {@code showAsAction="ifRoom"} to specific menu items in your <a
 href="{@docRoot}guide/topics/resources/menu-resource.html">menu resource</a>. You can also add
 navigation features to the Action Bar, such as tabs, and use the application icon to navigate to
-your application's "home" activity or "up" the activity hierarchy.</p>
+your application's "home" activity or to navigate "up" the application's activity hierarchy.</p>
 
 <p>For more information, read <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the
 Action Bar</a>.</p>
@@ -244,11 +308,12 @@
 
 <h3>Divide your activities into fragments</h3>
 
-<p>A fragment represents a behavior or a portion of user interface in an activity. You can combine
-multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple
-activities. You can think of a fragment as a modular section of an activity, which has its own
-lifecycle, receives its own input events, and which you can add or remove while the activity is
-running.</p>
+<p>A fragment represents a behavior or a portion of user interface in an activity. You can think of
+a fragment as a modular section of an activity, which has its own lifecycle, receives its own input
+events, and which you can add or remove while the activity is running. Fragments are an optional
+component for your activities that allow you to build a multi-pane UI and reuse them in multiple
+activities. If you're building an application for tablets, we recommend that you use fragments to
+create activities that offer a more dynamic and flexible user interface.</p>
 
 <p>For example, a news application can use one fragment to show a list of articles on the left and
 another fragment to display an article on the right&mdash;both fragments appear in one activity,
@@ -262,8 +327,8 @@
 
 <h3>Use new animation APIs for transitions</h3>
 
-<p>An all new flexible animation framework allows you to animate arbitrary properties of any object
-(View, Drawable, Fragment, Object, or anything else). You can define several animation aspects
+<p>An all-new animation framework allows you to animate arbitrary properties of any object
+(such as a View, Drawable, Fragment, or anything else). You can define several animation aspects
 (such as duration, repeat, interpolation, and more) for an object's int, float, and hexadecimal
 color values, by default. That is, when an object has a property field for one of these types, you
 can change its value over time to affect an animation.</p>
@@ -279,8 +344,9 @@
 
 <h3>Enable hardware acceleration</h3>
 
-<p>You can now enable the OpenGL renderer for your application by setting {@code
-android:hardwareAccelerated="true"} in your manifest's <a
+<p>Android 3.0 adds a hardware-accelerated OpenGL renderer that gives a performance boost to most 2D
+graphics operations. You can enable hardware-accelerated rendering in your application by setting
+{@code android:hardwareAccelerated="true"} in your manifest's <a
 href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
 element or for individual <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
 &lt;activity&gt;}</a> elements. Hardware acceleration results in smoother animations, smoother
@@ -314,48 +380,16 @@
 href="{@docRoot}sdk/android-3.0.html">Android 3.0 Platform</a> document.</p>
 
 
-<h3>Publish your app for extra large screens</h3>
-
-<p>You should also decide whether your application is <em>only</em> for
-tablet-type devices (specifically, <em>xlarge</em> devices) or for all types of screen sizes.</p>
-
-<p>If you want your application to be available to all screen sizes (for example, for all
-phones and tablets), there's nothing you need to do. By default, an application with <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
-android:minSdkVersion}</a> set to {@code "4"} or higher will resize to fit any screen size.</p>
-
-<p>If your application is <em>only</em> for <em>xlarge</em> screens, include the <a
-href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element in your manifest and declare that the application supports
-only <em>xlarge</em> screens, by declaring all other sizes {@code "false"}. For example:</p>
-
-<pre>
-&lt;manifest ... >
-    ...
-    &lt;supports-screens android:smallScreens="false"
-                      android:normalScreens="false"
-                      android:largeScreens="false"
-                      android:xlargeScreens="true" /&gt;
-    &lt;application ... >
-        ...
-    &lt;application>
-&lt;/manifest>
-</pre>
-
-<p>With this declaration, you indicate that your application does not support any screen size except
-extra large. External services such as Android Market may then use this information to filter your
-application from devices that do not have an extra large screen.</p>
-
-
 
 <h3>Look at some samples</h3>
 
-<p>Many of the new features and APIs that are described in the <a
-href="{@docRoot}sdk/android-3.0.html#api">Android 3.0 Platform Preview</a> also have accompanying
-samples that can help you understand how to use them. To get the samples, download them from the SDK
-repository using the Android SDK Manager. After downloading the samples ("Samples for SDK API 11"), 
-you can find them in <code>&lt;sdk_root&gt;/samples/android-11/</code>. The links below can help you
-find samples for the features you are interested in:</p>
+<p>Many of the new features and APIs that are described above and in the <a
+href="{@docRoot}sdk/android-3.0.html#api">Android 3.0 Platform</a> document also have accompanying
+samples that allow you to preview the effects and can help you understand how to use them. To get
+the samples, download them from the SDK repository <a href="{@docRoot}sdk/adding-components.html"
+>using the Android SDK and AVD Manager</a>. After downloading the samples ("Samples for SDK API
+11"), you can find them in <code>&lt;sdk_root&gt;/samples/android-11/</code>. The following list
+provides links to the browsable source code for some of the samples:</p>
 
 <ul>
   <li><a href="{@docRoot}resources/samples/HoneycombGallery/index.html">Honeycomb Gallery</a>:
@@ -395,3 +429,248 @@
 graphics.</li>
 </ul>
 
+
+
+<h2 id="ManagingAppDist">Managing App Distribution Based on Screen Configuration</h2>
+
+<p>If your manifest file has either <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
+or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> set to {@code "4"} or higher, then the Android system will scale your
+application's layout and assets to fit the current device screen, whether the device screen is
+smaller or larger than the one for which you originally designed your application. As such, you
+should always test your application on real or <a
+href="{@docRoot}guide/developing/devices/index.html">virtual devices</a> with various screen sizes
+and densities.</p>
+
+<p>Although we recommend that you design your application to function properly on multiple
+configurations of screen size and density, you can instead choose to limit the distribution of your
+application to certain types of screens, such as only tablets or only mobile devices. To do so, you
+can add elements to your Android manifest file that enable filtering based on screen configuration
+by external services such as Android Market.</p>
+
+<p>However, before you decide to restrict your application to certain screen configurations, you
+should understand the techniques for <a
+href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a> and employ
+them to the best of your ability. By supporting multiple screens, your application can be made
+available to the greatest number of users with different devices.</p>
+
+
+<h3 id="FilteringTabletApps">Filtering a tablet application from mobile devices</h3>
+
+<p>If the system scaling adversely affects your application UI when scaling your application down
+for smaller screens, you should add <a
+href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
+layouts</a> for smaller screens to adjust your layout. However, sometimes your layout still might
+not fit a smaller screen or you've explicitly designed your application only for tablets and other
+large devices. In this case, you can manage the availability of your application to smaller screens
+by using the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens>}</a> manifest element.</p>
+
+<p>For example, if you want your application to be available only to extra large
+screens, you can declare the element in your manifest like this:</p>
+
+<pre>
+&lt;manifest ... >
+    ...
+    &lt;supports-screens android:smallScreens="false"
+                      android:normalScreens="false"
+                      android:largeScreens="false"
+                      android:xlargeScreens="true" /&gt;
+    &lt;application ... >
+        ...
+    &lt;application>
+&lt;/manifest>
+</pre>
+
+<p>External services such as Android Market read this manifest element and use it to ensure that
+your application is available only to devices with an extra large screen.</p>
+
+<p class="note"><strong>Note:</strong> If you use the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens>}</a> element for the reverse scenario (when your application is not compatible
+with <em>larger</em> screens) and set the larger screen size attributes to {@code "false"}, then
+external services such as Android Market <strong>do not</strong> apply filtering. Your application
+will still be available to larger screens, but when it runs, it will not fill the screen&mdash;the
+system will draw it in a "postage stamp" window that's the same relative size as the screen size
+that your application does support. If you want to prevent your application from being downloaded on
+larger screens, see the following section.</p>
+
+
+<h3 id="FilteringMobileApps">Filtering a mobile device application from tablets</h3>
+
+<p>Because Android automatically scales applications to fit larger screens, you shouldn't
+need to filter your application from larger screens. However, you might discover that your
+application can't scale up or perhaps you've decided to publish two versions of your application
+that each deliver different features for different screen configurations, so you don't want
+larger devices to download the version designed for smaller screens. In such a case, you can
+use the <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens>}</a> element to manage the distribution of your application based on the
+combination of screen size and density. External services such as
+Android Market uses this information to apply filtering to your application, so that only devices
+that have a screen configuration with which you declare compatibility can download your
+application.</p>
+
+<p>The <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens>}</a> element must contain one or more {@code &lt;screen&gt;} elements,
+which each specify a screen configuration with which your application is compatible, using both
+the {@code android:screenSize} and {@code android:screenDensity} attributes. Each {@code
+&lt;screen&gt;} element <strong>must include both attributes</strong> to specify an individual
+screen configuration&mdash;if either attribute is missing, then the element is invalid
+(external services such as Android Market will ignore it).</p>
+
+<p>For example, if your application is compatible with only small and normal screens, regardless
+of screen density, then you must specify eight different {@code &lt;screen&gt;} elements,
+because each screen size has four density configurations. You must declare each one of
+these; any combination of size and density that you do <em>not</em> specify is considered a screen
+configuration with which your application is <em>not</em> compatible. Here's what the manifest
+entry looks like if your application is compatible with only small and normal screens:</p>
+
+<pre>
+&lt;manifest ... >
+    ...
+    &lt;compatible-screens>
+        &lt;!-- all small size screens -->
+        &lt;screen android:screenSize="small" android:screenDensity="ldpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="mdpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="hdpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="xhdpi" />
+        &lt;!-- all normal size screens -->
+        &lt;screen android:screenSize="normal" android:screenDensity="ldpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="mdpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
+    &lt;/compatible-screens>
+    &lt;application ... >
+        ...
+    &lt;application>
+&lt;/manifest>
+</pre>
+
+<p class="note"><strong>Note:</strong> Although you can also use the <a
+href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens>}</a> element for the reverse scenario (when your application is not
+compatible with smaller screens), it's easier if you instead use the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens>}</a> as discussed in the previous section, because it doesn't require you
+to specify each screen density your application supports.</p>
+
+<p>Remember, you should strive to make your application available to as many devices as possible by
+applying all necessary techniques for <a
+href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a>. You should
+then use the <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens>}</a> element to filter your application from certain devices only when you
+cannot offer compatibility on all screen configurations or you have decided to provide
+multiple versions of your application, each for a different set of screen configurations.</p>
+
+
+
+<h2 id="Issues">Other Issues</h2>
+
+<p>Whether you decide to optimize or upgrade your application for tablet-type devices, you
+should be aware that the functionality and availability of your application on new devices
+might be affected by the following issues:</p>
+
+<ul>
+  <li><a href="#Landscape">Tablets are often designed for use in the landscape orientation</a>
+  <p>Tablets and similar devices often have a screen that uses the landscape orientation
+by default. If your application assumes a portrait orientation or locks into portrait
+orientation, you should update your application to support landscape.</p></li>
+  <li><a href="#Telephony">Not all devices have telephony or other features</a>
+  <p>If your application declares the {@code "android.hardware.telephony"} feature in the manifest,
+then it will not be available to devices that do not offer telephony (such as tablets), based on
+Android Market filtering. If your application can function properly without telephony, you should
+update your application to gracefully disable the telephony features when not available on a
+device.</p></li>
+</ul>
+
+
+<h3 id="Landscape">Adding support for landscape screens</h3>
+
+<p>Although tablets can rotate to operate in any orientation, they are often designed for
+landscape orientation and that is how most users will use them. So, you should ensure that your
+application can function in landscape. Even if you want to avoid rotating the screen while your
+application is running, you should not assume that portrait is the device's default orientation. You
+should either ensure that your layout is usable in both portrait and landscape orientations or
+provide an <a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources" 
+>alternative layout resource</a> for landscape orientation.</p>
+
+<p>If you believe your application or game provides its best experience when the screen is tall,
+consider that tablets and similar devices have a screen that's as tall or taller in landscape
+orientation than a phone in portrait orientation. With that in mind, you might be able to add a
+landscape design that adds padding or extra landscape scenery on the left and right sides, so
+the primary screen space still remains taller than it is wide.</p>
+
+<p>Ideally, your application should handle all orientation changes instead of locking into one
+orientation. When the user rotates the screen, the system restarts the current activity by calling
+{@link android.app.Activity#onDestroy onDestroy()} and {@link android.app.Activity#onCreate
+onCreate()}) in immediate succession. You should design your activity to account for these changes
+in the lifecycle, so the activity can save and restore its state. You can learn about the
+necessary lifecycle callback methods and how to save and restore the activity state in the <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
+document. If your activity state is more complex and cannot retain it using the normal
+lifecycle callback methods, you can use alternative techniques described in <a
+href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a>.</p>
+
+<p>In the worst-case scenario, however, you can avoid orientation changes by using the <a
+href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
+android:screenOrientation}</a> attribute in the <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+element. Instead of locking the orientation in landscape or portrait, however, you should
+specify a value of {@code "nosensor"}. This way, your activity uses whatever orientation the
+device specifies as its natural orientation and the screen will not rotate. You should still
+avoid using the <a
+href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
+android:screenOrientation}</a> attribute, but because it's sometimes necessary to lock the
+screen into one orientation, it's best if you do so in a way that uses the device's natural
+orientation instead of assuming one specific orientation.</p>
+
+<p>If your application uses the orientation sensors, such as the accelerometer (with the {@link
+android.hardware.SensorManager} APIs), also be aware that the landscape screen can also cause
+problems, due to false assumptions about which orientation is the natural position. For more
+information about how you should properly handle rotation changes when using the orientation
+sensors, read the blog post, <a
+href="http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html">One
+Screen Turn Deserves Another</a>.</p>
+
+
+
+<h3 id="Telephony">Using telephony or other variable features</h3>
+
+<p>Tablets and similar devices might not include support for telephony, so they can't make
+traditional phone calls or handle SMS. Some devices might also omit
+other hardware features, such as Bluetooth. If your application uses these features, then your
+manifest file probably already includes (or should include) a declaration of the feature with the <a
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+element. Doing so prevents devices that do not declare support for the feature from downloading
+your applications. For example:</p>
+
+<pre>&lt;uses-feature android:name="android.hardware.telephony" /></pre>
+
+<p>By default, this declares that your application <em>requires</em> telephony features. So,
+external services such as Android Market use this information to filter your application from
+devices that do not offer telephony.</p>
+
+<p>If, however, your application uses, but does not require the feature, you should
+add to this element, {@code android:required="false"}. For example:</p>
+
+<pre>&lt;uses-feature android:name="android.hardware.telephony" android:required="false" /></pre>
+
+<p>This indicates that your application uses the feature, but is still functional if the feature is
+not available. So, it should still be available to devices that don't provide telephony hardware
+(or telephony features), such as tablets.</p>
+
+<p>Then in your application code, you must gracefully disable the features that use telephony
+when it's not available. You can check whether the feature is available using {@link
+android.content.pm.PackageManager#hasSystemFeature PackageManager.hasSystemFeature()}. For
+example:</p>
+
+<pre>
+PackageManager pm = getPackageManager();
+boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+</pre>
+
+<p>For more information about these
+issues and how to future-proof your application for different hardware, read the blog post <a
+href="http://android-developers.blogspot.com/2010/10/five-steps-to-future-hardware-happiness.html">
+The Five Steps to Future Hardware Happiness</a>.</p>
\ No newline at end of file
diff --git a/docs/html/guide/topics/manifest/compatible-screens-element.jd b/docs/html/guide/topics/manifest/compatible-screens-element.jd
index 8669874..5c89869 100644
--- a/docs/html/guide/topics/manifest/compatible-screens-element.jd
+++ b/docs/html/guide/topics/manifest/compatible-screens-element.jd
@@ -101,6 +101,38 @@
     </dd>
   </dl>
 </dd>
+
+<dt>example</dt>
+<dd>
+<p>If your application is compatible with only small and normal screens, regardless
+of screen density, then you must specify eight different {@code &lt;screen&gt;} elements,
+because each screen size has four different density configurations. You must declare each one of
+these; any combination of size and density that you do <em>not</em> specify is considered a screen
+configuration with which your application is <em>not</em> compatible. Here's what the manifest
+entry looks like if your application is compatible with only small and normal screens:</p>
+
+<pre>
+&lt;manifest ... >
+    ...
+    &lt;compatible-screens>
+        &lt;!-- all small size screens -->
+        &lt;screen android:screenSize="small" android:screenDensity="ldpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="mdpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="hdpi" />
+        &lt;screen android:screenSize="small" android:screenDensity="xhdpi" />
+        &lt;!-- all normal size screens -->
+        &lt;screen android:screenSize="normal" android:screenDensity="ldpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="mdpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="hdpi" />
+        &lt;screen android:screenSize="normal" android:screenDensity="xhdpi" />
+    &lt;/compatible-screens>
+    &lt;application ... >
+        ...
+    &lt;application>
+&lt;/manifest>
+</pre>
+</dd>
+
 <dt>introduced in:</dt>
 <dd>API Level 9</dd>
 <dt>see also:</dt>
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index 60030f0..1583dee 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -596,7 +596,7 @@
     </tr>
 -->
     <tr id="VersionQualifier">
-      <td>System Version (API Level)</td>
+      <td>Platform Version (API Level)</td>
       <td>Examples:<br/>
         <code>v3</code><br/>
         <code>v4</code><br/>
@@ -609,7 +609,7 @@
 href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a> document for more information
 about these values.</p>
         <p class="caution"><strong>Caution:</strong> Android 1.5 and 1.6 only match resources
-with this qualifier when it exactly matches the system version. See the section below about <a
+with this qualifier when it exactly matches the platform version. See the section below about <a
 href="#KnownIssues">Known Issues</a> for more information.</p>
       </td>
     </tr>
@@ -975,7 +975,7 @@
 
 <p>The correct behavior is for the system to match resources marked with a <a
 href="#VersionQualifier">version qualifier</a> equal
-to or less than the system version on the device, but on Android 1.5 and 1.6, (API Level 3 and 4),
+to or less than the platform version on the device, but on Android 1.5 and 1.6, (API Level 3 and 4),
 there is a bug that causes the system to match resources marked with the version qualifier
 only when it exactly matches the version on the device.</p>
 
diff --git a/docs/html/guide/topics/search/adding-custom-suggestions.jd b/docs/html/guide/topics/search/adding-custom-suggestions.jd
index c8f06b9..02ee084 100644
--- a/docs/html/guide/topics/search/adding-custom-suggestions.jd
+++ b/docs/html/guide/topics/search/adding-custom-suggestions.jd
@@ -17,8 +17,8 @@
 </li>
 <li><a href="#IntentForSuggestions">Declaring an Intent for Suggestions</a>
   <ol>
-    <li><a href="#IntentAction">Declaring the Intent action</a></li>
-    <li><a href="#IntentData">Declaring the Intent data</a></li>
+    <li><a href="#IntentAction">Declaring the intent action</a></li>
+    <li><a href="#IntentData">Declaring the intent data</a></li>
   </ol>
 </li>
 <li><a href="#HandlingIntent">Handling the Intent</a></li>
@@ -47,8 +47,8 @@
 </div>
 </div>
 
-<p>When using the Android search dialog, you can provide custom search suggestions that are
-created from data in your application. For example, if your application is a word
+<p>When using the Android search dialog or search widget, you can provide custom search suggestions
+that are created from data in your application. For example, if your application is a word
 dictionary, you can suggest words from the
 dictionary that match the text entered so far. These are the most valuable suggestions, because you
 can effectively predict what the user wants and provide instant access to it. Figure 1 shows
@@ -58,9 +58,8 @@
 Search Box, providing access to your content from outside your application.</p>
 
 <p>Before you begin with this guide to add custom suggestions, you need to have implemented the
-Android search dialog for searches in your
-application. If you haven't, see <a href="search-dialog.html">Using the Android Search
-Dialog</a>.</p>
+Android search dialog or a search widget for searches in your
+application. If you haven't, see <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 <h2 id="TheBasics">The Basics</h2>
@@ -71,11 +70,11 @@
 search suggestions.</p>
 </div>
 
-<p>When the user selects a custom suggestion, the Search Manager sends an {@link
+<p>When the user selects a custom suggestion, the Android system sends an {@link
 android.content.Intent} to
-your searchable Activity. Whereas a normal search query sends an Intent with the {@link
+your searchable activity. Whereas a normal search query sends an intent with the {@link
 android.content.Intent#ACTION_SEARCH} action, you can instead define your custom suggestions to use
-{@link android.content.Intent#ACTION_VIEW} (or any other Intent action), and also include data
+{@link android.content.Intent#ACTION_VIEW} (or any other intent action), and also include data
 that's relevant to the selected suggestion. Continuing
 the dictionary example, when the user selects a suggestion, your application can immediately
 open the definition for that word, instead of searching the dictionary for matches.</p>
@@ -83,8 +82,8 @@
 <p>To provide custom suggestions, do the following:</p>
 
 <ul>
-  <li>Implement a basic searchable Activity, as described in <a
-href="search-dialog.html">Using the Android Search Dialog</a>.</li>
+  <li>Implement a basic searchable activity, as described in <a
+href="search-dialog.html">Creating a Search Interface</a>.</li>
   <li>Modify the searchable configuration with information about the content provider that
 provides custom suggestions.</li>
   <li>Build a table (such as in an {@link android.database.sqlite.SQLiteDatabase}) for your
@@ -96,22 +95,21 @@
 suggestion (including a custom action and custom data). </li>
 </ul>
 
-<p>Just like the Search Manager displays the search dialog, it also displays your search
-suggestions. All you need is a content provider from which the Search Manager can retrieve your
+<p>Just as the Android system displays the search dialog, it also displays your search
+suggestions. All you need is a content provider from which the system can retrieve your
 suggestions. If you're not familiar with creating content
 providers, read the <a href="{@docRoot}guide/topics/providers/content-providers.html">Content
 Providers</a> developer guide before you continue.</p>
 
-<p>When the Search Manager identifies that your Activity is searchable and provides search
-suggestions, the following procedure takes place as soon as the user enters text into the
-search dialog:</p>
+<p>When the system identifies that your activity is searchable and provides search
+suggestions, the following procedure takes place when the user types a query:</p>
 
 <ol>
-  <li>Search Manager takes the search query text (whatever has been typed so far) and performs a
+  <li>The system takes the search query text (whatever has been typed so far) and performs a
 query to your content provider that manages your suggestions.</li>
   <li>Your content provider returns a {@link android.database.Cursor} that points to all
 suggestions that are relevant to the search query text.</li>
-  <li>Search Manager displays the list of suggestions provided by the Cursor.</li>
+  <li>The system displays the list of suggestions provided by the Cursor.</li>
 </ol>
 
 <p>Once the custom suggestions are displayed, the following might happen:</p>
@@ -120,9 +118,9 @@
   <li>If the user types another key, or changes the query in any way, the above steps are repeated
 and the suggestion list is updated as appropriate. </li>
   <li>If the user executes the search, the suggestions are ignored and the search is delivered
-to your searchable Activity using the normal {@link android.content.Intent#ACTION_SEARCH}
-Intent.</li>
-  <li>If the user selects a suggestion, an Intent is sent to your searchable Activity, carrying a
+to your searchable activity using the normal {@link android.content.Intent#ACTION_SEARCH}
+intent.</li>
+  <li>If the user selects a suggestion, an intent is sent to your searchable activity, carrying a
 custom action and custom data so that your application can open the suggested content.</li>
 </ul>
 
@@ -142,7 +140,7 @@
 &lt;/searchable&gt;
 </pre>
 
-<p>You might need some additional attributes, depending on the type of Intent you attach
+<p>You might need some additional attributes, depending on the type of intent you attach
 to each suggestion and how you want to format queries to your content provider. The other optional
 attributes are discussed in the following sections.</p>
 
@@ -155,11 +153,11 @@
 href="{@docRoot}guide/topics/providers/content-providers.html">Content Provider</a> developer
 guide. For the most part, a content provider for custom suggestions is the
 same as any other content provider. However, for each suggestion you provide, the respective row in
-the {@link android.database.Cursor} must include specific columns that the Search Manager
+the {@link android.database.Cursor} must include specific columns that the system
 understands and uses to format the suggestions.</p>
 
-<p>When the user starts typing into the search dialog, the Search Manager queries your content
-provider for suggestions by calling {@link
+<p>When the user starts typing into the search dialog or search widget, the system queries
+your content provider for suggestions by calling {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} each time
 a letter is typed. In your implementation of {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()}, your
@@ -170,22 +168,22 @@
 two sections:</p>
 <dl>
   <dt><a href="#HandlingSuggestionQuery">Handling the suggestion query</a></dt>
-  <dd>How the Search Manager sends requests to your content provider and how to handle them</dd>
+  <dd>How the system sends requests to your content provider and how to handle them</dd>
   <dt><a href="#SuggestionTable">Building a suggestion table</a></dt>
-  <dd>How to define the columns that the Search Manager expects in the {@link
+  <dd>How to define the columns that the system expects in the {@link
 android.database.Cursor} returned with each query</dd>
 </dl>
 
 
 <h3 id="HandlingSuggestionQuery">Handling the suggestion query</h3>
 
-<p>When the Search Manager requests suggestions from your content provider, it calls your content
+<p>When the system requests suggestions from your content provider, it calls your content
 provider's {@link android.content.ContentProvider#query(Uri,String[],String,String[],String)
 query()} method. You must
 implement this method to search your suggestion data and return a
 {@link android.database.Cursor} pointing to the suggestions you deem relevant.</p>
 
-<p>Here's a summary of the parameters that the Search Manager passes to your {@link
+<p>Here's a summary of the parameters that the system passes to your {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} method
 (listed in order):</p>
 
@@ -196,7 +194,7 @@
 content://<em>your.authority</em>/<em>optional.suggest.path</em>/<em>{@link
 android.app.SearchManager#SUGGEST_URI_PATH_QUERY}</em>
 </pre>
-<p>The default behavior is for Search Manager to pass this URI and append it with the query text.
+<p>The default behavior is for system to pass this URI and append it with the query text.
 For example:</p>
 <pre class="no-pretty-print">
 content://<em>your.authority</em>/<em>optional.suggest.path</em>/<em>{@link
@@ -233,7 +231,7 @@
   <dd>Always null</dd>
 </dl>
 
-<p>The Search Manager can send you the search query text in two ways. The
+<p>The system can send you the search query text in two ways. The
 default manner is for the query text to be included as the last path of the content
 URI passed in the {@code uri} parameter. However, if you include a selection value in your
 searchable configuration's {@code
@@ -251,8 +249,8 @@
 String query = uri.getLastPathSegment().toLowerCase();
 </pre>
 
-<p>This returns the last segment of the {@link android.net.Uri}, which is the query text entered in
-the search dialog.</p>
+<p>This returns the last segment of the {@link android.net.Uri}, which is the query text entered
+by the user.</p>
 
 
 
@@ -264,7 +262,7 @@
 {@code selection} and {@code selectionArgs} parameters to carry the appropriate values. In such a
 case, add the {@code android:searchSuggestSelection} attribute to your searchable configuration with
 your SQLite selection string. In the selection string, include a question mark ("?") as
-a placeholder for the actual search query. The Search Manager calls {@link
+a placeholder for the actual search query. The system calls {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} with the
 selection string as the {@code selection} parameter and the search query as the first
 element in the {@code selectionArgs} array.</p>
@@ -278,15 +276,15 @@
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     <b>android:searchSuggestSelection="word MATCH ?"</b>&gt;
 &lt;/searchable&gt;
 </pre>
 
 <p>With this configuration, your {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} method
-delivers the {@code selection} parameter as "word MATCH ?" and the {@code selectionArgs}
-parameter as whatever the user entered in the search dialog. When you pass these to an SQLite
+delivers the {@code selection} parameter as {@code "word MATCH ?"} and the {@code selectionArgs}
+parameter as the search query. When you pass these to an SQLite
 {@link android.database.sqlite.SQLiteDatabase#query(String,String[],String,String[],String,String,
 String) query()} method, as their respective arguments, they are synthesized together (the
 question mark is replaced with the query
@@ -296,9 +294,9 @@
 question mark.</p>
 
 <p>Another new attribute in the example above is {@code android:searchSuggestIntentAction}, which
-defines the Intent action sent with each Intent when the user selects a suggestion. It is
+defines the intent action sent with each intent when the user selects a suggestion. It is
 discussed further in the section about <a href="#IntentForSuggestions">Declaring an Intent for
-suggestions</a>.</p>
+Suggestions</a>.</p>
 
 <p class="note"><strong>Tip:</strong> If you don't want to define a selection clause in
 the {@code android:searchSuggestSelection} attribute, but would still like to receive the query
@@ -317,7 +315,7 @@
 <h2>Creating a Cursor without a table</h2>
 <p>If your search suggestions are not stored in a table format (such as an SQLite table) using the
 columns required by the
-Search Manager, then you can search your suggestion data for matches and then format them
+system, then you can search your suggestion data for matches and then format them
 into the necessary table on each request. To do so, create a {@link android.database.MatrixCursor}
 using the required column names and then add a row for each suggestion using {@link
 android.database.MatrixCursor#addRow(Object[])}. Return the final product from your Content
@@ -326,18 +324,18 @@
 </div>
 </div>
 
-<p>When you return suggestions to the Search Manager with a {@link android.database.Cursor}, the
-Search Manager expects specific columns in each row. So, regardless of whether you
+<p>When you return suggestions to the system with a {@link android.database.Cursor}, the
+system expects specific columns in each row. So, regardless of whether you
 decide to store
 your suggestion data in an SQLite database on the device, a database on a web server, or another
 format on the device or web, you must format the suggestions as rows in a table and
-present them with a {@link android.database.Cursor}. The Search
-Manager understands several columns, but only two are required:</p>
+present them with a {@link android.database.Cursor}. The system understands several columns, but
+only two are required:</p>
 
 <dl>
   <dt>{@link android.provider.BaseColumns#_ID}</dt>
-  <dd>A unique integer row ID for each suggestion. The search dialog requires this in order
-to present suggestions in a ListView.</dd>
+  <dd>A unique integer row ID for each suggestion. The system requires this in order
+to present suggestions in a {@link android.widget.ListView}.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_TEXT_1}</dt>
   <dd>The string that is presented as a suggestion.</dd>
 </dl>
@@ -359,35 +357,35 @@
 all suggestions are provided in an icon-plus-text format with the icon on the right side. This can
 be null or zero to indicate no icon in this row.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION}</dt>
-  <dd>An Intent action string. If this column exists and contains a value at the given row, the
-action defined here is used when forming the suggestion's Intent. If the element is not
+  <dd>An intent action string. If this column exists and contains a value at the given row, the
+action defined here is used when forming the suggestion's intent. If the element is not
 provided, the action is taken from the {@code android:searchSuggestIntentAction} field in your
 searchable configuration. If your action is the same for all
 suggestions, it is more efficient to specify the action using {@code
 android:searchSuggestIntentAction} and omit this column.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA}</dt>
   <dd>A data URI string. If this column exists and contains a value at the given row, this is the
-data that is used when forming the suggestion's Intent. If the element is not provided, the data is
+data that is used when forming the suggestion's intent. If the element is not provided, the data is
 taken from the {@code android:searchSuggestIntentData} field in your searchable configuration. If
 neither source is provided,
-the Intent's data field is null. If your data is the same for all suggestions, or can be
+the intent's data field is null. If your data is the same for all suggestions, or can be
 described using a constant part and a specific ID, it is more efficient to specify it using {@code
 android:searchSuggestIntentData} and omit this column.
 </dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID}</dt>
   <dd>A URI path string. If this column exists and contains a value at the given row, then "/" and
-this value is appended to the data field in the Intent. This should only be used if the data field
+this value is appended to the data field in the intent. This should only be used if the data field
 specified
 by the {@code android:searchSuggestIntentData} attribute in the searchable configuration has already
 been set to an appropriate base string.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_EXTRA_DATA}</dt>
   <dd>Arbitrary data. If this column exists and contains a value at a given row, this is the
-<em>extra</em> data used when forming the suggestion's Intent. If not provided, the
-Intent's extra data field is null. This column allows suggestions to provide additional data that is
-included as an extra in the Intent's {@link android.app.SearchManager#EXTRA_DATA_KEY} key.</dd>
+<em>extra</em> data used when forming the suggestion's intent. If not provided, the
+intent's extra data field is null. This column allows suggestions to provide additional data that is
+included as an extra in the intent's {@link android.app.SearchManager#EXTRA_DATA_KEY} key.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_QUERY}</dt>
   <dd>If this column exists and this element exists at the given row, this is the data that is
-used when forming the suggestion's query, included as an extra in the Intent's {@link
+used when forming the suggestion's query, included as an extra in the intent's {@link
 android.app.SearchManager#QUERY} key. Required if suggestion's action is {@link
 android.content.Intent#ACTION_SEARCH}, optional otherwise.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_SHORTCUT_ID}</dt>
@@ -410,22 +408,22 @@
 
 
 
-<h2 id="IntentForSuggestions">Declaring an Intent for suggestions</h2>
+<h2 id="IntentForSuggestions">Declaring an Intent for Suggestions</h2>
 
-<p>When the user selects a suggestion from the list that appears below the search dialog, the Search
-Manager sends a custom {@link android.content.Intent} to your searchable Activity. You must define
-the action and data for the Intent.</p>
+<p>When the user selects a suggestion from the list that appears below the search dialog or widget,
+the system sends a custom {@link android.content.Intent} to your searchable activity. You
+must define the action and data for the intent.</p>
 
 
-<h3 id="IntentAction">Declaring the Intent action</h3>
+<h3 id="IntentAction">Declaring the intent action</h3>
 
-<p>The most common Intent action for a custom suggestion is {@link
+<p>The most common intent action for a custom suggestion is {@link
 android.content.Intent#ACTION_VIEW}, which is appropriate when
 you want to open something, like the definition for a word, a person's contact information, or a web
-page. However, the Intent action can be any other action and can even be different for each
+page. However, the intent action can be any other action and can even be different for each
 suggestion.</p>
 
-<p>Depending on whether you want all suggestions to use the same Intent action, you
+<p>Depending on whether you want all suggestions to use the same intent action, you
 can define the action in two ways:</p>
 
 <ol type="a">
@@ -457,34 +455,34 @@
 default, then override this action for some suggestions by declaring a different action in the
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. If you do not include
 a value in the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column, then the
-Intent provided in the {@code android:searchSuggestIntentAction} attribute is used.</p>
+intent provided in the {@code android:searchSuggestIntentAction} attribute is used.</p>
 
 <p class="note"><strong>Note</strong>: If you do not include the
 {@code android:searchSuggestIntentAction} attribute in your searchable configuration, then you
 <em>must</em> include a value in the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION}
-column for every suggestion, or the Intent will fail.</p>
+column for every suggestion, or the intent will fail.</p>
 
 
 
-<h3 id="IntentData">Declaring Intent data</h3>
+<h3 id="IntentData">Declaring intent data</h3>
 
-<p>When the user selects a suggestion, your searchable Activity receives the Intent with the
-action you've defined (as discussed in the previous section), but the Intent must also carry
-data in order for your Activity to identify which suggestion was selected. Specifically,
+<p>When the user selects a suggestion, your searchable activity receives the intent with the
+action you've defined (as discussed in the previous section), but the intent must also carry
+data in order for your activity to identify which suggestion was selected. Specifically,
 the data should be something unique for each suggestion, such as the row ID for the suggestion in
-your SQLite table. When the Intent is received,
+your SQLite table. When the intent is received,
 you can retrieve the attached data with {@link android.content.Intent#getData()} or {@link
 android.content.Intent#getDataString()}.</p>
 
-<p>You can define the data included with the Intent in two ways:</p>
+<p>You can define the data included with the intent in two ways:</p>
 
 <ol type="a">
   <li>Define the data for each suggestion inside the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column of your suggestions table.
 
-<p>Provide all necessary data information for each Intent in the suggestions table by including the
+<p>Provide all necessary data information for each intent in the suggestions table by including the
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column and then populating it with
-unique data for each row. The data from this column is attached to the Intent exactly as you
+unique data for each row. The data from this column is attached to the intent exactly as you
 define it in this column. You can then retrieve it with with {@link
 android.content.Intent#getData()} or {@link android.content.Intent#getDataString()}.</p>
 
@@ -498,7 +496,7 @@
   </li>
 
   <li>Fragment a data URI into two pieces: the portion common to all suggestions and the portion
-unique to each suggestion. Place these parts into the {@code android:searchSuggestIntentData}
+unique to each suggestion. Place these parts into the {@code android:searchSuggestintentData}
 attribute of the searchable configuration and the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column of your
 suggestions table, respectively.
@@ -512,14 +510,14 @@
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     <b>android:searchSuggestIntentData="content://com.example/datatable"</b> >
 &lt;/searchable>
 </pre>
 
 <p>Then include the final path for each suggestion (the unique part) in the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID}
-column of your suggestions table. When the user selects a suggestion, the Search Manager takes
+column of your suggestions table. When the user selects a suggestion, the system takes
 the string from {@code android:searchSuggestIntentData}, appends a slash ("/") and then adds the
 respective value from the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column to
 form a complete content URI. You can then retrieve the {@link android.net.Uri} with with {@link
@@ -530,20 +528,20 @@
 
 <h4>Add more data</h4>
 
-<p>If you need to express even more information with your Intent, you can add another table column,
+<p>If you need to express even more information with your intent, you can add another table column,
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_EXTRA_DATA}, which can store additional
 information about the suggestion. The data saved in this column is placed in {@link
-android.app.SearchManager#EXTRA_DATA_KEY} of the Intent's extra Bundle.</p>
+android.app.SearchManager#EXTRA_DATA_KEY} of the intent's extra Bundle.</p>
 
 
 
 <h2 id="HandlingIntent">Handling the Intent</h2>
 
-<p>Now that your search dialog provides custom search suggestions with custom Intents, you
-need your searchable Activity to handle these Intents when the user selects a
+<p>Now that you provide custom search suggestions with custom intents, you
+need your searchable activity to handle these intents when the user selects a
 suggestion. This is in addition to handling the {@link
-android.content.Intent#ACTION_SEARCH} Intent, which your searchable Activity already does.
-Here's an example of how you can handle the Intents during your Activity {@link
+android.content.Intent#ACTION_SEARCH} intent, which your searchable activity already does.
+Here's an example of how you can handle the intents during your activity {@link
 android.app.Activity#onCreate(Bundle) onCreate()} callback:</p>
 
 <pre>
@@ -559,25 +557,25 @@
 }
 </pre>
 
-<p>In this example, the Intent action is {@link
+<p>In this example, the intent action is {@link
 android.content.Intent#ACTION_VIEW} and the data carries a complete URI pointing to the suggested
 item, as synthesized by the {@code android:searchSuggestIntentData} string and {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column. The URI is then passed to the local
 {@code showResult()} method that queries the content provider for the item specified by the URI.</p>
 
-<p class="note"><strong>Note:</strong> You do <em>not</em> need to add an Intent filter to your
-Android manifest file for the Intent action you defined with the {@code
+<p class="note"><strong>Note:</strong> You do <em>not</em> need to add an intent filter to your
+Android manifest file for the intent action you defined with the {@code
 android:searchSuggestIntentAction} attribute or {@link
-android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. The Search Manager opens your
-searchable Activity by name to deliver the suggestion's Intent, so the Activity does not need to
+android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. The system opens your
+searchable activity by name to deliver the suggestion's intent, so the activity does not need to
 declare the accepted action.</p>
 
 
 <h2 id="RewritingQueryText">Rewriting the query text</h2>
 
-<p>If the user navigates through the suggestions list using the directional controls (trackball or
-d-pad), the text in the search dialog won't change, by default. However, you can temporarily rewrite
-the user's query text as it appears in the text box with
+<p>If the user navigates through the suggestions list using the directional controls (such
+as with a trackball or d-pad), the query text does not update, by default. However, you
+can temporarily rewrite the user's query text as it appears in the text box with
 a query that matches the suggestion currently in focus. This enables the user to see what query is
 being suggested (if appropriate) and then select the search box and edit the query before
 dispatching it as a search.</p>
@@ -654,7 +652,7 @@
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     android:includeInGlobalSearch="true"
     <b>android:searchSettingsDescription="@string/search_description"</b> >
 &lt;/searchable>
@@ -676,7 +674,7 @@
 <h3 id="ManagingShortcuts">Managing Quick Search Box suggestion shortcuts</h3>
 
 <p>Suggestions that the user selects from Quick Search Box can be automatically made into shortcuts.
-These are suggestions that the Search Manager has copied from your content provider  so it can
+These are suggestions that the system has copied from your content provider  so it can
 quickly access the suggestion without the need to re-query your content provider. </p>
 
 <p>By default, this is enabled for all suggestions retrieved by Quick Search Box, but if your
diff --git a/docs/html/guide/topics/search/adding-recent-query-suggestions.jd b/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
index cb063a1..2c9a461 100644
--- a/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
+++ b/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
@@ -28,13 +28,15 @@
 </div>
 </div>
 
-<p>When using the Android search dialog, you can provide search suggestions based on recent search
+<p>When using the Android search dialog or search widget, you can provide search suggestions based
+on recent search
 queries. For example, if a user previously searched for "puppies," then that query appears as a
 suggestion once he or she begins typing the same query. Figure 1 shows an example of a search dialog
 with recent query suggestions.</p>
 
-<p>Before you begin, you need to implement the search dialog for basic searches in your application.
-If you haven't, see <a href="search-dialog.html">Using the Android Search Dialog</a>.</p>
+<p>Before you begin, you need to implement the search dialog or a search widget for basic searches
+in your application.
+If you haven't, see <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 
@@ -47,16 +49,16 @@
 </div>
 
 <p>Recent query suggestions are simply saved searches. When the user selects one of
-the suggestions, your searchable Activity receives a {@link
-android.content.Intent#ACTION_SEARCH} Intent with the suggestion as the search query, which your
-searchable Activity already handles (as described in <a href="search-dialog.html">Using the Android
-Search Dialog</a>).</p>
+the suggestions, your searchable activity receives a {@link
+android.content.Intent#ACTION_SEARCH} intent with the suggestion as the search query, which your
+searchable activity already handles (as described in <a href="search-dialog.html">Creating a Search
+Interface</a>).</p>
 
 <p>To provide recent queries suggestions, you need to:</p>
 
 <ul>
-  <li>Implement a searchable Activity, <a
-href="{@docRoot}guide/topics/search/search-dialog.html">using the Android Search Dialog</a>.</li>
+  <li>Implement a searchable activity, as described in <a
+href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>.</li>
   <li>Create a content provider that extends {@link
 android.content.SearchRecentSuggestionsProvider} and declare it in your application manifest.</li>
   <li>Modify the searchable configuration with information about the content provider that
@@ -64,20 +66,19 @@
   <li>Save queries to your content provider each time a search is executed.</li>
 </ul>
 
-<p>Just as the Search Manager displays the search dialog, it also displays the
-search suggestions. All you need to do is provide a source from which the suggestions can be
-retrieved.</p>
+<p>Just as the Android system displays the search dialog, it also displays the
+search suggestions below the dialog or search widget. All you need to do is provide a source from
+which the system can retrieve suggestions.</p>
 
-<p>When the Search Manager identifies that your Activity is searchable and provides search
-suggestions, the following procedure takes place as soon as the user types into the search
-dialog:</p>
+<p>When the system identifies that your activity is searchable and provides search
+suggestions, the following procedure takes place as soon as the user begins typing a query:</p>
 
 <ol>
-  <li>Search Manager takes the search query text (whatever has been typed so far) and performs a
+  <li>The system takes the search query text (whatever has been typed so far) and performs a
 query to the content provider that contains your suggestions.</li>
   <li>Your content provider returns a {@link android.database.Cursor} that points to all
 suggestions that match the search query text.</li>
-  <li>Search Manager displays the list of suggestions provided by the Cursor.</li>
+  <li>The system displays the list of suggestions provided by the Cursor.</li>
 </ol>
 
 <p>Once the recent query suggestions are displayed, the following might happen:</p>
@@ -86,10 +87,10 @@
   <li>If the user types another key, or changes the query in any way, the aforementioned steps are
 repeated and the suggestion list is updated.</li>
   <li>If the user executes the search, the suggestions are ignored and the search is delivered
-to your searchable Activity using the normal {@link android.content.Intent#ACTION_SEARCH}
-Intent.</li>
+to your searchable activity using the normal {@link android.content.Intent#ACTION_SEARCH}
+intent.</li>
   <li>If the user selects a suggestion, an
-{@link android.content.Intent#ACTION_SEARCH} Intent is delivered to your searchable Activity using
+{@link android.content.Intent#ACTION_SEARCH} intent is delivered to your searchable activity using
 the suggested text as the query.</li>
 </ul>
 
@@ -151,7 +152,7 @@
 
 <h2 id="RecentQuerySearchableConfiguration">Modifying the Searchable Configuration</h2>
 
-<p>To configure your search dialog to use your suggestions provider, you need to add
+<p>To configure the system to use your suggestions provider, you need to add
 the {@code android:searchSuggestAuthority} and {@code android:searchSuggestSelection} attributes to
 the {@code &lt;searchable&gt;} element in your searchable configuration file. For example:</p>
 
@@ -179,12 +180,12 @@
 <h2 id="SavingQueries">Saving Queries</h2>
 
 <p>To populate your collection of recent queries, add each query
-received by your searchable Activity to your {@link
+received by your searchable activity to your {@link
 android.content.SearchRecentSuggestionsProvider}. To do this, create an instance of {@link
 android.provider.SearchRecentSuggestions} and call {@link
 android.provider.SearchRecentSuggestions#saveRecentQuery(String,String) saveRecentQuery()} each time
-your searchable Activity receives a query. For example, here's how you can save the query during
-your Activity's {@link android.app.Activity#onCreate(Bundle) onCreate()} method:</p>
+your searchable activity receives a query. For example, here's how you can save the query during
+your activity's {@link android.app.Activity#onCreate(Bundle) onCreate()} method:</p>
 
 <pre>
 &#64;Override
@@ -192,10 +193,10 @@
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
 
-    Intent Intent  = getIntent();
+    Intent intent  = getIntent();
 
-    if (Intent.ACTION_SEARCH.equals(Intent .getAction())) {
-        String query = Intent .getStringExtra(SearchManager.QUERY);
+    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+        String query = intent.getStringExtra(SearchManager.QUERY);
         SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                 MySuggestionProvider.AUTHORITY, MySuggestionProvider.MODE);
         suggestions.saveRecentQuery(query, null);
@@ -212,7 +213,7 @@
 second line of the suggestion (or null). The second parameter is only used if you've enabled
 two-line mode for the search suggestions with {@link
 android.content.SearchRecentSuggestionsProvider#DATABASE_MODE_2LINES}. If you have enabled
-two-line mode, then the query text is also matched against this second line when the Search Manager
+two-line mode, then the query text is also matched against this second line when the system
 looks for matching suggestions.</p>
 
 
diff --git a/docs/html/guide/topics/search/index.jd b/docs/html/guide/topics/search/index.jd
index f563715..7ac5ff1 100644
--- a/docs/html/guide/topics/search/index.jd
+++ b/docs/html/guide/topics/search/index.jd
@@ -5,7 +5,7 @@
 <div id="qv">
 <h2>Topics</h2>
 <ol>
-<li><a href="search-dialog.html">Using the Android Search Dialog</a></li>
+<li><a href="search-dialog.html">Creating a Search Interface</a></li>
 <li><a href="adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
 <li><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
 </ol>
@@ -24,9 +24,8 @@
 
 <p>Search is a core user feature on Android. Users should be able
 to search any data that is available to them, whether the content is located on the device or
-the Internet. The search experience should be seamless and consistent across the entire
-system, which is why Android provides a search framework to help you provide users with
-a familiar search dialog and a great search experience.</p>
+the Internet. To help create a consistent search experience for users, Android provides a
+search framework that helps you implement search for your application.</p>
 
 <div class="figure" style="width:250px">
 <img src="{@docRoot}images/search/search-suggest-custom.png" alt="" height="417" />
@@ -34,16 +33,14 @@
 search suggestions.</p>
 </div>
 
-<p>Android's search framework provides a user interface in which users can perform a search and
-an interaction layer that communicates with your application, so you don't have to build
-your own search Activity. Instead, a search dialog appears at the top of the screen at the user's
-command without interrupting the current Activity.</p>
+<p>The search framework offers two modes of search input: a search dialog at the top of the
+screen or a search widget ({@link android.widget.SearchView}) that you can embed in your activity
+layout. In either case, the Android system will assist your search implementation by
+delivering search queries to a specific activity that performs searchs. You can also enable either
+the search dialog or widget to provide search suggestions as the user types. Figure 1 shows an
+example of the search dialog with optional search suggestions.</p>
 
-<p>The search framework manages the life of the search dialog. When users execute a search, the
-search framework passes the query text to your application so your application can perform a
-search. Figure 1 shows an example of the search dialog with optional search suggestions.</p>
-
-<p>Once your application is set up to use the search dialog, you can:</p>
+<p>Once you've set up either the search dialog or the search widget, you can:</p>
 
 <ul>
 <li>Enable voice search</li>
@@ -57,19 +54,19 @@
 if your data is stored in an SQLite database, you should use the {@link android.database.sqlite}
 APIs to perform searches.</p>
 
-<p>The following documents show you how to use the search dialog in your application:</p>
+<p>The following documents show you how to use Android's framework to implement search:</p>
 
 <dl>
-  <dt><strong><a href="search-dialog.html">Using the Android Search Dialog</a></strong></dt>
-  <dd>How to set up your application to use the search dialog. </dd>
+  <dt><strong><a href="search-dialog.html">Creating a Search Interface</a></strong></dt>
+  <dd>How to set up your application to use the search dialog or search widget. </dd>
   <dt><strong><a href="adding-recent-query-suggestions.html">Adding Recent Query
 Suggestions</a></strong></dt>
-  <dd>How to show suggestions based on queries previously used in the search dialog.</dd>
+  <dd>How to provide suggestions based on queries previously used.</dd>
   <dt><strong><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></strong></dt>
-  <dd>How to show suggestions based on custom data from your application and offer your suggestions
+  <dd>How to provide suggestions based on custom data from your application and also offer them
 in the system-wide Quick Search Box.</dd>
   <dt><strong><a href="searchable-config.html">Searchable Configuration</a></strong></dt>
-  <dd>A reference for the searchable configuration file (though the other
+  <dd>A reference document for the searchable configuration file (though the other
 documents also discuss the configuration file in terms of specific behaviors).</dd>
 </dl>
 
@@ -92,17 +89,17 @@
 send the personal information, you should not log it. If you must log it, protect that data
 very carefully and erase it as soon as possible.</p>
 </li>
-<li><strong>Provide the user with a way to clear their search history.</strong>
+<li><strong>Provide users with a way to clear their search history.</strong>
 <p>The search framework helps your application provide context-specific suggestions while the user
 types. Sometimes these
 suggestions are based on previous searches or other actions taken by the user in an earlier
 session. A user might not wish for previous searches to be revealed to other device users, for
-instance, if they share their phone with a friend. If your application provides suggestions that can
-reveal previous activities, you should implement the ability for the user to clear the search
-history. If you are using {@link android.provider.SearchRecentSuggestions}, you can simply call the
-{@link android.provider.SearchRecentSuggestions#clearHistory()} method. If you are implementing
-custom suggestions, you'll need to provide a similar "clear history" method in your provider that
-the user can execute.</p>
+instance, if the user shares the device with a friend. If your application provides suggestions that
+can reveal previous search activities, you should implement the ability for the user to clear the
+search history. If you are using {@link android.provider.SearchRecentSuggestions}, you can simply
+call the {@link android.provider.SearchRecentSuggestions#clearHistory()} method. If you are
+implementing custom suggestions, you'll need to provide a similar "clear history" method in your
+content provider that the user can execute.</p>
 </li>
 </ul>
 
diff --git a/docs/html/guide/topics/search/search-dialog.jd b/docs/html/guide/topics/search/search-dialog.jd
index 6699fe1..af6c8f2 100644
--- a/docs/html/guide/topics/search/search-dialog.jd
+++ b/docs/html/guide/topics/search/search-dialog.jd
@@ -1,38 +1,61 @@
-page.title=Using the Android Search Dialog
+page.title=Creating a Search Interface
 parent.title=Search
 parent.link=index.html
 @jd:body
 
 <div id="qv-wrapper">
 <div id="qv">
+
+  <h2>Quickview</h2>
+  <ul>
+    <li>The Android system sends search queries from the search dialog or widget to an activity you
+specify to perform searches and present results</li>
+    <li>You can put the search widget in the Action Bar, as an "action view," for quick
+access</li>
+  </ul>
+
+
 <h2>In this document</h2>
 <ol>
 <li><a href="#TheBasics">The Basics</a></li>
 <li><a href="#SearchableConfiguration">Creating a Searchable Configuration</a></li>
 <li><a href="#SearchableActivity">Creating a Searchable Activity</a>
   <ol>
-    <li><a href="#DeclaringSearchableActivity">Declaring a searchable Activity</a></li>
+    <li><a href="#DeclaringSearchableActivity">Declaring a searchable activity</a></li>
+    <li><a href="#EnableSearch">Enabling the search dialog and search widget</a></li>
     <li><a href="#PerformingSearch">Performing a search</a></li>
   </ol>
 </li>
-<li><a href="#InvokingTheSearchDialog">Invoking the Search Dialog</a>
+<li><a href="#UsingTheSearchDialog">Using the Search Dialog</a>
   <ol>
-    <li><a href="#LifeCycle">The impact of the search dialog on your Activity life-cycle</a></li>
+    <li><a href="#LifeCycle">The impact of the search dialog on your activity lifecycle</a></li>
+    <li><a href="#SearchContextData">Passing search context data</a></li>
   </ol>
 </li>
-<li><a href="#SearchContextData">Passing Search Context Data</a></li>
+<li><a href="#UsingSearchWidget">Using the Search Widget</a>
+  <ol>
+    <li><a href="#ConfiguringWidget">Configuring the search widget</a></li>
+    <li><a href="#WidgetFeatures">Other search widget features</a></li>
+  </ol>
+</li>
 <li><a href="#VoiceSearch">Adding Voice Search</a></li>
+<li><a href="#SearchSuggestions">Adding Search Suggestions</a></li>
 </ol>
 
 <h2>Key classes</h2>
 <ol>
 <li>{@link android.app.SearchManager}</li>
+<li>{@link android.widget.SearchView}</li>
 </ol>
 
 <h2>Related samples</h2>
 <ol>
 <li><a href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable
 Dictionary</a></li>
+<li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.html">SearchView
+    in the Action Bar</a></li>
+<li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewFilterMode.html">SearchView
+    filter mode</a></li>
 </ol>
 
 <h2>Downloads</h2>
@@ -50,16 +73,24 @@
 </div>
 </div>
 
-<p>When you want to implement search in your application, the last thing you should have to worry
-about is where to put the search box. When you implement search with the Android search framework,
-you don't have to. When the user invokes search, a search dialog appears at the top of the screen
-with your application icon to the left of the search box. When the user executes the search, your
-application receives the query so it can search your application's data. An example of the search
-dialog is shown in figure 1.</p>
+<p>When you're ready to add search functionality to your application, Android helps you implement
+the user interface with either a search dialog that appears at the top of the activity window or a
+search widget that you can insert in your layout. Both the search dialog and the widget can deliver
+the user's search query to a specific activity in your application. This way, the user can initiate
+a search from any activity where the search dialog or widget is available, and the system starts the
+appropriate activity to perform the search and present results.</p>
 
-<p>This guide shows you how to set up your application to provide search in the search
-dialog. When you use the search dialog, you provide a standardized search
-experience and can add features such as voice search and search suggestions.</p>
+<p>Other features available for the search dialog and widget include:</p>
+
+<ul>
+  <li>Voice search</li>
+  <li>Search suggestions based on recent queries</li>
+  <li>Search suggestions that match actual results in your application data</li>
+</ul>
+
+<p>This guide shows you how to set up your application to provide a search interface
+that's assisted by the Android system to deliver search queries, using either the
+search dialog or the search widget.</p>
 
 
 <h2 id="TheBasics">The Basics</h2>
@@ -69,40 +100,78 @@
 <p class="img-caption"><strong>Figure 1.</strong> Screenshot of an application's search dialog.</p>
 </div>
 
-<p>The Android search framework manages the search dialog for your application. You never need
-to draw it or worry about where it is, and your Activity is not interrupted when the search dialog
-appears. The Search Manager ({@link android.app.SearchManager}) is the component that does this work
-for you. It manages the life of the search dialog and sends your application the user's search
-query.</p>
+<p>Before you begin, you should decide whether you'll implement your search interface using the
+search dialog or the search widget. Both provide the same search features, but in slightly different
+ways:</p>
 
-<p>When the user executes a search, the Search Manager creates an {@link android.content.Intent} to
-pass the search query to the Activity that you've declared to handle searches. Basically, all you
-need is an Activity that receives the search Intent, performs the search, and presents the results.
-Specifically, you need the following:</p>
+<ul>
+  <li>The <strong>search dialog</strong> is a UI component that's controlled by the Android system.
+When activated by the user, the search dialog appears at the top of the activity, as shown in figure
+1.
+    <p>The Android system controls all events in the search dialog. When the user
+submits a query, the system delivers the query to the activity that you specify to
+handle searches. The dialog can also provide search suggestions while the user types.</p></li>
 
-<dl>
-  <dt>A searchable configuration</dt>
-  <dd>An XML file that configures the search dialog and includes settings for features such as voice
-search, search suggestion, and the hint text.</dd>
-  <dt>A searchable Activity</dt>
-  <dd>The {@link android.app.Activity} that receives the search query, then searches your data and
-displays the search results.</dd>
-  <dt>A mechanism by which the user can invoke search</dt>
-  <dd>The device search key invokes the search dialog, by default. However, a dedicated search key
-is not guaranteed on all devices, so provide another means by which the user can invoke a search,
-such as a search button in the Options Menu or elsewhere in the Activity UI.</dd>
-</dl>
+  <li>The <strong>search widget</strong> is an instance of {@link android.widget.SearchView} that
+you can place anywhere in your layout. By default, the search widget behaves like a standard {@link
+android.widget.EditText} widget and doesn't do anything, but you can configure it so that the
+Android system handles all input events, delivers queries to the appropriate activity, and provides
+search suggestions (just like the search dialog). However, the search widget is available only in
+Android 3.0 (API Level 11) and higher.
 
+<p class="note"><strong>Note:</strong> If you want, you can handle all user input into the
+search widget yourself, using various callback methods and listeners. This document, however,
+focuses on how to integrate the search widget with the system for an assisted search
+implementation. If you want to handle all user input yourself, read the reference documentation for
+{@link android.widget.SearchView} and its nested interfaces. </p></li>
+</ul>
+
+<p>When the user executes a search from the search dialog or a search widget, the system creates an
+{@link android.content.Intent} and stores the user query in it. The system then starts the activity
+that you've declared to handle searches (the "searchable activity") and delivers it the intent. To
+set up your application for this kind of assisted search, you need the following:</p>
+
+<ul>
+  <li>A searchable configuration
+  <p>An XML file that configures some settings for the search dialog or widget. It includes settings
+for features such as voice search, search suggestion, and hint text for the search box.</p></li>
+  <li>A searchable activity
+  <p>The {@link android.app.Activity} that receives the search query, searches your
+data, and displays the search results.</p></li>
+  <li>A search interface, provided by either:
+    <ul>
+      <li>The search dialog
+        <p>By default, the search dialog is hidden, but appears at the top of the screen when the 
+user presses the device SEARCH button (when available) or another button in your user interface.</p>
+      </li>
+      <li>Or, a {@link android.widget.SearchView} widget
+        <p>Using the search widget allows you to put the search box anywhere in your activity.
+Instead of putting it in your activity layout, however, it's usually more convenient for users as an
+<a href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view in the Action Bar</a>.</p>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<p>The rest of this document shows you how to create the searchable configuration, searchable
+activity, and implement a search interface with either the search dialog or search widget.</p>
 
 
 <h2 id="SearchableConfiguration">Creating a Searchable Configuration</h2>
 
-<p>The searchable configuration is an XML file that defines several settings for the search
-dialog in your application. This file is traditionally named {@code searchable.xml} and must be
-saved in the {@code res/xml/} project directory.</p>
+<p>The first thing you need is an XML file called the searchable configuration. It configures
+certain UI aspects of the search dialog or widget and defines how features such as suggestions and
+voice search behave. This file is traditionally named {@code searchable.xml} and must be saved in
+the {@code res/xml/} project directory.</p>
 
-<p>The file must consist of the {@code &lt;searchable&gt;} element as the root node and specify one
-or more attributes that configure your search dialog. For example:</p>
+<p class="note"><strong>Note:</strong> The system uses this file to instantiate a {@link
+android.app.SearchableInfo} object, but you cannot create this object yourself at
+runtime&mdash;you must declare the searchable configuration in XML.</p>
+
+<p>The searchable configuration file must include the <a
+href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
+&lt;searchable&gt;}</a> element as the root node and specify one
+or more attributes. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?>
@@ -112,51 +181,61 @@
 &lt;/searchable>
 </pre>
 
-<p>The {@code android:label} attribute is the only required attribute and points to a string
-resource, which should be the same as the application name. This label isn't actually visible to the
-user until you enable suggestions for Quick Search Box, at which point, this label is visible in the
-list of Searchable items in the system Settings.</p>
+<p>The {@code android:label} attribute is the only required attribute. It points to a string
+resource, which should be the application name. This label isn't actually visible to the
+user until you enable search suggestions for Quick Search Box. At that point, this label is visible
+in the list of Searchable items in the system Settings.</p>
 
 <p>Though it's not required, we recommend that you always include the {@code android:hint}
-attribute, which provides a hint string in the search dialog's text box before the user
-enters their query. The hint is important because it provides important clues to users about what
+attribute, which provides a hint string in the search box before users
+enters a query. The hint is important because it provides important clues to users about what
 they can search.</p>
 
 <p class="note"><strong>Tip:</strong> For consistency among other
 Android applications, you should format the string for {@code android:hint} as "Search
-<em>&lt;content-or-product&gt;</em>". For example, "Search songs and artists" or "Search
+&lt;content-or-product&gt;". For example, "Search songs and artists" or "Search
 YouTube".</p>
 
-<p>The {@code &lt;searchable&gt;} element accepts several other attributes. Most attributes apply
-only when configuring features such as search suggestions and voice search.</p>
-
-<p>For more details about the searchable configuration file, see the <a
-href="{@docRoot}guide/topics/search/searchable-config.html">Searchable Configuration</a>
-reference.</p>
+<p>The <a
+href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
+&lt;searchable&gt;}</a> element accepts several other attributes. However, you don't need
+most attributes until you add features such as <a href="#SearchSuggestions">search suggestions</a>
+and <a href="#VoiceSearch">voice search</a>. For detailed information about the searchable
+configuration file, see the <a
+href="{@docRoot}guide/topics/search/searchable-config.html">Searchable Configuration</a> reference
+document.</p>
 
 
 
 <h2 id="SearchableActivity">Creating a Searchable Activity</h2>
 
-<p>When the user executes a search from the search dialog, the Search Manager takes the query
-and sends it to your searchable {@link android.app.Activity} in the {@link
-android.content.Intent#ACTION_SEARCH} {@link android.content.Intent}. Your searchable Activity
-then searches your data using the query and presents the results to the user.</p>
+<p>A searchable activity is the {@link android.app.Activity} in your application that performs
+searches based on a query string and presents the search results.</p>
 
-<p>In order for the Search Manager to know where to deliver the search query, you must declare your
-searchable Activity in the Android manifest file.</p>
+<p>When the user executes a search in the search dialog or widget, the system starts your
+searchable activity and delivers it the search query in an {@link
+android.content.Intent} with the  {@link android.content.Intent#ACTION_SEARCH} action. Your
+searchable activity retrieves the query from the intent's {@link android.app.SearchManager#QUERY
+QUERY} extra, then searches your data and presents the results.</p>
+
+<p>Because you may include the search dialog or widget in any other activity in your application,
+the system must know which activity is your searchable activity, so it can properly deliver the
+search query. So, you must first declare your searchable activity in the Android manifest file.</p>
 
 
-<h3 id="DeclaringSearchableActivity">Declaring a searchable Activity</h3>
+<h3 id="DeclaringSearchableActivity">Declaring a searchable activity</h3>
 
-<p>If you don't have one already, create an {@link android.app.Activity} that performs
-searches and present search results. To set up this Activity as your searchable Activity:</p>
+<p>If you don't have one already, create an {@link android.app.Activity} that will perform
+searches and present results. You don't need to implement the search functionality yet&mdash;just
+create an activity that you can declare in the manifest. Inside the manifest's <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+element:</p>
 <ol>
-  <li>Declare the Activity to accept the {@link android.content.Intent#ACTION_SEARCH} {@link
-android.content.Intent}, in an <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+  <li>Declare the activity to accept the {@link android.content.Intent#ACTION_SEARCH} intent, in an
+<a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
+&lt;intent-filter&gt;}</a>
 element.</li>
-  <li>Apply the searchable configuration, in a <a
+  <li>Specify the searchable configuration to use, in a <a
 href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
 element.</li>
 </ol>
@@ -165,7 +244,7 @@
 
 <pre>
 &lt;application ... >
-    &lt;activity android:name=".MySearchableActivity" >
+    &lt;activity android:name=".SearchableActivity" >
         &lt;intent-filter>
             &lt;action android:name="android.intent.action.SEARCH" />
         &lt;/intent-filter>
@@ -181,71 +260,22 @@
 reference to the searchable configuration file (in this example, it
 refers to the {@code res/xml/searchable.xml} file).</p>
 
-<p class="note"><strong>Note:</strong> The {@code &lt;intent-filter&gt;} does not need a <a
+<p class="note"><strong>Note:</strong> The <a
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
+&lt;intent-filter&gt;}</a> does not need a <a
 href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a> with the
-{@code DEFAULT} value, because the Search Manager delivers the {@link
-android.content.Intent#ACTION_SEARCH} Intent explicitly to your searchable Activity by name.</p>
+{@code DEFAULT} value (which you usually see in <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> elements),
+because the system delivers the {@link android.content.Intent#ACTION_SEARCH} intent explicitly to
+your searchable activity, using its component name.</p>
 
-<p>The search dialog is not, by default, available from every Activity of your
-application. Rather, the search dialog is presented to users only when they
-invoke search from a searchable context of your application. A searchable context is any Activity
-for which you have
-declared searchable meta-data in the manifest file. For example, the searchable Activity itself
-(declared in the manifest snippet above) is
-a searchable context because it includes meta-data that defines the
-searchable configuration. Any other Activity in your application is not a searchable context, by
-default, and thus, does not reveal the search dialog. However, you probably do want the search
-dialog available from your other activities (and to launch the searchable Activity when the user
-executes a search). You can do exactly that.</p>
-
-<p>If you want all of your activities to provide the search dialog, add another {@code
-&lt;meta-data&gt;} element inside the {@code
-&lt;application&gt;} element. Use this element to declare the existing searchable Activity as the
-default searchable Activity. For example:</p>
-
-<pre>
-&lt;application ... >
-    &lt;activity android:name=".MySearchableActivity" >
-        &lt;intent-filter>
-            &lt;action android:name="android.intent.action.SEARCH" />
-        &lt;/intent-filter>
-        &lt;meta-data android:name="android.app.searchable"
-                   android:resource="@xml/searchable"/>
-    &lt;/activity>
-    &lt;activity android:name=".AnotherActivity" ... >
-    &lt;/activity>
-    &lt;!-- declare the default searchable Activity for the whole app --&gt;
-    <b>&lt;meta-data android:name="android.app.default_searchable"
-               android:value=".MySearchableActivity" /&gt;</b>
-    ...
-&lt;/application>
-</pre>
-
-<p>The {@code &lt;meta-data&gt;} element with the {@code android:name} attribute value of
-{@code "android.app.default_searchable"} specifies a default searchable Activity for the context in
-which it is placed (which, in this case, is the entire application). The searchable Activity to
-use is specified with the {@code android:value} attribute. All other activities in the
-application, such as {@code AnotherActivity}, are now considered a searchable context and can invoke
-the search dialog. When a search is executed, {@code MySearchableActivity} is launched to handle
-the search query.</p>
-
-<p>You can also control which activities provide search at a more granular level.
-To specify only an individual Activity as a searchable context, place the {@code
-&lt;meta-data&gt;} with the {@code
-"android.app.default_searchable"} name inside the respective {@code &lt;activity&gt;}
-element (rather than inside the {@code &lt;application&gt;} element). While uncommon, you
-can also create more than one searchable Activity and provide each one in different contexts of your
-application, either by declaring a different searchable Activity in each {@code &lt;activity&gt;}
-element, or by declaring a default searchable Activity for the entire application and then
-overriding it with a {@code &lt;meta-data&gt;} element inside certain activities. (You might do
-this if you want to search different sets of data that cannot be handled by the same
-searchable Activity, depending on the currently open Activity.)</p>
 
 
 <h3 id="PerformingSearch">Performing a search</h3>
 
-<p>Once you have declared your searchable Activity, performing a search for the user involves
-three steps:</p>
+<p>Once you have declared your searchable activity in the manifest, performing a search in your
+searchable activity involves three steps:</p>
+
 <ol>
   <li><a href="#ReceivingTheQuery">Receiving the query</a></li>
   <li><a href="#SearchingYourData">Searching your data</a></li>
@@ -253,20 +283,19 @@
 </ol>
 
 <p>Traditionally, your search results should be presented in a {@link android.widget.ListView}, so
-you might want your searchable Activity to extend {@link android.app.ListActivity}, which
-provides easy access to {@link android.widget.ListView} APIs. (See the <a
-href="{@docRoot}resources/tutorials/views/hello-listview.html">List View Tutorial</a> for a simple
-{@link android.app.ListActivity} sample.)</p>
+you might want your searchable activity to extend {@link android.app.ListActivity}. It includes
+a default layout with a single {@link android.widget.ListView} and provides several
+convenience methods for working with the {@link android.widget.ListView}.</p>
 
 
 <h4 id="ReceivingTheQuery">Receiving the query</h4>
 
-<p>When a user executes a search from the search dialog, the Search Manager sends the {@link
-android.content.Intent#ACTION_SEARCH} {@link android.content.Intent} to your searchable Activity.
-This Intent carries the search query in the
+<p>When a user executes a search from the search dialog or widget, the system starts your
+searchable activity and sends it a {@link android.content.Intent#ACTION_SEARCH} intent. This intent
+carries the search query in the
 {@link android.app.SearchManager#QUERY QUERY} string extra. You must check for
-this Intent when the Activity starts and extract the string. For example, here's how you can get the
-query when your Activity starts:</p>
+this intent when the activity starts and extract the string. For example, here's how you can get the
+search query when your searchable activity starts:</p>
 
 <pre>
 &#64;Override
@@ -274,8 +303,8 @@
     super.onCreate(savedInstanceState);
     setContentView(R.layout.search);
 
+    // Get the intent, verify the action and get the query
     Intent intent = getIntent();
-
     if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
       String query = intent.getStringExtra(SearchManager.QUERY);
       doMySearch(query);
@@ -284,7 +313,7 @@
 </pre>
 
 <p>The {@link android.app.SearchManager#QUERY QUERY} string is always included with
-the {@link android.content.Intent#ACTION_SEARCH} Intent. In this example, the query is
+the {@link android.content.Intent#ACTION_SEARCH} intent. In this example, the query is
 retrieved and passed to a local {@code doMySearch()} method where the actual search operation
 is done.</p>
 
@@ -294,12 +323,13 @@
 <p>The process of storing and searching your data is unique to your application.
 You can store and search your data in many ways, but this guide does not show you how to store your
 data and search it. Storing and searching your data is something you should carefully consider in
-terms of your needs and your data. However, here are some tips you might be able to apply:</p>
+terms of your needs and your data format. However, here are some tips you might be able to
+apply:</p>
 
   <ul>
     <li>If your data is stored in a SQLite database on the device, performing a full-text search
-(using FTS3, rather than a LIKE query) can provide a more robust search across text data and can
-produce results significantly faster. See <a href="http://sqlite.org/fts3.html">sqlite.org</a>
+(using FTS3, rather than a {@code LIKE} query) can provide a more robust search across text data and
+can produce results significantly faster. See <a href="http://sqlite.org/fts3.html">sqlite.org</a>
 for information about FTS3 and the {@link android.database.sqlite.SQLiteDatabase} class for
 information about SQLite on Android. Also look at the <a
 href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable Dictionary</a> sample
@@ -307,43 +337,45 @@
     <li>If your data is stored online, then the perceived search performance might be
 inhibited by the user's data connection. You might want to display a spinning progress wheel until
 your search returns. See {@link android.net} for a reference of network APIs and <a
-href="{@docRoot}guide/topics/ui/dialogs.html#ProgressDialog">Creating a Progress Dialog</a> to see
-how you can display a progress wheel.</li>
+href="{@docRoot}guide/topics/ui/dialogs.html#ProgressDialog">Creating a Progress Dialog</a>
+for information about how to display a progress wheel.</li>
   </ul>
 
 
 <div class="sidebox-wrapper">
 <div class="sidebox">
 <h2>About Adapters</h2>
-<p>An Adapter binds individual items from a set of data into individual {@link
-android.view.View} objects. When the Adapter
-is applied to a {@link android.widget.ListView}, the Views are injected as individual items of the
-list. {@link
-android.widget.Adapter} is simply an interface, so implementations such as {@link
+<p>An {@link android.widget.Adapter} binds each item from a set of data into a
+{@link android.view.View} object. When the {@link android.widget.Adapter}
+is applied to a {@link android.widget.ListView}, each piece of data is inserted as an individual
+view into the list. {@link
+android.widget.Adapter} is just an interface, so implementations such as {@link
 android.widget.CursorAdapter} (for binding data from a {@link android.database.Cursor}) are needed.
-If none of the existing implementations work for your data, then you should implement your own from
+If none of the existing implementations work for your data, then you can implement your own from
 {@link android.widget.BaseAdapter}. Install the SDK Samples package for API Level 4 to see the
-original version of the Searchable Dictionary, which creates a custom BaseAdapter.</p>
+original version of the Searchable Dictionary, which creates a custom adapter to read data from
+a file.</p>
 </div>
 </div>
 
 <p>Regardless of where your data lives and how you search it, we recommend that you return search
-results to your searchable Activity with an {@link android.widget.Adapter}. This way, you can easily
+results to your searchable activity with an {@link android.widget.Adapter}. This way, you can easily
 present all the search results in a {@link android.widget.ListView}. If your data comes from a
-SQLite database query, then you can apply your results to a {@link android.widget.ListView}
+SQLite database query, you can apply your results to a {@link android.widget.ListView}
 using a {@link android.widget.CursorAdapter}. If your data comes in some other type of format, then
-you can create an extension of the {@link android.widget.BaseAdapter}.</p>
+you can create an extension of {@link android.widget.BaseAdapter}.</p>
+
 
 <h4 id="PresentingTheResults">Presenting the results</h4>
 
-<p>Presenting your search results is mostly a UI detail that is not handled by the search APIs.
-However, one option is to create your searchable Activity to extend {@link
-android.app.ListActivity} and call {@link
-android.app.ListActivity#setListAdapter(ListAdapter)}, passing it an {@link
+<p>As discussed above, the recommended UI for your search results is a {@link
+android.widget.ListView}, so you might want your searchable activity to extend {@link
+android.app.ListActivity}. You can then call {@link
+android.app.ListActivity#setListAdapter(ListAdapter) setListAdapter()}, passing it an {@link
 android.widget.Adapter} that is bound to your data. This injects all the
-results into the Activity {@link android.widget.ListView}.</p>
+search results into the activity {@link android.widget.ListView}.</p>
 
-<p>For more help presenting your results, see the {@link android.app.ListActivity}
+<p>For more help presenting your results in a list, see the {@link android.app.ListActivity}
 documentation.</p>
 
 <p>Also see the <a
@@ -353,22 +385,130 @@
 
 
 
-<h2 id="InvokingTheSearchDialog">Invoking the Search Dialog</h2>
 
-<p>Once you have a searchable Activity, invoking the search dialog is easy. Many Android
-devices provide a dedicated SEARCH key, which reveals the search dialog when the user presses it
-from a searchable context of your application. However, you should not assume that a SEARCH
-key is available on the user's device and should always provide a search button in your UI that
-invokes search.</p>
 
-<p>To invoke search from your Activity, call {@link android.app.Activity#onSearchRequested()}.</p>
+<h2 id="SearchDialog">Using the Search Dialog</h2>
 
-<p>For instance, you should provide a menu item in your <a
-href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or a button in your UI to
-invoke search with this method. The <a
+<div class="sidebox-wrapper">
+<div class="sidebox">
+  <h2>Should I use the search dialog or the widget?</h2>
+  <p>The answer depends mostly on whether you are developing for Android 3.0 (API Level 11 or
+higher), because the {@link android.widget.SearchView} widget was introduced in Android 3.0. So,
+if you are developing your application for a version of Android lower than 3.0, the search widget is
+not an option and you should use the search dialog to implement your search interface.</p>
+  <p>If you <em>are</em> developing for Android 3.0 or higher, then the decision depends more on
+your needs. In most cases, we recommend that you use the search widget as an "action view" in the
+Action Bar. However, it might not be an option for you to put the search
+widget in the Action Bar for some reason (perhaps there's not enough space or you don't use the
+Action Bar). So, you might instead want to put the search widget somewhere in your activity layout.
+And if all else fails, you can still use the search dialog if you prefer to keep the search box
+hidden. In fact, you might want to offer both the dialog and the widget in some cases. For more
+information about the widget, skip to <a href="#UsingSearchWidget">Using the Search Widget</a>.</p>
+</div>
+</div>
+
+<p>The search dialog provides a floating search box at the top of the screen, with the application
+icon on the left. The search dialog can provide search suggestions as the user types and, when
+the user executes a search, the system sends the search query to a
+searchable activity that performs the search. However, if you are developing
+your application for devices running Android 3.0, you should consider using the search widget
+instead (see the side box).</p>
+
+<p>The search dialog is always hidden by default, until the user activates it. If the user's device
+includes a SEARCH button, pressing it will activate the search dialog by default. Your application
+can also activate the search dialog on demand by calling {@link
+android.app.Activity#onSearchRequested onSearchRequested()}. However, neither of these work
+until you enable the search dialog for the activity.</p>
+
+<p>To enable the search dialog, you must indicate to the system which searchable activity should
+receive search queries from the search dialog, in order to perform searches. For example, in the
+previous section about <a href="#SearchableActivity">Creating a Searchable Activity</a>, a
+searchable activity named {@code SearchableActivity} was created. If you want a separate activity,
+named {@code OtherActivity}, to show the search dialog and deliver searches to {@code
+SearchableActivity}, you must declare in the manifest that {@code SearchableActivity} is the
+searchable activity to use for the search dialog in {@code OtherActivity}.</p>
+
+<p>To declare the searchable activity for an activity's search dialog,
+add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element inside the respective activity's <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element.
+The <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element must include the {@code android:value} attribute that specifies the searchable activity's
+class name and the {@code android:name} attribute with a value of {@code
+"android.app.default_searchable"}.</p>
+
+<p>For example, here is the declaration for
+both a searchable activity, {@code SearchableActivity}, and another activity, {@code
+OtherActivity}, which uses {@code SearchableActivity} to perform searches executed from its
+search dialog:</p>
+
+<pre>
+&lt;application ... >
+    &lt;!-- this is the searchable activity; it performs searches --&gt;
+    &lt;activity android:name=".SearchableActivity" >
+        &lt;intent-filter>
+            &lt;action android:name="android.intent.action.SEARCH" />
+        &lt;/intent-filter>
+        &lt;meta-data android:name="android.app.searchable"
+                   android:resource="@xml/searchable"/>
+    &lt;/activity>
+
+    &lt;!-- this activity enables the search dialog to initiate searches
+         in the SearchableActivity --&gt;
+    &lt;activity android:name=".OtherActivity" ... >
+        &lt;!-- enable the search dialog to send searches to SearchableActivity -->
+        <b>&lt;meta-data android:name="android.app.default_searchable"
+                   android:value=".SearchableActivity" /&gt;</b>
+    &lt;/activity>
+    ...
+&lt;/application>
+</pre>
+
+<p>Because the {@code OtherActivity} now includes a <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element to declare which searchable activity to use for searches, the activity has enabled the
+search dialog.
+While the user is in this activity, the device SEARCH button (if available) and the {@link
+android.app.Activity#onSearchRequested onSearchRequested()} method will activate the search dialog.
+When the user executes the search, the system starts {@code SearchableActivity} and delivers it
+the {@link android.content.Intent#ACTION_SEARCH} intent.</p>
+
+<p class="note"><strong>Note:</strong> The searchable activity itself provides the search dialog
+by default, so you don't need to add this declaration to {@code SearchableActivity}.</p>
+
+<p>If you want every activity in your application to provide the search dialog, insert the above <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element as a child of the <a
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+element, instead of each <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>. This
+way, every activity inherits the value, provides the search dialog, and delivers searches to
+the same searchable activity. (If you have multiple searchable activities, you can override the
+default searchable activity by placing a different <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+declaration inside individual activities.)</p>
+
+<p>With the search dialog now enabled for your activities, your application is ready to perform
+searches.</p>
+
+
+<h3 id="InvokingTheSearchDialog">Invoking the search dialog</h3>
+
+<p>As mentioned above, the device SEARCH button and {@link android.app.Activity#onSearchRequested
+onSearchRequested()} method will open the search dialog, as long as the current activity
+has declared the searchable activity to use, as shown in the previous section.</p>
+
+<p>However, you should not assume that a SEARCH button is available on the user's device. You
+should always provide another search button in your UI that activates the search dialog by calling
+{@link android.app.Activity#onSearchRequested()}.</p>
+
+<p>For instance, you should either provide a menu item in your <a
+href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or a button in your
+activity layout that
+activates search by calling {@link android.app.Activity#onSearchRequested()}. The <a
 href="{@docRoot}shareables/search_icons.zip">search_icons.zip</a> file includes icons for
-medium and high density screens, which you can use for your search menu item or button (low density
-screens automatically scale-down the hdpi image by one half). </p>
+medium and high density screens, which you can use for your search menu item or button (low-density
+screens scale-down the hdpi image by one half). </p>
 
 <!-- ... maybe this should go into the Creating Menus document ....
 <p>If you chose to provide a shortcut key for the menu item,  using {@link
@@ -376,27 +516,28 @@
 key character, representing the default search key.</p>
 -->
 
-<p>You can also enable "type-to-search" functionality, which reveals the search dialog when the
-user starts typing on the keyboard and the keystrokes are inserted into the search dialog. You can
-enable type-to-search in your Activity by calling
+<p>You can also enable "type-to-search" functionality, which activates the search dialog when the
+user starts typing on the keyboard&mdash;the keystrokes are inserted into the search dialog. You can
+enable type-to-search in your activity by calling
 {@link android.app.Activity#setDefaultKeyMode(int) setDefaultKeyMode}({@link
-android.app.Activity#DEFAULT_KEYS_SEARCH_LOCAL}) during your Activity's
+android.app.Activity#DEFAULT_KEYS_SEARCH_LOCAL}) during your activity's
 {@link android.app.Activity#onCreate(Bundle) onCreate()} method.</p>
 
 
-<h3 id="LifeCycle">The impact of the search dialog on your Activity lifecycle</h3>
+<h3 id="LifeCycle">The impact of the search dialog on your activity lifecycle</h3>
 
 <p>The search dialog is a {@link android.app.Dialog} that floats at the top of the
-screen. It does not cause any change in the Activity stack, so when the search dialog appears, no
-lifecycle methods for the currently open Activity (such as {@link
-android.app.Activity#onPause()}) are called. Your Activity just loses input focus as it is given to
-the search dialog.
+screen. It does not cause any change in the activity stack, so when the search dialog appears, no
+lifecycle methods (such as {@link android.app.Activity#onPause()}) are called. Your activity just
+loses input focus, as input focus is given to the search dialog.
 </p>
 
-<p>If you want to be notified when search is invoked, override the {@link
-android.app.Activity#onSearchRequested()} method. When the system calls this method, you can do any
-work you want to when your Activity looses input focus to the search dialog (such as pause
-animations). Unless you are <a href="#SearchContextData">passing search context data</a>
+<p>If you want to be notified when the search dialog is activated, override the {@link
+android.app.Activity#onSearchRequested()} method. When the system calls this method, it is an
+indication that your activity has lost input focus to the search dialog, so you can do any
+work appropriate for the event (such as pause
+a game). Unless you are <a
+href="#SearchContextData">passing search context data</a>
 (discussed below), you should end the method by calling the super class implementation. For
 example:</p>
 
@@ -408,8 +549,8 @@
 }
 </pre>
 
-<p>If the user cancels search by pressing the BACK key, the Activity in which search was
-invoked re-gains input focus. You can register to be notified when the search dialog is
+<p>If the user cancels search by pressing the BACK button, the search dialog closes and the activity
+regains input focus. You can register to be notified when the search dialog is
 closed with {@link android.app.SearchManager#setOnDismissListener(SearchManager.OnDismissListener)
 setOnDismissListener()}
 and/or {@link android.app.SearchManager#setOnCancelListener(SearchManager.OnCancelListener)
@@ -420,25 +561,26 @@
 user explicitly exited the search dialog, so it is not called when a search is executed (in which
 case, the search dialog naturally disappears).</p>
 
-<p>If the current Activity is not the searchable Activity, then the normal Activity lifecycle
-events are triggered once the user executes a search (the current Activity receives {@link
+<p>If the current activity is not the searchable activity, then the normal activity lifecycle
+events are triggered once the user executes a search (the current activity receives {@link
 android.app.Activity#onPause()} and so forth, as
-described in <a href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
-document). If, however, the current Activity is the searchable Activity, then one of two
+described in the <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
+document). If, however, the current activity is the searchable activity, then one of two
 things happens:</p>
 
 <ol type="a">
-  <li>By default, the searchable Activity receives the {@link
-android.content.Intent#ACTION_SEARCH} Intent with a call to {@link
+  <li>By default, the searchable activity receives the {@link
+android.content.Intent#ACTION_SEARCH} intent with a call to {@link
 android.app.Activity#onCreate(Bundle) onCreate()} and a new instance of the
-Activity is brought to the top of the Activity stack. There are now two instances of your
-searchable Activity in the Activity stack (so pressing the BACK key goes back to the previous
-instance of the searchable Activity, rather than exiting the searchable Activity).</li>
-  <li>If you set {@code android:launchMode} to "singleTop", then the
-searchable Activity receives the {@link android.content.Intent#ACTION_SEARCH} Intent with a call
+activity is brought to the top of the activity stack. There are now two instances of your
+searchable activity in the activity stack (so pressing the BACK button goes back to the previous
+instance of the searchable activity, rather than exiting the searchable activity).</li>
+  <li>If you set {@code android:launchMode} to <code>"singleTop"</code>, then the
+searchable activity receives the {@link android.content.Intent#ACTION_SEARCH} intent with a call
 to {@link android.app.Activity#onNewIntent(Intent)}, passing the new {@link
-android.content.Intent#ACTION_SEARCH} Intent here. For example, here's how you might handle
-this case, in which the searchable Activity's launch mode is "singleTop":
+android.content.Intent#ACTION_SEARCH} intent here. For example, here's how you might handle
+this case, in which the searchable activity's launch mode is <code>"singleTop"</code>:
 <pre>
 &#64;Override
 public void onCreate(Bundle savedInstanceState) {
@@ -463,29 +605,29 @@
 
 <p>Compared to the example code in the section about <a href="#PerformingSearch">Performing a
 Search</a>, all the code to handle the
-search Intent is now in the {@code handleIntent()} method, so that both {@link
+search intent is now in the {@code handleIntent()} method, so that both {@link
 android.app.Activity#onCreate(Bundle)
 onCreate()} and {@link android.app.Activity#onNewIntent(Intent) onNewIntent()} can execute it.</p>
 
-<p>When the system calls {@link android.app.Activity#onNewIntent(Intent)}, the Activity has
+<p>When the system calls {@link android.app.Activity#onNewIntent(Intent)}, the activity has
 not been restarted, so the {@link android.app.Activity#getIntent()} method
-returns the same Intent that was received with {@link
+returns the same intent that was received with {@link
 android.app.Activity#onCreate(Bundle) onCreate()}. This is why you should call {@link
 android.app.Activity#setIntent(Intent)} inside {@link
-android.app.Activity#onNewIntent(Intent)} (so that the Intent saved by the Activity is updated in
+android.app.Activity#onNewIntent(Intent)} (so that the intent saved by the activity is updated in
 case you call {@link android.app.Activity#getIntent()} in the future).</p>
 
 </li>
 </ol>
 
-<p>The second scenario using "singleTop" launch mode is usually ideal, because chances are good that
-once a search is done, the user will perform additional searches and it's a bad experience if your
-application creates multiple instances of the searchable Activity. So, we recommend that you set
-your searchable Activity to "singleTop" launch mode in the application
-manifest. For example:</p>
+<p>The second scenario using <code>"singleTop"</code> launch mode is usually ideal, because chances
+are good that once a search is done, the user will perform additional searches and it's a bad
+experience if your application creates multiple instances of the searchable activity. So, we
+recommend that you set your searchable activity to <code>"singleTop"</code> launch mode in the
+application manifest. For example:</p>
 
 <pre>
-&lt;activity android:name=".MySearchableActivity"
+&lt;activity android:name=".SearchableActivity"
           <b>android:launchMode="singleTop"</b> >
     &lt;intent-filter>
         &lt;action android:name="android.intent.action.SEARCH" />
@@ -497,57 +639,192 @@
 
 
 
-<h2 id="SearchContextData">Passing Search Context Data</h2>
+<h3 id="SearchContextData">Passing search context data</h3>
 
-<p>To refine your search criteria from the current Activity instead of depending only on the user's
-search query, you can provide additional data in the Intent that the Search Manager sends to your
-searchable Activity. In a simple case, you can make your refinements inside the searchable
-Activity, for every search made, but if your
-search criteria varies from one searchable context to another, then you can pass whatever data
-is necessary to refine your search in the {@link android.app.SearchManager#APP_DATA} {@link
-android.os.Bundle}, which is included in the {@link android.content.Intent#ACTION_SEARCH}
-Intent.</p>
+<p>In some cases, you can make necessary refinements to the search query inside the searchable
+activity, for every search made. However, if you want to refine your search criteria based on the
+activity from which the user is performing a search, you can provide additional data in the intent
+that the system sends to your searchable activity. You can pass the additional data in the {@link
+android.app.SearchManager#APP_DATA} {@link android.os.Bundle}, which is included in the {@link
+android.content.Intent#ACTION_SEARCH} intent.</p>
 
-<p>To pass this kind of data to your searchable Activity, override  {@link
-android.app.Activity#onSearchRequested()} method for the Activity in which search can be invoked.
+<p>To pass this kind of data to your searchable activity, override the {@link
+android.app.Activity#onSearchRequested()} method for the activity from which the user can perform a
+search, create a {@link android.os.Bundle} with the additional data, and call {@link
+android.app.Activity#startSearch startSearch()} to activate the search dialog.
 For example:</p>
 
 <pre>
 &#64;Override
 public boolean onSearchRequested() {
      Bundle appData = new Bundle();
-     appData.putBoolean(MySearchableActivity.JARGON, true);
+     appData.putBoolean(SearchableActivity.JARGON, true);
      startSearch(null, false, appData, false);
      return true;
  }
 </pre>
 
-<p>Returning "true" indicates that you have successfully handled this callback event. Then in your
-searchable Activity, you can extract the data placed inside {@code appdata} from the {@link
+<p>Returning "true" indicates that you have successfully handled this callback event and
+called {@link android.app.Activity#startSearch startSearch()} to activate
+the search dialog. Once the user submits a query, it's delivered to your
+searchable activity along with the data you've added. You can extract the extra data from the {@link
 android.app.SearchManager#APP_DATA} {@link android.os.Bundle} to refine the search. For example:</p>
 
 <pre>
 Bundle appData = getIntent().getBundleExtra(SearchManager.APP_DATA);
 if (appData != null) {
-    boolean jargon = appData.getBoolean(MySearchableActivity.JARGON);
+    boolean jargon = appData.getBoolean(SearchableActivity.JARGON);
 }
 </pre>
 
 <p class="caution"><strong>Caution:</strong> Never call the {@link
 android.app.Activity#startSearch(String,boolean,Bundle,boolean) startSearch()} method from outside
-the {@link android.app.Activity#onSearchRequested()} callback method. To invoke the search dialog
-in your Activity, always call {@link android.app.Activity#onSearchRequested()}. Otherwise, {@link
+the {@link android.app.Activity#onSearchRequested()} callback method. To activate the search dialog
+in your activity, always call {@link android.app.Activity#onSearchRequested()}. Otherwise, {@link
 android.app.Activity#onSearchRequested()} is not called and customizations (such as the addition of
 {@code appData} in the above example) are missed.</p>
 
 
+
+<h2 id="UsingSearchWidget">Using the Search Widget</h2>
+
+<div class="figure" style="width:429px;margin:0">
+  <img src="{@docRoot}images/ui/actionbar-actionview.png" alt="" />
+  <p class="img-caption"><strong>Figure 2.</strong> The {@link
+android.widget.SearchView} widget as an "action view" in the Action Bar.</p>
+</div>
+
+<p>The {@link android.widget.SearchView} widget is available in Android 3.0 and higher. If
+you're developing your application for Android 3.0 and have decided to use the search widget, we
+recommend that you insert the search widget as an <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view in the Action Bar</a>,
+instead of using the search dialog (and instead of placing the search widget in your activity
+layout). For example, figure 2 shows the search widget in the Action Bar.</p>
+
+<p>The search widget provides the same functionality as the search dialog. It starts the appropriate
+activity when the user executes a search, and it can provide search suggestions and perform voice
+search.</p>
+
+<p class="note"><strong>Note:</strong> When you use the search widget as an action view, you
+still might need to support using the search dialog, for cases in which the search widget does
+not fit in the Action Bar. See the following section about <a href="#UsingBoth">Using both
+the widget and the dialog</a>.</p>
+
+
+<h3 id="ConfiguringWidget">Configuring the search widget</h3>
+
+<p>After you've created a  <a href="#SearchableConfiguration">searchable configuration</a> and a <a
+href="#SearchableActivity">searchable activity</a>, as discussed above, you need to enable assisted
+search for each {@link android.widget.SearchView}. You can do so by calling {@link
+android.widget.SearchView#setSearchableInfo setSearchableInfo()} and passing it the {@link
+android.app.SearchableInfo} object that represents your searchable configuration.</p>
+
+<p>You can get a reference to the {@link android.app.SearchableInfo} by calling {@link
+android.app.SearchManager#getSearchableInfo getSearchableInfo()} on {@link
+android.app.SearchManager}.</p>
+
+<p>For example, if you're using a {@link android.widget.SearchView} as an action view in the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>, you should enable the widget
+during the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} callback:</p>
+
+<pre>
+&#64;Override
+public boolean onCreateOptionsMenu(Menu menu) {
+    // Inflate the options menu from XML
+    MenuInflater inflater = getMenuInflater();
+    inflater.inflate(R.menu.options_menu, menu);
+
+    // Get the SearchView and set the searchable configuration
+    SearchManager searchManager = (SearchManager) {@link android.app.Activity#getSystemService getSystemService}(Context.SEARCH_SERVICE);
+    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
+    searchView.setSearchableInfo(searchManager.getSearchableInfo({@link android.app.Activity#getComponentName()}));
+    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
+
+    return true;
+}
+</pre>
+
+<p>That's all you need. The search widget is now configured and the system will deliver search
+queries to your searchable activity. You can also enable <a href="#SearchSuggestions">search
+suggestions</a> for the search widget.</p>
+
+<p class="note"><strong>Note:</strong> If you want to handle all user input yourself, you can do so
+with some callback methods and event listeners. For more information, see the reference
+documentation for {@link android.widget.SearchView} and its nested interfaces for the
+appropriate event listeners.</p>
+
+<p>For more information about action views in the Action Bar, read <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">Using the Action Bar</a> (which
+includes sample code for adding a search widget as an action view).</p>
+
+
+<h3 id="WidgetFeatures">Other search widget features</h3>
+
+<p>The {@link android.widget.SearchView} widget allows for a few additional features you might
+want:</p>
+
+<dl>
+  <dt>A submit button</dt>
+  <dd>By default, there's no button to submit a search query, so the user must press the
+"Return" key on the keyboard to initiate a search. You can add a "submit" button by calling
+{@link android.widget.SearchView#setSubmitButtonEnabled setSubmitButtonEnabled(true)}.</dd>
+  <dt>Query refinement for search suggestions</dt>
+  <dd>When you've enabled search suggestions, you usually expect users to simply select a
+suggestion, but they might also want to refine the suggested search query. You can add a button
+alongside each suggestion that inserts the suggestion in the search box for refinement by the
+user, by calling {@link android.widget.SearchView#setQueryRefinementEnabled
+setQueryRefinementEnabled(true)}.</dd>
+  <dt>The ability to toggle the search box visibility</dt>
+  <dd>By default, the search widget is "iconified," meaning that it is represented only by a
+search icon (a magnifying glass), and expands to show the search box when the user touches it.
+As shown above, you can show the search box by default, by calling {@link
+android.widget.SearchView#setIconifiedByDefault setIconifiedByDefault(false)}. You can also
+toggle the search widget appearance by calling {@link android.widget.SearchView#setIconified
+setIconified()}.</dd>
+</dl>
+
+<p>There are several other APIs in the {@link android.widget.SearchView} class that allow you to
+customize the search widget. However, most of them are used only when you handle all
+user input yourself, instead of using the Android system to deliver search queries and display
+search suggestions.</p>
+
+
+<h3 id="UsingBoth">Using both the widget and the dialog</h3>
+
+<p>If you insert the search widget in the Action Bar as an <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view</a>, and you enable it to
+appear in the Action Bar "if there is room" (by setting {@code
+android:showAsAction="ifRoom"}), then there is a chance that the search widget will not appear
+as an action view, but the menu item will appear in the overflow menu. For example, when your
+application runs on a smaller screen, there might not be enough room in the Action Bar to display
+the search widget along with other action items or navigation elements, so the menu item will
+instead appear in the overflow menu. When placed in the overflow menu, the item works like an
+ordinary menu item and does not display the action view (the search widget).</p>
+
+<p>To handle this situation, the menu item to which you've attached the search widget should
+activate the search dialog when the user selects it from the overflow menu. In order for it to do
+so, you must implement {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} to
+handle the "Search" menu item and open the search dialog by calling {@link
+android.app.Activity#onSearchRequested onSearchRequested()}.</p>
+
+<p>For more information about how items in the Action Bar work and how to handle this situation, see
+the documentation for <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the Action
+Bar</a>.</p>
+
+<p>Also see the <a
+href="{@docRoot}resources/samples/SearchableDictionary/src/com/example/android/searchabledict/
+SearchableDictionary.html">Searchable Dictionary</a> for an example implementation using
+both the dialog and the widget.</p>
+
+
+
 <h2 id="VoiceSearch">Adding Voice Search</h2>
 
-<p>You can add voice search functionality to your search dialog by adding the {@code
+<p>You can add voice search functionality to your search dialog or widget by adding the {@code
 android:voiceSearchMode} attribute to your searchable configuration. This adds a voice search
-button in the search dialog that launches a voice prompt. When the user
+button that launches a voice prompt. When the user
 has finished speaking, the transcribed search query is sent to your searchable
-Activity.</p>
+activity.</p>
 
 <p>For example:</p>
 
@@ -562,7 +839,7 @@
 
 <p>The value {@code showVoiceSearchButton} is required to enable voice
 search, while the second value, {@code launchRecognizer}, specifies that the voice search button
-should launch a recognizer that returns the transcribed text to the searchable Activity.</p>
+should launch a recognizer that returns the transcribed text to the searchable activity.</p>
 
 <p>You can provide additional attributes to specify the voice search behavior, such
 as the language to be expected and the maximum number of results to return. See the <a
@@ -571,6 +848,38 @@
 
 <p class="note"><strong>Note:</strong> Carefully consider whether voice search is appropriate for
 your application. All searches performed with the voice search button are immediately sent to
-your searchable Activity without a chance for the user to review the transcribed query. Sufficiently
+your searchable activity without a chance for the user to review the transcribed query. Sufficiently
 test the voice recognition and ensure that it understands the types of queries that
 the user might submit inside your application.</p>
+
+
+
+<h2 id="SearchSuggestions">Adding Search Suggestions</h2>
+
+<div class="figure" style="width:250px;margin:0">
+<img src="{@docRoot}images/search/search-suggest-custom.png" alt="" height="417" />
+<p class="img-caption"><strong>Figure 3.</strong> Screenshot of a search dialog with custom
+search suggestions.</p>
+</div>
+
+<p>Both the search dialog and the search widget can provide search suggestions as the user
+types, with assistance from the Android system. The system manages the list of suggestions and
+handles the event when the user selects a suggestion.</p>
+
+<p>You can provide two kinds of search suggestions:</p>
+
+<dl>
+  <dt>Recent query search suggestions</dt>
+  <dd>These suggestions are simply words that the user previously used as search queries in
+your application.
+  <p>See <a href="adding-recent-query-suggestions.html">Adding Recent Query
+Suggestions</a>.</p></dd>
+  <dt>Custom search suggestions</dt>
+  <dd>These are search suggestions that you provide from your own data source, to help users
+immediately select the correct spelling or item they are searching for. Figure 3 shows an
+example of custom suggestions for a dictionary application&mdash;the user can select a suggestion
+to instantly go to the definition.
+  <p>See <a href="adding-custom-suggestions.html">Adding Custom
+Suggestions</a></p></dd>
+</dl>
+
diff --git a/docs/html/guide/topics/search/searchable-config.jd b/docs/html/guide/topics/search/searchable-config.jd
index 2aa2db6..fb689f9 100644
--- a/docs/html/guide/topics/search/searchable-config.jd
+++ b/docs/html/guide/topics/search/searchable-config.jd
@@ -7,19 +7,20 @@
 <div id="qv">
 <h2>See also</h2>
 <ol>
-  <li><a href="search-dialog.html">Using the Android Search Dialog</a></li>
+  <li><a href="search-dialog.html">Creating a Search Interface</a></li>
   <li><a href="adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
   <li><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
 </ol>
 </div>
 </div>
 
-<p>To utilize the Android search framework and provide a custom search dialog, your
-application must provide a search
-configuration in the form of an XML resource. This document describes the search configuration XML
-in terms of its syntax and usage. For more information about how to implement search
-features for your application, see the developer guide about <a
-href="index.html">Search</a>.</p>
+<p>In order to implement search with assistance from the Android system (to deliver search queries
+to an activity and provide search suggestions), your application must provide a search configuration
+in the form of an XML file.</p>
+
+<p>This page describes the search configuration file in terms of its syntax and usage. For more
+information about how to implement search features for your application, begin with the developer
+guide about <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 <dl class="xml">
 
@@ -66,7 +67,7 @@
 <dd>
 <dl class="tag-list">
   <dt id="searchable-element"><code>&lt;searchable&gt;</code></dt>
-  <dd>Defines all search configurations used with the search dialog.
+  <dd>Defines all search configurations used by the Android system to provide assisted search.
     <p class="caps">attributes:</p>
       <dl class="atn-list">
       <dt><code>android:label</code></dt>
@@ -86,21 +87,21 @@
 "Search songs and artists" or "Search YouTube".</dd>
 
       <dt><code>android:searchMode</code></dt>
-      <dd><em>Keyword</em>. Sets additional modes that control the search dialog presentation.
-Currently available modes define how the query text that appears in the search dialog
-should be rewritten when a custom suggestion receives focus. The following mode values are accepted:
+      <dd><em>Keyword</em>. Sets additional modes that control the search presentation.
+Currently available modes define how the query text should be rewritten when a custom suggestion
+receives focus. The following mode values are accepted:
         <table>
           <tr><th>Value</th><th>Description</th></tr>
           <tr>
             <td><code>"queryRewriteFromText"</code></td>
             <td>Use the value from the {@link android.app.SearchManager#SUGGEST_COLUMN_TEXT_1}
-colum to rewrite the query text in the search dialog.</td>
+column to rewrite the query text.</td>
           </tr>
           <tr>
             <td><code>"queryRewriteFromData"</code></td>
             <td>Use the value from the
             {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column to rewrite the
-query text in the search dialog. This should only be used when the values in
+query text. This should only be used when the values in
             {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} are suitable for user
 inspection and editing, typically HTTP URI's.</td>
           </tr>
@@ -117,7 +118,7 @@
 
       <dt><code>android:inputType</code></dt>
       <dd><em>Keyword</em>. Defines the type of input method (such as the type of soft keyboard)
-to use with the search dialog. For most searches, in which free-form text is expected, you don't 
+to use. For most searches, in which free-form text is expected, you don't 
 need this attribute. See {@link android.R.attr#inputType} for a list of suitable values for this
 attribute.</dd>
 
@@ -161,14 +162,14 @@
 selectionArgs} parameter (and then ignore the {@code selection} parameter).</dd>
 
       <dt><code>android:searchSuggestIntentAction</code></dt>
-        <dd><em>String</em>. The default Intent action to be used when a user
+        <dd><em>String</em>. The default intent action to be used when a user
         clicks on a custom search suggestion (such as {@code "android.intent.action.VIEW"}).
         If this is not overridden by the selected suggestion (via the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column), this value is placed in the action
 field of the {@link android.content.Intent} when the user clicks a suggestion.</dd>
 
       <dt><code>android:searchSuggestIntentData</code></dt>
-        <dd><em>String</em>. The default Intent data to be used when a user
+        <dd><em>String</em>. The default intent data to be used when a user
         clicks on a custom search suggestion.
         If not overridden by the selected suggestion (via the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column), this value is
@@ -177,7 +178,7 @@
 
       <dt><code>android:searchSuggestThreshold</code></dt>
         <dd><em>Integer</em>. The minimum number of characters needed to
-        trigger a suggestion look-up. Only guarantees that the Search Manager will not query your
+        trigger a suggestion look-up. Only guarantees that the system will not query your
         content provider for anything shorter than the threshold. The default value is 0.</dd>
       </dl>
 
@@ -210,20 +211,21 @@
         supersets of queries that have returned zero results in the past. For example, if
 your content provider returned zero results for "bo", it should be requiried for "bob". If set to
 "false", supersets are ignored for a single session ("bob" does not invoke a requery). This lasts
-only for the life of the search dialog (when the search dialog is reopened, "bo" queries your
+only for the life of the search dialog or the life of the activity when using the search widget
+(when the search dialog or activity is reopened, "bo" queries your
 content provider again). The default value is false.</dd>
       </dl>
 
 
     <h4>Voice search attributes</h4>
 
-    <p>To enable voice search for your search dialog, you'll need some of the
+    <p>To enable voice search, you'll need some of the
     following {@code &lt;searchable>} attributes:</p><br/>
 
       <dl class="atn-list">
         <dt><code>android:voiceSearchMode</code></dt>
         <dd><em>Keyword</em>. (Required to provide voice search capabilities.)
-          Enables voice search for the search dialog, with a specific mode for voice search.
+          Enables voice search, with a specific mode for voice search.
           (Voice search may not be provided by the device, in which case these flags
           have no effect.) The following mode values are accepted:
           <table>
@@ -238,14 +240,14 @@
               <td><code>"launchWebSearch"</code></td>
               <td>The voice search button takes the user directly
               to a built-in voice web search activity. Most applications don't need this flag, as
-              it takes the user away from the Activity in which search was invoked.</td>
+              it takes the user away from the activity in which search was invoked.</td>
             </tr>
             <tr>
               <td><code>"launchRecognizer"</code></td>
               <td>The voice search button takes
-              the user directly to a built-in voice recording activity. This Activity
+              the user directly to a built-in voice recording activity. This activity
               prompts the user to speak, transcribes the spoken text, and forwards the resulting
-              query text to the searchable Activity, just as if the user typed it into the
+              query text to the searchable activity, just as if the user typed it into the
               search UI and clicked the search button.</td>
             </tr>
           </table>
@@ -283,9 +285,9 @@
         <dt><code>android:voiceMaxResults</code></dt>
           <dd><em>Integer</em>. Forces the maximum number of results to return,
           including the "best" result which is always provided as the {@link
-android.content.Intent#ACTION_SEARCH} Intent's primary
+android.content.Intent#ACTION_SEARCH} intent's primary
           query. Must be 1 or greater. Use {@link android.speech.RecognizerIntent#EXTRA_RESULTS} to
-get the results from the Intent.
+get the results from the intent.
           If not provided, the recognizer chooses how many results to return.</dd>
       </dl>
   </dd> <!-- end searchable element -->
@@ -311,8 +313,8 @@
         <dd><em>String</em>. (Required.) A key code from {@link
 android.view.KeyEvent} that represents the action key
         you wish to respond to (for example {@code "KEYCODE_CALL"}). This is added to the
-        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} Intent that is passed to your
-        searchable Activity. To examine the key code, use
+        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} intent that is passed to your
+        searchable activity. To examine the key code, use
         {@link android.content.Intent#getIntExtra getIntExtra(SearchManager.ACTION_KEY)}. Not all
 keys are supported for a search action, as many of them are used for typing, navigation, or system
 functions.</dd>
@@ -320,15 +322,15 @@
       <dt><code>android:queryActionMsg</code></dt>
         <dd><em>String</em>. An action message to be sent if the action key is pressed while the
 user is entering query text. This is added to the
-        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} Intent that the Search Manager
-        passes to your searchable Activity. To examine the string, use
+        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} intent that the system
+        passes to your searchable activity. To examine the string, use
         {@link android.content.Intent#getStringExtra
         getStringExtra(SearchManager.ACTION_MSG)}.</dd>
 
       <dt><code>android:suggestActionMsg</code></dt>
         <dd><em>String</em>. An action message to be sent if the action key is pressed while a
         suggestion is in focus. This is added to the
-        Intent that that the Search Manager passes to your searchable Activity (using the action
+        intent that that the system passes to your searchable activity (using the action
 you've defined for the suggestion). To examine the string,
         use {@link android.content.Intent#getStringExtra 
         getStringExtra(SearchManager.ACTION_MSG)}. This should only be used if all your
@@ -344,10 +346,10 @@
 your content provider provides its own action message.
         <p>First, you must define a column in your
 content provider for each suggestion to provide an action message, then provide the name of that
-column in this attribute. The Search Manager looks at your suggestion cursor,
+column in this attribute. The system looks at your suggestion cursor,
         using the string provided here to select your action message column, and
         then select the action message string from the Cursor. That string is added to the
-        Intent that the Search Manager passes to your searchable Activity (using the action you've
+        intent that the system passes to your searchable activity (using the action you've
 defined for suggestions). To examine the string, use {@link
 android.content.Intent#getStringExtra getStringExtra(SearchManager.ACTION_MSG)}. If the data
 does not exist for the selected suggestion, the action key is ignored.</dd>
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index 065f95a..d8898ae3e 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -323,8 +323,7 @@
 
 <p>When adding an action view for a menu item, it's important that you still allow the item to
 behave as a normal menu item when it does not appear in the Action Bar. For example, a menu item to
-perform a search should, by default, bring up the <a
-href="{@docRoot}guide/topics/search/search-dialog.html">search dialog</a>, but if the item is
+perform a search should, by default, bring up the Android search dialog, but if the item is
 placed in the Action Bar, the action view appears with a {@link android.widget.SearchView}
 widget. Figure 4 shows an example of  the {@link android.widget.SearchView} widget in an action
 view.</p>
@@ -369,9 +368,7 @@
 <p>Now, when the menu item is displayed as an action item, it's action view appears instead of
 the icon and/or title text. However, if there's not enough room in the Action Bar, the item appears
 in the overflow menu as a normal menu item and you must respond to it from the {@link
-android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method. (For a
-guide to providing search functionality, see the <a
-href="{@docRoot}guide/topics/search/index.html">Search</a> documentation.)</p>
+android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method.</p>
 
 <p>When the activity first starts, the system populates the Action Bar and overflow menu by calling
 {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()}.
@@ -392,8 +389,8 @@
 }
 </pre>
 
-<p>For more information about enabling search in the Action Bar, see the <a
-href="{@docRoot}guide/topics/search/index.html">Search</a> developer guide.</p>
+<p>For more information about using the search widget, see <a
+href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 
diff --git a/docs/html/index.jd b/docs/html/index.jd
index f1bb59f..7fcd7b6 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -13,7 +13,7 @@
                             <!-- total max width is 520px -->
                                   <img src="{@docRoot}assets/images/home/GDC2011.png" alt="Android at GDC 2011" width="203px" style="padding-left:22px;padding-bottom:28px;padding-top:22px;"/>
                                   <div id="announcement" style="width:275px">
-    <p>Android will be at the <a href="http://www.gdconf.com/">2011 Game Developers Conference</a> in San Francisco, from March 1st to 4th. We're looking forward to seeing you there!</p>
+    <p>Thanks to everyone who visited us at the <a href="http://www.gdconf.com/">Game Developers Conference</a> in San Francisco. We're looking forward to seeing your games running on Android!</p>
     <p><a href="http://android-developers.blogspot.com/2011/02/heading-for-gdc.html">Learn more &raquo;</a></p>
                                 </div> <!-- end annoucement -->
                             </div> <!-- end annoucement-block -->
diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd
index 6c087bb..f88c3a6 100644
--- a/docs/html/sdk/android-3.0.jd
+++ b/docs/html/sdk/android-3.0.jd
@@ -556,11 +556,10 @@
 menu.</p></li>
     
     <li>{@link android.widget.SearchView}
-    <p>Provides a search box that works in conjunction with the Search Manager (in the same manner
-as the traditional <a href="{@docRoot}guide/topics/search/search-dialog.html">search dialog</a>). It
-can also display recent query suggestions or custom suggestions as configured by the search
-provider. This widget is particularly useful for offering search in the <a
-href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>.</p></li>
+    <p>Provides a search box that you can configure to deliver search queries to a specified
+activity and display search suggestions (in the same manner as the traditional search dialog). This
+widget is particularly useful for offering a search widget in the Action Bar. For more information,
+see <a href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</p>.</li>
     
     <li>{@link android.widget.StackView}
     <p>A view that displays its children in a 3D stack and allows users to swipe through
diff --git a/docs/html/sdk/eclipse-adt.jd b/docs/html/sdk/eclipse-adt.jd
index 97717fe..ece9d4a 100644
--- a/docs/html/sdk/eclipse-adt.jd
+++ b/docs/html/sdk/eclipse-adt.jd
@@ -1,8 +1,8 @@
 page.title=ADT Plugin for Eclipse
-adt.zip.version=10.0.0
-adt.zip.download=ADT-10.0.0.zip
-adt.zip.bytes=4243777
-adt.zip.checksum=bf88bff62bc45c3b6d062e2beed67765
+adt.zip.version=10.0.1
+adt.zip.download=ADT-10.0.1.zip
+adt.zip.bytes=5096182
+adt.zip.checksum=e26a77db08377bdd2e62edeb9a3e3701
 
 @jd:body
 
@@ -33,7 +33,7 @@
 <p>ADT extends the capabilities of Eclipse to let you quickly set up new Android
 projects, create an application UI, add components based on the Android
 Framework API, debug your applications using the Android SDK tools, and even
-export signed (or unsigned) APKs in order to distribute your application.</p>
+export signed (or unsigned) {@code .apk} files in order to distribute your application.</p>
 
 <p>Developing in Eclipse with ADT is highly recommended and is the fastest way
 to get started. With the guided project setup it provides, as well as tools
@@ -100,6 +100,36 @@
   <a href="#" onclick="return toggleDiv(this)">
         <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px"
 width="9px" />
+ADT 10.0.1</a> <em>(March 2011)</em>
+  <div class="toggleme">
+
+<dl>
+
+<dt>Dependencies:</dt>
+
+<dd>ADT 10.0.1 is designed for use with SDK Tools r10. If you haven't
+already installed SDK Tools r10 into your SDK, use the Android SDK and AVD Manager to do
+so.</dd>
+
+<dt>General notes:</dt>
+<dd>
+  <ul>
+    <li>Temporary work-around to resolve the rare cases in which the layout editor will
+not open.</li>
+    <li>Fix issue in which ADT 10.0.0 would install on Eclipse 3.4 and lower, even though ADT
+requires Eclipse 3.5 or higher (as of 10.0.0).</li>
+  </ul>
+</dd>
+</dl>
+</div>
+</div>
+
+
+
+<div class="toggleable closed">
+  <a href="#" onclick="return toggleDiv(this)">
+        <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px"
+width="9px" />
 ADT 10.0.0</a> <em>(February 2011)</em>
   <div class="toggleme">
 
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index a1c26db..6b9a5ce 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -129,7 +129,7 @@
       <span style="display:none" class="zh-TW"></span>
       </h2>
     <ul>
-      <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 10.0.0
+      <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 10.0.1
       <span style="display:none" class="de"></span>
       <span style="display:none" class="es"></span>
       <span style="display:none" class="fr"></span>
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index 305bafc..1eee5f2 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -119,7 +119,7 @@
 
 status_t DrmManager::setDrmServiceListener(
             int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
-    Mutex::Autolock _l(mLock);
+    Mutex::Autolock _l(mListenerLock);
     if (NULL != drmServiceListener.get()) {
         mServiceListeners.add(uniqueId, drmServiceListener);
     } else {
@@ -573,7 +573,7 @@
 }
 
 void DrmManager::onInfo(const DrmInfoEvent& event) {
-    Mutex::Autolock _l(mLock);
+    Mutex::Autolock _l(mListenerLock);
     for (unsigned int index = 0; index < mServiceListeners.size(); index++) {
         int uniqueId = mServiceListeners.keyAt(index);
 
diff --git a/drm/java/android/drm/DrmErrorEvent.java b/drm/java/android/drm/DrmErrorEvent.java
index 20fd8aa..90adb47f 100644
--- a/drm/java/android/drm/DrmErrorEvent.java
+++ b/drm/java/android/drm/DrmErrorEvent.java
@@ -53,6 +53,10 @@
      * associated with all DRM schemes.
      */
     public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
+    /**
+     * TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
+     */
+    public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
 
     /**
      * constructor to create DrmErrorEvent object with given parameters
diff --git a/drm/java/android/drm/DrmInfoEvent.java b/drm/java/android/drm/DrmInfoEvent.java
index a778e06..72f37ea 100644
--- a/drm/java/android/drm/DrmInfoEvent.java
+++ b/drm/java/android/drm/DrmInfoEvent.java
@@ -45,6 +45,10 @@
      * already done for the given account.
      */
     public static final int TYPE_ACCOUNT_ALREADY_REGISTERED = 5;
+    /**
+     * TYPE_RIGHTS_REMOVED, when the rights has been removed.
+     */
+    public static final int TYPE_RIGHTS_REMOVED = 6;
 
     /**
      * constructor to create DrmInfoEvent object with given parameters
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index 782ffdb..aa56159 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -181,7 +181,7 @@
         }
 
         public void handleMessage(Message msg) {
-            DrmInfoEvent event = null;
+            DrmInfoEvent info = null;
             DrmErrorEvent error = null;
 
             switch (msg.what) {
@@ -197,11 +197,15 @@
                     } catch (IOException e) {
                         e.printStackTrace();
                     }
-                    event = new DrmInfoEvent(uniqueId, infoType, message);
+                    info = new DrmInfoEvent(uniqueId, infoType, message);
                     break;
                 }
-                case DrmInfoEvent.TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT: {
-                    event = new DrmInfoEvent(uniqueId, infoType, message);
+                case DrmInfoEvent.TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT:
+                case DrmInfoEvent.TYPE_RIGHTS_INSTALLED:
+                case DrmInfoEvent.TYPE_WAIT_FOR_RIGHTS:
+                case DrmInfoEvent.TYPE_ACCOUNT_ALREADY_REGISTERED:
+                case DrmInfoEvent.TYPE_RIGHTS_REMOVED: {
+                    info = new DrmInfoEvent(uniqueId, infoType, message);
                     break;
                 }
                 default:
@@ -209,8 +213,8 @@
                     break;
                 }
 
-                if (null != mOnInfoListener && null != event) {
-                    mOnInfoListener.onInfo(DrmManagerClient.this, event);
+                if (null != mOnInfoListener && null != info) {
+                    mOnInfoListener.onInfo(DrmManagerClient.this, info);
                 }
                 if (null != mOnErrorListener && null != error) {
                     mOnErrorListener.onError(DrmManagerClient.this, error);
diff --git a/drm/jni/Android.mk b/drm/jni/Android.mk
index b65e4da..69bb48d 100644
--- a/drm/jni/Android.mk
+++ b/drm/jni/Android.mk
@@ -42,7 +42,7 @@
     $(TOP)/frameworks/base/drm/libdrmframework/plugins/common/include \
     $(TOP)/frameworks/base/include
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_MODULE_TAGS := optional
 
diff --git a/drm/libdrmframework/Android.mk b/drm/libdrmframework/Android.mk
index 99133ba..f1526a4 100644
--- a/drm/libdrmframework/Android.mk
+++ b/drm/libdrmframework/Android.mk
@@ -40,7 +40,7 @@
     $(TOP)/frameworks/base/drm/libdrmframework/include \
     $(TOP)/frameworks/base/include
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_MODULE_TAGS := optional
 
diff --git a/drm/libdrmframework/DrmManagerClient.cpp b/drm/libdrmframework/DrmManagerClient.cpp
index 3143d45..8b781326 100644
--- a/drm/libdrmframework/DrmManagerClient.cpp
+++ b/drm/libdrmframework/DrmManagerClient.cpp
@@ -79,7 +79,6 @@
 
 status_t DrmManagerClient::consumeRights(
             sp<DecryptHandle> &decryptHandle, int action, bool reserve) {
-    Mutex::Autolock _l(mDecryptLock);
     return mDrmManagerClientImpl->consumeRights(mUniqueId, decryptHandle, action, reserve);
 }
 
@@ -132,7 +131,6 @@
 
 status_t DrmManagerClient::initializeDecryptUnit(
             sp<DecryptHandle> &decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
-    Mutex::Autolock _l(mDecryptLock);
     return mDrmManagerClientImpl->initializeDecryptUnit(
             mUniqueId, decryptHandle, decryptUnitId, headerInfo);
 }
@@ -140,21 +138,18 @@
 status_t DrmManagerClient::decrypt(
             sp<DecryptHandle> &decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    Mutex::Autolock _l(mDecryptLock);
     return mDrmManagerClientImpl->decrypt(
             mUniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
 }
 
 status_t DrmManagerClient::finalizeDecryptUnit(
             sp<DecryptHandle> &decryptHandle, int decryptUnitId) {
-    Mutex::Autolock _l(mDecryptLock);
     return mDrmManagerClientImpl->finalizeDecryptUnit(mUniqueId,
             decryptHandle, decryptUnitId);
 }
 
 ssize_t DrmManagerClient::pread(
             sp<DecryptHandle> &decryptHandle, void* buffer, ssize_t numBytes, off64_t offset) {
-    Mutex::Autolock _l(mDecryptLock);
     return mDrmManagerClientImpl->pread(mUniqueId, decryptHandle, buffer, numBytes, offset);
 }
 
diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h
index e05366d..c7276f9 100644
--- a/drm/libdrmframework/include/DrmManager.h
+++ b/drm/libdrmframework/include/DrmManager.h
@@ -147,6 +147,7 @@
     int mDecryptSessionId;
     int mConvertId;
     Mutex mLock;
+    Mutex mListenerLock;
     Mutex mDecryptLock;
     Mutex mConvertLock;
     TPlugInManager<IDrmEngine> mPlugInManager;
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk
index af67aa3..9805a40 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk
@@ -47,7 +47,7 @@
     libfwdlock-converter \
     libfwdlock-decoder
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_C_INCLUDES += \
     $(JNI_H_INCLUDE) \
diff --git a/drm/libdrmframework/plugins/passthru/Android.mk b/drm/libdrmframework/plugins/passthru/Android.mk
index 7856d37..be18b64 100644
--- a/drm/libdrmframework/plugins/passthru/Android.mk
+++ b/drm/libdrmframework/plugins/passthru/Android.mk
@@ -32,7 +32,7 @@
  LOCAL_SHARED_LIBRARIES += libdl
 endif
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_C_INCLUDES += \
     $(TOP)/frameworks/base/drm/libdrmframework/include \
diff --git a/include/drm/DrmInfoEvent.h b/include/drm/DrmInfoEvent.h
index 7b409ff..add33d3 100644
--- a/include/drm/DrmInfoEvent.h
+++ b/include/drm/DrmInfoEvent.h
@@ -43,6 +43,8 @@
     //! TYPE_ACCOUNT_ALREADY_REGISTERED, when registration has been
     //! already done for the given account.
     static const int TYPE_ACCOUNT_ALREADY_REGISTERED = 5;
+    //! TYPE_RIGHTS_REMOVED, when the rights has been removed.
+    static const int TYPE_RIGHTS_REMOVED = 6;
 
     /**
      * The following constant values should be in sync with DrmErrorEvent.java
@@ -61,6 +63,11 @@
     static const int TYPE_NO_INTERNET_CONNECTION = 2005;
     //! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
     static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
+    //! TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects
+    //! associated with all DRM schemes.
+    static const int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
+    //! TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
+    static const int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
 
 public:
     /**
diff --git a/include/drm/DrmManagerClient.h b/include/drm/DrmManagerClient.h
index 044ff0e..5011137 100644
--- a/include/drm/DrmManagerClient.h
+++ b/include/drm/DrmManagerClient.h
@@ -368,7 +368,6 @@
 
 private:
     int mUniqueId;
-    Mutex mDecryptLock;
     DrmManagerClientImpl* mDrmManagerClientImpl;
 };
 
diff --git a/include/ui/Input.h b/include/ui/Input.h
index d9d77c4..e9cacf4 100644
--- a/include/ui/Input.h
+++ b/include/ui/Input.h
@@ -27,6 +27,7 @@
 #include <utils/Timers.h>
 #include <utils/RefBase.h>
 #include <utils/String8.h>
+#include <utils/BitSet.h>
 
 #ifdef HAVE_ANDROID_OS
 class SkMatrix;
@@ -208,6 +209,13 @@
     status_t writeToParcel(Parcel* parcel) const;
 #endif
 
+    bool operator==(const PointerCoords& other) const;
+    inline bool operator!=(const PointerCoords& other) const {
+        return !(*this == other);
+    }
+
+    void copyFrom(const PointerCoords& other);
+
 private:
     void tooManyAxes(int axis);
 };
@@ -543,6 +551,53 @@
 };
 
 /*
+ * Calculates the velocity of pointer motions over time.
+ * Uses essentially the same algorithm as android.view.VelocityTracker.
+ */
+class VelocityTracker {
+public:
+    struct Position {
+        float x, y;
+    };
+
+    VelocityTracker();
+
+    // Resets the velocity tracker state.
+    void clear();
+
+    // Adds movement information for a set of pointers.
+    // The idBits bitfield specifies the pointer ids of the pointers whose positions
+    // are included in the movement.
+    // The positions array contains position information for each pointer in order by
+    // increasing id.  Its size should be equal to the number of one bits in idBits.
+    void addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions);
+
+    // Gets the velocity of the specified pointer id in position units per second.
+    // Returns false and sets the velocity components to zero if there is no movement
+    // information for the pointer.
+    bool getVelocity(uint32_t id, float* outVx, float* outVy) const;
+
+private:
+    // Number of samples to keep.
+    static const uint32_t HISTORY_SIZE = 10;
+
+    // Oldest sample to consider when calculating the velocity.
+    static const nsecs_t MAX_AGE = 200 * 1000000; // 200 ms
+
+    // The minimum duration between samples when estimating velocity.
+    static const nsecs_t MIN_DURATION = 5 * 1000000; // 5 ms
+
+    struct Movement {
+        nsecs_t eventTime;
+        BitSet32 idBits;
+        Position positions[MAX_POINTERS];
+    };
+
+    uint32_t mIndex;
+    Movement mMovements[HISTORY_SIZE];
+};
+
+/*
  * Describes the characteristics and capabilities of an input device.
  */
 class InputDeviceInfo {
diff --git a/include/utils/BitSet.h b/include/utils/BitSet.h
index f5dbcd94..f03825a 100644
--- a/include/utils/BitSet.h
+++ b/include/utils/BitSet.h
@@ -61,6 +61,12 @@
     // Result is undefined if all bits are marked.
     inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); }
 
+    // Gets the index of the specified bit in the set, which is the number of
+    // marked bits that appear before the specified bit.
+    inline uint32_t getIndexOfBit(uint32_t n) const {
+        return __builtin_popcount(value & ~(0xffffffffUL >> n));
+    }
+
     inline bool operator== (const BitSet32& other) const { return value == other.value; }
     inline bool operator!= (const BitSet32& other) const { return value != other.value; }
 };
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 3bed959..5c6d71b 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -283,11 +283,42 @@
     sp<GraphicBuffer>& buf(mSlots[mCurrentTexture].mGraphicBuffer);
     float tx, ty, sx, sy;
     if (!mCurrentCrop.isEmpty()) {
-        tx = float(mCurrentCrop.left) / float(buf->getWidth());
-        ty = float(buf->getHeight() - mCurrentCrop.bottom) /
-                float(buf->getHeight());
-        sx = float(mCurrentCrop.width()) / float(buf->getWidth());
-        sy = float(mCurrentCrop.height()) / float(buf->getHeight());
+        // In order to prevent bilinear sampling at the of the crop rectangle we
+        // may need to shrink it by 2 texels in each direction.  Normally this
+        // would just need to take 1/2 a texel off each end, but because the
+        // chroma channels will likely be subsampled we need to chop off a whole
+        // texel.  This will cause artifacts if someone does nearest sampling
+        // with 1:1 pixel:texel ratio, but it's impossible to simultaneously
+        // accomodate the bilinear and nearest sampling uses.
+        //
+        // If nearest sampling turns out to be a desirable usage of these
+        // textures then we could add the ability to switch a SurfaceTexture to
+        // nearest-mode.  Preferably, however, the image producers (video
+        // decoder, camera, etc.) would simply not use a crop rectangle (or at
+        // least not tell the framework about it) so that the GPU can do the
+        // correct edge behavior.
+        int xshrink = 0, yshrink = 0;
+        if (mCurrentCrop.left > 0) {
+            tx = float(mCurrentCrop.left + 1) / float(buf->getWidth());
+            xshrink++;
+        } else {
+            tx = 0.0f;
+        }
+        if (mCurrentCrop.right < buf->getWidth()) {
+            xshrink++;
+        }
+        if (mCurrentCrop.bottom < buf->getHeight()) {
+            ty = (float(buf->getHeight() - mCurrentCrop.bottom) + 1.0f) /
+                    float(buf->getHeight());
+            yshrink++;
+        } else {
+            ty = 0.0f;
+        }
+        if (mCurrentCrop.top > 0) {
+            yshrink++;
+        }
+        sx = float(mCurrentCrop.width() - xshrink) / float(buf->getWidth());
+        sy = float(mCurrentCrop.height() - yshrink) / float(buf->getHeight());
     } else {
         tx = 0.0f;
         ty = 0.0f;
@@ -298,7 +329,7 @@
         sx, 0, 0, 0,
         0, sy, 0, 0,
         0, 0, 1, 0,
-        sx*tx, sy*ty, 0, 1,
+        tx, ty, 0, 1,
     };
 
     float mtxBeforeFlipV[16];
diff --git a/libs/gui/tests/Android.mk b/libs/gui/tests/Android.mk
index 1dd8885..7516299 100644
--- a/libs/gui/tests/Android.mk
+++ b/libs/gui/tests/Android.mk
@@ -4,39 +4,37 @@
 
 ifneq ($(TARGET_SIMULATOR),true)
 
-# Build the unit tests.
-test_src_files := \
-    SurfaceTextureClient_test.cpp \
+LOCAL_MODULE := SurfaceTexture_test
 
-shared_libraries := \
-	libcutils \
-	libutils \
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := \
+    SurfaceTextureClient_test.cpp \
+    SurfaceTexture_test.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+	libEGL \
+	libGLESv2 \
+	libandroid \
 	libbinder \
+	libcutils \
 	libgui \
 	libstlport \
+	libsurfaceflinger_client \
+	libui \
+	libutils \
 
-static_libraries := \
+LOCAL_STATIC_LIBRARIES := \
 	libgtest \
 	libgtest_main \
 
-c_includes := \
+LOCAL_C_INCLUDES := \
     bionic \
     bionic/libstdc++/include \
     external/gtest/include \
     external/stlport/stlport \
 
-module_tags := tests
-
-$(foreach file,$(test_src_files), \
-    $(eval include $(CLEAR_VARS)) \
-    $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
-    $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
-    $(eval LOCAL_C_INCLUDES := $(c_includes)) \
-    $(eval LOCAL_SRC_FILES := $(file)) \
-    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
-    $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
-    $(eval include $(BUILD_EXECUTABLE)) \
-)
+include $(BUILD_EXECUTABLE)
 
 # Build the manual test programs.
 include $(call all-subdir-makefiles)
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
new file mode 100644
index 0000000..4184463
--- /dev/null
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -0,0 +1,621 @@
+/*
+ * 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 <gtest/gtest.h>
+#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
+#include <ui/GraphicBuffer.h>
+#include <utils/String8.h>
+
+#include <surfaceflinger/ISurfaceComposer.h>
+#include <surfaceflinger/Surface.h>
+#include <surfaceflinger/SurfaceComposerClient.h>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <ui/FramebufferNativeWindow.h>
+
+namespace android {
+
+class GLTest : public ::testing::Test {
+protected:
+
+    GLTest():
+            mEglDisplay(EGL_NO_DISPLAY),
+            mEglSurface(EGL_NO_SURFACE),
+            mEglContext(EGL_NO_CONTEXT) {
+    }
+
+    virtual void SetUp() {
+        EGLBoolean returnValue;
+
+        mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
+
+        EGLint majorVersion;
+        EGLint minorVersion;
+        EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        RecordProperty("EglVersionMajor", majorVersion);
+        RecordProperty("EglVersionMajor", minorVersion);
+
+        EGLConfig myConfig = {0};
+        EGLint numConfigs = 0;
+        EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &myConfig,
+                1, &numConfigs));
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+        char* displaySecsEnv = getenv("GLTEST_DISPLAY_SECS");
+        if (displaySecsEnv != NULL) {
+            mDisplaySecs = atoi(displaySecsEnv);
+            if (mDisplaySecs < 0) {
+                mDisplaySecs = 0;
+            }
+        } else {
+            mDisplaySecs = 0;
+        }
+
+        if (mDisplaySecs > 0) {
+            mComposerClient = new SurfaceComposerClient;
+            ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
+
+            mSurfaceControl = mComposerClient->createSurface(getpid(),
+                    String8("Test Surface"), 0,
+                    getSurfaceWidth(), getSurfaceHeight(),
+                    PIXEL_FORMAT_RGB_888, 0);
+
+            ASSERT_TRUE(mSurfaceControl != NULL);
+            ASSERT_TRUE(mSurfaceControl->isValid());
+
+            ASSERT_EQ(NO_ERROR, mComposerClient->openTransaction());
+            ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(30000));
+            ASSERT_EQ(NO_ERROR, mSurfaceControl->show());
+            ASSERT_EQ(NO_ERROR, mComposerClient->closeTransaction());
+
+            sp<ANativeWindow> window = mSurfaceControl->getSurface();
+            mEglSurface = eglCreateWindowSurface(mEglDisplay, myConfig,
+                    window.get(), NULL);
+        } else {
+            EGLint pbufferAttribs[] = {
+                EGL_WIDTH, getSurfaceWidth(),
+                EGL_HEIGHT, getSurfaceHeight(),
+                EGL_NONE };
+
+            mEglSurface = eglCreatePbufferSurface(mEglDisplay, myConfig,
+                    pbufferAttribs);
+        }
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
+
+        mEglContext = eglCreateContext(mEglDisplay, myConfig, EGL_NO_CONTEXT,
+                getContextAttribs());
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
+
+        EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
+                mEglContext));
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+        EGLint w, h;
+        EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &w));
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &h));
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+        RecordProperty("EglSurfaceWidth", w);
+        RecordProperty("EglSurfaceHeight", h);
+
+        glViewport(0, 0, w, h);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+    }
+
+    virtual void TearDown() {
+        // Display the result 
+        if (mDisplaySecs > 0 && mEglSurface != EGL_NO_SURFACE) {
+            eglSwapBuffers(mEglDisplay, mEglSurface);
+            sleep(mDisplaySecs);
+        }
+
+        if (mComposerClient != NULL) {
+            mComposerClient->dispose();
+        }
+        if (mEglContext != EGL_NO_CONTEXT) {
+            eglDestroyContext(mEglDisplay, mEglContext);
+        }
+        if (mEglSurface != EGL_NO_SURFACE) {
+            eglDestroySurface(mEglDisplay, mEglSurface);
+        }
+        if (mEglDisplay != EGL_NO_DISPLAY) {
+            eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
+                    EGL_NO_CONTEXT);
+            eglTerminate(mEglDisplay);
+        }
+        ASSERT_EQ(EGL_SUCCESS, eglGetError());
+    }
+
+    virtual EGLint const* getConfigAttribs() {
+        static EGLint sDefaultConfigAttribs[] = {
+            EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+            EGL_RED_SIZE, 8,
+            EGL_GREEN_SIZE, 8,
+            EGL_BLUE_SIZE, 8,
+            EGL_ALPHA_SIZE, 8,
+            EGL_DEPTH_SIZE, 16,
+            EGL_STENCIL_SIZE, 8,
+            EGL_NONE };
+
+        return sDefaultConfigAttribs;
+    }
+
+    virtual EGLint const* getContextAttribs() {
+        static EGLint sDefaultContextAttribs[] = {
+            EGL_CONTEXT_CLIENT_VERSION, 2,
+            EGL_NONE };
+
+        return sDefaultContextAttribs;
+    }
+
+    virtual EGLint getSurfaceWidth() {
+        return 64;
+    }
+
+    virtual EGLint getSurfaceHeight() {
+        return 64;
+    }
+
+    void loadShader(GLenum shaderType, const char* pSource, GLuint* outShader) {
+        GLuint shader = glCreateShader(shaderType);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        if (shader) {
+            glShaderSource(shader, 1, &pSource, NULL);
+            ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+            glCompileShader(shader);
+            ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+            GLint compiled = 0;
+            glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+            ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+            if (!compiled) {
+                GLint infoLen = 0;
+                glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+                ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+                if (infoLen) {
+                    char* buf = (char*) malloc(infoLen);
+                    if (buf) {
+                        glGetShaderInfoLog(shader, infoLen, NULL, buf);
+                        printf("Shader compile log:\n%s\n", buf);
+                        free(buf);
+                        FAIL();
+                    }
+                } else {
+                    char* buf = (char*) malloc(0x1000);
+                    if (buf) {
+                        glGetShaderInfoLog(shader, 0x1000, NULL, buf);
+                        printf("Shader compile log:\n%s\n", buf);
+                        free(buf);
+                        FAIL();
+                    }
+                }
+                glDeleteShader(shader);
+                shader = 0;
+            }
+        }
+        ASSERT_TRUE(shader != 0);
+        *outShader = shader;
+    }
+
+    void createProgram(const char* pVertexSource, const char* pFragmentSource,
+            GLuint* outPgm) {
+        GLuint vertexShader, fragmentShader;
+        {
+            SCOPED_TRACE("compiling vertex shader");
+            loadShader(GL_VERTEX_SHADER, pVertexSource, &vertexShader);
+            if (HasFatalFailure()) {
+                return;
+            }
+        }
+        {
+            SCOPED_TRACE("compiling fragment shader");
+            loadShader(GL_FRAGMENT_SHADER, pFragmentSource, &fragmentShader);
+            if (HasFatalFailure()) {
+                return;
+            }
+        }
+
+        GLuint program = glCreateProgram();
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        if (program) {
+            glAttachShader(program, vertexShader);
+            ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+            glAttachShader(program, fragmentShader);
+            ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+            glLinkProgram(program);
+            GLint linkStatus = GL_FALSE;
+            glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+            if (linkStatus != GL_TRUE) {
+                GLint bufLength = 0;
+                glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+                if (bufLength) {
+                    char* buf = (char*) malloc(bufLength);
+                    if (buf) {
+                        glGetProgramInfoLog(program, bufLength, NULL, buf);
+                        printf("Program link log:\n%s\n", buf);
+                        free(buf);
+                        FAIL();
+                    }
+                }
+                glDeleteProgram(program);
+                program = 0;
+            }
+        }
+        glDeleteShader(vertexShader);
+        glDeleteShader(fragmentShader);
+        ASSERT_TRUE(program != 0);
+        *outPgm = program;
+    }
+
+    ::testing::AssertionResult checkPixel(int x, int y, int r,
+            int g, int b, int a) {
+        GLubyte pixel[4];
+        String8 msg;
+        glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
+        GLenum err = glGetError();
+        if (err != GL_NO_ERROR) {
+            msg += String8::format("error reading pixel: %#x", err);
+            while ((err = glGetError()) != GL_NO_ERROR) {
+                msg += String8::format(", %#x", err);
+            }
+            fprintf(stderr, "pixel check failure: %s\n", msg.string());
+            return ::testing::AssertionFailure(
+                    ::testing::Message(msg.string()));
+        }
+        if (r >= 0 && GLubyte(r) != pixel[0]) {
+            msg += String8::format("r(%d isn't %d)", pixel[0], r);
+        }
+        if (g >= 0 && GLubyte(g) != pixel[1]) {
+            if (!msg.isEmpty()) {
+                msg += " ";
+            }
+            msg += String8::format("g(%d isn't %d)", pixel[1], g);
+        }
+        if (b >= 0 && GLubyte(b) != pixel[2]) {
+            if (!msg.isEmpty()) {
+                msg += " ";
+            }
+            msg += String8::format("b(%d isn't %d)", pixel[2], b);
+        }
+        if (a >= 0 && GLubyte(a) != pixel[3]) {
+            if (!msg.isEmpty()) {
+                msg += " ";
+            }
+            msg += String8::format("a(%d isn't %d)", pixel[3], a);
+        }
+        if (!msg.isEmpty()) {
+            fprintf(stderr, "pixel check failure: %s\n", msg.string());
+            return ::testing::AssertionFailure(
+                    ::testing::Message(msg.string()));
+        } else {
+            return ::testing::AssertionSuccess();
+        }
+    }
+
+    int mDisplaySecs;
+    sp<SurfaceComposerClient> mComposerClient;
+    sp<SurfaceControl> mSurfaceControl;
+
+    EGLDisplay mEglDisplay;
+    EGLSurface mEglSurface;
+    EGLContext mEglContext;
+};
+
+// XXX: Code above this point should live elsewhere
+
+class SurfaceTextureGLTest : public GLTest {
+protected:
+    static const GLint TEX_ID = 123;
+
+    virtual void SetUp() {
+        GLTest::SetUp();
+        mST = new SurfaceTexture(TEX_ID);
+        mSTC = new SurfaceTextureClient(mST);
+        mANW = mSTC;
+
+        const char vsrc[] =
+            "attribute vec4 vPosition;\n"
+            "varying vec2 texCoords;\n"
+            "uniform mat4 texMatrix;\n"
+            "void main() {\n"
+            "  vec2 vTexCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n"
+            "  texCoords = (texMatrix * vec4(vTexCoords, 0.0, 1.0)).xy;\n"
+            "  gl_Position = vPosition;\n"
+            "}\n";
+
+        const char fsrc[] =
+            "#extension GL_OES_EGL_image_external : require\n"
+            "precision mediump float;\n"
+            "uniform samplerExternalOES texSampler;\n"
+            "varying vec2 texCoords;\n"
+            "void main() {\n"
+            "  gl_FragColor = texture2D(texSampler, texCoords);\n"
+            "}\n";
+
+        {
+            SCOPED_TRACE("creating shader program");
+            createProgram(vsrc, fsrc, &mPgm);
+            if (HasFatalFailure()) {
+                return;
+            }
+        }
+
+        mPositionHandle = glGetAttribLocation(mPgm, "vPosition");
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        ASSERT_NE(-1, mPositionHandle);
+        mTexSamplerHandle = glGetUniformLocation(mPgm, "texSampler");
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        ASSERT_NE(-1, mTexSamplerHandle);
+        mTexMatrixHandle = glGetUniformLocation(mPgm, "texMatrix");
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        ASSERT_NE(-1, mTexMatrixHandle);
+    }
+
+    // drawTexture draws the SurfaceTexture over the entire GL viewport.
+    void drawTexture() {
+        const GLfloat triangleVertices[] = {
+            -1.0f, 1.0f,
+            -1.0f, -1.0f,
+            1.0f, -1.0f,
+            1.0f, 1.0f,
+        };
+
+        glVertexAttribPointer(mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, triangleVertices);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        glEnableVertexAttribArray(mPositionHandle);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+
+        glUseProgram(mPgm);
+        glUniform1i(mTexSamplerHandle, 0);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+        glBindTexture(GL_TEXTURE_EXTERNAL_OES, TEX_ID);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+
+        GLfloat texMatrix[16];
+        mST->getTransformMatrix(texMatrix);
+        glUniformMatrix4fv(mTexMatrixHandle, 1, GL_FALSE, texMatrix);
+
+        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+        ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
+    }
+
+    sp<SurfaceTexture> mST;
+    sp<SurfaceTextureClient> mSTC;
+    sp<ANativeWindow> mANW;
+
+    GLuint mPgm;
+    GLint mPositionHandle;
+    GLint mTexSamplerHandle;
+    GLint mTexMatrixHandle;
+};
+
+// Fill a YV12 buffer with a multi-colored checkerboard pattern
+void fillYV12Buffer(uint8_t* buf, int w, int h, int stride) {
+    const int blockWidth = w > 16 ? w / 16 : 1;
+    const int blockHeight = h > 16 ? h / 16 : 1;
+    const int yuvTexOffsetY = 0;
+    int yuvTexStrideY = stride;
+    int yuvTexOffsetV = yuvTexStrideY * h;
+    int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
+    int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2;
+    int yuvTexStrideU = yuvTexStrideV;
+    for (int x = 0; x < w; x++) {
+        for (int y = 0; y < h; y++) {
+            int parityX = (x / blockWidth) & 1;
+            int parityY = (y / blockHeight) & 1;
+            unsigned char intensity = (parityX ^ parityY) ? 63 : 191;
+            buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity;
+            if (x < w / 2 && y < h / 2) {
+                buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity;
+                if (x * 2 < w / 2 && y * 2 < h / 2) {
+                    buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] =
+                    buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] =
+                    buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] =
+                    buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] =
+                        intensity;
+                }
+            }
+        }
+    }
+}
+
+// Fill a YV12 buffer with red outside a given rectangle and green inside it.
+void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride,
+        const android_native_rect_t& rect) {
+    const int yuvTexOffsetY = 0;
+    int yuvTexStrideY = stride;
+    int yuvTexOffsetV = yuvTexStrideY * h;
+    int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
+    int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2;
+    int yuvTexStrideU = yuvTexStrideV;
+    for (int x = 0; x < w; x++) {
+        for (int y = 0; y < h; y++) {
+            bool inside = rect.left <= x && x < rect.right &&
+                    rect.top <= y && y < rect.bottom;
+            buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = inside ? 240 : 64;
+            if (x < w / 2 && y < h / 2) {
+                bool inside = rect.left <= 2*x && 2*x < rect.right &&
+                        rect.top <= 2*y && 2*y < rect.bottom;
+                buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = 16;
+                buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] =
+                        inside ? 16 : 255;
+            }
+        }
+    }
+}
+
+TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) {
+    const int yuvTexWidth = 64;
+    const int yuvTexHeight = 66;
+
+    ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
+            yuvTexWidth, yuvTexHeight, HAL_PIXEL_FORMAT_YV12));
+    ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
+            GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
+
+    android_native_buffer_t* anb;
+    ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+    ASSERT_TRUE(anb != NULL);
+
+    sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
+    ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
+
+    // Fill the buffer with the a checkerboard pattern
+    uint8_t* img = NULL;
+    buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
+    fillYV12Buffer(img, yuvTexWidth, yuvTexHeight, buf->getStride());
+    buf->unlock();
+    ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
+
+    mST->updateTexImage();
+
+    glClearColor(0.2, 0.2, 0.2, 0.2);
+    glClear(GL_COLOR_BUFFER_BIT);
+
+    drawTexture();
+
+    EXPECT_TRUE(checkPixel( 0,  0, 255, 127, 255, 255));
+    EXPECT_TRUE(checkPixel(63,  0,   0, 133,   0, 255));
+    EXPECT_TRUE(checkPixel(63, 63,   0, 133,   0, 255));
+    EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255));
+
+    EXPECT_TRUE(checkPixel(22, 44, 247,  70, 255, 255));
+    EXPECT_TRUE(checkPixel(45, 52, 209,  32, 235, 255));
+    EXPECT_TRUE(checkPixel(52, 51, 100, 255,  73, 255));
+    EXPECT_TRUE(checkPixel( 7, 31, 155,   0, 118, 255));
+    EXPECT_TRUE(checkPixel(31,  9, 148,  71, 110, 255));
+    EXPECT_TRUE(checkPixel(29, 35, 255, 127, 255, 255));
+    EXPECT_TRUE(checkPixel(36, 22, 155,  29,   0, 255));
+}
+
+// XXX: This test is disabled because it it currently broken on all devices to
+// which I have access.  Some of the checkPixel calls are not correct because
+// I just copied them from the npot test above and haven't bothered to figure
+// out the correct values.
+TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledYV12BufferPow2) {
+    const int yuvTexWidth = 64;
+    const int yuvTexHeight = 64;
+
+    ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
+            yuvTexWidth, yuvTexHeight, HAL_PIXEL_FORMAT_YV12));
+    ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
+            GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
+
+    android_native_buffer_t* anb;
+    ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+    ASSERT_TRUE(anb != NULL);
+
+    sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
+    ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
+
+    // Fill the buffer with the a checkerboard pattern
+    uint8_t* img = NULL;
+    buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
+    fillYV12Buffer(img, yuvTexWidth, yuvTexHeight, buf->getStride());
+    buf->unlock();
+    ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
+
+    mST->updateTexImage();
+
+    glClearColor(0.2, 0.2, 0.2, 0.2);
+    glClear(GL_COLOR_BUFFER_BIT);
+
+    drawTexture();
+
+    EXPECT_TRUE(checkPixel( 0,  0, 255, 127, 255, 255));
+    EXPECT_TRUE(checkPixel(63,  0,   0, 133,   0, 255));
+    EXPECT_TRUE(checkPixel(63, 63,   0, 133,   0, 255));
+    EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255));
+
+    EXPECT_TRUE(checkPixel(22, 19, 247,  70, 255, 255));
+    EXPECT_TRUE(checkPixel(45, 11, 209,  32, 235, 255));
+    EXPECT_TRUE(checkPixel(52, 12, 100, 255,  73, 255));
+    EXPECT_TRUE(checkPixel( 7, 32, 155,   0, 118, 255));
+    EXPECT_TRUE(checkPixel(31, 54, 148,  71, 110, 255));
+    EXPECT_TRUE(checkPixel(29, 28, 255, 127, 255, 255));
+    EXPECT_TRUE(checkPixel(36, 41, 155,  29,   0, 255));
+}
+
+TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {
+    const int yuvTexWidth = 64;
+    const int yuvTexHeight = 66;
+
+    ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
+            yuvTexWidth, yuvTexHeight, HAL_PIXEL_FORMAT_YV12));
+    ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
+            GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
+
+    android_native_rect_t crops[] = {
+        {4, 6, 22, 36},
+        {0, 6, 22, 36},
+        {4, 0, 22, 36},
+        {4, 6, yuvTexWidth, 36},
+        {4, 6, 22, yuvTexHeight},
+    };
+
+    for (int i = 0; i < 5; i++) {
+        const android_native_rect_t& crop(crops[i]);
+        SCOPED_TRACE(String8::format("rect{ l: %d t: %d r: %d b: %d }", crop.left,
+                crop.top, crop.right, crop.bottom).string());
+
+        ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop));
+
+        android_native_buffer_t* anb;
+        ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+        ASSERT_TRUE(anb != NULL);
+
+        sp<GraphicBuffer> buf(new GraphicBuffer(anb, false));
+        ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()));
+
+        uint8_t* img = NULL;
+        buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
+        fillYV12BufferRect(img, yuvTexWidth, yuvTexHeight, buf->getStride(), crop);
+        buf->unlock();
+        ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()));
+
+        mST->updateTexImage();
+
+        glClearColor(0.2, 0.2, 0.2, 0.2);
+        glClear(GL_COLOR_BUFFER_BIT);
+
+        drawTexture();
+
+        EXPECT_TRUE(checkPixel( 0,  0,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(63,  0,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(63, 63,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel( 0, 63,  82, 255,  35, 255));
+
+        EXPECT_TRUE(checkPixel(25, 14,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(35, 31,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(57,  6,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel( 5, 42,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(32, 33,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(16, 26,  82, 255,  35, 255));
+        EXPECT_TRUE(checkPixel(46, 51,  82, 255,  35, 255));
+    }
+}
+
+}
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index f4a0161..b465fee 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -42,7 +42,6 @@
 	LOCAL_SHARED_LIBRARIES := libcutils libutils libGLESv2 libskia libui
 	LOCAL_MODULE := libhwui
 	LOCAL_MODULE_TAGS := optional
-	LOCAL_PRELINK_MODULE := false
 	
 	include $(BUILD_SHARED_LIBRARY)
 
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 737fa02..868290b 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -285,9 +285,12 @@
             break;
             case DrawDisplayList: {
                 DisplayList* displayList = getDisplayList();
-                DISPLAY_LIST_LOGD("%s%s %p, %d", (char*) indent, OP_NAMES[op],
-                    displayList, level + 1);
-                needsInvalidate |= renderer.drawDisplayList(displayList, dirty, level + 1);
+                uint32_t width = getUInt();
+                uint32_t height = getUInt();
+                DISPLAY_LIST_LOGD("%s%s %p, %dx%d, %d", (char*) indent, OP_NAMES[op],
+                    displayList, width, height, level + 1);
+                needsInvalidate |= renderer.drawDisplayList(displayList, width, height,
+                        dirty, level + 1);
             }
             break;
             case DrawLayer: {
@@ -674,11 +677,13 @@
     return OpenGLRenderer::clipRect(left, top, right, bottom, op);
 }
 
-bool DisplayListRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level) {
+bool DisplayListRenderer::drawDisplayList(DisplayList* displayList,
+        uint32_t width, uint32_t height, Rect& dirty, uint32_t level) {
     // dirty is an out parameter and should not be recorded,
     // it matters only when replaying the display list
     addOp(DisplayList::DrawDisplayList);
     addDisplayList(displayList);
+    addSize(width, height);
     return false;
 }
 
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index f24545d..6fc315c 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -144,6 +144,10 @@
         return mReader.readInt();
     }
 
+    inline uint32_t getUInt() {
+        return mReader.readU32();
+    }
+
     SkMatrix* getMatrix() {
         return (SkMatrix*) getInt();
     }
@@ -238,7 +242,8 @@
 
     bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
 
-    bool drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level = 0);
+    bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+            Rect& dirty, uint32_t level = 0);
     void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
     void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
     void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
@@ -323,6 +328,11 @@
         mWriter.writeInt(value);
     }
 
+    inline void addSize(uint32_t w, uint32_t h) {
+        mWriter.writeInt(w);
+        mWriter.writeInt(h);
+    }
+
     void addInts(const int32_t* values, uint32_t count) {
         mWriter.writeInt(count);
         for (uint32_t i = 0; i < count; i++) {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 1f65201..5d9522e 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -403,10 +403,7 @@
 
     // Window coordinates of the layer
     Rect bounds(left, top, right, bottom);
-    if (fboLayer) {
-        // Clear the previous layer regions before we change the viewport
-        clearLayerRegions();
-    } else {
+    if (!fboLayer) {
         mSnapshot->transform->mapRect(bounds);
 
         // Layers only make sense if they are in the framebuffer's bounds
@@ -464,8 +461,14 @@
                 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
                         snapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
             }
-            // Enqueue the buffer coordinates to clear the corresponding region later
-            mLayers.push(new Rect(bounds));
+
+            // Clear the framebuffer where the layer will draw
+            glScissor(bounds.left, mSnapshot->height - bounds.bottom,
+                    bounds.getWidth(), bounds.getHeight());
+            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+            glClear(GL_COLOR_BUFFER_BIT);
+
+            dirtyClip();
         }
     }
 
@@ -760,31 +763,6 @@
 #endif
 }
 
-void OpenGLRenderer::clearLayerRegions() {
-    if (mLayers.size() == 0 || mSnapshot->isIgnored()) return;
-
-    Rect clipRect(*mSnapshot->clipRect);
-    clipRect.snapToPixelBoundaries();
-
-    for (uint32_t i = 0; i < mLayers.size(); i++) {
-        Rect* bounds = mLayers.itemAt(i);
-        if (clipRect.intersects(*bounds)) {
-            // Clear the framebuffer where the layer will draw
-            glScissor(bounds->left, mSnapshot->height - bounds->bottom,
-                    bounds->getWidth(), bounds->getHeight());
-            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-            glClear(GL_COLOR_BUFFER_BIT);
-
-            // Restore the clip
-            dirtyClip();
-        }
-
-        delete bounds;
-    }
-
-    mLayers.clear();
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 // Transforms
 ///////////////////////////////////////////////////////////////////////////////
@@ -870,7 +848,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void OpenGLRenderer::setupDraw() {
-    clearLayerRegions();
     if (mDirtyClip) {
         setScissorFromClip();
     }
@@ -1064,12 +1041,18 @@
 // Drawing
 ///////////////////////////////////////////////////////////////////////////////
 
-bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level) {
+bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+        Rect& dirty, uint32_t level) {
+    if (quickReject(0.0f, 0.0f, width, height)) {
+        return false;
+    }
+
     // All the usual checks and setup operations (quickReject, setupDraw, etc.)
     // will be performed by the display list itself
     if (displayList) {
         return displayList->replay(*this, dirty, level);
     }
+
     return false;
 }
 
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 9d86388..7362473 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -96,7 +96,8 @@
     bool quickReject(float left, float top, float right, float bottom);
     virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
 
-    virtual bool drawDisplayList(DisplayList* displayList, Rect& dirty, uint32_t level = 0);
+    virtual bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+            Rect& dirty, uint32_t level = 0);
     virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
     virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
     virtual void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
@@ -247,12 +248,6 @@
     void composeLayerRect(Layer* layer, const Rect& rect, bool swap = false);
 
     /**
-     * Clears all the regions corresponding to the current list of layers.
-     * This method MUST be invoked before any drawing operation.
-     */
-    void clearLayerRegions();
-
-    /**
      * Mark the layer as dirty at the specified coordinates. The coordinates
      * are transformed with the supplied matrix.
      */
@@ -499,9 +494,6 @@
     // Various caches
     Caches& mCaches;
 
-    // List of rectangles to clear due to calls to saveLayer()
-    Vector<Rect*> mLayers;
-
     // Indentity matrix
     const mat4 mIdentity;
 
diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h
index 3acd18a..ead5b92 100644
--- a/libs/hwui/ProgramCache.h
+++ b/libs/hwui/ProgramCache.h
@@ -231,9 +231,11 @@
      * Logs the specified message followed by the key identifying this program.
      */
     void log(const char* message) const {
+#if DEBUG_PROGRAMS
         programid k = key();
         PROGRAM_LOGD("%s (key = 0x%.8x%.8x)", message, uint32_t(k >> 32),
                 uint32_t(k & 0xffffffff));
+#endif
     }
 
 private:
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 0836887..5520315 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -28,7 +28,6 @@
 # slangdata_output_var_name := rs_runtime_lib_bc
 # LOCAL_MODULE := librslib_rt
 
-# LOCAL_PRELINK_MODULE := false
 # LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 # LOCAL_MODULE_TAGS := optional
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp
index e2e698e..eaa8926 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -7,8 +7,12 @@
 
 //#define LOG_NDEBUG 0
 
+// Log debug messages about keymap probing.
 #define DEBUG_PROBE 0
 
+// Log debug messages about velocity tracking.
+#define DEBUG_VELOCITY 0
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <ctype.h>
@@ -329,6 +333,27 @@
             "cannot contain more than %d axis values.", axis, int(MAX_AXES));
 }
 
+bool PointerCoords::operator==(const PointerCoords& other) const {
+    if (bits != other.bits) {
+        return false;
+    }
+    uint32_t count = __builtin_popcountll(bits);
+    for (uint32_t i = 0; i < count; i++) {
+        if (values[i] != other.values[i]) {
+            return false;
+        }
+    }
+    return true;
+}
+
+void PointerCoords::copyFrom(const PointerCoords& other) {
+    bits = other.bits;
+    uint32_t count = __builtin_popcountll(bits);
+    for (uint32_t i = 0; i < count; i++) {
+        values[i] = other.values[i];
+    }
+}
+
 
 // --- MotionEvent ---
 
@@ -634,6 +659,135 @@
 }
 
 
+// --- VelocityTracker ---
+
+VelocityTracker::VelocityTracker() {
+    clear();
+}
+
+void VelocityTracker::clear() {
+    mIndex = 0;
+    mMovements[0].idBits.clear();
+}
+
+void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions) {
+    if (++mIndex == HISTORY_SIZE) {
+        mIndex = 0;
+    }
+    Movement& movement = mMovements[mIndex];
+    movement.eventTime = eventTime;
+    movement.idBits = idBits;
+    uint32_t count = idBits.count();
+    for (uint32_t i = 0; i < count; i++) {
+        movement.positions[i] = positions[i];
+    }
+
+#if DEBUG_VELOCITY
+    LOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x", eventTime, idBits.value);
+    for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) {
+        uint32_t id = iterBits.firstMarkedBit();
+        uint32_t index = idBits.getIndexOfBit(id);
+        iterBits.clearBit(id);
+        float vx, vy;
+        bool available = getVelocity(id, &vx, &vy);
+        if (available) {
+            LOGD("  %d: position (%0.3f, %0.3f), velocity (%0.3f, %0.3f), speed %0.3f",
+                    id, positions[index].x, positions[index].y, vx, vy, sqrtf(vx * vx + vy * vy));
+        } else {
+            assert(vx == 0 && vy == 0);
+            LOGD("  %d: position (%0.3f, %0.3f), velocity not available",
+                    id, positions[index].x, positions[index].y);
+        }
+    }
+#endif
+}
+
+bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {
+    const Movement& newestMovement = mMovements[mIndex];
+    if (newestMovement.idBits.hasBit(id)) {
+        // Find the oldest sample that contains the pointer and that is not older than MAX_AGE.
+        nsecs_t minTime = newestMovement.eventTime - MAX_AGE;
+        uint32_t oldestIndex = mIndex;
+        uint32_t numTouches = 1;
+        do {
+            uint32_t nextOldestIndex = (oldestIndex == 0 ? HISTORY_SIZE : oldestIndex) - 1;
+            const Movement& nextOldestMovement = mMovements[nextOldestIndex];
+            if (!nextOldestMovement.idBits.hasBit(id)
+                    || nextOldestMovement.eventTime < minTime) {
+                break;
+            }
+            oldestIndex = nextOldestIndex;
+        } while (++numTouches < HISTORY_SIZE);
+
+        // If we have a lot of samples, skip the last received sample since it is
+        // probably pretty noisy compared to the sum of all of the traces already acquired.
+        //
+        // NOTE: This condition exists in the android.view.VelocityTracker and imposes a
+        // bias against the most recent data.
+        if (numTouches > 3) {
+            numTouches -= 1;
+        }
+
+        // Calculate an exponentially weighted moving average of the velocity at different
+        // points in time measured relative to the oldest samples.  This is essentially
+        // an IIR filter.
+        //
+        // One problem with this algorithm is that the sample data may be poorly conditioned.
+        // Sometimes samples arrive very close together in time which can cause us to
+        // overestimate the velocity at that time point.  Most samples might be measured
+        // 16ms apart but some consecutive samples could be only 0.5sm apart due to
+        // the way they are reported by the hardware or driver (sometimes in bursts or with
+        // significant jitter).  The instantaneous velocity for those samples 0.5ms apart will
+        // be calculated to be 32 times what it should have been.
+        // To work around this effect, we impose a minimum duration on the samples.
+        //
+        // FIXME: Samples close together in time can have an disproportionately large
+        // impact on the result because all samples are equally weighted.  The average should
+        // instead take the time factor into account.
+        //
+        // FIXME: The minimum duration condition does not exist in
+        // android.view.VelocityTracker yet.  It is less important there because sample times
+        // are truncated to the millisecond so back to back samples will often appear to be
+        // zero milliseconds apart and will be ignored if they are the oldest ones.
+        float accumVx = 0;
+        float accumVy = 0;
+        uint32_t index = oldestIndex;
+        uint32_t samplesUsed = 0;
+        const Movement& oldestMovement = mMovements[oldestIndex];
+        const Position& oldestPosition =
+                oldestMovement.positions[oldestMovement.idBits.getIndexOfBit(id)];
+        while (numTouches-- > 1) {
+            if (++index == HISTORY_SIZE) {
+                index = 0;
+            }
+            const Movement& movement = mMovements[index];
+            nsecs_t duration = movement.eventTime - oldestMovement.eventTime;
+            if (duration > MIN_DURATION) {
+                const Position& position = movement.positions[movement.idBits.getIndexOfBit(id)];
+                float scale = 1000000000.0f / duration; // one over time delta in seconds
+                float vx = (position.x - oldestPosition.x) * scale;
+                float vy = (position.y - oldestPosition.y) * scale;
+                accumVx = accumVx == 0 ? vx : (accumVx + vx) * 0.5f;
+                accumVy = accumVy == 0 ? vy : (accumVy + vy) * 0.5f;
+                samplesUsed += 1;
+            }
+        }
+
+        // Make sure we used at least one sample.
+        if (samplesUsed != 0) {
+            *outVx = accumVx;
+            *outVy = accumVy;
+            return true;
+        }
+    }
+
+    // No data available for this pointer.
+    *outVx = 0;
+    *outVy = 0;
+    return false;
+}
+
+
 // --- InputDeviceInfo ---
 
 InputDeviceInfo::InputDeviceInfo() {
diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp
index 5c57a76..9d1b8b9 100644
--- a/libs/ui/InputTransport.cpp
+++ b/libs/ui/InputTransport.cpp
@@ -406,7 +406,7 @@
 
     for (size_t i = 0; i < pointerCount; i++) {
         mSharedMessage->motion.pointerIds[i] = pointerIds[i];
-        mSharedMessage->motion.sampleData[0].coords[i] = pointerCoords[i];
+        mSharedMessage->motion.sampleData[0].coords[i].copyFrom(pointerCoords[i]);
     }
 
     // Cache essential information about the motion event to ensure that a malicious consumer
@@ -475,7 +475,7 @@
 
     mMotionEventSampleDataTail->eventTime = eventTime;
     for (size_t i = 0; i < mMotionEventPointerCount; i++) {
-        mMotionEventSampleDataTail->coords[i] = pointerCoords[i];
+        mMotionEventSampleDataTail->coords[i].copyFrom(pointerCoords[i]);
     }
     mMotionEventSampleDataTail = newTail;
 
diff --git a/libs/usb/src/com/android/future/usb/UsbAccessory.java b/libs/usb/src/com/android/future/usb/UsbAccessory.java
index 3d0707f..0f965d7 100644
--- a/libs/usb/src/com/android/future/usb/UsbAccessory.java
+++ b/libs/usb/src/com/android/future/usb/UsbAccessory.java
@@ -19,13 +19,14 @@
 /**
  * A class representing a USB accessory.
  */
-public final class UsbAccessory {
+public class UsbAccessory {
 
     private final String mManufacturer;
     private final String mModel;
     private final String mDescription;
     private final String mVersion;
     private final String mUri;
+    private final String mSerial;
 
     /* package */ UsbAccessory(android.hardware.usb.UsbAccessory accessory) {
         mManufacturer = accessory.getManufacturer();
@@ -33,6 +34,7 @@
         mDescription = accessory.getDescription();
         mVersion = accessory.getVersion();
         mUri = accessory.getUri();
+        mSerial = accessory.getSerial();
     }
 
     /**
@@ -82,6 +84,17 @@
         return mUri;
     }
 
+    /**
+     * Returns the unique serial number for the accessory.
+     * This is an optional serial number that can be used to differentiate
+     * between individual accessories of the same model and manufacturer
+     *
+     * @return the unique serial number
+     */
+    public String getSerial() {
+        return mSerial;
+    }
+
     private static boolean compare(String s1, String s2) {
         if (s1 == null) return (s2 == null);
         return s1.equals(s2);
@@ -95,7 +108,8 @@
                     compare(mModel, accessory.getModel()) &&
                     compare(mDescription, accessory.getDescription()) &&
                     compare(mVersion, accessory.getVersion()) &&
-                    compare(mUri, accessory.getUri()));
+                    compare(mUri, accessory.getUri()) &&
+                    compare(mSerial, accessory.getSerial()));
         }
         return false;
     }
@@ -106,7 +120,8 @@
                 (mModel == null ? 0 : mModel.hashCode()) ^
                 (mDescription == null ? 0 : mDescription.hashCode()) ^
                 (mVersion == null ? 0 : mVersion.hashCode()) ^
-                (mUri == null ? 0 : mUri.hashCode()));
+                (mUri == null ? 0 : mUri.hashCode()) ^
+                (mSerial == null ? 0 : mSerial.hashCode()));
     }
 
     @Override
@@ -115,6 +130,7 @@
                             ", mModel=" + mModel +
                             ", mDescription=" + mDescription +
                             ", mVersion=" + mVersion +
-                            ", mUri=" + mUri + "]";
+                            ", mUri=" + mUri +
+                            ", mSerial=" + mSerial + "]";
     }
 }
diff --git a/libs/usb/src/com/android/future/usb/UsbManager.java b/libs/usb/src/com/android/future/usb/UsbManager.java
index 840e1e3..d424b63 100644
--- a/libs/usb/src/com/android/future/usb/UsbManager.java
+++ b/libs/usb/src/com/android/future/usb/UsbManager.java
@@ -130,7 +130,8 @@
         try {
             return mService.openAccessory(new android.hardware.usb.UsbAccessory(
                     accessory.getManufacturer(),accessory.getModel(),
-                    accessory.getDescription(), accessory.getVersion(), accessory.getUri()));
+                    accessory.getDescription(), accessory.getVersion(),
+                    accessory.getUri(), accessory.getSerial()));
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException in openAccessory" , e);
             return null;
@@ -150,7 +151,8 @@
         try {
             return mService.hasAccessoryPermission(new android.hardware.usb.UsbAccessory(
                     accessory.getManufacturer(),accessory.getModel(),
-                    accessory.getDescription(), accessory.getVersion(), accessory.getUri()));
+                    accessory.getDescription(), accessory.getVersion(),
+                    accessory.getUri(), accessory.getSerial()));
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException in hasPermission", e);
             return false;
@@ -174,7 +176,8 @@
         try {
             mService.requestAccessoryPermission(new android.hardware.usb.UsbAccessory(
                     accessory.getManufacturer(),accessory.getModel(),
-                    accessory.getDescription(), accessory.getVersion(), accessory.getUri()),
+                    accessory.getDescription(), accessory.getVersion(),
+                    accessory.getUri(), accessory.getSerial()),
                     mContext.getPackageName(), pi);
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException in requestPermission", e);
diff --git a/libs/usb/tests/AccessoryChat/Android.mk b/libs/usb/tests/AccessoryChat/Android.mk
index d555961..77b8424 100644
--- a/libs/usb/tests/AccessoryChat/Android.mk
+++ b/libs/usb/tests/AccessoryChat/Android.mk
@@ -21,7 +21,7 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := AccessoryChatGB
+LOCAL_PACKAGE_NAME := AccessoryChat
 
 LOCAL_JAVA_LIBRARIES := com.android.future.usb.accessory
 
diff --git a/libs/usb/tests/AccessoryChat/AndroidManifest.xml b/libs/usb/tests/AccessoryChat/AndroidManifest.xml
index d6093ae..37ab29f 100644
--- a/libs/usb/tests/AccessoryChat/AndroidManifest.xml
+++ b/libs/usb/tests/AccessoryChat/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application>
         <uses-library android:name="com.android.future.usb.accessory" />
 
-        <activity android:name="AccessoryChat" android:label="Accessory Chat GB">
+        <activity android:name="AccessoryChat" android:label="Accessory Chat">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
diff --git a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
index 3c0de69..c80b7c4 100644
--- a/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
+++ b/libs/usb/tests/AccessoryChat/accessorychat/accessorychat.c
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <pthread.h>
+#include <time.h>
 
 #include <usbhost/usbhost.h>
 #include <linux/usb/f_accessory.h>
@@ -65,9 +66,20 @@
     return NULL;
 }
 
+static void milli_sleep(int millis) {
+	struct timespec tm;
+
+	tm.tv_sec = 0;
+	tm.tv_nsec = millis * 1000000;
+	nanosleep(&tm, NULL);
+}
+
 static void send_string(struct usb_device *device, int index, const char* string) {
     int ret = usb_device_control_transfer(device, USB_DIR_OUT | USB_TYPE_VENDOR,
             ACCESSORY_SEND_STRING, 0, index, (void *)string, strlen(string) + 1, 0);
+
+    // some devices can't handle back-to-back requests, so delay a bit
+    milli_sleep(10);
 }
 
 static int usb_device_added(const char *devname, void* client_data) {
@@ -146,6 +158,7 @@
             send_string(device, ACCESSORY_STRING_DESCRIPTION, "Sample Program");
             send_string(device, ACCESSORY_STRING_VERSION, "1.0");
             send_string(device, ACCESSORY_STRING_URI, "http://www.android.com");
+            send_string(device, ACCESSORY_STRING_SERIAL, "1234567890");
 
             ret = usb_device_control_transfer(device, USB_DIR_OUT | USB_TYPE_VENDOR,
                     ACCESSORY_START, 0, 0, 0, 0, 0);
diff --git a/libs/usb/tests/AccessoryChat/src/com/android/accessorychat/AccessoryChat.java b/libs/usb/tests/AccessoryChat/src/com/android/accessorychat/AccessoryChat.java
index f9a5bf4..c3f4fa3 100644
--- a/libs/usb/tests/AccessoryChat/src/com/android/accessorychat/AccessoryChat.java
+++ b/libs/usb/tests/AccessoryChat/src/com/android/accessorychat/AccessoryChat.java
@@ -135,7 +135,8 @@
     }
 
     private void openAccessory(UsbAccessory accessory) {
-       mFileDescriptor = mUsbManager.openAccessory(accessory);
+        Log.d(TAG, "openAccessory: " + accessory);
+        mFileDescriptor = mUsbManager.openAccessory(accessory);
         if (mFileDescriptor != null) {
             FileDescriptor fd = mFileDescriptor.getFileDescriptor();
             mInputStream = new FileInputStream(fd);
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index fd12e19..9d0cba3 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -110,6 +110,8 @@
     private static final int MSG_PLAY_SOUND_EFFECT = 7;
     private static final int MSG_BTA2DP_DOCK_TIMEOUT = 8;
     private static final int MSG_LOAD_SOUND_EFFECTS = 9;
+    private static final int MSG_SET_FORCE_USE = 10;
+
 
     private static final int BTA2DP_DOCK_TIMEOUT_MILLIS = 8000;
 
@@ -1170,22 +1172,15 @@
         if (!checkAudioSettingsPermission("setSpeakerphoneOn()")) {
             return;
         }
-        if (on) {
-            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_SPEAKER);
-            mForcedUseForComm = AudioSystem.FORCE_SPEAKER;
-        } else {
-            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE);
-            mForcedUseForComm = AudioSystem.FORCE_NONE;
-        }
+        mForcedUseForComm = on ? AudioSystem.FORCE_SPEAKER : AudioSystem.FORCE_NONE;
+
+        sendMsg(mAudioHandler, MSG_SET_FORCE_USE, SHARED_MSG, SENDMSG_QUEUE,
+                AudioSystem.FOR_COMMUNICATION, mForcedUseForComm, null, 0);
     }
 
     /** @see AudioManager#isSpeakerphoneOn() */
     public boolean isSpeakerphoneOn() {
-        if (mForcedUseForComm == AudioSystem.FORCE_SPEAKER) {
-            return true;
-        } else {
-            return false;
-        }
+        return (mForcedUseForComm == AudioSystem.FORCE_SPEAKER);
     }
 
     /** @see AudioManager#setBluetoothScoOn() */
@@ -1193,24 +1188,17 @@
         if (!checkAudioSettingsPermission("setBluetoothScoOn()")) {
             return;
         }
-        if (on) {
-            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_BT_SCO);
-            AudioSystem.setForceUse(AudioSystem.FOR_RECORD, AudioSystem.FORCE_BT_SCO);
-            mForcedUseForComm = AudioSystem.FORCE_BT_SCO;
-        } else {
-            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_NONE);
-            AudioSystem.setForceUse(AudioSystem.FOR_RECORD, AudioSystem.FORCE_NONE);
-            mForcedUseForComm = AudioSystem.FORCE_NONE;
-        }
+        mForcedUseForComm = on ? AudioSystem.FORCE_BT_SCO : AudioSystem.FORCE_NONE;
+
+        sendMsg(mAudioHandler, MSG_SET_FORCE_USE, SHARED_MSG, SENDMSG_QUEUE,
+                AudioSystem.FOR_COMMUNICATION, mForcedUseForComm, null, 0);
+        sendMsg(mAudioHandler, MSG_SET_FORCE_USE, SHARED_MSG, SENDMSG_QUEUE,
+                AudioSystem.FOR_RECORD, mForcedUseForComm, null, 0);
     }
 
     /** @see AudioManager#isBluetoothScoOn() */
     public boolean isBluetoothScoOn() {
-        if (mForcedUseForComm == AudioSystem.FORCE_BT_SCO) {
-            return true;
-        } else {
-            return false;
-        }
+        return (mForcedUseForComm == AudioSystem.FORCE_BT_SCO);
     }
 
     /** @see AudioManager#startBluetoothSco() */
@@ -1935,6 +1923,10 @@
             }
         }
 
+        private void setForceUse(int usage, int config) {
+            AudioSystem.setForceUse(usage, config);
+        }
+
         @Override
         public void handleMessage(Message msg) {
             int baseMsgWhat = getMsgBase(msg.what);
@@ -2026,6 +2018,10 @@
                     // msg.obj  == address of BTA2DP device
                     makeA2dpDeviceUnavailableNow( (String) msg.obj );
                     break;
+
+                case MSG_SET_FORCE_USE:
+                    setForceUse(msg.arg1, msg.arg2);
+                    break;
             }
         }
     }
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 74d65d1..6b9f2fb 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1585,6 +1585,17 @@
     private static native final void native_init();
     private native final void native_setup();
     private native final void native_finalize();
+
+    /**
+     * Releases resouces associated with this MediaScanner object.
+     * It is considered good practice to call this method when
+     * one is done using the MediaScanner object. After this method
+     * is called, the MediaScanner object can no longer be used.
+     */
+    public void release() {
+        native_finalize();
+    }
+
     @Override
     protected void finalize() {
         mContext.getContentResolver().releaseProvider(mMediaProvider);
diff --git a/media/java/android/media/videoeditor/AudioTrack.java b/media/java/android/media/videoeditor/AudioTrack.java
index 7069b23..2de82f2 100755
--- a/media/java/android/media/videoeditor/AudioTrack.java
+++ b/media/java/android/media/videoeditor/AudioTrack.java
@@ -49,7 +49,6 @@
     private final int mAudioType;
     private final int mAudioBitrate;
     private final int mAudioSamplingFrequency;
-
     /**
      *  Ducking variables
      */
@@ -127,11 +126,17 @@
                int duckThreshold, int duckedTrackVolume,
             String audioWaveformFilename) throws IOException {
         Properties properties = null;
+
         File file = new File(filename);
         if (!file.exists()) {
             throw new IOException(filename + " not found ! ");
         }
 
+        /*Compare file_size with 2GB*/
+        if (VideoEditor.MAX_SUPPORTED_FILE_SIZE <= file.length()) {
+            throw new IllegalArgumentException("File size is more than 2GB");
+        }
+
         if (editor instanceof VideoEditorImpl) {
             mMANativeHelper = ((VideoEditorImpl)editor).getNativeContext();
         } else {
diff --git a/media/java/android/media/videoeditor/MediaItem.java b/media/java/android/media/videoeditor/MediaItem.java
index dfe0bae..8c4841f 100755
--- a/media/java/android/media/videoeditor/MediaItem.java
+++ b/media/java/android/media/videoeditor/MediaItem.java
@@ -131,6 +131,15 @@
         if (filename == null) {
             throw new IllegalArgumentException("MediaItem : filename is null");
         }
+        File file = new File(filename);
+        if (!file.exists()) {
+            throw new IOException(filename + " not found ! ");
+        }
+
+        /*Compare file_size with 2GB*/
+        if (VideoEditor.MAX_SUPPORTED_FILE_SIZE <= file.length()) {
+            throw new IllegalArgumentException("File size is more than 2GB");
+        }
         mUniqueId = mediaItemId;
         mFilename = filename;
         mRenderingMode = renderingMode;
diff --git a/media/java/android/media/videoeditor/VideoEditor.java b/media/java/android/media/videoeditor/VideoEditor.java
index 122dc8d..59e4540 100755
--- a/media/java/android/media/videoeditor/VideoEditor.java
+++ b/media/java/android/media/videoeditor/VideoEditor.java
@@ -68,6 +68,11 @@
     public final static int DURATION_OF_STORYBOARD = -1;
 
     /**
+     *  Maximum supported file size
+     */
+    public static final long MAX_SUPPORTED_FILE_SIZE = 2147483648L;
+
+    /**
      * This listener interface is used by the VideoEditor to emit preview
      * progress notifications. This callback should be invoked after the number
      * of frames specified by
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index 7e1f73a..78557ee 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -119,7 +119,6 @@
     private static final String ATTR_OVERLAY_FRAME_HEIGHT = "overlay_frame_height";
     private static final String ATTR_OVERLAY_RESIZED_RGB_FRAME_WIDTH = "resized_RGBframe_width";
     private static final String ATTR_OVERLAY_RESIZED_RGB_FRAME_HEIGHT = "resized_RGBframe_height";
-
     private static final int ENGINE_ACCESS_MAX_TIMEOUT_MS = 500;
     /*
      *  Instance variables
@@ -437,6 +436,12 @@
                 throw new IllegalArgumentException(message);
             }
         }
+        computeTimelineDuration();
+        final long audioBitrate = MediaArtistNativeHelper.Bitrate.BR_96_KBPS;
+        final long fileSize = (mDurationMs * (bitrate + audioBitrate)) / 8000;
+        if (MAX_SUPPORTED_FILE_SIZE <= fileSize) {
+            throw new IllegalStateException("Export Size is more than 2GB");
+        }
 
         boolean semAcquireDone = false;
         try {
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 8bbb997..9d7bf2c 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -29,11 +29,6 @@
 using namespace android;
 
 
-struct fields_t {
-    jfieldID    context;
-};
-static fields_t fields;
-
 static const char* const kClassMediaScannerClient =
         "android/media/MediaScannerClient";
 
@@ -46,6 +41,12 @@
 static const char* const kIllegalArgumentException =
         "java/lang/IllegalArgumentException";
 
+struct fields_t {
+    jfieldID    context;
+};
+static fields_t fields;
+static Mutex sLock;
+
 class MyMediaScannerClient : public MediaScannerClient
 {
 public:
@@ -181,13 +182,29 @@
     return ((JNIEnv *)env)->ExceptionCheck();
 }
 
+// Call this method with sLock hold
+static MediaScanner *getNativeScanner_l(JNIEnv* env, jobject thiz)
+{
+    return (MediaScanner *) env->GetIntField(thiz, fields.context);
+}
+
+// Call this method with sLock hold
+static void setNativeScanner_l(JNIEnv* env, jobject thiz, MediaScanner *s)
+{
+    env->SetIntField(thiz, fields.context, (int)s);
+}
+
 static void
 android_media_MediaScanner_processDirectory(
         JNIEnv *env, jobject thiz, jstring path, jobject client)
 {
     LOGV("processDirectory");
-    MediaScanner *mp =
-        (MediaScanner *)env->GetIntField(thiz, fields.context);
+    Mutex::Autolock l(sLock);
+    MediaScanner *mp = getNativeScanner_l(env, thiz);
+    if (mp == NULL) {
+        jniThrowException(env, kRunTimeException, "No scanner available");
+        return;
+    }
 
     if (path == NULL) {
         jniThrowException(env, kIllegalArgumentException, NULL);
@@ -211,8 +228,13 @@
         jstring mimeType, jobject client)
 {
     LOGV("processFile");
-    MediaScanner *mp =
-        (MediaScanner *)env->GetIntField(thiz, fields.context);
+
+    // Lock already hold by processDirectory
+    MediaScanner *mp = getNativeScanner_l(env, thiz);
+    if (mp == NULL) {
+        jniThrowException(env, kRunTimeException, "No scanner available");
+        return;
+    }
 
     if (path == NULL) {
         jniThrowException(env, kIllegalArgumentException, NULL);
@@ -246,8 +268,12 @@
         JNIEnv *env, jobject thiz, jstring locale)
 {
     LOGV("setLocale");
-    MediaScanner *mp =
-        (MediaScanner *)env->GetIntField(thiz, fields.context);
+    Mutex::Autolock l(sLock);
+    MediaScanner *mp = getNativeScanner_l(env, thiz);
+    if (mp == NULL) {
+        jniThrowException(env, kRunTimeException, "No scanner available");
+        return;
+    }
 
     if (locale == NULL) {
         jniThrowException(env, kIllegalArgumentException, NULL);
@@ -268,8 +294,12 @@
         JNIEnv *env, jobject thiz, jobject fileDescriptor)
 {
     LOGV("extractAlbumArt");
-    MediaScanner *mp =
-        (MediaScanner *)env->GetIntField(thiz, fields.context);
+    Mutex::Autolock l(sLock);
+    MediaScanner *mp = getNativeScanner_l(env, thiz);
+    if (mp == NULL) {
+        jniThrowException(env, kRunTimeException, "No scanner available");
+        return NULL;
+    }
 
     if (fileDescriptor == NULL) {
         jniThrowException(env, kIllegalArgumentException, NULL);
@@ -339,14 +369,13 @@
 android_media_MediaScanner_native_finalize(JNIEnv *env, jobject thiz)
 {
     LOGV("native_finalize");
-    MediaScanner *mp =
-        (MediaScanner *)env->GetIntField(thiz, fields.context);
-
+    Mutex::Autolock l(sLock);
+    MediaScanner *mp = getNativeScanner_l(env, thiz);
     if (mp == 0) {
         return;
     }
-
     delete mp;
+    setNativeScanner_l(env, thiz, 0);
 }
 
 static JNINativeMethod gMethods[] = {
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index f054deb..283b4ea 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -79,10 +79,6 @@
 
 LOCAL_MODULE:= libvideoeditor_jni
 
-# Don't prelink this library.  For more efficient code, you may want
-# to add this library to the prelink map and set this to true.
-LOCAL_PRELINK_MODULE := false
-
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/lib/Android.mk b/media/libeffects/lvm/lib/Android.mk
index ff34707..f49267e 100644
--- a/media/libeffects/lvm/lib/Android.mk
+++ b/media/libeffects/lvm/lib/Android.mk
@@ -105,7 +105,7 @@
 
 LOCAL_MODULE:= libmusicbundle
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/Eq/lib \
@@ -168,7 +168,7 @@
 
 LOCAL_MODULE:= libreverb
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/Reverb/lib \
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index 2e9b9b4..99cfdfa 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -13,7 +13,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_STATIC_LIBRARIES += libmusicbundle
 
@@ -47,7 +47,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_STATIC_LIBRARIES += libreverb
 
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index e6ff654..3a0f438 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -25,6 +25,6 @@
 LOCAL_C_INCLUDES := \
 	$(call include-path-for, graphics corecg)
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/codecs/aacdec/sbr_dec.cpp b/media/libstagefright/codecs/aacdec/sbr_dec.cpp
index 8fcc3ce..8519b17 100644
--- a/media/libstagefright/codecs/aacdec/sbr_dec.cpp
+++ b/media/libstagefright/codecs/aacdec/sbr_dec.cpp
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -447,7 +447,12 @@
 
             if (xoverBand > sbrDec->highSubband)
             {
-                xoverBand = 32; /* error condition, default to upsampling mode */
+                /*
+                 * error condition, default to upsampling mode
+                 * and make sure that the number of bands for xover does
+                 * not exceed the number of high freq bands.
+                 */
+                xoverBand = (sbrDec->highSubband > 32)? 32: sbrDec->highSubband;
             }
 
             m = sbrDec->bufReadOffs + i;    /*  2 + i */
@@ -558,18 +563,22 @@
         /*
          *  Set Circular buffer for PS hybrid analysis
          */
+
+        int32_t *pt_temp = &scratch_mem[2][32];
+
         for (i = 0, j = 0; i < 3; i++)
         {
 
-            pv_memmove(&scratch_mem[2][32 + j     ],
+            pv_memmove(&pt_temp[ j],
                        hParametricStereoDec->hHybrid->mQmfBufferReal[i],
                        HYBRID_FILTER_LENGTH_m_1*sizeof(*hParametricStereoDec->hHybrid->mQmfBufferReal));
-            pv_memmove(&scratch_mem[2][32 + j + 44],
+            pv_memmove(&pt_temp[ j + 44],
                        hParametricStereoDec->hHybrid->mQmfBufferImag[i],
                        HYBRID_FILTER_LENGTH_m_1*sizeof(*hParametricStereoDec->hHybrid->mQmfBufferImag));
             j += 88;
         }
 
+
         pv_memset((void *)&qmf_PS_generated_Real[hParametricStereoDec->usb],
                   0,
                   (64 - hParametricStereoDec->usb)*sizeof(*qmf_PS_generated_Real));
@@ -626,19 +635,23 @@
          *  Save Circular buffer history used on PS hybrid analysis
          */
 
+
+        pt_temp = &scratch_mem[2][64];
+
         for (i = 0, j = 0; i < 3; i++)
         {
             pv_memmove(hParametricStereoDec->hHybrid->mQmfBufferReal[i],
-                       &scratch_mem[2][ 64 + j     ],
+                       &pt_temp[ j],
                        HYBRID_FILTER_LENGTH_m_1*sizeof(*hParametricStereoDec->hHybrid->mQmfBufferReal));
 
             pv_memmove(hParametricStereoDec->hHybrid->mQmfBufferImag[i],
-                       &scratch_mem[2][ 64 + j + 44],
+                       &pt_temp[ j + 44],
                        HYBRID_FILTER_LENGTH_m_1*sizeof(*hParametricStereoDec->hHybrid->mQmfBufferImag));
 
             j += 88;
         }
 
+
         pv_memmove(hFrameData->V, &circular_buffer_s[0], 1152*sizeof(*circular_buffer_s));
 
         /*
@@ -746,7 +759,12 @@
 
                 if (xoverBand > sbrDec->highSubband)
                 {
-                    xoverBand = 32; /* error condition, default to upsampling mode */
+                    /*
+                     * error condition, default to upsampling mode
+                     * and make sure that the number of bands for xover does
+                     * not exceed the number of high freq bands.
+                     */
+                    xoverBand = (sbrDec->highSubband > 32)? 32: sbrDec->highSubband;
                 }
             }
             else
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index cda4f9d..f9cc6a3 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -2,7 +2,7 @@
 include $(CLEAR_VARS)
 include frameworks/base/media/libstagefright/codecs/common/Config.mk
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_SRC_FILES := basic_op/basicop2.c basic_op/oper_32b.c
 
diff --git a/media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp b/media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp
index fb300da..a11d46b 100644
--- a/media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp
@@ -14,6 +14,10 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "AMRNBDecoder"
+#include <utils/Log.h>
+
 #include "AMRNBDecoder.h"
 
 #include "gsmamr_dec.h"
@@ -154,18 +158,24 @@
     const uint8_t *inputPtr =
         (const uint8_t *)mInputBuffer->data() + mInputBuffer->range_offset();
 
-    size_t numBytesRead =
+    int32_t numBytesRead =
         AMRDecode(mState,
           (Frame_Type_3GPP)((inputPtr[0] >> 3) & 0x0f),
           (UWord8 *)&inputPtr[1],
           static_cast<int16_t *>(buffer->data()),
           MIME_IETF);
 
+    if (numBytesRead == -1 ) {
+        LOGE("PV AMR decoder AMRDecode() call failed");
+        buffer->release();
+        buffer = NULL;
+        return ERROR_MALFORMED;
+    }
     ++numBytesRead;  // Include the frame type header byte.
 
     buffer->set_range(0, kNumSamplesPerFrame * sizeof(int16_t));
 
-    if (numBytesRead > mInputBuffer->range_length()) {
+    if (static_cast<size_t>(numBytesRead) > mInputBuffer->range_length()) {
         // This is bad, should never have happened, but did. Abort now.
 
         buffer->release();
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 4293287..5179380 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -2,7 +2,7 @@
 include $(CLEAR_VARS)
 include frameworks/base/media/libstagefright/codecs/common/Config.mk
 
-LOCAL_PRELINK_MODULE := false
+
  	
 LOCAL_SRC_FILES := \
 	AMRWBEncoder.cpp \
diff --git a/media/libstagefright/codecs/common/Android.mk b/media/libstagefright/codecs/common/Android.mk
index fffb2ad..af8795a 100644
--- a/media/libstagefright/codecs/common/Android.mk
+++ b/media/libstagefright/codecs/common/Android.mk
@@ -1,7 +1,7 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_SRC_FILES := cmnMemory.c
 
diff --git a/media/libstagefright/foundation/Android.mk b/media/libstagefright/foundation/Android.mk
index 4e07f6f..d5025a1 100644
--- a/media/libstagefright/foundation/Android.mk
+++ b/media/libstagefright/foundation/Android.mk
@@ -25,6 +25,6 @@
 
 LOCAL_MODULE:= libstagefright_foundation
 
-LOCAL_PRELINK_MODULE:= false
+
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/yuv/Android.mk b/media/libstagefright/yuv/Android.mk
index 7697e3c..a4253f6 100644
--- a/media/libstagefright/yuv/Android.mk
+++ b/media/libstagefright/yuv/Android.mk
@@ -10,6 +10,6 @@
 
 LOCAL_MODULE:= libstagefright_yuv
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 4ea8849..2e86159 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -819,6 +819,10 @@
         return mResponse.getResponseCode();
     }
     int ret = mResponse.read(mRequestIn1);
+    // handle zero length packets, which might occur if the data transfer
+    // ends on a packet boundary
+    if (ret == 0)
+        ret = mResponse.read(mRequestIn1);
     if (ret >= MTP_CONTAINER_HEADER_SIZE) {
         mResponse.dump();
         return mResponse.getResponseCode();
diff --git a/media/tests/players/Android.mk b/media/tests/players/Android.mk
index 10367cf..c655ae6 100644
--- a/media/tests/players/Android.mk
+++ b/media/tests/players/Android.mk
@@ -24,6 +24,6 @@
 
 LOCAL_MODULE:= invoke_mock_media_player
 LOCAL_MODULE_TAGS := tests eng
-LOCAL_PRELINK_MODULE:= false
+
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/nfc-extras/Android.mk b/nfc-extras/Android.mk
new file mode 100644
index 0000000..131d898
--- /dev/null
+++ b/nfc-extras/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_MODULE:= com.android.nfc_extras
+
+include $(BUILD_JAVA_LIBRARY)
+
+# put the classes.jar, with full class files instead of classes.dex inside, into the dist directory
+$(call dist-for-goals, droidcore, $(full_classes_jar):com.android.nfc_extras.jar)
diff --git a/nfc-extras/com.android.nfc_extras.xml b/nfc-extras/com.android.nfc_extras.xml
new file mode 100644
index 0000000..370145d
--- /dev/null
+++ b/nfc-extras/com.android.nfc_extras.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<permissions>
+    <library name="com.android.nfc_extras"
+            file="/system/framework/com.android.nfc_extras.jar" />
+</permissions>
diff --git a/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java b/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java
new file mode 100644
index 0000000..cf38bd1
--- /dev/null
+++ b/nfc-extras/java/com/android/nfc_extras/NfcAdapterExtras.java
@@ -0,0 +1,180 @@
+/*
+ * 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.nfc_extras;
+
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
+import android.nfc.INfcAdapterExtras;
+import android.nfc.NfcAdapter;
+import android.os.RemoteException;
+import android.util.Log;
+
+/**
+ * Provides additional methods on an {@link NfcAdapter} for Card Emulation
+ * and management of {@link NfcExecutionEnvironment}'s.
+ *
+ * There is a 1-1 relationship between an {@link NfcAdapterExtras} object and
+ * a {@link NfcAdapter} object.
+ */
+public final class NfcAdapterExtras {
+    private static final String TAG = "NfcAdapterExtras";
+
+    /**
+     * Broadcast Action: an RF field ON has been detected.
+     *
+     * <p class="note">This is an unreliable signal, and will be removed.
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission
+     * to receive.
+     */
+    public static final String ACTION_RF_FIELD_ON_DETECTED =
+            "com.android.nfc_extras.action.RF_FIELD_ON_DETECTED";
+
+    /**
+     * Broadcast Action: an RF field OFF has been detected.
+     *
+     * <p class="note">This is an unreliable signal, and will be removed.
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission
+     * to receive.
+     */
+    public static final String ACTION_RF_FIELD_OFF_DETECTED =
+            "com.android.nfc_extras.action.RF_FIELD_OFF_DETECTED";
+
+    // protected by NfcAdapterExtras.class, and final after first construction
+    private static INfcAdapterExtras sService;
+    private static boolean sIsInitialized = false;
+    private static NfcAdapterExtras sSingleton;
+    private static NfcExecutionEnvironment sEmbeddedEe;
+    private static CardEmulationRoute sRouteOff;
+    private static CardEmulationRoute sRouteOnWhenScreenOn;
+
+    /**
+     * Get the {@link NfcAdapterExtras} for the given {@link NfcAdapter}.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @param adapter a {@link NfcAdapter}, must not be null
+     * @return the {@link NfcAdapterExtras} object for the given {@link NfcAdapter}
+     */
+    public static NfcAdapterExtras get(NfcAdapter adapter) {
+        synchronized(NfcAdapterExtras.class) {
+            if (!sIsInitialized) {
+               sIsInitialized = true;
+               sService = adapter.getNfcAdapterExtrasInterface();
+               sEmbeddedEe = new NfcExecutionEnvironment(sService);
+               sRouteOff = new CardEmulationRoute(CardEmulationRoute.ROUTE_OFF, null);
+               sRouteOnWhenScreenOn = new CardEmulationRoute(
+                       CardEmulationRoute.ROUTE_ON_WHEN_SCREEN_ON, sEmbeddedEe);
+               sSingleton = new NfcAdapterExtras();
+            }
+            return sSingleton;
+        }
+    }
+
+    private NfcAdapterExtras() {}
+
+    /**
+     * Immutable data class that describes a card emulation route.
+     */
+    public final static class CardEmulationRoute {
+        /**
+         * Card Emulation is turned off on this NfcAdapter.
+         * <p>This is the default routing state after boot.
+         */
+        public static final int ROUTE_OFF = 1;
+
+        /**
+         * Card Emulation is routed to {@link #nfcEe} only when the screen is on,
+         * otherwise it is turned off.
+         */
+        public static final int ROUTE_ON_WHEN_SCREEN_ON = 2;
+
+        /**
+         * A route such as {@link #ROUTE_OFF} or {@link #ROUTE_ON_WHEN_SCREEN_ON}.
+         */
+        public final int route;
+
+        /**
+         * The {@link NFcExecutionEnvironment} that is Card Emulation is routed to.
+         * <p>null if {@link #route} is {@link #ROUTE_OFF}, otherwise not null.
+         */
+        public final NfcExecutionEnvironment nfcEe;
+
+        public CardEmulationRoute(int route, NfcExecutionEnvironment nfcEe) {
+            if (route == ROUTE_OFF && nfcEe != null) {
+                throw new IllegalArgumentException("must not specifiy a NFC-EE with ROUTE_OFF");
+            } else if (route != ROUTE_OFF && nfcEe == null) {
+                throw new IllegalArgumentException("must specifiy a NFC-EE for this route");
+            }
+            this.route = route;
+            this.nfcEe = nfcEe;
+        }
+    }
+
+    /**
+     * Get the routing state of this NFC EE.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @return
+     */
+    public CardEmulationRoute getCardEmulationRoute() {
+        try {
+            int route = sService.getCardEmulationRoute();
+            return route == CardEmulationRoute.ROUTE_OFF ?
+                    sRouteOff :
+                    sRouteOnWhenScreenOn;
+        } catch (RemoteException e) {
+            Log.e(TAG, "", e);
+            return sRouteOff;
+        }
+    }
+
+    /**
+     * Set the routing state of this NFC EE.
+     *
+     * <p>This routing state is not persisted across reboot.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @param route a {@link #CardEmulationRoute}
+     */
+    public void setCardEmulationRoute(CardEmulationRoute route) {
+        try {
+            sService.setCardEmulationRoute(route.route);
+        } catch (RemoteException e) {
+            Log.e(TAG, "", e);
+        }
+    }
+
+    /**
+     * Get the {@link NfcExecutionEnvironment} that is embedded with the
+     * {@link NFcAdapter}.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @return a {@link NfcExecutionEnvironment}, or null if there is no embedded NFC-EE
+     */
+    public NfcExecutionEnvironment getEmbeddedExecutionEnvironment() {
+        return sEmbeddedEe;
+    }
+}
diff --git a/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java b/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
new file mode 100644
index 0000000..3efe492
--- /dev/null
+++ b/nfc-extras/java/com/android/nfc_extras/NfcExecutionEnvironment.java
@@ -0,0 +1,125 @@
+/*
+ * 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.nfc_extras;
+
+import java.io.IOException;
+
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
+import android.content.Context;
+import android.nfc.INfcAdapterExtras;
+import android.nfc.NfcAdapter;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+public class NfcExecutionEnvironment {
+    private final INfcAdapterExtras mService;
+
+    /**
+     * Broadcast Action: An ISO-DEP AID was selected.
+     *
+     * <p>This happens as the result of a 'SELECT AID' command from an
+     * external NFC reader/writer.
+     *
+     * <p>Always contains the extra field {@link #EXTRA_AID}
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission
+     * to receive.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_AID_SELECTED =
+        "com.android.nfc_extras.action.AID_SELECTED";
+
+    /**
+     * Mandatory byte array extra field in {@link #ACTION_AID_SELECTED}.
+     *
+     * <p>Contains the AID selected.
+     * @hide
+     */
+    public static final String EXTRA_AID = "com.android.nfc_extras.extra.AID";
+
+    NfcExecutionEnvironment(INfcAdapterExtras service) {
+        mService = service;
+    }
+
+    /**
+     * Open the NFC Execution Environment on its contact interface.
+     *
+     * <p>Only one process may open the secure element at a time. If it is
+     * already open, an {@link IOException} is thrown.
+     *
+     * <p>All other NFC functionality is disabled while the NFC-EE is open
+     * on its contact interface, so make sure to call {@link #close} once complete.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @throws IOException if the NFC-EE is already open, or some other error occurs
+     */
+    public void open() throws IOException {
+        try {
+            Bundle b = mService.open(new Binder());
+            throwBundle(b);
+        } catch (RemoteException e) {
+            return;
+        }
+    }
+
+    /**
+     * Close the NFC Execution Environment on its contact interface.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @throws IOException if the NFC-EE is already open, or some other error occurs
+     */
+    public void close() throws IOException {
+        try {
+            throwBundle(mService.close());
+        } catch (RemoteException e) {
+            return;
+        }
+    }
+
+    /**
+     * Send raw commands to the NFC-EE and receive the response.
+     *
+     * <p class="note">
+     * Requires the {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission.
+     *
+     * @throws IOException if the NFC-EE is not open, or some other error occurs
+     */
+    public byte[] transceive(byte[] in) throws IOException {
+        Bundle b;
+        try {
+            b = mService.transceive(in);
+        } catch (RemoteException e) {
+            throw new IOException(e.getMessage());
+        }
+        throwBundle(b);
+        return b.getByteArray("out");
+    }
+
+    private static void throwBundle(Bundle b) throws IOException {
+        if (b.getInt("e") == -1) {
+            throw new IOException(b.getString("m"));
+        }
+    }
+}
diff --git a/opengl/tests/gl2_jni/Android.mk b/opengl/tests/gl2_jni/Android.mk
index 384966c..e8b6c57 100644
--- a/opengl/tests/gl2_jni/Android.mk
+++ b/opengl/tests/gl2_jni/Android.mk
@@ -44,7 +44,7 @@
 
 LOCAL_MODULE := libgl2jni
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
index 602ea1a..f0b8d12 100644
--- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
+++ b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
@@ -186,11 +186,6 @@
         GraphicBuffer::USAGE_SW_WRITE_RARELY;
 const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12;
 const int yuvTexOffsetY = 0;
-const int yuvTexStrideY = (yuvTexWidth + 0xf) & ~0xf;
-const int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
-const int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; 
-const int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
-const int yuvTexStrideU = yuvTexStrideV;
 const bool yuvTexSameUV = false;
 static sp<GraphicBuffer> yuvTexBuffer;
 static GLuint yuvTex;
@@ -200,6 +195,11 @@
     int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
     yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
             yuvTexUsage);
+    int yuvTexStrideY = yuvTexBuffer->getStride();
+    int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
+    int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
+    int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
+    int yuvTexStrideU = yuvTexStrideV;
     char* buf = NULL;
     status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
     if (err != 0) {
diff --git a/opengl/tests/gl_jni/Android.mk b/opengl/tests/gl_jni/Android.mk
index f1bd31d..4acd91f 100644
--- a/opengl/tests/gl_jni/Android.mk
+++ b/opengl/tests/gl_jni/Android.mk
@@ -46,7 +46,7 @@
 
 LOCAL_ARM_MODE := arm
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/opengl/tests/gl_perfapp/Android.mk b/opengl/tests/gl_perfapp/Android.mk
index dd75a74..4b79569 100644
--- a/opengl/tests/gl_perfapp/Android.mk
+++ b/opengl/tests/gl_perfapp/Android.mk
@@ -47,7 +47,7 @@
 
 LOCAL_MODULE := libglperf
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/opengl/tests/gldual/Android.mk b/opengl/tests/gldual/Android.mk
index 995a5d7..f1a998a 100644
--- a/opengl/tests/gldual/Android.mk
+++ b/opengl/tests/gldual/Android.mk
@@ -44,7 +44,7 @@
 
 LOCAL_MODULE := libgldualjni
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/opengl/tests/hwc/Android.mk b/opengl/tests/hwc/Android.mk
index 6312970..e4d7e28 100644
--- a/opengl/tests/hwc/Android.mk
+++ b/opengl/tests/hwc/Android.mk
@@ -29,7 +29,7 @@
 
 LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport
 LOCAL_STATIC_LIBRARIES += libglTest
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_STATIC_LIBRARY)
 
diff --git a/opengl/tests/lib/Android.mk b/opengl/tests/lib/Android.mk
index 7542ac4..ac1e183 100644
--- a/opengl/tests/lib/Android.mk
+++ b/opengl/tests/lib/Android.mk
@@ -27,6 +27,6 @@
 LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
 
 LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/packages/DefaultContainerService/jni/Android.mk b/packages/DefaultContainerService/jni/Android.mk
index a2febec..79ff451 100644
--- a/packages/DefaultContainerService/jni/Android.mk
+++ b/packages/DefaultContainerService/jni/Android.mk
@@ -18,7 +18,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_SRC_FILES := \
     com_android_defcontainer_MeasurementUtils.cpp
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index fa63edb..744798e 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -27,6 +27,7 @@
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
+import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Arrays;
@@ -58,15 +59,20 @@
     private static final String KEY_SECURE = "secure";
     private static final String KEY_LOCALE = "locale";
 
+    //Version 2 adds STATE_WIFI_CONFIG
+    private static final int STATE_VERSION_1       = 1;
+    private static final int STATE_VERSION_1_SIZE  = 4;
+
     // Versioning of the state file.  Increment this version
     // number any time the set of state items is altered.
-    private static final int STATE_VERSION = 1;
+    private static final int STATE_VERSION = 2;
 
-    private static final int STATE_SYSTEM = 0;
-    private static final int STATE_SECURE = 1;
-    private static final int STATE_LOCALE = 2;
-    private static final int STATE_WIFI   = 3;
-    private static final int STATE_SIZE   = 4; // The number of state items
+    private static final int STATE_SYSTEM          = 0;
+    private static final int STATE_SECURE          = 1;
+    private static final int STATE_LOCALE          = 2;
+    private static final int STATE_WIFI_SUPPLICANT = 3;
+    private static final int STATE_WIFI_CONFIG     = 4;
+    private static final int STATE_SIZE            = 5; // The number of state items
 
     private static String[] sortedSystemKeys = null;
     private static String[] sortedSecureKeys = null;
@@ -91,12 +97,18 @@
     // the key to store the WIFI data under, should be sorted as last, so restore happens last.
     // use very late unicode character to quasi-guarantee last sort position.
     private static final String KEY_WIFI_SUPPLICANT = "\uffedWIFI";
+    private static final String KEY_WIFI_CONFIG = "\uffedCONFIG_WIFI";
 
     private SettingsHelper mSettingsHelper;
+    private WifiManager mWfm;
+    private static String mWifiConfigFile;
 
     public void onCreate() {
         mSettingsHelper = new SettingsHelper(this);
         super.onCreate();
+
+        WifiManager mWfm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+        if (mWfm != null) mWifiConfigFile = mWfm.getConfigFile();
     }
 
     @Override
@@ -106,7 +118,8 @@
         byte[] systemSettingsData = getSystemSettings();
         byte[] secureSettingsData = getSecureSettings();
         byte[] locale = mSettingsHelper.getLocaleData();
-        byte[] wifiData = getWifiSupplicant(FILE_WIFI_SUPPLICANT);
+        byte[] wifiSupplicantData = getWifiSupplicant(FILE_WIFI_SUPPLICANT);
+        byte[] wifiConfigData = getFileData(mWifiConfigFile);
 
         long[] stateChecksums = readOldChecksums(oldState);
 
@@ -116,8 +129,12 @@
                 writeIfChanged(stateChecksums[STATE_SECURE], KEY_SECURE, secureSettingsData, data);
         stateChecksums[STATE_LOCALE] =
                 writeIfChanged(stateChecksums[STATE_LOCALE], KEY_LOCALE, locale, data);
-        stateChecksums[STATE_WIFI] =
-                writeIfChanged(stateChecksums[STATE_WIFI], KEY_WIFI_SUPPLICANT, wifiData, data);
+        stateChecksums[STATE_WIFI_SUPPLICANT] =
+                writeIfChanged(stateChecksums[STATE_WIFI_SUPPLICANT], KEY_WIFI_SUPPLICANT,
+                wifiSupplicantData, data);
+        stateChecksums[STATE_WIFI_CONFIG] =
+                writeIfChanged(stateChecksums[STATE_WIFI_CONFIG], KEY_WIFI_CONFIG, wifiConfigData,
+                data);
 
         writeNewChecksums(stateChecksums, newState);
     }
@@ -148,7 +165,9 @@
                 byte[] localeData = new byte[size];
                 data.readEntityData(localeData, 0, size);
                 mSettingsHelper.setLocaleData(localeData);
-            } else {
+            } else if (KEY_WIFI_CONFIG.equals(key)) {
+                restoreFileData(mWifiConfigFile, data);
+             } else {
                 data.skipEntityData();
             }
         }
@@ -162,7 +181,11 @@
 
         try {
             int stateVersion = dataInput.readInt();
-            if (stateVersion == STATE_VERSION) {
+            if (stateVersion == STATE_VERSION_1) {
+                for (int i = 0; i < STATE_VERSION_1_SIZE; i++) {
+                    stateChecksums[i] = dataInput.readLong();
+                }
+            } else if (stateVersion == STATE_VERSION) {
                 for (int i = 0; i < STATE_SIZE; i++) {
                     stateChecksums[i] = dataInput.readLong();
                 }
@@ -353,6 +376,60 @@
         return result;
     }
 
+    private byte[] getFileData(String filename) {
+        InputStream is = null;
+        try {
+            File file = new File(filename);
+            is = new FileInputStream(file);
+
+            //Will truncate read on a very long file,
+            //should not happen for a config file
+            byte[] bytes = new byte[(int)file.length()];
+
+            int offset = 0;
+            int numRead = 0;
+            while (offset < bytes.length
+                    && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
+                offset += numRead;
+            }
+
+            //read failure
+            if (offset < bytes.length) {
+                Log.w(TAG, "Couldn't backup " + filename);
+                return EMPTY_DATA;
+            }
+            return bytes;
+        } catch (IOException ioe) {
+            Log.w(TAG, "Couldn't backup " + filename);
+            return EMPTY_DATA;
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+
+    }
+
+    private void restoreFileData(String filename, BackupDataInput data) {
+        byte[] bytes = new byte[data.getDataSize()];
+        if (bytes.length <= 0) return;
+        try {
+            data.readEntityData(bytes, 0, bytes.length);
+            File file = new File(filename);
+            if (file.exists()) file.delete();
+
+            OutputStream os = new BufferedOutputStream(new FileOutputStream(filename, true));
+            os.write(bytes);
+            os.close();
+        } catch (IOException ioe) {
+            Log.w(TAG, "Couldn't restore " + filename);
+        }
+    }
+
+
     private byte[] getWifiSupplicant(String filename) {
         BufferedReader br = null;
         try {
@@ -455,10 +532,9 @@
     }
 
     private int enableWifi(boolean enable) {
-        WifiManager wfm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
-        if (wfm != null) {
-            int state = wfm.getWifiState();
-            wfm.setWifiEnabled(enable);
+        if (mWfm != null) {
+            int state = mWfm.getWifiState();
+            mWfm.setWifiEnabled(enable);
             return state;
         }
         return WifiManager.WIFI_STATE_UNKNOWN;
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java
index 4e6f81f..2781246 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbConfirmActivity.java
@@ -100,6 +100,14 @@
 
     }
 
+    @Override
+    protected void onDestroy() {
+        if (mDisconnectedReceiver != null) {
+            unregisterReceiver(mDisconnectedReceiver);
+        }
+        super.onDestroy();
+    }
+
     public void onClick(DialogInterface dialog, int which) {
         if (which == AlertDialog.BUTTON_POSITIVE) {
             try {
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 19295e6d..ff26fc9 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -2135,8 +2135,8 @@
         if (pointerIds.hasBit(pointerId)) {
             splitPointerIndexMap[splitPointerCount] = originalPointerIndex;
             splitPointerIds[splitPointerCount] = pointerId;
-            splitPointerCoords[splitPointerCount] =
-                    originalMotionEntry->firstSample.pointerCoords[originalPointerIndex];
+            splitPointerCoords[splitPointerCount].copyFrom(
+                    originalMotionEntry->firstSample.pointerCoords[originalPointerIndex]);
             splitPointerCount += 1;
         }
     }
@@ -2199,8 +2199,8 @@
         for (uint32_t splitPointerIndex = 0; splitPointerIndex < splitPointerCount;
                 splitPointerIndex++) {
             uint32_t originalPointerIndex = splitPointerIndexMap[splitPointerIndex];
-            splitPointerCoords[splitPointerIndex] =
-                    originalMotionSample->pointerCoords[originalPointerIndex];
+            splitPointerCoords[splitPointerIndex].copyFrom(
+                    originalMotionSample->pointerCoords[originalPointerIndex]);
         }
 
         mAllocator.appendMotionSample(splitMotionEntry, originalMotionSample->eventTime,
@@ -3453,7 +3453,7 @@
     entry->lastSample = & entry->firstSample;
     for (uint32_t i = 0; i < pointerCount; i++) {
         entry->pointerIds[i] = pointerIds[i];
-        entry->firstSample.pointerCoords[i] = pointerCoords[i];
+        entry->firstSample.pointerCoords[i].copyFrom(pointerCoords[i]);
     }
     return entry;
 }
@@ -3556,7 +3556,7 @@
     sample->eventTime = eventTime;
     uint32_t pointerCount = motionEntry->pointerCount;
     for (uint32_t i = 0; i < pointerCount; i++) {
-        sample->pointerCoords[i] = pointerCoords[i];
+        sample->pointerCoords[i].copyFrom(pointerCoords[i]);
     }
 
     sample->next = NULL;
@@ -3693,7 +3693,7 @@
     pointerCount = entry->pointerCount;
     for (uint32_t i = 0; i < entry->pointerCount; i++) {
         pointerIds[i] = entry->pointerIds[i];
-        pointerCoords[i] = entry->lastSample->pointerCoords[i];
+        pointerCoords[i].copyFrom(entry->lastSample->pointerCoords[i]);
     }
 }
 
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 3029028..592939f 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -33,6 +33,9 @@
 // Log debug messages about pointer assignment calculations.
 #define DEBUG_POINTER_ASSIGNMENT 0
 
+// Log debug messages about gesture detection.
+#define DEBUG_GESTURES 0
+
 
 #include "InputReader.h"
 
@@ -54,6 +57,38 @@
 
 namespace android {
 
+// --- Constants ---
+
+// Quiet time between certain gesture transitions.
+// Time to allow for all fingers or buttons to settle into a stable state before
+// starting a new gesture.
+static const nsecs_t QUIET_INTERVAL = 100 * 1000000; // 100 ms
+
+// The minimum speed that a pointer must travel for us to consider switching the active
+// touch pointer to it during a drag.  This threshold is set to avoid switching due
+// to noise from a finger resting on the touch pad (perhaps just pressing it down).
+static const float DRAG_MIN_SWITCH_SPEED = 50.0f; // pixels per second
+
+// Tap gesture delay time.
+// The time between down and up must be less than this to be considered a tap.
+static const nsecs_t TAP_INTERVAL = 100 * 1000000; // 100 ms
+
+// The distance in pixels that the pointer is allowed to move from initial down
+// to up and still be called a tap.
+static const float TAP_SLOP = 5.0f; // 5 pixels
+
+// The transition from INDETERMINATE_MULTITOUCH to SWIPE or FREEFORM gesture mode is made when
+// all of the pointers have traveled this number of pixels from the start point.
+static const float MULTITOUCH_MIN_TRAVEL = 5.0f;
+
+// The transition from INDETERMINATE_MULTITOUCH to SWIPE gesture mode can only occur when the
+// cosine of the angle between the two vectors is greater than or equal to than this value
+// which indicates that the vectors are oriented in the same direction.
+// When the vectors are oriented in the exactly same direction, the cosine is 1.0.
+// (In exactly opposite directions, the cosine is -1.0.)
+static const float SWIPE_TRANSITION_ANGLE_COSINE = 0.5f; // cosine of 45 degrees
+
+
 // --- Static Functions ---
 
 template<typename T>
@@ -81,6 +116,12 @@
     return sqrtf(x * x + y * y);
 }
 
+inline static int32_t distanceSquared(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {
+    int32_t dx = x1 - x2;
+    int32_t dy = y1 - y2;
+    return dx * dx + dy * dy;
+}
+
 inline static int32_t signExtendNybble(int32_t value) {
     return value >= 8 ? value - 16 : value;
 }
@@ -207,7 +248,7 @@
     mEventHub->getEvent(& rawEvent);
 
 #if DEBUG_RAW_EVENTS
-    LOGD("Input event: device=%d type=0x%x scancode=%d keycode=%d value=%d",
+    LOGD("Input event: device=%d type=0x%04x scancode=0x%04x keycode=0x%04x value=0x%04x",
             rawEvent.deviceId, rawEvent.type, rawEvent.scanCode, rawEvent.keyCode,
             rawEvent.value);
 #endif
@@ -1540,7 +1581,7 @@
 }
 
 uint32_t TouchInputMapper::getSources() {
-    return mTouchSource;
+    return mTouchSource | mPointerSource;
 }
 
 void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) {
@@ -1579,6 +1620,18 @@
         if (mLocked.orientedRanges.haveOrientation) {
             info->addMotionRange(mLocked.orientedRanges.orientation);
         }
+
+        if (mPointerController != NULL) {
+            float minX, minY, maxX, maxY;
+            if (mPointerController->getBounds(&minX, &minY, &maxX, &maxY)) {
+                info->addMotionRange(AMOTION_EVENT_AXIS_X, mPointerSource,
+                        minX, maxX, 0.0f, 0.0f);
+                info->addMotionRange(AMOTION_EVENT_AXIS_Y, mPointerSource,
+                        minY, maxY, 0.0f, 0.0f);
+            }
+            info->addMotionRange(AMOTION_EVENT_AXIS_PRESSURE, mPointerSource,
+                    0.0f, 1.0f, 0.0f, 0.0f);
+        }
     } // release lock
 }
 
@@ -1608,6 +1661,21 @@
 
         dump.appendFormat(INDENT3 "Last Touch:\n");
         dump.appendFormat(INDENT4 "Pointer Count: %d\n", mLastTouch.pointerCount);
+        dump.appendFormat(INDENT4 "Button State: 0x%08x\n", mLastTouch.buttonState);
+
+        if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+            dump.appendFormat(INDENT3 "Pointer Gesture Detector:\n");
+            dump.appendFormat(INDENT4 "XMovementScale: %0.3f\n",
+                    mLocked.pointerGestureXMovementScale);
+            dump.appendFormat(INDENT4 "YMovementScale: %0.3f\n",
+                    mLocked.pointerGestureYMovementScale);
+            dump.appendFormat(INDENT4 "XZoomScale: %0.3f\n",
+                    mLocked.pointerGestureXZoomScale);
+            dump.appendFormat(INDENT4 "YZoomScale: %0.3f\n",
+                    mLocked.pointerGestureYZoomScale);
+            dump.appendFormat(INDENT4 "MaxSwipeWidthSquared: %d\n",
+                    mLocked.pointerGestureMaxSwipeWidthSquared);
+        }
     } // release lock
 }
 
@@ -1630,6 +1698,8 @@
     mLocked.orientedRanges.haveTouchSize = false;
     mLocked.orientedRanges.haveToolSize = false;
     mLocked.orientedRanges.haveOrientation = false;
+
+    mPointerGesture.reset();
 }
 
 void TouchInputMapper::configure() {
@@ -1642,9 +1712,15 @@
     switch (mParameters.deviceType) {
     case Parameters::DEVICE_TYPE_TOUCH_SCREEN:
         mTouchSource = AINPUT_SOURCE_TOUCHSCREEN;
+        mPointerSource = 0;
         break;
     case Parameters::DEVICE_TYPE_TOUCH_PAD:
         mTouchSource = AINPUT_SOURCE_TOUCHPAD;
+        mPointerSource = 0;
+        break;
+    case Parameters::DEVICE_TYPE_POINTER:
+        mTouchSource = AINPUT_SOURCE_TOUCHPAD;
+        mPointerSource = AINPUT_SOURCE_MOUSE;
         break;
     default:
         assert(false);
@@ -1671,14 +1747,26 @@
     mParameters.useJumpyTouchFilter = getPolicy()->filterJumpyTouchEvents();
     mParameters.virtualKeyQuietTime = getPolicy()->getVirtualKeyQuietTime();
 
+    if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
+            || getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) {
+        // The device is a cursor device with a touch pad attached.
+        // By default don't use the touch pad to move the pointer.
+        mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
+    } else {
+        // The device is just a touch pad.
+        // By default use the touch pad to move the pointer and to perform related gestures.
+        mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
+    }
+
     String8 deviceTypeString;
-    mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
     if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"),
             deviceTypeString)) {
         if (deviceTypeString == "touchScreen") {
             mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
         } else if (deviceTypeString == "touchPad") {
             mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
+        } else if (deviceTypeString == "pointer") {
+            mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
         } else {
             LOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
         }
@@ -1690,6 +1778,7 @@
 
     mParameters.associatedDisplayId = mParameters.orientationAware
             || mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
+            || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER
             ? 0 : -1;
 }
 
@@ -1703,6 +1792,9 @@
     case Parameters::DEVICE_TYPE_TOUCH_PAD:
         dump.append(INDENT4 "DeviceType: touchPad\n");
         break;
+    case Parameters::DEVICE_TYPE_POINTER:
+        dump.append(INDENT4 "DeviceType: pointer\n");
+        break;
     default:
         assert(false);
     }
@@ -1776,6 +1868,11 @@
         }
     }
 
+    if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER
+            && mPointerController == NULL) {
+        mPointerController = getPolicy()->obtainPointerController(getDeviceId());
+    }
+
     bool orientationChanged = mLocked.surfaceOrientation != orientation;
     if (orientationChanged) {
         mLocked.surfaceOrientation = orientation;
@@ -1997,6 +2094,37 @@
             mLocked.orientedRanges.y.fuzz = mLocked.yScale;
             break;
         }
+
+        // Compute pointer gesture detection parameters.
+        // TODO: These factors should not be hardcoded.
+        if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+            int32_t rawWidth = mRawAxes.x.maxValue - mRawAxes.x.minValue + 1;
+            int32_t rawHeight = mRawAxes.y.maxValue - mRawAxes.y.minValue + 1;
+
+            // Scale movements such that one whole swipe of the touch pad covers a portion
+            // of the display along whichever axis of the touch pad is longer.
+            // Assume that the touch pad has a square aspect ratio such that movements in
+            // X and Y of the same number of raw units cover the same physical distance.
+            const float scaleFactor = 0.8f;
+
+            mLocked.pointerGestureXMovementScale = rawWidth > rawHeight
+                    ? scaleFactor * float(mLocked.associatedDisplayWidth) / rawWidth
+                    : scaleFactor * float(mLocked.associatedDisplayHeight) / rawHeight;
+            mLocked.pointerGestureYMovementScale = mLocked.pointerGestureXMovementScale;
+
+            // Scale zooms to cover a smaller range of the display than movements do.
+            // This value determines the area around the pointer that is affected by freeform
+            // pointer gestures.
+            mLocked.pointerGestureXZoomScale = mLocked.pointerGestureXMovementScale * 0.4f;
+            mLocked.pointerGestureYZoomScale = mLocked.pointerGestureYMovementScale * 0.4f;
+
+            // Max width between pointers to detect a swipe gesture is 3/4 of the short
+            // axis of the touch pad.  Touches that are wider than this are translated
+            // into freeform gestures.
+            mLocked.pointerGestureMaxSwipeWidthSquared = min(rawWidth, rawHeight) * 3 / 4;
+            mLocked.pointerGestureMaxSwipeWidthSquared *=
+                    mLocked.pointerGestureMaxSwipeWidthSquared;
+        }
     }
 
     return true;
@@ -2476,12 +2604,17 @@
     TouchResult touchResult = consumeOffScreenTouches(when, policyFlags);
     if (touchResult == DISPATCH_TOUCH) {
         suppressSwipeOntoVirtualKeys(when);
+        if (mPointerController != NULL) {
+            dispatchPointerGestures(when, policyFlags);
+        }
         dispatchTouches(when, policyFlags);
     }
 
     // Copy current touch to last touch in preparation for the next cycle.
+    // Keep the button state so we can track edge-triggered button state changes.
     if (touchResult == DROP_STROKE) {
         mLastTouch.clear();
+        mLastTouch.buttonState = savedTouch->buttonState;
     } else {
         mLastTouch.copyFrom(*savedTouch);
     }
@@ -2629,329 +2762,1097 @@
         return; // nothing to do!
     }
 
+    // Update current touch coordinates.
+    int32_t edgeFlags;
+    float xPrecision, yPrecision;
+    prepareTouches(&edgeFlags, &xPrecision, &yPrecision);
+
+    // Dispatch motions.
     BitSet32 currentIdBits = mCurrentTouch.idBits;
     BitSet32 lastIdBits = mLastTouch.idBits;
+    uint32_t metaState = getContext()->getGlobalMetaState();
 
     if (currentIdBits == lastIdBits) {
         // No pointer id changes so this is a move event.
         // The dispatcher takes care of batching moves so we don't have to deal with that here.
-        int32_t motionEventAction = AMOTION_EVENT_ACTION_MOVE;
-        dispatchTouch(when, policyFlags, & mCurrentTouch,
-                currentIdBits, -1, currentPointerCount, motionEventAction);
+        dispatchMotion(when, policyFlags, mTouchSource,
+                AMOTION_EVENT_ACTION_MOVE, 0, metaState, AMOTION_EVENT_EDGE_FLAG_NONE,
+                mCurrentTouchCoords, mCurrentTouch.idToIndex, currentIdBits, -1,
+                xPrecision, yPrecision, mDownTime);
     } else {
         // There may be pointers going up and pointers going down and pointers moving
         // all at the same time.
-        BitSet32 upIdBits(lastIdBits.value & ~ currentIdBits.value);
-        BitSet32 downIdBits(currentIdBits.value & ~ lastIdBits.value);
-        BitSet32 activeIdBits(lastIdBits.value);
-        uint32_t pointerCount = lastPointerCount;
-
-        // Produce an intermediate representation of the touch data that consists of the
-        // old location of pointers that have just gone up and the new location of pointers that
-        // have just moved but omits the location of pointers that have just gone down.
-        TouchData interimTouch;
-        interimTouch.copyFrom(mLastTouch);
-
+        BitSet32 upIdBits(lastIdBits.value & ~currentIdBits.value);
+        BitSet32 downIdBits(currentIdBits.value & ~lastIdBits.value);
         BitSet32 moveIdBits(lastIdBits.value & currentIdBits.value);
-        bool moveNeeded = false;
-        while (!moveIdBits.isEmpty()) {
-            uint32_t moveId = moveIdBits.firstMarkedBit();
-            moveIdBits.clearBit(moveId);
+        BitSet32 dispatchedIdBits(lastIdBits.value);
 
-            int32_t oldIndex = mLastTouch.idToIndex[moveId];
-            int32_t newIndex = mCurrentTouch.idToIndex[moveId];
-            if (mLastTouch.pointers[oldIndex] != mCurrentTouch.pointers[newIndex]) {
-                interimTouch.pointers[oldIndex] = mCurrentTouch.pointers[newIndex];
-                moveNeeded = true;
-            }
-        }
+        // Update last coordinates of pointers that have moved so that we observe the new
+        // pointer positions at the same time as other pointers that have just gone up.
+        bool moveNeeded = updateMovedPointerCoords(
+                mCurrentTouchCoords, mCurrentTouch.idToIndex,
+                mLastTouchCoords, mLastTouch.idToIndex,
+                moveIdBits);
 
-        // Dispatch pointer up events using the interim pointer locations.
+        // Dispatch pointer up events.
         while (!upIdBits.isEmpty()) {
             uint32_t upId = upIdBits.firstMarkedBit();
             upIdBits.clearBit(upId);
-            BitSet32 oldActiveIdBits = activeIdBits;
-            activeIdBits.clearBit(upId);
 
-            int32_t motionEventAction;
-            if (activeIdBits.isEmpty()) {
-                motionEventAction = AMOTION_EVENT_ACTION_UP;
-            } else {
-                motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP;
-            }
-
-            dispatchTouch(when, policyFlags, &interimTouch,
-                    oldActiveIdBits, upId, pointerCount, motionEventAction);
-            pointerCount -= 1;
+            dispatchMotion(when, policyFlags, mTouchSource,
+                    AMOTION_EVENT_ACTION_POINTER_UP, 0, metaState, 0,
+                    mLastTouchCoords, mLastTouch.idToIndex, dispatchedIdBits, upId,
+                    xPrecision, yPrecision, mDownTime);
+            dispatchedIdBits.clearBit(upId);
         }
 
         // Dispatch move events if any of the remaining pointers moved from their old locations.
         // Although applications receive new locations as part of individual pointer up
         // events, they do not generally handle them except when presented in a move event.
         if (moveNeeded) {
-            dispatchTouch(when, policyFlags, &mCurrentTouch,
-                    activeIdBits, -1, pointerCount, AMOTION_EVENT_ACTION_MOVE);
+            assert(moveIdBits.value == dispatchedIdBits.value);
+            dispatchMotion(when, policyFlags, mTouchSource,
+                    AMOTION_EVENT_ACTION_MOVE, 0, metaState, 0,
+                    mCurrentTouchCoords, mCurrentTouch.idToIndex, dispatchedIdBits, -1,
+                    xPrecision, yPrecision, mDownTime);
         }
 
         // Dispatch pointer down events using the new pointer locations.
         while (!downIdBits.isEmpty()) {
             uint32_t downId = downIdBits.firstMarkedBit();
             downIdBits.clearBit(downId);
-            BitSet32 oldActiveIdBits = activeIdBits;
-            activeIdBits.markBit(downId);
+            dispatchedIdBits.markBit(downId);
 
-            int32_t motionEventAction;
-            if (oldActiveIdBits.isEmpty()) {
-                motionEventAction = AMOTION_EVENT_ACTION_DOWN;
+            if (dispatchedIdBits.count() == 1) {
+                // First pointer is going down.  Set down time.
                 mDownTime = when;
             } else {
-                motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN;
+                // Only send edge flags with first pointer down.
+                edgeFlags = AMOTION_EVENT_EDGE_FLAG_NONE;
             }
 
-            pointerCount += 1;
-            dispatchTouch(when, policyFlags, &mCurrentTouch,
-                    activeIdBits, downId, pointerCount, motionEventAction);
+            dispatchMotion(when, policyFlags, mTouchSource,
+                    AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, edgeFlags,
+                    mCurrentTouchCoords, mCurrentTouch.idToIndex, dispatchedIdBits, downId,
+                    xPrecision, yPrecision, mDownTime);
+        }
+    }
+
+    // Update state for next time.
+    for (uint32_t i = 0; i < currentPointerCount; i++) {
+        mLastTouchCoords[i].copyFrom(mCurrentTouchCoords[i]);
+    }
+}
+
+void TouchInputMapper::prepareTouches(int32_t* outEdgeFlags,
+        float* outXPrecision, float* outYPrecision) {
+    uint32_t currentPointerCount = mCurrentTouch.pointerCount;
+    uint32_t lastPointerCount = mLastTouch.pointerCount;
+
+    AutoMutex _l(mLock);
+
+    // Walk through the the active pointers and map touch screen coordinates (TouchData) into
+    // display or surface coordinates (PointerCoords) and adjust for display orientation.
+    for (uint32_t i = 0; i < currentPointerCount; i++) {
+        const PointerData& in = mCurrentTouch.pointers[i];
+
+        // ToolMajor and ToolMinor
+        float toolMajor, toolMinor;
+        switch (mCalibration.toolSizeCalibration) {
+        case Calibration::TOOL_SIZE_CALIBRATION_GEOMETRIC:
+            toolMajor = in.toolMajor * mLocked.geometricScale;
+            if (mRawAxes.toolMinor.valid) {
+                toolMinor = in.toolMinor * mLocked.geometricScale;
+            } else {
+                toolMinor = toolMajor;
+            }
+            break;
+        case Calibration::TOOL_SIZE_CALIBRATION_LINEAR:
+            toolMajor = in.toolMajor != 0
+                    ? in.toolMajor * mLocked.toolSizeLinearScale + mLocked.toolSizeLinearBias
+                    : 0;
+            if (mRawAxes.toolMinor.valid) {
+                toolMinor = in.toolMinor != 0
+                        ? in.toolMinor * mLocked.toolSizeLinearScale
+                                + mLocked.toolSizeLinearBias
+                        : 0;
+            } else {
+                toolMinor = toolMajor;
+            }
+            break;
+        case Calibration::TOOL_SIZE_CALIBRATION_AREA:
+            if (in.toolMajor != 0) {
+                float diameter = sqrtf(in.toolMajor
+                        * mLocked.toolSizeAreaScale + mLocked.toolSizeAreaBias);
+                toolMajor = diameter * mLocked.toolSizeLinearScale + mLocked.toolSizeLinearBias;
+            } else {
+                toolMajor = 0;
+            }
+            toolMinor = toolMajor;
+            break;
+        default:
+            toolMajor = 0;
+            toolMinor = 0;
+            break;
+        }
+
+        if (mCalibration.haveToolSizeIsSummed && mCalibration.toolSizeIsSummed) {
+            toolMajor /= currentPointerCount;
+            toolMinor /= currentPointerCount;
+        }
+
+        // Pressure
+        float rawPressure;
+        switch (mCalibration.pressureSource) {
+        case Calibration::PRESSURE_SOURCE_PRESSURE:
+            rawPressure = in.pressure;
+            break;
+        case Calibration::PRESSURE_SOURCE_TOUCH:
+            rawPressure = in.touchMajor;
+            break;
+        default:
+            rawPressure = 0;
+        }
+
+        float pressure;
+        switch (mCalibration.pressureCalibration) {
+        case Calibration::PRESSURE_CALIBRATION_PHYSICAL:
+        case Calibration::PRESSURE_CALIBRATION_AMPLITUDE:
+            pressure = rawPressure * mLocked.pressureScale;
+            break;
+        default:
+            pressure = 1;
+            break;
+        }
+
+        // TouchMajor and TouchMinor
+        float touchMajor, touchMinor;
+        switch (mCalibration.touchSizeCalibration) {
+        case Calibration::TOUCH_SIZE_CALIBRATION_GEOMETRIC:
+            touchMajor = in.touchMajor * mLocked.geometricScale;
+            if (mRawAxes.touchMinor.valid) {
+                touchMinor = in.touchMinor * mLocked.geometricScale;
+            } else {
+                touchMinor = touchMajor;
+            }
+            break;
+        case Calibration::TOUCH_SIZE_CALIBRATION_PRESSURE:
+            touchMajor = toolMajor * pressure;
+            touchMinor = toolMinor * pressure;
+            break;
+        default:
+            touchMajor = 0;
+            touchMinor = 0;
+            break;
+        }
+
+        if (touchMajor > toolMajor) {
+            touchMajor = toolMajor;
+        }
+        if (touchMinor > toolMinor) {
+            touchMinor = toolMinor;
+        }
+
+        // Size
+        float size;
+        switch (mCalibration.sizeCalibration) {
+        case Calibration::SIZE_CALIBRATION_NORMALIZED: {
+            float rawSize = mRawAxes.toolMinor.valid
+                    ? avg(in.toolMajor, in.toolMinor)
+                    : in.toolMajor;
+            size = rawSize * mLocked.sizeScale;
+            break;
+        }
+        default:
+            size = 0;
+            break;
+        }
+
+        // Orientation
+        float orientation;
+        switch (mCalibration.orientationCalibration) {
+        case Calibration::ORIENTATION_CALIBRATION_INTERPOLATED:
+            orientation = in.orientation * mLocked.orientationScale;
+            break;
+        case Calibration::ORIENTATION_CALIBRATION_VECTOR: {
+            int32_t c1 = signExtendNybble((in.orientation & 0xf0) >> 4);
+            int32_t c2 = signExtendNybble(in.orientation & 0x0f);
+            if (c1 != 0 || c2 != 0) {
+                orientation = atan2f(c1, c2) * 0.5f;
+                float scale = 1.0f + pythag(c1, c2) / 16.0f;
+                touchMajor *= scale;
+                touchMinor /= scale;
+                toolMajor *= scale;
+                toolMinor /= scale;
+            } else {
+                orientation = 0;
+            }
+            break;
+        }
+        default:
+            orientation = 0;
+        }
+
+        // X and Y
+        // Adjust coords for surface orientation.
+        float x, y;
+        switch (mLocked.surfaceOrientation) {
+        case DISPLAY_ORIENTATION_90:
+            x = float(in.y - mRawAxes.y.minValue) * mLocked.yScale;
+            y = float(mRawAxes.x.maxValue - in.x) * mLocked.xScale;
+            orientation -= M_PI_2;
+            if (orientation < - M_PI_2) {
+                orientation += M_PI;
+            }
+            break;
+        case DISPLAY_ORIENTATION_180:
+            x = float(mRawAxes.x.maxValue - in.x) * mLocked.xScale;
+            y = float(mRawAxes.y.maxValue - in.y) * mLocked.yScale;
+            break;
+        case DISPLAY_ORIENTATION_270:
+            x = float(mRawAxes.y.maxValue - in.y) * mLocked.yScale;
+            y = float(in.x - mRawAxes.x.minValue) * mLocked.xScale;
+            orientation += M_PI_2;
+            if (orientation > M_PI_2) {
+                orientation -= M_PI;
+            }
+            break;
+        default:
+            x = float(in.x - mRawAxes.x.minValue) * mLocked.xScale;
+            y = float(in.y - mRawAxes.y.minValue) * mLocked.yScale;
+            break;
+        }
+
+        // Write output coords.
+        PointerCoords& out = mCurrentTouchCoords[i];
+        out.clear();
+        out.setAxisValue(AMOTION_EVENT_AXIS_X, x);
+        out.setAxisValue(AMOTION_EVENT_AXIS_Y, y);
+        out.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure);
+        out.setAxisValue(AMOTION_EVENT_AXIS_SIZE, size);
+        out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, touchMajor);
+        out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, touchMinor);
+        out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, toolMajor);
+        out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, toolMinor);
+        out.setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, orientation);
+    }
+
+    // Check edge flags by looking only at the first pointer since the flags are
+    // global to the event.
+    *outEdgeFlags = AMOTION_EVENT_EDGE_FLAG_NONE;
+    if (lastPointerCount == 0 && currentPointerCount > 0) {
+        const PointerData& in = mCurrentTouch.pointers[0];
+
+        if (in.x <= mRawAxes.x.minValue) {
+            *outEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_LEFT,
+                    mLocked.surfaceOrientation);
+        } else if (in.x >= mRawAxes.x.maxValue) {
+            *outEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_RIGHT,
+                    mLocked.surfaceOrientation);
+        }
+        if (in.y <= mRawAxes.y.minValue) {
+            *outEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_TOP,
+                    mLocked.surfaceOrientation);
+        } else if (in.y >= mRawAxes.y.maxValue) {
+            *outEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_BOTTOM,
+                    mLocked.surfaceOrientation);
+        }
+    }
+
+    *outXPrecision = mLocked.orientedXPrecision;
+    *outYPrecision = mLocked.orientedYPrecision;
+}
+
+void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlags) {
+    // Update current gesture coordinates.
+    bool cancelPreviousGesture, finishPreviousGesture;
+    preparePointerGestures(when, &cancelPreviousGesture, &finishPreviousGesture);
+
+    // Send events!
+    uint32_t metaState = getContext()->getGlobalMetaState();
+
+    // Update last coordinates of pointers that have moved so that we observe the new
+    // pointer positions at the same time as other pointers that have just gone up.
+    bool down = mPointerGesture.currentGestureMode == PointerGesture::CLICK_OR_DRAG
+            || mPointerGesture.currentGestureMode == PointerGesture::SWIPE
+            || mPointerGesture.currentGestureMode == PointerGesture::FREEFORM;
+    bool moveNeeded = false;
+    if (down && !cancelPreviousGesture && !finishPreviousGesture
+            && mPointerGesture.lastGesturePointerCount != 0
+            && mPointerGesture.currentGesturePointerCount != 0) {
+        BitSet32 movedGestureIdBits(mPointerGesture.currentGestureIdBits.value
+                & mPointerGesture.lastGestureIdBits.value);
+        moveNeeded = updateMovedPointerCoords(
+                mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,
+                movedGestureIdBits);
+    }
+
+    // Send motion events for all pointers that went up or were canceled.
+    BitSet32 dispatchedGestureIdBits(mPointerGesture.lastGestureIdBits);
+    if (!dispatchedGestureIdBits.isEmpty()) {
+        if (cancelPreviousGesture) {
+            dispatchMotion(when, policyFlags, mPointerSource,
+                    AMOTION_EVENT_ACTION_CANCEL, 0, metaState, AMOTION_EVENT_EDGE_FLAG_NONE,
+                    mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,
+                    dispatchedGestureIdBits, -1,
+                    0, 0, mPointerGesture.downTime);
+
+            dispatchedGestureIdBits.clear();
+        } else {
+            BitSet32 upGestureIdBits;
+            if (finishPreviousGesture) {
+                upGestureIdBits = dispatchedGestureIdBits;
+            } else {
+                upGestureIdBits.value = dispatchedGestureIdBits.value
+                        & ~mPointerGesture.currentGestureIdBits.value;
+            }
+            while (!upGestureIdBits.isEmpty()) {
+                uint32_t id = upGestureIdBits.firstMarkedBit();
+                upGestureIdBits.clearBit(id);
+
+                dispatchMotion(when, policyFlags, mPointerSource,
+                        AMOTION_EVENT_ACTION_POINTER_UP, 0,
+                        metaState, AMOTION_EVENT_EDGE_FLAG_NONE,
+                        mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,
+                        dispatchedGestureIdBits, id,
+                        0, 0, mPointerGesture.downTime);
+
+                dispatchedGestureIdBits.clearBit(id);
+            }
+        }
+    }
+
+    // Send motion events for all pointers that moved.
+    if (moveNeeded) {
+        dispatchMotion(when, policyFlags, mPointerSource,
+                AMOTION_EVENT_ACTION_MOVE, 0, metaState, AMOTION_EVENT_EDGE_FLAG_NONE,
+                mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                dispatchedGestureIdBits, -1,
+                0, 0, mPointerGesture.downTime);
+    }
+
+    // Send motion events for all pointers that went down.
+    if (down) {
+        BitSet32 downGestureIdBits(mPointerGesture.currentGestureIdBits.value
+                & ~dispatchedGestureIdBits.value);
+        while (!downGestureIdBits.isEmpty()) {
+            uint32_t id = downGestureIdBits.firstMarkedBit();
+            downGestureIdBits.clearBit(id);
+            dispatchedGestureIdBits.markBit(id);
+
+            int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_NONE;
+            if (dispatchedGestureIdBits.count() == 1) {
+                // First pointer is going down.  Calculate edge flags and set down time.
+                uint32_t index = mPointerGesture.currentGestureIdToIndex[id];
+                const PointerCoords& downCoords = mPointerGesture.currentGestureCoords[index];
+                edgeFlags = calculateEdgeFlagsUsingPointerBounds(mPointerController,
+                        downCoords.getAxisValue(AMOTION_EVENT_AXIS_X),
+                        downCoords.getAxisValue(AMOTION_EVENT_AXIS_Y));
+                mPointerGesture.downTime = when;
+            }
+
+            dispatchMotion(when, policyFlags, mPointerSource,
+                    AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, edgeFlags,
+                    mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                    dispatchedGestureIdBits, id,
+                    0, 0, mPointerGesture.downTime);
+        }
+    }
+
+    // Send down and up for a tap.
+    if (mPointerGesture.currentGestureMode == PointerGesture::TAP) {
+        const PointerCoords& coords = mPointerGesture.currentGestureCoords[0];
+        int32_t edgeFlags = calculateEdgeFlagsUsingPointerBounds(mPointerController,
+                coords.getAxisValue(AMOTION_EVENT_AXIS_X),
+                coords.getAxisValue(AMOTION_EVENT_AXIS_Y));
+        nsecs_t downTime = mPointerGesture.downTime = mPointerGesture.tapTime;
+        mPointerGesture.resetTapTime();
+
+        dispatchMotion(downTime, policyFlags, mPointerSource,
+                AMOTION_EVENT_ACTION_DOWN, 0, metaState, edgeFlags,
+                mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                mPointerGesture.currentGestureIdBits, -1,
+                0, 0, downTime);
+        dispatchMotion(when, policyFlags, mPointerSource,
+                AMOTION_EVENT_ACTION_UP, 0, metaState, edgeFlags,
+                mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                mPointerGesture.currentGestureIdBits, -1,
+                0, 0, downTime);
+    }
+
+    // Send motion events for hover.
+    if (mPointerGesture.currentGestureMode == PointerGesture::HOVER) {
+        dispatchMotion(when, policyFlags, mPointerSource,
+                AMOTION_EVENT_ACTION_HOVER_MOVE, 0, metaState, AMOTION_EVENT_EDGE_FLAG_NONE,
+                mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,
+                mPointerGesture.currentGestureIdBits, -1,
+                0, 0, mPointerGesture.downTime);
+    }
+
+    // Update state.
+    mPointerGesture.lastGestureMode = mPointerGesture.currentGestureMode;
+    if (!down) {
+        mPointerGesture.lastGesturePointerCount = 0;
+        mPointerGesture.lastGestureIdBits.clear();
+    } else {
+        uint32_t currentGesturePointerCount = mPointerGesture.currentGesturePointerCount;
+        mPointerGesture.lastGesturePointerCount = currentGesturePointerCount;
+        mPointerGesture.lastGestureIdBits = mPointerGesture.currentGestureIdBits;
+        for (BitSet32 idBits(mPointerGesture.currentGestureIdBits); !idBits.isEmpty(); ) {
+            uint32_t id = idBits.firstMarkedBit();
+            idBits.clearBit(id);
+            uint32_t index = mPointerGesture.currentGestureIdToIndex[id];
+            mPointerGesture.lastGestureCoords[index].copyFrom(
+                    mPointerGesture.currentGestureCoords[index]);
+            mPointerGesture.lastGestureIdToIndex[id] = index;
         }
     }
 }
 
-void TouchInputMapper::dispatchTouch(nsecs_t when, uint32_t policyFlags,
-        TouchData* touch, BitSet32 idBits, uint32_t changedId, uint32_t pointerCount,
-        int32_t motionEventAction) {
-    int32_t pointerIds[MAX_POINTERS];
-    PointerCoords pointerCoords[MAX_POINTERS];
-    int32_t motionEventEdgeFlags = AMOTION_EVENT_EDGE_FLAG_NONE;
-    float xPrecision, yPrecision;
+void TouchInputMapper::preparePointerGestures(nsecs_t when,
+        bool* outCancelPreviousGesture, bool* outFinishPreviousGesture) {
+    *outCancelPreviousGesture = false;
+    *outFinishPreviousGesture = false;
 
-    { // acquire lock
-        AutoMutex _l(mLock);
+    AutoMutex _l(mLock);
 
-        // Walk through the the active pointers and map touch screen coordinates (TouchData) into
-        // display or surface coordinates (PointerCoords) and adjust for display orientation.
-        for (uint32_t outIndex = 0; ! idBits.isEmpty(); outIndex++) {
+    // Update the velocity tracker.
+    {
+        VelocityTracker::Position positions[MAX_POINTERS];
+        uint32_t count = 0;
+        for (BitSet32 idBits(mCurrentTouch.idBits); !idBits.isEmpty(); count++) {
             uint32_t id = idBits.firstMarkedBit();
             idBits.clearBit(id);
-            uint32_t inIndex = touch->idToIndex[id];
+            uint32_t index = mCurrentTouch.idToIndex[id];
+            positions[count].x = mCurrentTouch.pointers[index].x
+                    * mLocked.pointerGestureXMovementScale;
+            positions[count].y = mCurrentTouch.pointers[index].y
+                    * mLocked.pointerGestureYMovementScale;
+        }
+        mPointerGesture.velocityTracker.addMovement(when, mCurrentTouch.idBits, positions);
+    }
 
-            const PointerData& in = touch->pointers[inIndex];
+    // Pick a new active touch id if needed.
+    // Choose an arbitrary pointer that just went down, if there is one.
+    // Otherwise choose an arbitrary remaining pointer.
+    // This guarantees we always have an active touch id when there is at least one pointer.
+    // We always switch to the newest pointer down because that's usually where the user's
+    // attention is focused.
+    int32_t activeTouchId;
+    BitSet32 downTouchIdBits(mCurrentTouch.idBits.value & ~mLastTouch.idBits.value);
+    if (!downTouchIdBits.isEmpty()) {
+        activeTouchId = mPointerGesture.activeTouchId = downTouchIdBits.firstMarkedBit();
+    } else {
+        activeTouchId = mPointerGesture.activeTouchId;
+        if (activeTouchId < 0 || !mCurrentTouch.idBits.hasBit(activeTouchId)) {
+            if (!mCurrentTouch.idBits.isEmpty()) {
+                activeTouchId = mPointerGesture.activeTouchId =
+                        mCurrentTouch.idBits.firstMarkedBit();
+            } else {
+                activeTouchId = mPointerGesture.activeTouchId = -1;
+            }
+        }
+    }
 
-            // ToolMajor and ToolMinor
-            float toolMajor, toolMinor;
-            switch (mCalibration.toolSizeCalibration) {
-            case Calibration::TOOL_SIZE_CALIBRATION_GEOMETRIC:
-                toolMajor = in.toolMajor * mLocked.geometricScale;
-                if (mRawAxes.toolMinor.valid) {
-                    toolMinor = in.toolMinor * mLocked.geometricScale;
-                } else {
-                    toolMinor = toolMajor;
+    // Update the touch origin data to track where each finger originally went down.
+    if (mCurrentTouch.pointerCount == 0 || mPointerGesture.touchOrigin.pointerCount == 0) {
+        // Fast path when all fingers have gone up or down.
+        mPointerGesture.touchOrigin.copyFrom(mCurrentTouch);
+    } else {
+        // Slow path when only some fingers have gone up or down.
+        for (BitSet32 idBits(mPointerGesture.touchOrigin.idBits.value
+                & ~mCurrentTouch.idBits.value); !idBits.isEmpty(); ) {
+            uint32_t id = idBits.firstMarkedBit();
+            idBits.clearBit(id);
+            mPointerGesture.touchOrigin.idBits.clearBit(id);
+            uint32_t index = mPointerGesture.touchOrigin.idToIndex[id];
+            uint32_t count = --mPointerGesture.touchOrigin.pointerCount;
+            while (index < count) {
+                mPointerGesture.touchOrigin.pointers[index] =
+                        mPointerGesture.touchOrigin.pointers[index + 1];
+                uint32_t movedId = mPointerGesture.touchOrigin.pointers[index].id;
+                mPointerGesture.touchOrigin.idToIndex[movedId] = index;
+                index += 1;
+            }
+        }
+        for (BitSet32 idBits(mCurrentTouch.idBits.value
+                & ~mPointerGesture.touchOrigin.idBits.value); !idBits.isEmpty(); ) {
+            uint32_t id = idBits.firstMarkedBit();
+            idBits.clearBit(id);
+            mPointerGesture.touchOrigin.idBits.markBit(id);
+            uint32_t index = mPointerGesture.touchOrigin.pointerCount++;
+            mPointerGesture.touchOrigin.pointers[index] =
+                    mCurrentTouch.pointers[mCurrentTouch.idToIndex[id]];
+            mPointerGesture.touchOrigin.idToIndex[id] = index;
+        }
+    }
+
+    // Determine whether we are in quiet time.
+    bool isQuietTime = when < mPointerGesture.quietTime + QUIET_INTERVAL;
+    if (!isQuietTime) {
+        if ((mPointerGesture.lastGestureMode == PointerGesture::SWIPE
+                || mPointerGesture.lastGestureMode == PointerGesture::FREEFORM)
+                && mCurrentTouch.pointerCount < 2) {
+            // Enter quiet time when exiting swipe or freeform state.
+            // This is to prevent accidentally entering the hover state and flinging the
+            // pointer when finishing a swipe and there is still one pointer left onscreen.
+            isQuietTime = true;
+        } else if (mPointerGesture.lastGestureMode == PointerGesture::CLICK_OR_DRAG
+                && mCurrentTouch.pointerCount >= 2
+                && !isPointerDown(mCurrentTouch.buttonState)) {
+            // Enter quiet time when releasing the button and there are still two or more
+            // fingers down.  This may indicate that one finger was used to press the button
+            // but it has not gone up yet.
+            isQuietTime = true;
+        }
+        if (isQuietTime) {
+            mPointerGesture.quietTime = when;
+        }
+    }
+
+    // Switch states based on button and pointer state.
+    if (isQuietTime) {
+        // Case 1: Quiet time. (QUIET)
+#if DEBUG_GESTURES
+        LOGD("Gestures: QUIET for next %0.3fms",
+                (mPointerGesture.quietTime + QUIET_INTERVAL - when) * 0.000001f);
+#endif
+        *outFinishPreviousGesture = true;
+
+        mPointerGesture.activeGestureId = -1;
+        mPointerGesture.currentGestureMode = PointerGesture::QUIET;
+        mPointerGesture.currentGesturePointerCount = 0;
+        mPointerGesture.currentGestureIdBits.clear();
+    } else if (isPointerDown(mCurrentTouch.buttonState)) {
+        // Case 2: Button is pressed. (DRAG)
+        // The pointer follows the active touch point.
+        // Emit DOWN, MOVE, UP events at the pointer location.
+        //
+        // Only the active touch matters; other fingers are ignored.  This policy helps
+        // to handle the case where the user places a second finger on the touch pad
+        // to apply the necessary force to depress an integrated button below the surface.
+        // We don't want the second finger to be delivered to applications.
+        //
+        // For this to work well, we need to make sure to track the pointer that is really
+        // active.  If the user first puts one finger down to click then adds another
+        // finger to drag then the active pointer should switch to the finger that is
+        // being dragged.
+#if DEBUG_GESTURES
+        LOGD("Gestures: CLICK_OR_DRAG activeTouchId=%d, "
+                "currentTouchPointerCount=%d", activeTouchId, mCurrentTouch.pointerCount);
+#endif
+        // Reset state when just starting.
+        if (mPointerGesture.lastGestureMode != PointerGesture::CLICK_OR_DRAG) {
+            *outFinishPreviousGesture = true;
+            mPointerGesture.activeGestureId = 0;
+        }
+
+        // Switch pointers if needed.
+        // Find the fastest pointer and follow it.
+        if (activeTouchId >= 0) {
+            if (mCurrentTouch.pointerCount > 1) {
+                int32_t bestId = -1;
+                float bestSpeed = DRAG_MIN_SWITCH_SPEED;
+                for (uint32_t i = 0; i < mCurrentTouch.pointerCount; i++) {
+                    uint32_t id = mCurrentTouch.pointers[i].id;
+                    float vx, vy;
+                    if (mPointerGesture.velocityTracker.getVelocity(id, &vx, &vy)) {
+                        float speed = pythag(vx, vy);
+                        if (speed > bestSpeed) {
+                            bestId = id;
+                            bestSpeed = speed;
+                        }
+                    }
                 }
-                break;
-            case Calibration::TOOL_SIZE_CALIBRATION_LINEAR:
-                toolMajor = in.toolMajor != 0
-                        ? in.toolMajor * mLocked.toolSizeLinearScale + mLocked.toolSizeLinearBias
-                        : 0;
-                if (mRawAxes.toolMinor.valid) {
-                    toolMinor = in.toolMinor != 0
-                            ? in.toolMinor * mLocked.toolSizeLinearScale
-                                    + mLocked.toolSizeLinearBias
-                            : 0;
-                } else {
-                    toolMinor = toolMajor;
+                if (bestId >= 0 && bestId != activeTouchId) {
+                    mPointerGesture.activeTouchId = activeTouchId = bestId;
+#if DEBUG_GESTURES
+                    LOGD("Gestures: CLICK_OR_DRAG switched pointers, "
+                            "bestId=%d, bestSpeed=%0.3f", bestId, bestSpeed);
+#endif
                 }
-                break;
-            case Calibration::TOOL_SIZE_CALIBRATION_AREA:
-                if (in.toolMajor != 0) {
-                    float diameter = sqrtf(in.toolMajor
-                            * mLocked.toolSizeAreaScale + mLocked.toolSizeAreaBias);
-                    toolMajor = diameter * mLocked.toolSizeLinearScale + mLocked.toolSizeLinearBias;
-                } else {
-                    toolMajor = 0;
-                }
-                toolMinor = toolMajor;
-                break;
-            default:
-                toolMajor = 0;
-                toolMinor = 0;
-                break;
             }
 
-            if (mCalibration.haveToolSizeIsSummed && mCalibration.toolSizeIsSummed) {
-                toolMajor /= pointerCount;
-                toolMinor /= pointerCount;
-            }
-
-            // Pressure
-            float rawPressure;
-            switch (mCalibration.pressureSource) {
-            case Calibration::PRESSURE_SOURCE_PRESSURE:
-                rawPressure = in.pressure;
-                break;
-            case Calibration::PRESSURE_SOURCE_TOUCH:
-                rawPressure = in.touchMajor;
-                break;
-            default:
-                rawPressure = 0;
-            }
-
-            float pressure;
-            switch (mCalibration.pressureCalibration) {
-            case Calibration::PRESSURE_CALIBRATION_PHYSICAL:
-            case Calibration::PRESSURE_CALIBRATION_AMPLITUDE:
-                pressure = rawPressure * mLocked.pressureScale;
-                break;
-            default:
-                pressure = 1;
-                break;
-            }
-
-            // TouchMajor and TouchMinor
-            float touchMajor, touchMinor;
-            switch (mCalibration.touchSizeCalibration) {
-            case Calibration::TOUCH_SIZE_CALIBRATION_GEOMETRIC:
-                touchMajor = in.touchMajor * mLocked.geometricScale;
-                if (mRawAxes.touchMinor.valid) {
-                    touchMinor = in.touchMinor * mLocked.geometricScale;
-                } else {
-                    touchMinor = touchMajor;
-                }
-                break;
-            case Calibration::TOUCH_SIZE_CALIBRATION_PRESSURE:
-                touchMajor = toolMajor * pressure;
-                touchMinor = toolMinor * pressure;
-                break;
-            default:
-                touchMajor = 0;
-                touchMinor = 0;
-                break;
-            }
-
-            if (touchMajor > toolMajor) {
-                touchMajor = toolMajor;
-            }
-            if (touchMinor > toolMinor) {
-                touchMinor = toolMinor;
-            }
-
-            // Size
-            float size;
-            switch (mCalibration.sizeCalibration) {
-            case Calibration::SIZE_CALIBRATION_NORMALIZED: {
-                float rawSize = mRawAxes.toolMinor.valid
-                        ? avg(in.toolMajor, in.toolMinor)
-                        : in.toolMajor;
-                size = rawSize * mLocked.sizeScale;
-                break;
-            }
-            default:
-                size = 0;
-                break;
-            }
-
-            // Orientation
-            float orientation;
-            switch (mCalibration.orientationCalibration) {
-            case Calibration::ORIENTATION_CALIBRATION_INTERPOLATED:
-                orientation = in.orientation * mLocked.orientationScale;
-                break;
-            case Calibration::ORIENTATION_CALIBRATION_VECTOR: {
-                int32_t c1 = signExtendNybble((in.orientation & 0xf0) >> 4);
-                int32_t c2 = signExtendNybble(in.orientation & 0x0f);
-                if (c1 != 0 || c2 != 0) {
-                    orientation = atan2f(c1, c2) * 0.5f;
-                    float scale = 1.0f + pythag(c1, c2) / 16.0f;
-                    touchMajor *= scale;
-                    touchMinor /= scale;
-                    toolMajor *= scale;
-                    toolMinor /= scale;
-                } else {
-                    orientation = 0;
-                }
-                break;
-            }
-            default:
-                orientation = 0;
-            }
-
-            // X and Y
-            // Adjust coords for surface orientation.
-            float x, y;
-            switch (mLocked.surfaceOrientation) {
-            case DISPLAY_ORIENTATION_90:
-                x = float(in.y - mRawAxes.y.minValue) * mLocked.yScale;
-                y = float(mRawAxes.x.maxValue - in.x) * mLocked.xScale;
-                orientation -= M_PI_2;
-                if (orientation < - M_PI_2) {
-                    orientation += M_PI;
-                }
-                break;
-            case DISPLAY_ORIENTATION_180:
-                x = float(mRawAxes.x.maxValue - in.x) * mLocked.xScale;
-                y = float(mRawAxes.y.maxValue - in.y) * mLocked.yScale;
-                break;
-            case DISPLAY_ORIENTATION_270:
-                x = float(mRawAxes.y.maxValue - in.y) * mLocked.yScale;
-                y = float(in.x - mRawAxes.x.minValue) * mLocked.xScale;
-                orientation += M_PI_2;
-                if (orientation > M_PI_2) {
-                    orientation -= M_PI;
-                }
-                break;
-            default:
-                x = float(in.x - mRawAxes.x.minValue) * mLocked.xScale;
-                y = float(in.y - mRawAxes.y.minValue) * mLocked.yScale;
-                break;
-            }
-
-            // Write output coords.
-            PointerCoords& out = pointerCoords[outIndex];
-            out.clear();
-            out.setAxisValue(AMOTION_EVENT_AXIS_X, x);
-            out.setAxisValue(AMOTION_EVENT_AXIS_Y, y);
-            out.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure);
-            out.setAxisValue(AMOTION_EVENT_AXIS_SIZE, size);
-            out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, touchMajor);
-            out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, touchMinor);
-            out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, toolMajor);
-            out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, toolMinor);
-            out.setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, orientation);
-
-            pointerIds[outIndex] = int32_t(id);
-
-            if (id == changedId) {
-                motionEventAction |= outIndex << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+            if (mLastTouch.idBits.hasBit(activeTouchId)) {
+                const PointerData& currentPointer =
+                        mCurrentTouch.pointers[mCurrentTouch.idToIndex[activeTouchId]];
+                const PointerData& lastPointer =
+                        mLastTouch.pointers[mLastTouch.idToIndex[activeTouchId]];
+                float deltaX = (currentPointer.x - lastPointer.x)
+                        * mLocked.pointerGestureXMovementScale;
+                float deltaY = (currentPointer.y - lastPointer.y)
+                        * mLocked.pointerGestureYMovementScale;
+                mPointerController->move(deltaX, deltaY);
             }
         }
 
-        // Check edge flags by looking only at the first pointer since the flags are
-        // global to the event.
-        if (motionEventAction == AMOTION_EVENT_ACTION_DOWN) {
-            uint32_t inIndex = touch->idToIndex[pointerIds[0]];
-            const PointerData& in = touch->pointers[inIndex];
+        float x, y;
+        mPointerController->getPosition(&x, &y);
 
-            if (in.x <= mRawAxes.x.minValue) {
-                motionEventEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_LEFT,
-                        mLocked.surfaceOrientation);
-            } else if (in.x >= mRawAxes.x.maxValue) {
-                motionEventEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_RIGHT,
-                        mLocked.surfaceOrientation);
+        mPointerGesture.currentGestureMode = PointerGesture::CLICK_OR_DRAG;
+        mPointerGesture.currentGesturePointerCount = 1;
+        mPointerGesture.currentGestureIdBits.clear();
+        mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);
+        mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
+        mPointerGesture.currentGestureCoords[0].clear();
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x);
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y);
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
+    } else if (mCurrentTouch.pointerCount == 0) {
+        // Case 3. No fingers down and button is not pressed. (NEUTRAL)
+        *outFinishPreviousGesture = true;
+
+        // Watch for taps coming out of HOVER or INDETERMINATE_MULTITOUCH mode.
+        bool tapped = false;
+        if (mPointerGesture.lastGestureMode == PointerGesture::HOVER
+                || mPointerGesture.lastGestureMode
+                        == PointerGesture::INDETERMINATE_MULTITOUCH) {
+            if (when <= mPointerGesture.tapTime + TAP_INTERVAL) {
+                float x, y;
+                mPointerController->getPosition(&x, &y);
+                if (fabs(x - mPointerGesture.initialPointerX) <= TAP_SLOP
+                        && fabs(y - mPointerGesture.initialPointerY) <= TAP_SLOP) {
+#if DEBUG_GESTURES
+                    LOGD("Gestures: TAP");
+#endif
+                    mPointerGesture.activeGestureId = 0;
+                    mPointerGesture.currentGestureMode = PointerGesture::TAP;
+                    mPointerGesture.currentGesturePointerCount = 1;
+                    mPointerGesture.currentGestureIdBits.clear();
+                    mPointerGesture.currentGestureIdBits.markBit(
+                            mPointerGesture.activeGestureId);
+                    mPointerGesture.currentGestureIdToIndex[
+                            mPointerGesture.activeGestureId] = 0;
+                    mPointerGesture.currentGestureCoords[0].clear();
+                    mPointerGesture.currentGestureCoords[0].setAxisValue(
+                            AMOTION_EVENT_AXIS_X, mPointerGesture.initialPointerX);
+                    mPointerGesture.currentGestureCoords[0].setAxisValue(
+                            AMOTION_EVENT_AXIS_Y, mPointerGesture.initialPointerY);
+                    mPointerGesture.currentGestureCoords[0].setAxisValue(
+                            AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
+                    tapped = true;
+                } else {
+#if DEBUG_GESTURES
+                    LOGD("Gestures: Not a TAP, deltaX=%f, deltaY=%f",
+                            x - mPointerGesture.initialPointerX,
+                            y - mPointerGesture.initialPointerY);
+#endif
+                }
+            } else {
+#if DEBUG_GESTURES
+                LOGD("Gestures: Not a TAP, delay=%lld",
+                        when - mPointerGesture.tapTime);
+#endif
             }
-            if (in.y <= mRawAxes.y.minValue) {
-                motionEventEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_TOP,
-                        mLocked.surfaceOrientation);
-            } else if (in.y >= mRawAxes.y.maxValue) {
-                motionEventEdgeFlags |= rotateEdgeFlag(AMOTION_EVENT_EDGE_FLAG_BOTTOM,
-                        mLocked.surfaceOrientation);
+        }
+        if (!tapped) {
+#if DEBUG_GESTURES
+            LOGD("Gestures: NEUTRAL");
+#endif
+            mPointerGesture.activeGestureId = -1;
+            mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;
+            mPointerGesture.currentGesturePointerCount = 0;
+            mPointerGesture.currentGestureIdBits.clear();
+        }
+    } else if (mCurrentTouch.pointerCount == 1) {
+        // Case 4. Exactly one finger down, button is not pressed. (HOVER)
+        // The pointer follows the active touch point.
+        // Emit HOVER_MOVE events at the pointer location.
+        assert(activeTouchId >= 0);
+
+#if DEBUG_GESTURES
+        LOGD("Gestures: HOVER");
+#endif
+
+        if (mLastTouch.idBits.hasBit(activeTouchId)) {
+            const PointerData& currentPointer =
+                    mCurrentTouch.pointers[mCurrentTouch.idToIndex[activeTouchId]];
+            const PointerData& lastPointer =
+                    mLastTouch.pointers[mLastTouch.idToIndex[activeTouchId]];
+            float deltaX = (currentPointer.x - lastPointer.x)
+                    * mLocked.pointerGestureXMovementScale;
+            float deltaY = (currentPointer.y - lastPointer.y)
+                    * mLocked.pointerGestureYMovementScale;
+            mPointerController->move(deltaX, deltaY);
+        }
+
+        *outFinishPreviousGesture = true;
+        mPointerGesture.activeGestureId = 0;
+
+        float x, y;
+        mPointerController->getPosition(&x, &y);
+
+        mPointerGesture.currentGestureMode = PointerGesture::HOVER;
+        mPointerGesture.currentGesturePointerCount = 1;
+        mPointerGesture.currentGestureIdBits.clear();
+        mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);
+        mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
+        mPointerGesture.currentGestureCoords[0].clear();
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x);
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y);
+        mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 0.0f);
+
+        if (mLastTouch.pointerCount == 0 && mCurrentTouch.pointerCount != 0) {
+            mPointerGesture.tapTime = when;
+            mPointerGesture.initialPointerX = x;
+            mPointerGesture.initialPointerY = y;
+        }
+    } else {
+        // Case 5. At least two fingers down, button is not pressed. (SWIPE or FREEFORM
+        // or INDETERMINATE_MULTITOUCH)
+        // Initially we watch and wait for something interesting to happen so as to
+        // avoid making a spurious guess as to the nature of the gesture.  For example,
+        // the fingers may be in transition to some other state such as pressing or
+        // releasing the button or we may be performing a two finger tap.
+        //
+        // Fix the centroid of the figure when the gesture actually starts.
+        // We do not recalculate the centroid at any other time during the gesture because
+        // it would affect the relationship of the touch points relative to the pointer location.
+        assert(activeTouchId >= 0);
+
+        uint32_t currentTouchPointerCount = mCurrentTouch.pointerCount;
+        if (currentTouchPointerCount > MAX_POINTERS) {
+            currentTouchPointerCount = MAX_POINTERS;
+        }
+
+        if (mPointerGesture.lastGestureMode != PointerGesture::INDETERMINATE_MULTITOUCH
+                && mPointerGesture.lastGestureMode != PointerGesture::SWIPE
+                && mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) {
+            mPointerGesture.currentGestureMode = PointerGesture::INDETERMINATE_MULTITOUCH;
+
+            *outFinishPreviousGesture = true;
+            mPointerGesture.activeGestureId = -1;
+
+            // Remember the initial pointer location.
+            // Everything we do will be relative to this location.
+            mPointerController->getPosition(&mPointerGesture.initialPointerX,
+                    &mPointerGesture.initialPointerY);
+
+            // Track taps.
+            if (mLastTouch.pointerCount == 0 && mCurrentTouch.pointerCount != 0) {
+                mPointerGesture.tapTime = when;
+            }
+
+            // Reset the touch origin to be relative to exactly where the fingers are now
+            // in case they have moved some distance away as part of a previous gesture.
+            // We want to know how far the fingers have traveled since we started considering
+            // a multitouch gesture.
+            mPointerGesture.touchOrigin.copyFrom(mCurrentTouch);
+        } else {
+            mPointerGesture.currentGestureMode = mPointerGesture.lastGestureMode;
+        }
+
+        if (mPointerGesture.currentGestureMode == PointerGesture::INDETERMINATE_MULTITOUCH) {
+            // Wait for the pointers to start moving before doing anything.
+            bool decideNow = true;
+            for (uint32_t i = 0; i < currentTouchPointerCount; i++) {
+                const PointerData& current = mCurrentTouch.pointers[i];
+                const PointerData& origin = mPointerGesture.touchOrigin.pointers[
+                        mPointerGesture.touchOrigin.idToIndex[current.id]];
+                float distance = pythag(
+                        (current.x - origin.x) * mLocked.pointerGestureXZoomScale,
+                        (current.y - origin.y) * mLocked.pointerGestureYZoomScale);
+                if (distance < MULTITOUCH_MIN_TRAVEL) {
+                    decideNow = false;
+                    break;
+                }
+            }
+
+            if (decideNow) {
+                mPointerGesture.currentGestureMode = PointerGesture::FREEFORM;
+                if (currentTouchPointerCount == 2
+                        && distanceSquared(
+                                mCurrentTouch.pointers[0].x, mCurrentTouch.pointers[0].y,
+                                mCurrentTouch.pointers[1].x, mCurrentTouch.pointers[1].y)
+                                <= mLocked.pointerGestureMaxSwipeWidthSquared) {
+                    const PointerData& current1 = mCurrentTouch.pointers[0];
+                    const PointerData& current2 = mCurrentTouch.pointers[1];
+                    const PointerData& origin1 = mPointerGesture.touchOrigin.pointers[
+                            mPointerGesture.touchOrigin.idToIndex[current1.id]];
+                    const PointerData& origin2 = mPointerGesture.touchOrigin.pointers[
+                            mPointerGesture.touchOrigin.idToIndex[current2.id]];
+
+                    float x1 = (current1.x - origin1.x) * mLocked.pointerGestureXZoomScale;
+                    float y1 = (current1.y - origin1.y) * mLocked.pointerGestureYZoomScale;
+                    float x2 = (current2.x - origin2.x) * mLocked.pointerGestureXZoomScale;
+                    float y2 = (current2.y - origin2.y) * mLocked.pointerGestureYZoomScale;
+                    float magnitude1 = pythag(x1, y1);
+                    float magnitude2 = pythag(x2, y2);
+
+                    // Calculate the dot product of the vectors.
+                    // When the vectors are oriented in approximately the same direction,
+                    // the angle betweeen them is near zero and the cosine of the angle
+                    // approches 1.0.  Recall that dot(v1, v2) = cos(angle) * mag(v1) * mag(v2).
+                    // We know that the magnitude is at least MULTITOUCH_MIN_TRAVEL because
+                    // we checked it above.
+                    float dot = x1 * x2 + y1 * y2;
+                    float cosine = dot / (magnitude1 * magnitude2); // denominator always > 0
+                    if (cosine > SWIPE_TRANSITION_ANGLE_COSINE) {
+                        mPointerGesture.currentGestureMode = PointerGesture::SWIPE;
+                    }
+                }
+
+                // Remember the initial centroid for the duration of the gesture.
+                mPointerGesture.initialCentroidX = 0;
+                mPointerGesture.initialCentroidY = 0;
+                for (uint32_t i = 0; i < currentTouchPointerCount; i++) {
+                    const PointerData& touch = mCurrentTouch.pointers[i];
+                    mPointerGesture.initialCentroidX += touch.x;
+                    mPointerGesture.initialCentroidY += touch.y;
+                }
+                mPointerGesture.initialCentroidX /= int32_t(currentTouchPointerCount);
+                mPointerGesture.initialCentroidY /= int32_t(currentTouchPointerCount);
+
+                mPointerGesture.activeGestureId = 0;
+            }
+        } else if (mPointerGesture.currentGestureMode == PointerGesture::SWIPE) {
+            // Switch to FREEFORM if additional pointers go down.
+            if (currentTouchPointerCount > 2) {
+                *outCancelPreviousGesture = true;
+                mPointerGesture.currentGestureMode = PointerGesture::FREEFORM;
             }
         }
 
-        xPrecision = mLocked.orientedXPrecision;
-        yPrecision = mLocked.orientedYPrecision;
+        if (mPointerGesture.currentGestureMode == PointerGesture::SWIPE) {
+            // SWIPE mode.
+#if DEBUG_GESTURES
+            LOGD("Gestures: SWIPE activeTouchId=%d,"
+                    "activeGestureId=%d, currentTouchPointerCount=%d",
+                    activeTouchId, mPointerGesture.activeGestureId, currentTouchPointerCount);
+#endif
+            assert(mPointerGesture.activeGestureId >= 0);
+
+            float x = (mCurrentTouch.pointers[0].x + mCurrentTouch.pointers[1].x
+                    - mPointerGesture.initialCentroidX * 2) * 0.5f
+                    * mLocked.pointerGestureXMovementScale + mPointerGesture.initialPointerX;
+            float y = (mCurrentTouch.pointers[0].y + mCurrentTouch.pointers[1].y
+                    - mPointerGesture.initialCentroidY * 2) * 0.5f
+                    * mLocked.pointerGestureYMovementScale + mPointerGesture.initialPointerY;
+
+            mPointerGesture.currentGesturePointerCount = 1;
+            mPointerGesture.currentGestureIdBits.clear();
+            mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);
+            mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
+            mPointerGesture.currentGestureCoords[0].clear();
+            mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x);
+            mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y);
+            mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
+        } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) {
+            // FREEFORM mode.
+#if DEBUG_GESTURES
+            LOGD("Gestures: FREEFORM activeTouchId=%d,"
+                    "activeGestureId=%d, currentTouchPointerCount=%d",
+                    activeTouchId, mPointerGesture.activeGestureId, currentTouchPointerCount);
+#endif
+            assert(mPointerGesture.activeGestureId >= 0);
+
+            mPointerGesture.currentGesturePointerCount = currentTouchPointerCount;
+            mPointerGesture.currentGestureIdBits.clear();
+
+            BitSet32 mappedTouchIdBits;
+            BitSet32 usedGestureIdBits;
+            if (mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) {
+                // Initially, assign the active gesture id to the active touch point
+                // if there is one.  No other touch id bits are mapped yet.
+                if (!*outCancelPreviousGesture) {
+                    mappedTouchIdBits.markBit(activeTouchId);
+                    usedGestureIdBits.markBit(mPointerGesture.activeGestureId);
+                    mPointerGesture.freeformTouchToGestureIdMap[activeTouchId] =
+                            mPointerGesture.activeGestureId;
+                } else {
+                    mPointerGesture.activeGestureId = -1;
+                }
+            } else {
+                // Otherwise, assume we mapped all touches from the previous frame.
+                // Reuse all mappings that are still applicable.
+                mappedTouchIdBits.value = mLastTouch.idBits.value & mCurrentTouch.idBits.value;
+                usedGestureIdBits = mPointerGesture.lastGestureIdBits;
+
+                // Check whether we need to choose a new active gesture id because the
+                // current went went up.
+                for (BitSet32 upTouchIdBits(mLastTouch.idBits.value & ~mCurrentTouch.idBits.value);
+                        !upTouchIdBits.isEmpty(); ) {
+                    uint32_t upTouchId = upTouchIdBits.firstMarkedBit();
+                    upTouchIdBits.clearBit(upTouchId);
+                    uint32_t upGestureId = mPointerGesture.freeformTouchToGestureIdMap[upTouchId];
+                    if (upGestureId == uint32_t(mPointerGesture.activeGestureId)) {
+                        mPointerGesture.activeGestureId = -1;
+                        break;
+                    }
+                }
+            }
+
+#if DEBUG_GESTURES
+            LOGD("Gestures: FREEFORM follow up "
+                    "mappedTouchIdBits=0x%08x, usedGestureIdBits=0x%08x, "
+                    "activeGestureId=%d",
+                    mappedTouchIdBits.value, usedGestureIdBits.value,
+                    mPointerGesture.activeGestureId);
+#endif
+
+            for (uint32_t i = 0; i < currentTouchPointerCount; i++) {
+                uint32_t touchId = mCurrentTouch.pointers[i].id;
+                uint32_t gestureId;
+                if (!mappedTouchIdBits.hasBit(touchId)) {
+                    gestureId = usedGestureIdBits.firstUnmarkedBit();
+                    usedGestureIdBits.markBit(gestureId);
+                    mPointerGesture.freeformTouchToGestureIdMap[touchId] = gestureId;
+#if DEBUG_GESTURES
+                    LOGD("Gestures: FREEFORM "
+                            "new mapping for touch id %d -> gesture id %d",
+                            touchId, gestureId);
+#endif
+                } else {
+                    gestureId = mPointerGesture.freeformTouchToGestureIdMap[touchId];
+#if DEBUG_GESTURES
+                    LOGD("Gestures: FREEFORM "
+                            "existing mapping for touch id %d -> gesture id %d",
+                            touchId, gestureId);
+#endif
+                }
+                mPointerGesture.currentGestureIdBits.markBit(gestureId);
+                mPointerGesture.currentGestureIdToIndex[gestureId] = i;
+
+                float x = (mCurrentTouch.pointers[i].x - mPointerGesture.initialCentroidX)
+                        * mLocked.pointerGestureXZoomScale + mPointerGesture.initialPointerX;
+                float y = (mCurrentTouch.pointers[i].y - mPointerGesture.initialCentroidY)
+                        * mLocked.pointerGestureYZoomScale + mPointerGesture.initialPointerY;
+
+                mPointerGesture.currentGestureCoords[i].clear();
+                mPointerGesture.currentGestureCoords[i].setAxisValue(
+                        AMOTION_EVENT_AXIS_X, x);
+                mPointerGesture.currentGestureCoords[i].setAxisValue(
+                        AMOTION_EVENT_AXIS_Y, y);
+                mPointerGesture.currentGestureCoords[i].setAxisValue(
+                        AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
+            }
+
+            if (mPointerGesture.activeGestureId < 0) {
+                mPointerGesture.activeGestureId =
+                        mPointerGesture.currentGestureIdBits.firstMarkedBit();
+#if DEBUG_GESTURES
+                LOGD("Gestures: FREEFORM new "
+                        "activeGestureId=%d", mPointerGesture.activeGestureId);
+#endif
+            }
+        } else {
+            // INDETERMINATE_MULTITOUCH mode.
+            // Do nothing.
+#if DEBUG_GESTURES
+            LOGD("Gestures: INDETERMINATE_MULTITOUCH");
+#endif
+        }
+    }
+
+    // Unfade the pointer if the user is doing anything with the touch pad.
+    mPointerController->setButtonState(mCurrentTouch.buttonState);
+    if (mCurrentTouch.buttonState || mCurrentTouch.pointerCount != 0) {
+        mPointerController->unfade();
+    }
+
+#if DEBUG_GESTURES
+    LOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, "
+            "currentGestureMode=%d, currentGesturePointerCount=%d, currentGestureIdBits=0x%08x, "
+            "lastGestureMode=%d, lastGesturePointerCount=%d, lastGestureIdBits=0x%08x",
+            toString(*outFinishPreviousGesture), toString(*outCancelPreviousGesture),
+            mPointerGesture.currentGestureMode, mPointerGesture.currentGesturePointerCount,
+            mPointerGesture.currentGestureIdBits.value,
+            mPointerGesture.lastGestureMode, mPointerGesture.lastGesturePointerCount,
+            mPointerGesture.lastGestureIdBits.value);
+    for (BitSet32 idBits = mPointerGesture.currentGestureIdBits; !idBits.isEmpty(); ) {
+        uint32_t id = idBits.firstMarkedBit();
+        idBits.clearBit(id);
+        uint32_t index = mPointerGesture.currentGestureIdToIndex[id];
+        const PointerCoords& coords = mPointerGesture.currentGestureCoords[index];
+        LOGD("  currentGesture[%d]: index=%d, x=%0.3f, y=%0.3f, pressure=%0.3f",
+                id, index, coords.getAxisValue(AMOTION_EVENT_AXIS_X),
+                coords.getAxisValue(AMOTION_EVENT_AXIS_Y),
+                coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
+    }
+    for (BitSet32 idBits = mPointerGesture.lastGestureIdBits; !idBits.isEmpty(); ) {
+        uint32_t id = idBits.firstMarkedBit();
+        idBits.clearBit(id);
+        uint32_t index = mPointerGesture.lastGestureIdToIndex[id];
+        const PointerCoords& coords = mPointerGesture.lastGestureCoords[index];
+        LOGD("  lastGesture[%d]: index=%d, x=%0.3f, y=%0.3f, pressure=%0.3f",
+                id, index, coords.getAxisValue(AMOTION_EVENT_AXIS_X),
+                coords.getAxisValue(AMOTION_EVENT_AXIS_Y),
+                coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
+    }
+#endif
+}
+
+void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
+        int32_t action, int32_t flags, uint32_t metaState, int32_t edgeFlags,
+        const PointerCoords* coords, const uint32_t* idToIndex, BitSet32 idBits,
+        int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) {
+    PointerCoords pointerCoords[MAX_POINTERS];
+    int32_t pointerIds[MAX_POINTERS];
+    uint32_t pointerCount = 0;
+    while (!idBits.isEmpty()) {
+        uint32_t id = idBits.firstMarkedBit();
+        idBits.clearBit(id);
+        uint32_t index = idToIndex[id];
+        pointerIds[pointerCount] = id;
+        pointerCoords[pointerCount].copyFrom(coords[index]);
+
+        if (changedId >= 0 && id == uint32_t(changedId)) {
+            action |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+        }
+
+        pointerCount += 1;
+    }
+
+    assert(pointerCount != 0);
+
+    if (changedId >= 0 && pointerCount == 1) {
+        // Replace initial down and final up action.
+        // We can compare the action without masking off the changed pointer index
+        // because we know the index is 0.
+        if (action == AMOTION_EVENT_ACTION_POINTER_DOWN) {
+            action = AMOTION_EVENT_ACTION_DOWN;
+        } else if (action == AMOTION_EVENT_ACTION_POINTER_UP) {
+            action = AMOTION_EVENT_ACTION_UP;
+        } else {
+            // Can't happen.
+            assert(false);
+        }
+    }
+
+    getDispatcher()->notifyMotion(when, getDeviceId(), source, policyFlags,
+            action, flags, metaState, edgeFlags,
+            pointerCount, pointerIds, pointerCoords, xPrecision, yPrecision, downTime);
+}
+
+bool TouchInputMapper::updateMovedPointerCoords(
+        const PointerCoords* inCoords, const uint32_t* inIdToIndex,
+        PointerCoords* outCoords, const uint32_t* outIdToIndex, BitSet32 idBits) const {
+    bool changed = false;
+    while (!idBits.isEmpty()) {
+        uint32_t id = idBits.firstMarkedBit();
+        idBits.clearBit(id);
+
+        uint32_t inIndex = inIdToIndex[id];
+        uint32_t outIndex = outIdToIndex[id];
+        const PointerCoords& curInCoords = inCoords[inIndex];
+        PointerCoords& curOutCoords = outCoords[outIndex];
+
+        if (curInCoords != curOutCoords) {
+            curOutCoords.copyFrom(curInCoords);
+            changed = true;
+        }
+    }
+    return changed;
+}
+
+void TouchInputMapper::fadePointer() {
+    { // acquire lock
+        AutoMutex _l(mLock);
+        if (mPointerController != NULL) {
+            mPointerController->fade();
+        }
     } // release lock
-
-    getDispatcher()->notifyMotion(when, getDeviceId(), mTouchSource, policyFlags,
-            motionEventAction, 0, getContext()->getGlobalMetaState(), motionEventEdgeFlags,
-            pointerCount, pointerIds, pointerCoords,
-            xPrecision, yPrecision, mDownTime);
 }
 
 bool TouchInputMapper::isPointInsideSurfaceLocked(int32_t x, int32_t y) {
@@ -3592,6 +4493,7 @@
     mY = 0;
     mPressure = 0; // default to 0 for devices that don't report pressure
     mToolWidth = 0; // default to 0 for devices that don't report tool width
+    mButtonState = 0;
 }
 
 void SingleTouchInputMapper::reset() {
@@ -3611,6 +4513,19 @@
             // not have received valid position information yet.  This logic assumes that
             // BTN_TOUCH is always followed by SYN_REPORT as part of a complete packet.
             break;
+        default:
+            if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+                uint32_t buttonState = getButtonStateForScanCode(rawEvent->scanCode);
+                if (buttonState) {
+                    if (rawEvent->value) {
+                        mAccumulator.buttonDown |= buttonState;
+                    } else {
+                        mAccumulator.buttonUp |= buttonState;
+                    }
+                    mAccumulator.fields |= Accumulator::FIELD_BUTTONS;
+                }
+            }
+            break;
         }
         break;
 
@@ -3671,6 +4586,10 @@
         mToolWidth = mAccumulator.absToolWidth;
     }
 
+    if (fields & Accumulator::FIELD_BUTTONS) {
+        mButtonState = (mButtonState | mAccumulator.buttonDown) & ~mAccumulator.buttonUp;
+    }
+
     mCurrentTouch.clear();
 
     if (mDown) {
@@ -3686,6 +4605,7 @@
         mCurrentTouch.pointers[0].orientation = 0;
         mCurrentTouch.idToIndex[0] = 0;
         mCurrentTouch.idBits.markBit(0);
+        mCurrentTouch.buttonState = mButtonState;
     }
 
     syncTouch(when, true);
@@ -3715,6 +4635,7 @@
 
 void MultiTouchInputMapper::initialize() {
     mAccumulator.clear();
+    mButtonState = 0;
 }
 
 void MultiTouchInputMapper::reset() {
@@ -3725,6 +4646,20 @@
 
 void MultiTouchInputMapper::process(const RawEvent* rawEvent) {
     switch (rawEvent->type) {
+    case EV_KEY: {
+        if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+            uint32_t buttonState = getButtonStateForScanCode(rawEvent->scanCode);
+            if (buttonState) {
+                if (rawEvent->value) {
+                    mAccumulator.buttonDown |= buttonState;
+                } else {
+                    mAccumulator.buttonUp |= buttonState;
+                }
+            }
+        }
+        break;
+    }
+
     case EV_ABS: {
         uint32_t pointerIndex = mAccumulator.pointerCount;
         Accumulator::Pointer* pointer = & mAccumulator.pointers[pointerIndex];
@@ -3902,6 +4837,9 @@
 
     mCurrentTouch.pointerCount = outCount;
 
+    mButtonState = (mButtonState | mAccumulator.buttonDown) & ~mAccumulator.buttonUp;
+    mCurrentTouch.buttonState = mButtonState;
+
     syncTouch(when, havePointerIds);
 
     mAccumulator.clear();
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index 68002ca..55ab479 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -558,6 +558,8 @@
     virtual bool markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes,
             const int32_t* keyCodes, uint8_t* outFlags);
 
+    virtual void fadePointer();
+
 protected:
     Mutex mLock;
 
@@ -611,10 +613,12 @@
         PointerData pointers[MAX_POINTERS];
         BitSet32 idBits;
         uint32_t idToIndex[MAX_POINTER_ID + 1];
+        uint32_t buttonState;
 
         void copyFrom(const TouchData& other) {
             pointerCount = other.pointerCount;
             idBits = other.idBits;
+            buttonState = other.buttonState;
 
             for (uint32_t i = 0; i < pointerCount; i++) {
                 pointers[i] = other.pointers[i];
@@ -627,17 +631,20 @@
         inline void clear() {
             pointerCount = 0;
             idBits.clear();
+            buttonState = 0;
         }
     };
 
     // Input sources supported by the device.
     uint32_t mTouchSource; // sources when reporting touch data
+    uint32_t mPointerSource; // sources when reporting pointer gestures
 
     // Immutable configuration parameters.
     struct Parameters {
         enum DeviceType {
             DEVICE_TYPE_TOUCH_SCREEN,
             DEVICE_TYPE_TOUCH_PAD,
+            DEVICE_TYPE_POINTER,
         };
 
         DeviceType deviceType;
@@ -735,11 +742,17 @@
 
     // Current and previous touch sample data.
     TouchData mCurrentTouch;
+    PointerCoords mCurrentTouchCoords[MAX_POINTERS];
+
     TouchData mLastTouch;
+    PointerCoords mLastTouchCoords[MAX_POINTERS];
 
     // The time the primary pointer last went down.
     nsecs_t mDownTime;
 
+    // The pointer controller, or null if the device is not a pointer.
+    sp<PointerControllerInterface> mPointerController;
+
     struct LockedState {
         Vector<VirtualKey> virtualKeys;
 
@@ -804,6 +817,17 @@
             int32_t keyCode;
             int32_t scanCode;
         } currentVirtualKey;
+
+        // Scale factor for gesture based pointer movements.
+        float pointerGestureXMovementScale;
+        float pointerGestureYMovementScale;
+
+        // Scale factor for gesture based zooming and other freeform motions.
+        float pointerGestureXZoomScale;
+        float pointerGestureYZoomScale;
+
+        // The maximum swipe width squared.
+        int32_t pointerGestureMaxSwipeWidthSquared;
     } mLocked;
 
     virtual void configureParameters();
@@ -869,13 +893,148 @@
         uint64_t distance : 48; // squared distance
     };
 
+    struct PointerGesture {
+        enum Mode {
+            // No fingers, button is not pressed.
+            // Nothing happening.
+            NEUTRAL,
+
+            // No fingers, button is not pressed.
+            // Tap detected.
+            // Emits DOWN and UP events at the pointer location.
+            TAP,
+
+            // Button is pressed.
+            // Pointer follows the active finger if there is one.  Other fingers are ignored.
+            // Emits DOWN, MOVE and UP events at the pointer location.
+            CLICK_OR_DRAG,
+
+            // Exactly one finger, button is not pressed.
+            // Pointer follows the active finger.
+            // Emits HOVER_MOVE events at the pointer location.
+            HOVER,
+
+            // More than two fingers involved but they haven't moved enough for us
+            // to figure out what is intended.
+            INDETERMINATE_MULTITOUCH,
+
+            // Exactly two fingers moving in the same direction, button is not pressed.
+            // Pointer does not move.
+            // Emits DOWN, MOVE and UP events with a single pointer coordinate that
+            // follows the midpoint between both fingers.
+            // The centroid is fixed when entering this state.
+            SWIPE,
+
+            // Two or more fingers moving in arbitrary directions, button is not pressed.
+            // Pointer does not move.
+            // Emits DOWN, POINTER_DOWN, MOVE, POINTER_UP and UP events that follow
+            // each finger individually relative to the initial centroid of the finger.
+            // The centroid is fixed when entering this state.
+            FREEFORM,
+
+            // Waiting for quiet time to end before starting the next gesture.
+            QUIET,
+        };
+
+        // The active pointer id from the raw touch data.
+        int32_t activeTouchId; // -1 if none
+
+        // The active pointer id from the gesture last delivered to the application.
+        int32_t activeGestureId; // -1 if none
+
+        // Pointer coords and ids for the current and previous pointer gesture.
+        Mode currentGestureMode;
+        uint32_t currentGesturePointerCount;
+        BitSet32 currentGestureIdBits;
+        uint32_t currentGestureIdToIndex[MAX_POINTER_ID + 1];
+        PointerCoords currentGestureCoords[MAX_POINTERS];
+
+        Mode lastGestureMode;
+        uint32_t lastGesturePointerCount;
+        BitSet32 lastGestureIdBits;
+        uint32_t lastGestureIdToIndex[MAX_POINTER_ID + 1];
+        PointerCoords lastGestureCoords[MAX_POINTERS];
+
+        // Tracks for all pointers originally went down.
+        TouchData touchOrigin;
+
+        // Describes how touch ids are mapped to gesture ids for freeform gestures.
+        uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1];
+
+        // Initial centroid of the movement.
+        // Used to calculate how far the touch pointers have moved since the gesture started.
+        int32_t initialCentroidX;
+        int32_t initialCentroidY;
+
+        // Initial pointer location.
+        // Used to track where the pointer was when the gesture started.
+        float initialPointerX;
+        float initialPointerY;
+
+        // Time the pointer gesture last went down.
+        nsecs_t downTime;
+
+        // Time we started waiting for a tap gesture.
+        nsecs_t tapTime;
+
+        // Time we started waiting for quiescence.
+        nsecs_t quietTime;
+
+        // A velocity tracker for determining whether to switch active pointers during drags.
+        VelocityTracker velocityTracker;
+
+        void reset() {
+            activeTouchId = -1;
+            activeGestureId = -1;
+            currentGestureMode = NEUTRAL;
+            currentGesturePointerCount = 0;
+            currentGestureIdBits.clear();
+            lastGestureMode = NEUTRAL;
+            lastGesturePointerCount = 0;
+            lastGestureIdBits.clear();
+            touchOrigin.clear();
+            initialCentroidX = 0;
+            initialCentroidY = 0;
+            initialPointerX = 0;
+            initialPointerY = 0;
+            downTime = 0;
+            velocityTracker.clear();
+            resetTapTime();
+            resetQuietTime();
+        }
+
+        void resetTapTime() {
+            tapTime = LLONG_MIN;
+        }
+
+        void resetQuietTime() {
+            quietTime = LLONG_MIN;
+        }
+    } mPointerGesture;
+
     void initializeLocked();
 
     TouchResult consumeOffScreenTouches(nsecs_t when, uint32_t policyFlags);
     void dispatchTouches(nsecs_t when, uint32_t policyFlags);
-    void dispatchTouch(nsecs_t when, uint32_t policyFlags, TouchData* touch,
-            BitSet32 idBits, uint32_t changedId, uint32_t pointerCount,
-            int32_t motionEventAction);
+    void prepareTouches(int32_t* outEdgeFlags, float* outXPrecision, float* outYPrecision);
+    void dispatchPointerGestures(nsecs_t when, uint32_t policyFlags);
+    void preparePointerGestures(nsecs_t when,
+            bool* outCancelPreviousGesture, bool* outFinishPreviousGesture);
+
+    // Dispatches a motion event.
+    // If the changedId is >= 0 and the action is POINTER_DOWN or POINTER_UP, the
+    // method will take care of setting the index and transmuting the action to DOWN or UP
+    // it is the first / last pointer to go down / up.
+    void dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
+            int32_t action, int32_t flags, uint32_t metaState, int32_t edgeFlags,
+            const PointerCoords* coords, const uint32_t* idToIndex, BitSet32 idBits,
+            int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime);
+
+    // Updates pointer coords for pointers with specified ids that have moved.
+    // Returns true if any of them changed.
+    bool updateMovedPointerCoords(const PointerCoords* inCoords, const uint32_t* inIdToIndex,
+            PointerCoords* outCoords, const uint32_t* outIdToIndex, BitSet32 idBits) const;
+
     void suppressSwipeOntoVirtualKeys(nsecs_t when);
 
     bool isPointInsideSurfaceLocked(int32_t x, int32_t y);
@@ -907,6 +1066,7 @@
             FIELD_ABS_Y = 4,
             FIELD_ABS_PRESSURE = 8,
             FIELD_ABS_TOOL_WIDTH = 16,
+            FIELD_BUTTONS = 32,
         };
 
         uint32_t fields;
@@ -917,8 +1077,13 @@
         int32_t absPressure;
         int32_t absToolWidth;
 
+        uint32_t buttonDown;
+        uint32_t buttonUp;
+
         inline void clear() {
             fields = 0;
+            buttonDown = 0;
+            buttonUp = 0;
         }
     } mAccumulator;
 
@@ -927,6 +1092,7 @@
     int32_t mY;
     int32_t mPressure;
     int32_t mToolWidth;
+    uint32_t mButtonState;
 
     void initialize();
 
@@ -978,12 +1144,20 @@
             }
         } pointers[MAX_POINTERS + 1]; // + 1 to remove the need for extra range checks
 
+        // Bitfield of buttons that went down or up.
+        uint32_t buttonDown;
+        uint32_t buttonUp;
+
         inline void clear() {
             pointerCount = 0;
             pointers[0].clear();
+            buttonDown = 0;
+            buttonUp = 0;
         }
     } mAccumulator;
 
+    uint32_t mButtonState;
+
     void initialize();
 
     void sync(nsecs_t when);
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index 67a2e21..075eff3 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -2448,11 +2448,21 @@
 }
 
 
-TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecified_ReturnsTouchPad) {
+TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecifiedAndNotACursor_ReturnsPointer) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
     prepareAxes(POSITION);
     addMapperAndConfigure(mapper);
 
+    ASSERT_EQ(AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD, mapper->getSources());
+}
+
+TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecifiedAndIsACursor_ReturnsTouchPad) {
+    SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    mFakeEventHub->addRelativeAxis(DEVICE_ID, REL_X);
+    mFakeEventHub->addRelativeAxis(DEVICE_ID, REL_Y);
+    prepareAxes(POSITION);
+    addMapperAndConfigure(mapper);
+
     ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper->getSources());
 }
 
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index d48cf5a..915b679 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -29,12 +29,12 @@
 import android.content.pm.PackageManager;
 import android.database.ContentObserver;
 import android.net.wifi.IWifiManager;
+import android.net.wifi.ScanResult;
+import android.net.wifi.SupplicantState;
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiStateMachine;
-import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
-import android.net.wifi.SupplicantState;
 import android.net.wifi.WifiConfiguration.KeyMgmt;
 import android.net.wifi.WpsConfiguration;
 import android.net.wifi.WpsResult;
@@ -891,8 +891,6 @@
         mWifiStateMachine.clearBlacklist();
     }
 
-
-
     /**
      * Get a reference to handler. This is used by a client to establish
      * an AsyncChannel communication with WifiService
@@ -907,6 +905,14 @@
         return new Messenger(mAsyncServiceHandler);
     }
 
+    /**
+     * Get the IP and proxy configuration file
+     */
+    public String getConfigFile() {
+        enforceAccessPermission();
+        return mWifiStateMachine.getConfigFile();
+    }
+
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
diff --git a/services/jni/com_android_server_UsbService.cpp b/services/jni/com_android_server_UsbService.cpp
index c66f181..816f76f 100644
--- a/services/jni/com_android_server_UsbService.cpp
+++ b/services/jni/com_android_server_UsbService.cpp
@@ -193,13 +193,14 @@
         return NULL;
     }
     jclass stringClass = env->FindClass("java/lang/String");
-    jobjectArray strArray = env->NewObjectArray(5, stringClass, NULL);
+    jobjectArray strArray = env->NewObjectArray(6, stringClass, NULL);
     if (!strArray) goto out;
     set_accessory_string(env, fd, ACCESSORY_GET_STRING_MANUFACTURER, strArray, 0);
     set_accessory_string(env, fd, ACCESSORY_GET_STRING_MODEL, strArray, 1);
     set_accessory_string(env, fd, ACCESSORY_GET_STRING_DESCRIPTION, strArray, 2);
     set_accessory_string(env, fd, ACCESSORY_GET_STRING_VERSION, strArray, 3);
     set_accessory_string(env, fd, ACCESSORY_GET_STRING_URI, strArray, 4);
+    set_accessory_string(env, fd, ACCESSORY_GET_STRING_SERIAL, strArray, 5);
 
 out:
     close(fd);
diff --git a/services/sensorservice/Android.mk b/services/sensorservice/Android.mk
index 7e17fdd..c50e4a1 100644
--- a/services/sensorservice/Android.mk
+++ b/services/sensorservice/Android.mk
@@ -27,7 +27,7 @@
 	libui \
 	libgui
 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_MODULE:= libsensorservice
 
diff --git a/tests/BrowserTestPlugin/jni/Android.mk b/tests/BrowserTestPlugin/jni/Android.mk
index 95a21e9..a0d647b 100644
--- a/tests/BrowserTestPlugin/jni/Android.mk
+++ b/tests/BrowserTestPlugin/jni/Android.mk
@@ -41,7 +41,7 @@
 	external/webkit/WebKit/android/plugins
 
 LOCAL_CFLAGS += -fvisibility=hidden 
-LOCAL_PRELINK_MODULE := false
+
 
 LOCAL_MODULE := libtestplugin
 LOCAL_MODULE_TAGS := tests
diff --git a/tests/HwAccelerationTest/res/drawable/gradient.xml b/tests/HwAccelerationTest/res/drawable/gradient.xml
new file mode 100644
index 0000000..756db0b
--- /dev/null
+++ b/tests/HwAccelerationTest/res/drawable/gradient.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient
+        android:startColor="#FF707070"
+        android:endColor="#FF0C0C0C"
+        android:angle="270" />
+</shape>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
index f8422f4..90db818 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
@@ -193,6 +193,7 @@
         private final float mDrawWidth;
         private final float mDrawHeight;
         private final LinearGradient mGradient;
+        private final LinearGradient mGradientStops;
         private final Matrix mMatrix;
 
         ShadersView(Context c) {
@@ -202,6 +203,9 @@
             mDrawHeight = 200;
 
             mGradient = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP);
+            mGradientStops = new LinearGradient(0, 0, 0, 1,
+                    new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF }, null, Shader.TileMode.CLAMP);
+
             mMatrix = new Matrix();
 
             mPaint = new Paint();
@@ -255,6 +259,19 @@
             mGradient.setLocalMatrix(mMatrix);
             canvas.drawRect(left, top, left + mDrawWidth, bottom, mPaint);
 
+            right = left + mDrawWidth;
+            left = 40.0f;
+            top = bottom + 20.0f;
+            bottom = top + 50.0f;
+
+            mPaint.setShader(mGradientStops);
+
+            mMatrix.setScale(1, mDrawWidth);
+            mMatrix.postRotate(90);
+            mMatrix.postTranslate(right, top);
+            mGradientStops.setLocalMatrix(mMatrix);
+            canvas.drawRect(left, top, right, bottom, mPaint);
+            
             canvas.restore();
         }
     }
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java
index 763169a..535f865 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java
@@ -79,7 +79,7 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         
-        getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.default_wallpaper));
+        getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.gradient));
         setContentView(R.layout.list_activity);
 
         ListAdapter adapter = new SimpleListAdapter(this);
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index 88fd678..922cd4c 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -33,6 +33,7 @@
 import java.awt.RenderingHints;
 import java.awt.Shape;
 import java.awt.geom.AffineTransform;
+import java.awt.geom.Arc2D;
 import java.awt.image.BufferedImage;
 import java.util.List;
 
@@ -290,7 +291,7 @@
             Paint paint) {
         draw(thisCanvas.mNativeCanvas, paint.mNativePaint, false /*compositeOnly*/,
                 false /*forceSrcMode*/, new GcSnapshot.Drawable() {
-                    public void draw(Graphics2D graphics, Paint_Delegate paint) {
+                    public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
                         for (int i = 0 ; i < count ; i += 4) {
                             graphics.drawLine((int)pts[i + offset], (int)pts[i + offset + 1],
                                     (int)pts[i + offset + 2], (int)pts[i + offset + 3]);
@@ -314,12 +315,12 @@
             Canvas_Delegate newDelegate = new Canvas_Delegate(bitmapDelegate);
 
             return sManager.addNewDelegate(newDelegate);
-        } else {
-            // create a new Canvas_Delegate and return its new native int.
-            Canvas_Delegate newDelegate = new Canvas_Delegate();
-
-            return sManager.addNewDelegate(newDelegate);
         }
+
+        // create a new Canvas_Delegate and return its new native int.
+        Canvas_Delegate newDelegate = new Canvas_Delegate();
+
+        return sManager.addNewDelegate(newDelegate);
     }
 
     @LayoutlibDelegate
@@ -650,7 +651,7 @@
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
-                    public void draw(Graphics2D graphics, Paint_Delegate paint) {
+                    public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
                         graphics.drawLine((int)startX, (int)startY, (int)stopX, (int)stopY);
                     }
         });
@@ -668,8 +669,8 @@
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
-                    public void draw(Graphics2D graphics, Paint_Delegate paint) {
-                        int style = paint.getStyle();
+                    public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
+                        int style = paintDelegate.getStyle();
 
                         // draw
                         if (style == Paint.Style.FILL.nativeInt ||
@@ -692,8 +693,8 @@
         if (oval.right > oval.left && oval.bottom > oval.top) {
             draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                     new GcSnapshot.Drawable() {
-                        public void draw(Graphics2D graphics, Paint_Delegate paint) {
-                            int style = paint.getStyle();
+                        public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
+                            int style = paintDelegate.getStyle();
 
                             // draw
                             if (style == Paint.Style.FILL.nativeInt ||
@@ -722,10 +723,32 @@
 
     @LayoutlibDelegate
     /*package*/ static void native_drawArc(int nativeCanvas,
-            RectF oval, float startAngle, float sweep, boolean useCenter, int paint) {
-        // FIXME
-        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
-                "Canvas.drawArc is not supported.", null, null /*data*/);
+            final RectF oval, final float startAngle, final float sweep,
+            final boolean useCenter, int paint) {
+        if (oval.right > oval.left && oval.bottom > oval.top) {
+            draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
+                    new GcSnapshot.Drawable() {
+                        public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
+                            int style = paintDelegate.getStyle();
+
+                            Arc2D.Float arc = new Arc2D.Float(
+                                    oval.left, oval.top, oval.width(), oval.height(),
+                                    -startAngle, -sweep,
+                                    useCenter ? Arc2D.PIE : Arc2D.OPEN);
+
+                            // draw
+                            if (style == Paint.Style.FILL.nativeInt ||
+                                    style == Paint.Style.FILL_AND_STROKE.nativeInt) {
+                                graphics.fill(arc);
+                            }
+
+                            if (style == Paint.Style.STROKE.nativeInt ||
+                                    style == Paint.Style.FILL_AND_STROKE.nativeInt) {
+                                graphics.draw(arc);
+                            }
+                        }
+            });
+        }
     }
 
     @LayoutlibDelegate
@@ -734,8 +757,8 @@
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
-                    public void draw(Graphics2D graphics, Paint_Delegate paint) {
-                        int style = paint.getStyle();
+                    public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
+                        int style = paintDelegate.getStyle();
 
                         // draw
                         if (style == Paint.Style.FILL.nativeInt ||
@@ -766,9 +789,9 @@
 
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
-                    public void draw(Graphics2D graphics, Paint_Delegate paint) {
+                    public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
                         Shape shape = pathDelegate.getJavaShape();
-                        int style = paint.getStyle();
+                        int style = paintDelegate.getStyle();
 
                         if (style == Paint.Style.FILL.nativeInt ||
                                 style == Paint.Style.FILL_AND_STROKE.nativeInt) {
@@ -947,23 +970,23 @@
             final float startX, final float startY, int flags, int paint) {
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
-            public void draw(Graphics2D graphics, Paint_Delegate paint) {
+            public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) {
                 // WARNING: the logic in this method is similar to Paint_Delegate.measureText.
                 // Any change to this method should be reflected in Paint.measureText
                 // Paint.TextAlign indicates how the text is positioned relative to X.
                 // LEFT is the default and there's nothing to do.
                 float x = startX;
                 float y = startY;
-                if (paint.getTextAlign() != Paint.Align.LEFT.nativeInt) {
-                    float m = paint.measureText(text, index, count);
-                    if (paint.getTextAlign() == Paint.Align.CENTER.nativeInt) {
+                if (paintDelegate.getTextAlign() != Paint.Align.LEFT.nativeInt) {
+                    float m = paintDelegate.measureText(text, index, count);
+                    if (paintDelegate.getTextAlign() == Paint.Align.CENTER.nativeInt) {
                         x -= m / 2;
-                    } else if (paint.getTextAlign() == Paint.Align.RIGHT.nativeInt) {
+                    } else if (paintDelegate.getTextAlign() == Paint.Align.RIGHT.nativeInt) {
                         x -= m;
                     }
                 }
 
-                List<FontInfo> fonts = paint.getFonts();
+                List<FontInfo> fonts = paintDelegate.getFonts();
 
                 if (fonts.size() > 0) {
                     FontInfo mainFont = fonts.get(0);
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index db14e53..64f19d3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -365,7 +365,7 @@
         // because x/y is the center of the circle, need to offset this by the radius
         pathDelegate.mPath.append(new Arc2D.Float(
                 oval.left, oval.top, oval.width(), oval.height(),
-                startAngle, sweepAngle, Arc2D.OPEN), false);
+                -startAngle, -sweepAngle, Arc2D.OPEN), false);
     }
 
     @LayoutlibDelegate
@@ -707,10 +707,9 @@
      *                    mod 360.
      * @param forceMoveTo If true, always begin a new contour with the arc
      */
-    private void arcTo(RectF oval, float startAngle, float sweepAngle,
-                      boolean forceMoveTo) {
-        Arc2D arc = new Arc2D.Float(oval.left, oval.top, oval.width(), oval.height(), startAngle,
-                sweepAngle, Arc2D.OPEN);
+    private void arcTo(RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo) {
+        Arc2D arc = new Arc2D.Float(oval.left, oval.top, oval.width(), oval.height(), -startAngle,
+                -sweepAngle, Arc2D.OPEN);
         mPath.append(arc, true /*connect*/);
 
         resetLastPointFromPath();
diff --git a/voip/jni/rtp/Android.mk b/voip/jni/rtp/Android.mk
index 76c43ba..61680a2 100644
--- a/voip/jni/rtp/Android.mk
+++ b/voip/jni/rtp/Android.mk
@@ -53,6 +53,6 @@
 
 LOCAL_CFLAGS += -fvisibility=hidden
 
-LOCAL_PRELINK_MODULE := false
+
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 1d115b1..16a61db 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -104,5 +104,7 @@
     void clearBlacklist();
 
     Messenger getMessenger();
+
+    String getConfigFile();
 }
 
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index e6decc88..6455d84 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -1347,4 +1347,8 @@
         }
         return sb.toString();
     }
+
+    public static String getConfigFile() {
+        return ipConfigFile;
+    }
 }
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 5238899..2e49a77 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1176,6 +1176,18 @@
     }
 
     /**
+     * Returns the file in which IP and proxy configuration data is stored
+     * @hide
+     */
+    public String getConfigFile() {
+        try {
+            return mService.getConfigFile();
+        } catch (RemoteException e) {
+            return null;
+        }
+    }
+
+    /**
      * Allows an application to keep the Wi-Fi radio awake.
      * Normally the Wi-Fi radio may turn off when the user has not used the device in a while.
      * Acquiring a WifiLock will keep the radio on until the lock is released.  Multiple
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 717dcf0..4346b327 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -887,6 +887,13 @@
     }
 
     /**
+     * Returns the wifi configuration file
+     */
+    public String getConfigFile() {
+        return WifiConfigStore.getConfigFile();
+    }
+
+    /**
      * Send a message indicating bluetooth adapter connection state changed
      */
     public void sendBluetoothAdapterStateChange(int state) {