Merge "Handle offscreen animations correctly" into jb-mr1-dev
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 8e4d7ed..387f33d 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -185,8 +185,8 @@
     if (create_pkg_path(pkgdir, pkgname, PKG_DIR_POSTFIX, persona))
         return -1;
 
-    /* delete contents AND directory, no exceptions */
-    return delete_dir_contents(pkgdir, 1, NULL);
+    /* delete contents, excluding "lib", but not the directory itself */
+    return delete_dir_contents(pkgdir, 0, "lib");
 }
 
 int make_user_data(const char *pkgname, uid_t uid, uid_t persona)
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 201b43f..7aa2507 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -33,6 +33,7 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.util.AttributeSet;
 import android.view.CompatibilityInfoHolder;
 import android.view.Display;
@@ -587,6 +588,10 @@
      * can read and write files placed here.
      * </ul>
      *
+     * <p>On devices with multiple users (as described by {@link UserManager}),
+     * each user has their own isolated external storage. Applications only
+     * have access to the external storage for the user they're running as.</p>
+     *
      * <p>Here is an example of typical code to manipulate a file in
      * an application's private storage:</p>
      *
@@ -616,6 +621,9 @@
      * {@sample development/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java
      * private_picture}
      *
+     * <p>Writing to this path requires the
+     * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission.</p>
+     *
      * @param type The type of files directory to return.  May be null for
      * the root of the files directory or one of
      * the following Environment constants for a subdirectory:
@@ -641,6 +649,11 @@
      * Return the directory where this application's OBB files (if there
      * are any) can be found.  Note if the application does not have any OBB
      * files, this directory may not exist.
+     *
+     * <p>On devices with multiple users (as described by {@link UserManager}),
+     * multiple users may share the same OBB storage location. Applications
+     * should ensure that multiple instances running under different users
+     * don't interfere with each other.</p>
      */
     public abstract File getObbDir();
 
@@ -689,6 +702,13 @@
      * can read and write files placed here.
      * </ul>
      *
+     * <p>On devices with multiple users (as described by {@link UserManager}),
+     * each user has their own isolated external storage. Applications only
+     * have access to the external storage for the user they're running as.</p>
+     *
+     * <p>Writing to this path requires the
+     * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission.</p>
+     *
      * @return Returns the path of the directory holding application cache files
      * on external storage.  Returns null if external storage is not currently
      * mounted so it could not ensure the path exists; you will need to call
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index 3315566..88529f8 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -274,6 +274,10 @@
      * built-in storage in a device that is distinct from the protected
      * internal storage and can be mounted as a filesystem on a computer.</em></p>
      *
+     * <p>On devices with multiple users (as described by {@link UserManager}),
+     * each user has their own isolated external storage. Applications only
+     * have access to the external storage for the user they're running as.</p>
+     *
      * <p>In devices with multiple "external" storage directories (such as
      * both secure app storage and mountable shared storage), this directory
      * represents the "primary" external storage that the user will interact
@@ -286,7 +290,16 @@
      * Context.getExternalFilesDir}, which the system will take care of deleting
      * if the application is uninstalled.  Other shared files should be placed
      * in one of the directories returned by
-     * {@link #getExternalStoragePublicDirectory}.
+     * {@link #getExternalStoragePublicDirectory}.</p>
+     *
+     * <p>Writing to this path requires the
+     * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission. In
+     * a future platform release, access to this path will require the
+     * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission,
+     * which is automatically granted if you hold the write permission.</p>
+     *
+     * <p>This path may change between platform versions, so applications
+     * should only persist relative paths.</p>
      * 
      * <p>Here is an example of typical code to monitor the state of
      * external storage:</p>
@@ -423,6 +436,10 @@
      * to ensure you don't erase their files or get in the way of their own
      * organization.
      * 
+     * <p>On devices with multiple users (as described by {@link UserManager}),
+     * each user has their own isolated external storage. Applications only
+     * have access to the external storage for the user they're running as.</p>
+     *
      * <p>Here is an example of typical code to manipulate a picture on
      * the public external storage:</p>
      * 
@@ -500,7 +517,7 @@
     }
     
     /**
-     * Gets the Android Download/Cache content directory.
+     * Gets the Android download/cache content directory.
      */
     public static File getDownloadCacheDirectory() {
         return DOWNLOAD_CACHE_DIRECTORY;
@@ -563,7 +580,7 @@
     /**
      * Gets the current state of the primary "external" storage device.
      * 
-     * <p>See {@link #getExternalStorageDirectory()} for more information.
+     * @see #getExternalStorageDirectory()
      */
     public static String getExternalStorageState() {
         try {
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
index 59d0f7a..ed51818 100644
--- a/core/java/android/os/Trace.java
+++ b/core/java/android/os/Trace.java
@@ -16,6 +16,8 @@
 
 package android.os;
 
+import android.util.Log;
+
 /**
  * Writes trace events to the kernel trace buffer.  These trace events can be
  * collected using the "atrace" program for offline analysis.
@@ -27,6 +29,8 @@
  * @hide
  */
 public final class Trace {
+    private static final String TAG = "Trace";
+
     // These tags must be kept in sync with frameworks/native/include/utils/Trace.h.
     public static final long TRACE_TAG_NEVER = 0;
     public static final long TRACE_TAG_ALWAYS = 1L << 0;
@@ -49,7 +53,11 @@
 
     public static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.tags.enableflags";
 
-    private static long sEnabledTags = nativeGetEnabledTags();
+    // This works as a "not ready" flag because TRACE_TAG_ALWAYS is always set.
+    private static final long TRACE_FLAGS_NOT_READY = 0;
+
+    // Must be volatile to avoid word tearing.
+    private static volatile long sEnabledTags = TRACE_FLAGS_NOT_READY;
 
     private static native long nativeGetEnabledTags();
     private static native void nativeTraceCounter(long tag, String name, int value);
@@ -57,9 +65,17 @@
     private static native void nativeTraceEnd(long tag);
 
     static {
+        // We configure two separate change callbacks, one in Trace.cpp and one here.  The
+        // native callback reads the tags from the system property, and this callback
+        // reads the value that the native code retrieved.  It's essential that the native
+        // callback executes first.
+        //
+        // The system provides ordering through a priority level.  Callbacks made through
+        // SystemProperties.addChangeCallback currently have a negative priority, while
+        // our native code is using a priority of zero.
         SystemProperties.addChangeCallback(new Runnable() {
             @Override public void run() {
-                sEnabledTags = nativeGetEnabledTags();
+                cacheEnabledTags();
             }
         });
     }
@@ -68,13 +84,41 @@
     }
 
     /**
+     * Caches a copy of the enabled-tag bits.  The "master" copy is held by the native code,
+     * and comes from the PROPERTY_TRACE_TAG_ENABLEFLAGS property.
+     * <p>
+     * If the native code hasn't yet read the property, we will cause it to do one-time
+     * initialization.  We don't want to do this during class init, because this class is
+     * preloaded, so all apps would be stuck with whatever the zygote saw.  (The zygote
+     * doesn't see the system-property update broadcasts.)
+     * <p>
+     * We want to defer initialization until the first use by an app, post-zygote.
+     * <p>
+     * We're okay if multiple threads call here simultaneously -- the native state is
+     * synchronized, and sEnabledTags is volatile (prevents word tearing).
+     */
+    private static long cacheEnabledTags() {
+        long tags = nativeGetEnabledTags();
+        if (tags == TRACE_FLAGS_NOT_READY) {
+            Log.w(TAG, "Unexpected value from nativeGetEnabledTags: " + tags);
+            // keep going
+        }
+        sEnabledTags = tags;
+        return tags;
+    }
+
+    /**
      * Returns true if a trace tag is enabled.
      *
      * @param traceTag The trace tag to check.
      * @return True if the trace tag is valid.
      */
     public static boolean isTagEnabled(long traceTag) {
-        return (sEnabledTags & traceTag) != 0;
+        long tags = sEnabledTags;
+        if (tags == TRACE_FLAGS_NOT_READY) {
+            tags = cacheEnabledTags();
+        }
+        return (tags & traceTag) != 0;
     }
 
     /**
@@ -85,7 +129,7 @@
      * @param counterValue The counter value.
      */
     public static void traceCounter(long traceTag, String counterName, int counterValue) {
-        if ((sEnabledTags & traceTag) != 0) {
+        if (isTagEnabled(traceTag)) {
             nativeTraceCounter(traceTag, counterName, counterValue);
         }
     }
@@ -98,7 +142,7 @@
      * @param methodName The method name to appear in the trace.
      */
     public static void traceBegin(long traceTag, String methodName) {
-        if ((sEnabledTags & traceTag) != 0) {
+        if (isTagEnabled(traceTag)) {
             nativeTraceBegin(traceTag, methodName);
         }
     }
@@ -110,7 +154,7 @@
      * @param traceTag The trace tag.
      */
     public static void traceEnd(long traceTag) {
-        if ((sEnabledTags & traceTag) != 0) {
+        if (isTagEnabled(traceTag)) {
             nativeTraceEnd(traceTag);
         }
     }
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 183b012..550a740 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -758,6 +758,7 @@
         public float density;
         public float xDpi;
         public float yDpi;
+        public boolean secure;
 
         public PhysicalDisplayInfo() {
         }
@@ -778,7 +779,8 @@
                     && refreshRate == other.refreshRate
                     && density == other.density
                     && xDpi == other.xDpi
-                    && yDpi == other.yDpi;
+                    && yDpi == other.yDpi
+                    && secure == other.secure;
         }
 
         @Override
@@ -793,13 +795,15 @@
             density = other.density;
             xDpi = other.xDpi;
             yDpi = other.yDpi;
+            secure = other.secure;
         }
 
         // For debugging purposes
         @Override
         public String toString() {
             return "PhysicalDisplayInfo{" + width + " x " + height + ", " + refreshRate + " fps, "
-                    + "density " + density + ", " + xDpi + " x " + yDpi + " dpi}";
+                    + "density " + density + ", " + xDpi + " x " + yDpi + " dpi, secure " + secure
+                    + "}";
         }
     }
 
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b96a1c2..cd63f07 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -29,14 +29,12 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Canvas;
-import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.PixelFormat;
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.PorterDuff;
 import android.graphics.Rect;
-import android.graphics.RectF;
 import android.graphics.Region;
 import android.graphics.drawable.Drawable;
 import android.media.AudioManager;
@@ -1424,8 +1422,6 @@
                             layerCanvas.setViewport(mWidth, mHeight);
                             layerCanvas.onPreDraw(null);
                             final int restoreCount = layerCanvas.save();
-                            
-                            layerCanvas.drawColor(0xff000000, PorterDuff.Mode.SRC);
 
                             int yoff;
                             final boolean scrolling = mScroller != null
@@ -1442,7 +1438,13 @@
                                 mTranslator.translateCanvas(layerCanvas);
                             }
 
-                            mView.draw(layerCanvas);
+                            DisplayList displayList = mView.mDisplayList;
+                            if (displayList != null) {
+                                layerCanvas.drawDisplayList(displayList, null,
+                                        DisplayList.FLAG_CLIP_CHILDREN);
+                            } else {
+                                mView.draw(layerCanvas);
+                            }
 
                             drawAccessibilityFocusedDrawableIfNeeded(layerCanvas);
 
diff --git a/core/java/android/webkit/AccessibilityInjector.java b/core/java/android/webkit/AccessibilityInjector.java
index fe5cad4..95a0416 100644
--- a/core/java/android/webkit/AccessibilityInjector.java
+++ b/core/java/android/webkit/AccessibilityInjector.java
@@ -514,6 +514,8 @@
             }
         } catch (URISyntaxException e) {
             // Do nothing.
+        } catch (IllegalArgumentException e) {
+            // Catch badly-formed URLs.
         }
 
         return ACCESSIBILITY_SCRIPT_INJECTION_UNDEFINED;
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 8a2c88c..2767e94 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -89,6 +89,7 @@
     jfieldID density;
     jfieldID xDpi;
     jfieldID yDpi;
+    jfieldID secure;
 } gPhysicalDisplayInfoClassInfo;
 
 
@@ -714,6 +715,7 @@
     env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.density, info.density);
     env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.xDpi, info.xdpi);
     env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.yDpi, info.ydpi);
+    env->SetBooleanField(infoObj, gPhysicalDisplayInfoClassInfo.secure, info.secure);
     return JNI_TRUE;
 }
 
@@ -907,6 +909,7 @@
     gPhysicalDisplayInfoClassInfo.density = env->GetFieldID(clazz, "density", "F");
     gPhysicalDisplayInfoClassInfo.xDpi = env->GetFieldID(clazz, "xDpi", "F");
     gPhysicalDisplayInfoClassInfo.yDpi = env->GetFieldID(clazz, "yDpi", "F");
+    gPhysicalDisplayInfoClassInfo.secure = env->GetFieldID(clazz, "secure", "Z");
     return err;
 }
 
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 34e82a7..6d6d5e5 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-skerm"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Oorlegger #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Draadlose skerm is gekoppel"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Hierdie skerm word op \'n ander toestel gewys"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Ontkoppel"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Noodoproep"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Het jy die patroon vergeet?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Verkeerde patroon"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 30adcad..be9d2bf 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -1381,7 +1381,7 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"شاشة HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"المركب #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>، <xliff:g id="DPI">%4$d</xliff:g> نقطة لكل بوصة"</string>
-    <string name="wifi_display_notification_title" msgid="2223050649240326557">"تم الاتصال بعرض شاشة اللاسلكي"</string>
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"تم التوصيل بشاشة لاسلكية"</string>
     <string name="wifi_display_notification_message" msgid="4498802012464170685">"يتم عرض هذه الشاشة على جهاز آخر"</string>
     <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"قطع الاتصال"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"الاتصال بالطوارئ"</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index ed28d37..f9ca00a 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Екран „HDMI“"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Наслагване №<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"„<xliff:g id="NAME">%1$s</xliff:g>“: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Безжичният дисплей е свързан"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Този екран се показва на друго устройство"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Прекратяване на връзката"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Спешно обаждане"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Забравена фигура"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Грешна фигура"</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index c6f1e1a..32cac85 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Pantalla HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposa #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"La pantalla sense fil està connectada"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Aquesta pantalla es mostra en un altre dispositiu"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Desconnecta"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Trucada d\'emergència"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Patró oblidat"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Patró incorrecte"</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 3c1b52f..3525a4e 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Obrazovka HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Překryvná vrstva č. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Bezdrátový displej je připojen"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Tato obrazovka se zobrazuje v jiném zařízení"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Odpojit"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Tísňové volání"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Zapomenuté gesto"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nesprávné gesto"</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 0801988..164657e 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-skærm"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlejring nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Der er tilsluttet en trådløs skærm"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Denne skærm vises på en anden enhed"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Afbryd forbindelsen"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Nødopkald"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Glemt mønster"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Forkert mønster"</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index d554e21..17d0724 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-ekraan"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Ülekate nr .<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Juhtmeta ekraaniühendus on loodud"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Ekraan on näha teises seadmes"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Katkesta ühendus"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Hädaabikõne"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Unustasin mustri"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Vale muster"</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index f19c4a6..1f82449 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Écran HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Superposition n° <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g> : <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"L\'affichage sans fil est connecté."</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Cet écran s\'affiche sur un autre appareil."</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Déconnecter"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Appel d\'urgence"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"J\'ai oublié le schéma"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Schéma incorrect."</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index 5b7516d..0a2c1fb 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI स्क्रीन"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"ओवरले #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"वायरलेस डिस्प्ले कनेक्ट है"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"यह स्क्रीन अन्य उपकरण पर दिखाई दे रही है"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"डिस्कनेक्ट करें"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"आपातकालीन कॉल"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"प्रतिमान भूल गए"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"गलत प्रतिमान"</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index e899b60..d2e2bcb 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-képernyő"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"<xliff:g id="ID">%1$d</xliff:g>. fedvény"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> képpont"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Vezeték nélküli kijelző csatlakoztatva"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Ez a kijelző megjelenítést végez egy másik eszközön"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Szétkapcsol"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Segélyhívás"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Elfelejtett minta"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Helytelen minta"</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 23d077c..ac81bf9 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI画面"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"オーバーレイ第<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>、<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"ワイヤレスディスプレイが接続されています"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"この画面は別の端末で表示されています"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"切断"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"緊急通報"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"パターンを忘れた場合"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"パターンが正しくありません"</string>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index f6217a3..2689ff3 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI ekranas"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Perdanga nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"„<xliff:g id="NAME">%1$s</xliff:g>“: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> tašk. colyje"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Prijungtas belaidis monitorius"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Šis ekranas rodomas kitame įrenginyje"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Atjungti"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Skambutis pagalbos numeriu"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Pamiršau atrakinimo piešinį"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Netinkamas atrakinimo piešinys"</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index fe141de..4f8fb16 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI ekrāns"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Pārklājums Nr. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Bezvadu attēlošanas savienojums ir izveidots."</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Šis ekrāns tiek rādīts citā ierīcē."</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Pārtraukt savienojumu"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Ārkārtas izsaukums"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Aizmirsu kombināciju"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nepareiza kombinācija"</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index aa6b0c4..38163b5 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-skjerm"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Overlegg #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Trådløs skjermdeling er tilkoblet"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Denne skjermen vises på en annen enhet"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Koble fra"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Nødnummer"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Har du glemt mønsteret?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Feil mønster"</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 7b90687..e800e9d 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Ecrã HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Sobreposição #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> ppp"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"O Display sem fios está ligado"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Este ecrã está a ser apresentado noutro dispositivo"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Desligar"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Chamada de emergência"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Esqueceu-se da Sequência"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Sequência Incorreta"</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 5b8fca7..edbb3c2 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Ecran HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Suprapunerea <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Ecranul wireless este conectat"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Acest ecran este afişat pe alt gadget"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Deconectaţi-vă"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Apel de urgenţă"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Model uitat"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Model greşit"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index f32aa97..4d24fcb 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Экран HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Наложение № <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> х <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> тчк/дюйм"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Беспроводной проектор подключен"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Изображение проецируется на другое устройство"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Отключить"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Экстренный вызов"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Забыли графический ключ?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Неправильный графический ключ"</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 946a0ce..a40bb67 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Obrazovka HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Prekrytie č. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Bezdrôtový displej je pripojený"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Táto obrazovka sa zobrazuje na inom zariadení"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Odpojiť"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Tiesňové volanie"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Nepamätám si vzor"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Nesprávny vzor"</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index b94be23..85c2ff4 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Zaslon HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Prekrivanje #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> pik na palec"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Brezžični zaslon je povezan"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Ta zaslon je prikazan v drugi napravi"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Prekini povezavo"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Klic v sili"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Pozabljen vzorec"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Napačen vzorec"</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index c2c41c5..8463443 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI-skärm"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Överlagring #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g> x <xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Trådlös anslutning till skärm"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Den här skärmen visas på en annan enhet"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Koppla från"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Nödsamtal"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Har du glömt ditt grafiska lösenord?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Fel grafiskt lösenord"</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 4a661b7..5056a79 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI Ekran"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Yer Paylaşımı No. <xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Kablosuz ekrana bağlandı"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Bu ekran başka bir cihazda gösteriliyor"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Bağlantıyı kes"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Acil durum çağrısı"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Deseni Unuttunuz mu?"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Yanlış Desen"</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index f3a4ca6..97dcf3e 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"Màn hình HDMI"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"Lớp phủ #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>: <xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>, <xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"Hiển thị không dây đã được kết nối"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"Màn hình này đang hiển thị trên thiết bị khác"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Ngắt kết nối"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Cuộc gọi khẩn cấp"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Đã quên hình"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"Hình sai"</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index e60bee4..8783b0b 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -1381,12 +1381,9 @@
     <string name="display_manager_hdmi_display_name" msgid="1555264559227470109">"HDMI 屏幕"</string>
     <string name="display_manager_overlay_display_name" msgid="5142365982271620716">"叠加视图 #<xliff:g id="ID">%1$d</xliff:g>"</string>
     <string name="display_manager_overlay_display_title" msgid="652124517672257172">"<xliff:g id="NAME">%1$s</xliff:g>:<xliff:g id="WIDTH">%2$d</xliff:g>x<xliff:g id="HEIGHT">%3$d</xliff:g>,<xliff:g id="DPI">%4$d</xliff:g> dpi"</string>
-    <!-- no translation found for wifi_display_notification_title (2223050649240326557) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_message (4498802012464170685) -->
-    <skip />
-    <!-- no translation found for wifi_display_notification_disconnect (6183754463561153372) -->
-    <skip />
+    <string name="wifi_display_notification_title" msgid="2223050649240326557">"无线显示设备已连接"</string>
+    <string name="wifi_display_notification_message" msgid="4498802012464170685">"此屏幕显示在另一台设备上"</string>
+    <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"断开连接"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"紧急呼救"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"忘记了图案"</string>
     <string name="kg_wrong_pattern" msgid="1850806070801358830">"图案错误"</string>
diff --git a/data/sounds/effects/ogg/VideoRecord.ogg b/data/sounds/effects/ogg/VideoRecord.ogg
index ca66604..0d7bf12 100644
--- a/data/sounds/effects/ogg/VideoRecord.ogg
+++ b/data/sounds/effects/ogg/VideoRecord.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/VideoRecord_48k.ogg b/data/sounds/effects/ogg/VideoRecord_48k.ogg
index fd9c760..3eefaed 100644
--- a/data/sounds/effects/ogg/VideoRecord_48k.ogg
+++ b/data/sounds/effects/ogg/VideoRecord_48k.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/VideoStop.ogg b/data/sounds/effects/ogg/VideoStop.ogg
index 2516710..a20d524 100644
--- a/data/sounds/effects/ogg/VideoStop.ogg
+++ b/data/sounds/effects/ogg/VideoStop.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/VideoStop_48k.ogg b/data/sounds/effects/ogg/VideoStop_48k.ogg
index 7c40021..7fd9f47 100644
--- a/data/sounds/effects/ogg/VideoStop_48k.ogg
+++ b/data/sounds/effects/ogg/VideoStop_48k.ogg
Binary files differ
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 914516c..e2d7156 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -179,7 +179,7 @@
     mSaveCount = 1;
 
     mSnapshot->setClip(left, top, right, bottom);
-    mDirtyClip = opaque;
+    mDirtyClip = true;
 
     updateLayers();
 
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index cfe70dc..02b5326 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -214,7 +214,7 @@
 
         <activity android:name=".Somnambulator"
             android:label="@string/start_dreams"
-            android:icon="@mipmap/ic_launcher_dreams"
+            android:icon="@mipmap/ic_daydreams"
             android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
             android:exported="true"
             android:excludeFromRecents="true"
diff --git a/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml b/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml
deleted file mode 100644
index 363efeb..0000000
--- a/packages/SystemUI/res/drawable-sw600dp/status_bar_recents_background.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-<color xmlns:android="http://schemas.android.com/apk/res/android"
-    android:color="#e6000000"
-/>
diff --git a/packages/SystemUI/res/drawable/status_bar_recents_background.xml b/packages/SystemUI/res/drawable/status_bar_recents_background.xml
index 7831db0..ea0b75c 100644
--- a/packages/SystemUI/res/drawable/status_bar_recents_background.xml
+++ b/packages/SystemUI/res/drawable/status_bar_recents_background.xml
@@ -18,8 +18,8 @@
 -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
     <gradient name="status_bar_recents_background"
-        android:startColor="#e6000000"
-        android:endColor="#c0000000"
+        android:startColor="#E0000000"
+        android:endColor="#99000000"
         android:angle="@integer/status_bar_recents_bg_gradient_degrees"
         />
 </shape>
diff --git a/packages/SystemUI/res/mipmap-hdpi/ic_daydreams.png b/packages/SystemUI/res/mipmap-hdpi/ic_daydreams.png
new file mode 100644
index 0000000..4779a09
--- /dev/null
+++ b/packages/SystemUI/res/mipmap-hdpi/ic_daydreams.png
Binary files differ
diff --git a/packages/SystemUI/res/mipmap-mdpi/ic_daydreams.png b/packages/SystemUI/res/mipmap-mdpi/ic_daydreams.png
new file mode 100644
index 0000000..b3a634d
--- /dev/null
+++ b/packages/SystemUI/res/mipmap-mdpi/ic_daydreams.png
Binary files differ
diff --git a/packages/SystemUI/res/mipmap-xhdpi/ic_daydreams.png b/packages/SystemUI/res/mipmap-xhdpi/ic_daydreams.png
new file mode 100644
index 0000000..50b1f50
--- /dev/null
+++ b/packages/SystemUI/res/mipmap-xhdpi/ic_daydreams.png
Binary files differ
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index b5be2ac2..e9ac98f 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -183,9 +183,9 @@
     <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"Carica"</string>
     <string name="quick_settings_bluetooth_label" msgid="6304190285170721401">"Bluetooth"</string>
     <string name="quick_settings_bluetooth_multiple_devices_label" msgid="3912245565613684735">"Bluetooth (<xliff:g id="NUMBER">%d</xliff:g> dispositivi)"</string>
-    <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"Bluetooth non attivo"</string>
+    <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"Bluetooth spento"</string>
     <string name="quick_settings_brightness_label" msgid="6968372297018755815">"Luminosità"</string>
-    <string name="quick_settings_rotation_unlocked_label" msgid="336054930362580584">"Rotazione automatica"</string>
+    <string name="quick_settings_rotation_unlocked_label" msgid="336054930362580584">"Rotazione autom."</string>
     <string name="quick_settings_rotation_locked_label" msgid="8058646447242565486">"Rotazione bloccata"</string>
     <string name="quick_settings_ime_label" msgid="7073463064369468429">"Metodo di immissione"</string>
     <string name="quick_settings_location_label" msgid="3292451598267467545">"Posizione in uso"</string>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index e0b0227..f3db062 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -456,7 +456,7 @@
     <string name="jelly_bean_dream_name">BeanFlinger</string>
 
     <!-- Name of the launcher shortcut icon that allows dreams to be started immediately [CHAR LIMIT=20] -->
-    <string name="start_dreams">Sleep Now</string>
+    <string name="start_dreams">Daydream</string>
 
     <!-- Textual description of Ethernet connections -->
     <string name="ethernet_label">Ethernet</string>
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 4e9013f..edfaf49 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -27,13 +27,12 @@
 import android.view.Gravity;
 import android.view.MotionEvent;
 import android.view.ScaleGestureDetector;
+import android.view.ScaleGestureDetector.OnScaleGestureListener;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.view.View.OnClickListener;
 
-import java.util.Stack;
-
 public class ExpandHelper implements Gefingerpoken, OnClickListener {
     public interface Callback {
         View getChildAtRawPosition(float x, float y);
@@ -110,6 +109,32 @@
 
     private View mScrollView;
 
+    private OnScaleGestureListener mScaleGestureListener 
+            = new ScaleGestureDetector.SimpleOnScaleGestureListener() {
+        @Override
+        public boolean onScaleBegin(ScaleGestureDetector detector) {
+            if (DEBUG_SCALE) Slog.v(TAG, "onscalebegin()");
+            float focusX = detector.getFocusX();
+            float focusY = detector.getFocusY();
+
+            final View underFocus = findView(focusX, focusY);
+            if (underFocus != null) {
+                startExpanding(underFocus, STRETCH);
+            }
+            return mExpanding;
+        }
+
+        @Override
+        public boolean onScale(ScaleGestureDetector detector) {
+            if (DEBUG_SCALE) Slog.v(TAG, "onscale() on " + mCurrView);
+            return true;
+        }
+
+        @Override
+        public void onScaleEnd(ScaleGestureDetector detector) {
+        }
+    };
+
     private class ViewScaler {
         View mView;
 
@@ -201,31 +226,7 @@
         final ViewConfiguration configuration = ViewConfiguration.get(mContext);
         mTouchSlop = configuration.getScaledTouchSlop();
 
-        mSGD = new ScaleGestureDetector(context,
-                                         new ScaleGestureDetector.SimpleOnScaleGestureListener() {
-            @Override
-            public boolean onScaleBegin(ScaleGestureDetector detector) {
-                if (DEBUG_SCALE) Slog.v(TAG, "onscalebegin()");
-                float focusX = detector.getFocusX();
-                float focusY = detector.getFocusY();
-
-                final View underFocus = findView(focusX, focusY);
-                if (underFocus != null) {
-                    startExpanding(underFocus, STRETCH);
-                }
-                return mExpanding;
-            }
-
-            @Override
-            public boolean onScale(ScaleGestureDetector detector) {
-                if (DEBUG_SCALE) Slog.v(TAG, "onscale() on " + mCurrView);
-                return true;
-            }
-
-            @Override
-            public void onScaleEnd(ScaleGestureDetector detector) {
-            }
-        });
+        mSGD = new ScaleGestureDetector(context, mScaleGestureListener);
     }
 
     private void updateExpansion() {
@@ -587,6 +588,17 @@
     }
 
     /**
+     * Use this to abort any pending expansions in progress.
+     */
+    public void cancel() {
+        finishExpanding(true);
+        clearView();
+
+        // reset the gesture detector
+        mSGD = new ScaleGestureDetector(mContext, mScaleGestureListener);
+    }
+
+    /**
      * Triggers haptic feedback.
      */
     private synchronized void vibrate(long duration) {
diff --git a/packages/SystemUI/src/com/android/systemui/Somnambulator.java b/packages/SystemUI/src/com/android/systemui/Somnambulator.java
index 0dd6d92..1f00bc1 100644
--- a/packages/SystemUI/src/com/android/systemui/Somnambulator.java
+++ b/packages/SystemUI/src/com/android/systemui/Somnambulator.java
@@ -43,7 +43,7 @@
                     | Intent.FLAG_ACTIVITY_NEW_TASK);
             Intent resultIntent = new Intent();
             resultIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
-                    Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher_dreams));
+                    Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_daydreams));
             resultIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
             resultIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.start_dreams));
             setResult(RESULT_OK, resultIntent);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 2008d0e..cd3bc42 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -19,7 +19,6 @@
 import android.animation.Animator;
 import android.animation.LayoutTransition;
 import android.animation.TimeInterpolator;
-import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.ActivityManagerNative;
 import android.app.ActivityOptions;
@@ -178,16 +177,18 @@
                 mNumItemsWaitingForThumbnailsAndIcons--;
             }
             if (index == 0) {
-                final Activity activity = (Activity) RecentsPanelView.this.getContext();
                 if (mWaitingForWindowAnimation) {
                     if (mItemToAnimateInWhenWindowAnimationIsFinished != null) {
-                        for (View v :
-                            new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
-                            if (v != null) {
-                                v.setAlpha(1f);
-                                v.setTranslationX(0f);
-                                v.setTranslationY(0f);
-                            }
+                        holder.iconView.setAlpha(1f);
+                        holder.iconView.setTranslationX(0f);
+                        holder.iconView.setTranslationY(0f);
+                        holder.labelView.setAlpha(1f);
+                        holder.labelView.setTranslationX(0f);
+                        holder.labelView.setTranslationY(0f);
+                        if (holder.calloutLine != null) {
+                            holder.calloutLine.setAlpha(1f);
+                            holder.calloutLine.setTranslationX(0f);
+                            holder.calloutLine.setTranslationY(0f);
                         }
                     }
                     mItemToAnimateInWhenWindowAnimationIsFinished = holder;
@@ -195,13 +196,12 @@
                             R.dimen.status_bar_recents_app_icon_translate_distance);
                     final Configuration config = getResources().getConfiguration();
                     if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
-                        for (View v :
-                            new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
-                            if (v != null) {
-                                v.setAlpha(0f);
-                                v.setTranslationX(translation);
-                            }
-                        }
+                        holder.iconView.setAlpha(0f);
+                        holder.iconView.setTranslationX(translation);
+                        holder.labelView.setAlpha(0f);
+                        holder.labelView.setTranslationX(translation);
+                        holder.calloutLine.setAlpha(0f);
+                        holder.calloutLine.setTranslationX(translation);
                     } else {
                         holder.iconView.setAlpha(0f);
                         holder.iconView.setTranslationY(translation);
@@ -225,6 +225,17 @@
             holder.thumbnailView.setTag(null);
             holder.thumbnailView.setOnLongClickListener(null);
             holder.thumbnailView.setVisibility(INVISIBLE);
+            holder.iconView.setAlpha(1f);
+            holder.iconView.setTranslationX(0f);
+            holder.iconView.setTranslationY(0f);
+            holder.labelView.setAlpha(1f);
+            holder.labelView.setTranslationX(0f);
+            holder.labelView.setTranslationY(0f);
+            if (holder.calloutLine != null) {
+                holder.calloutLine.setAlpha(1f);
+                holder.calloutLine.setTranslationX(0f);
+                holder.calloutLine.setTranslationY(0f);
+            }
             holder.taskDescription = null;
             holder.loadedThumbnailAndIcon = false;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 770ae6d..eef5446 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -18,6 +18,7 @@
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
+import android.animation.LayoutTransition;
 import android.app.StatusBarManager;
 import android.content.Context;
 import android.content.res.Resources;
@@ -34,6 +35,7 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.Surface;
+import android.view.ViewGroup;
 import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -62,6 +64,7 @@
 
     int mBarSize;
     boolean mVertical;
+    boolean mScreenOn;
 
     boolean mHidden, mLowProfile, mShowMenu;
     int mDisabledFlags = 0;
@@ -169,6 +172,11 @@
         mBackAltLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime);
     }
 
+    public void notifyScreenOn(boolean screenOn) {
+        mScreenOn = screenOn;
+        setDisabledFlags(mDisabledFlags, true);
+    }
+
     View.OnTouchListener mLightsOutListener = new View.OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent ev) {
@@ -231,6 +239,16 @@
 
         setSlippery(disableHome && disableRecent && disableBack);
 
+        if (!mScreenOn && mCurrentView != null) {
+            ViewGroup navButtons = (ViewGroup) mCurrentView.findViewById(R.id.nav_buttons);
+            LayoutTransition lt = navButtons == null ? null : navButtons.getLayoutTransition();
+            if (lt != null) {
+                lt.disableTransitionType(
+                        LayoutTransition.CHANGE_APPEARING | LayoutTransition.CHANGE_DISAPPEARING |
+                        LayoutTransition.APPEARING | LayoutTransition.DISAPPEARING);
+            }
+        }
+
         getBackButton()   .setVisibility(disableBack       ? View.INVISIBLE : View.VISIBLE);
         getHomeButton()   .setVisibility(disableHome       ? View.INVISIBLE : View.VISIBLE);
         getRecentsButton().setVisibility(disableRecent     ? View.INVISIBLE : View.VISIBLE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index f906176..45886df 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -783,6 +783,11 @@
         mWindowManager.updateViewLayout(mNavigationBarView, getNavigationBarLayoutParams());
     }
 
+    private void notifyNavigationBarScreenOn(boolean screenOn) {
+        if (mNavigationBarView == null) return;
+        mNavigationBarView.notifyScreenOn(screenOn);
+    }
+
     private WindowManager.LayoutParams getNavigationBarLayoutParams() {
         WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
@@ -1368,6 +1373,7 @@
             mHandler.sendEmptyMessage(MSG_CLOSE_SEARCH_PANEL);
         }
 
+        mStatusBarWindow.cancelExpandHelper();
         mStatusBarView.collapseAllPanels(true);
     }
 
@@ -2256,6 +2262,7 @@
             else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
                 // no waiting!
                 makeExpandedInvisible();
+                notifyNavigationBarScreenOn(false);
             }
             else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
                 if (DEBUG) {
@@ -2271,6 +2278,7 @@
             else if (Intent.ACTION_SCREEN_ON.equals(action)) {
                 // work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
                 repositionNavigationBar();
+                notifyNavigationBarScreenOn(true);
             }
         }
     };
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
index 22af699..599b7e2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java
@@ -771,8 +771,8 @@
             });
 
             mBrightnessDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
-            mBrightnessDialog.getWindow().addFlags(
-                    WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS);
+            mBrightnessDialog.getWindow().getAttributes().privateFlags |=
+                    WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
             mBrightnessDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
         }
         if (!mBrightnessDialog.isShowing()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 89c70e8..9bdcf5e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -119,5 +119,9 @@
             canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
         }
     }
+
+    public void cancelExpandHelper() {
+        mExpandHelper.cancel();
+    }
 }
 
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index ceb0325..cb70922 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -1306,6 +1306,13 @@
                 // (like recents). Temporary enable/disable (e.g. the "back" button) are
                 // done in KeyguardHostView.
                 flags |= StatusBarManager.DISABLE_RECENT;
+                if (!mScreenOn) {
+                    // Disable all navbar buttons on screen off.  The navigation bar will hide
+                    // these immediately to avoid seeing the end of layout transition animations
+                    // if quickly turning back on.
+                    flags |= StatusBarManager.DISABLE_HOME;
+                    flags |= StatusBarManager.DISABLE_BACK;
+                }
                 if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
                     // showing secure lockscreen; disable expanding.
                     flags |= StatusBarManager.DISABLE_EXPAND;
diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java
index ba5a475..4abd8f5 100644
--- a/services/java/com/android/server/power/DisplayPowerController.java
+++ b/services/java/com/android/server/power/DisplayPowerController.java
@@ -125,12 +125,18 @@
     // Trigger proximity if distance is less than 5 cm.
     private static final float TYPICAL_PROXIMITY_THRESHOLD = 5.0f;
 
-    // Light sensor event rate in microseconds.
-    private static final int LIGHT_SENSOR_RATE = 500 * 1000;
+    // Light sensor event rate in milliseconds.
+    private static final int LIGHT_SENSOR_RATE_MILLIS = 1000;
+
+    // A rate for generating synthetic light sensor events in the case where the light
+    // sensor hasn't reported any new data in a while and we need it to update the
+    // debounce filter.  We only synthesize light sensor measurements when needed.
+    private static final int SYNTHETIC_LIGHT_SENSOR_RATE_MILLIS =
+            LIGHT_SENSOR_RATE_MILLIS * 2;
 
     // Brightness animation ramp rate in brightness units per second.
     private static final int BRIGHTNESS_RAMP_RATE_FAST = 200;
-    private static final int BRIGHTNESS_RAMP_RATE_SLOW = 30;
+    private static final int BRIGHTNESS_RAMP_RATE_SLOW = 40;
 
     // IIR filter time constants in milliseconds for computing two moving averages of
     // the light samples.  One is a long-term average and the other is a short-term average.
@@ -138,15 +144,15 @@
     // The short term average gives us a filtered but relatively low latency measurement.
     // The long term average informs us about the overall trend.
     private static final long SHORT_TERM_AVERAGE_LIGHT_TIME_CONSTANT = 1000;
-    private static final long LONG_TERM_AVERAGE_LIGHT_TIME_CONSTANT = 8000;
+    private static final long LONG_TERM_AVERAGE_LIGHT_TIME_CONSTANT = 5000;
 
     // Stability requirements in milliseconds for accepting a new brightness
     // level.  This is used for debouncing the light sensor.  Different constants
     // are used to debounce the light sensor when adapting to brighter or darker environments.
     // This parameter controls how quickly brightness changes occur in response to
-    // an observed change in light level following a previous change in the opposite direction.
-    private static final long BRIGHTENING_LIGHT_DEBOUNCE = 5000;
-    private static final long DARKENING_LIGHT_DEBOUNCE = 15000;
+    // an observed change in light level that exceeds the hysteresis threshold.
+    private static final long BRIGHTENING_LIGHT_DEBOUNCE = 4000;
+    private static final long DARKENING_LIGHT_DEBOUNCE = 8000;
 
     // Hysteresis constraints for brightening or darkening.
     // The recent lux must have changed by at least this fraction relative to the
@@ -290,10 +296,6 @@
     // True if mAmbientLux holds a valid value.
     private boolean mAmbientLuxValid;
 
-    // The time when the ambient lux was last brightened or darkened.
-    private long mLastAmbientBrightenTime;
-    private long mLastAmbientDarkenTime;
-
     // The most recent light sample.
     private float mLastObservedLux;
 
@@ -307,6 +309,15 @@
     private float mRecentShortTermAverageLux;
     private float mRecentLongTermAverageLux;
 
+    // The direction in which the average lux is moving relative to the current ambient lux.
+    //    0 if not changing or within hysteresis threshold.
+    //    1 if brightening beyond hysteresis threshold.
+    //   -1 if darkening beyond hysteresis threshold.
+    private int mDebounceLuxDirection;
+
+    // The time when the average lux last changed direction.
+    private long mDebounceLuxTime;
+
     // The screen brightness level that has been chosen by the auto-brightness
     // algorithm.  The actual brightness should ramp towards this value.
     // We preserve this value even when we stop using the light sensor so
@@ -547,6 +558,7 @@
         final boolean mustNotify;
         boolean mustInitialize = false;
         boolean updateAutoBrightness = mTwilightChanged;
+        boolean wasDim = false;
         mTwilightChanged = false;
 
         synchronized (mLock) {
@@ -566,6 +578,7 @@
                         != mPendingRequestLocked.screenAutoBrightnessAdjustment) {
                     updateAutoBrightness = true;
                 }
+                wasDim = (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DIM);
                 mPowerRequest.copyFrom(mPendingRequestLocked);
                 mWaitingForNegativeProximity |= mPendingWaitForNegativeProximityLocked;
                 mPendingWaitForNegativeProximityLocked = false;
@@ -635,9 +648,12 @@
                 mUsingScreenAutoBrightness = false;
             }
             if (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DIM) {
-                // Screen is dimmed.  Sets an upper bound on everything else.
+                // Dim slowly by at least some minimum amount.
                 target = Math.min(target - SCREEN_DIM_MINIMUM_REDUCTION,
                         mScreenBrightnessDimConfig);
+                slow = true;
+            } else if (wasDim) {
+                // Brighten quickly.
                 slow = false;
             }
             animateScreenBrightness(clampScreenBrightness(target),
@@ -852,7 +868,7 @@
                 mLightSensorEnabled = true;
                 mLightSensorEnableTime = SystemClock.uptimeMillis();
                 mSensorManager.registerListener(mLightSensorListener, mLightSensor,
-                        LIGHT_SENSOR_RATE, mHandler);
+                        LIGHT_SENSOR_RATE_MILLIS * 1000, mHandler);
             }
         } else {
             if (mLightSensorEnabled) {
@@ -869,6 +885,13 @@
     }
 
     private void handleLightSensorEvent(long time, float lux) {
+        mHandler.removeMessages(MSG_LIGHT_SENSOR_DEBOUNCED);
+
+        applyLightSensorMeasurement(time, lux);
+        updateAmbientLux(time);
+    }
+
+    private void applyLightSensorMeasurement(long time, float lux) {
         // Update our filters.
         mRecentLightSamples += 1;
         if (mRecentLightSamples == 1) {
@@ -885,10 +908,6 @@
         // Remember this sample value.
         mLastObservedLux = lux;
         mLastObservedLuxTime = time;
-
-        // Update the ambient lux level.
-        mHandler.removeMessages(MSG_LIGHT_SENSOR_DEBOUNCED);
-        updateAmbientLux(time);
     }
 
     private void updateAmbientLux(long time) {
@@ -896,34 +915,46 @@
         // estimate of the current ambient light level.
         if (!mAmbientLuxValid
                 || (time - mLightSensorEnableTime) < mLightSensorWarmUpTimeConfig) {
-            if (DEBUG) {
-                Slog.d(TAG, "updateAmbientLux: Initializing, "
-                        + "mAmbientLux=" + (mAmbientLuxValid ? mAmbientLux : -1)
-                        + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
-                        + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux);
-            }
             mAmbientLux = mRecentShortTermAverageLux;
             mAmbientLuxValid = true;
-            mLastAmbientBrightenTime = time;
-            mLastAmbientDarkenTime = time;
+            mDebounceLuxDirection = 0;
+            mDebounceLuxTime = time;
+            if (DEBUG) {
+                Slog.d(TAG, "updateAmbientLux: Initializing: "
+                        + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
+                        + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                        + ", mAmbientLux=" + mAmbientLux);
+            }
             updateAutoBrightness(true);
             return;
         }
 
         // Determine whether the ambient environment appears to be brightening.
-        float minAmbientLux = mAmbientLux * (1.0f + BRIGHTENING_LIGHT_HYSTERESIS);
-        if (mRecentShortTermAverageLux > minAmbientLux
-                && mRecentLongTermAverageLux > minAmbientLux) {
-            long debounceTime = mLastAmbientDarkenTime + BRIGHTENING_LIGHT_DEBOUNCE;
+        float brighteningLuxThreshold = mAmbientLux * (1.0f + BRIGHTENING_LIGHT_HYSTERESIS);
+        if (mRecentShortTermAverageLux > brighteningLuxThreshold
+                && mRecentLongTermAverageLux > brighteningLuxThreshold) {
+            if (mDebounceLuxDirection <= 0) {
+                mDebounceLuxDirection = 1;
+                mDebounceLuxTime = time;
+                if (DEBUG) {
+                    Slog.d(TAG, "updateAmbientLux: Possibly brightened, waiting for "
+                            + BRIGHTENING_LIGHT_DEBOUNCE + " ms: "
+                            + "brighteningLuxThreshold=" + brighteningLuxThreshold
+                            + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
+                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                            + ", mAmbientLux=" + mAmbientLux);
+                }
+            }
+            long debounceTime = mDebounceLuxTime + BRIGHTENING_LIGHT_DEBOUNCE;
             if (time >= debounceTime) {
+                mAmbientLux = mRecentShortTermAverageLux;
                 if (DEBUG) {
                     Slog.d(TAG, "updateAmbientLux: Brightened: "
-                            + "mAmbientLux=" + mAmbientLux
+                            + "brighteningLuxThreshold=" + brighteningLuxThreshold
                             + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
-                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux);
+                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                            + ", mAmbientLux=" + mAmbientLux);
                 }
-                mLastAmbientBrightenTime = time;
-                mAmbientLux = mRecentShortTermAverageLux;
                 updateAutoBrightness(true);
             } else {
                 mHandler.sendEmptyMessageAtTime(MSG_LIGHT_SENSOR_DEBOUNCED, debounceTime);
@@ -932,28 +963,78 @@
         }
 
         // Determine whether the ambient environment appears to be darkening.
-        float maxAmbientLux = mAmbientLux * (1.0f - DARKENING_LIGHT_HYSTERESIS);
-        if (mRecentShortTermAverageLux < maxAmbientLux
-                && mRecentLongTermAverageLux < maxAmbientLux) {
-            long debounceTime = mLastAmbientBrightenTime + DARKENING_LIGHT_DEBOUNCE;
+        float darkeningLuxThreshold = mAmbientLux * (1.0f - DARKENING_LIGHT_HYSTERESIS);
+        if (mRecentShortTermAverageLux < darkeningLuxThreshold
+                && mRecentLongTermAverageLux < darkeningLuxThreshold) {
+            if (mDebounceLuxDirection >= 0) {
+                mDebounceLuxDirection = -1;
+                mDebounceLuxTime = time;
+                if (DEBUG) {
+                    Slog.d(TAG, "updateAmbientLux: Possibly darkened, waiting for "
+                            + DARKENING_LIGHT_DEBOUNCE + " ms: "
+                            + "darkeningLuxThreshold=" + darkeningLuxThreshold
+                            + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
+                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                            + ", mAmbientLux=" + mAmbientLux);
+                }
+            }
+            long debounceTime = mDebounceLuxTime + DARKENING_LIGHT_DEBOUNCE;
             if (time >= debounceTime) {
+                // Be conservative about reducing the brightness, only reduce it a little bit
+                // at a time to avoid having to bump it up again soon.
+                mAmbientLux = Math.max(mRecentShortTermAverageLux, mRecentLongTermAverageLux);
                 if (DEBUG) {
                     Slog.d(TAG, "updateAmbientLux: Darkened: "
-                            + "mAmbientLux=" + mAmbientLux
+                            + "darkeningLuxThreshold=" + darkeningLuxThreshold
                             + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
-                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux);
+                            + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                            + ", mAmbientLux=" + mAmbientLux);
                 }
-                mLastAmbientDarkenTime = time;
-                mAmbientLux = mRecentShortTermAverageLux;
                 updateAutoBrightness(true);
             } else {
                 mHandler.sendEmptyMessageAtTime(MSG_LIGHT_SENSOR_DEBOUNCED, debounceTime);
             }
+            return;
+        }
+
+        // No change or change is within the hysteresis thresholds.
+        if (mDebounceLuxDirection != 0) {
+            mDebounceLuxDirection = 0;
+            mDebounceLuxTime = time;
+            if (DEBUG) {
+                Slog.d(TAG, "updateAmbientLux: Canceled debounce: "
+                        + "brighteningLuxThreshold=" + brighteningLuxThreshold
+                        + ", darkeningLuxThreshold=" + darkeningLuxThreshold
+                        + ", mRecentShortTermAverageLux=" + mRecentShortTermAverageLux
+                        + ", mRecentLongTermAverageLux=" + mRecentLongTermAverageLux
+                        + ", mAmbientLux=" + mAmbientLux);
+            }
+        }
+
+        // If the light level does not change, then the sensor may not report
+        // a new value.  This can cause problems for the auto-brightness algorithm
+        // because the filters might not be updated.  To work around it, we want to
+        // make sure to update the filters whenever the observed light level could
+        // possibly exceed one of the hysteresis thresholds.
+        if (mLastObservedLux > brighteningLuxThreshold
+                || mLastObservedLux < darkeningLuxThreshold) {
+            mHandler.sendEmptyMessageAtTime(MSG_LIGHT_SENSOR_DEBOUNCED,
+                    time + SYNTHETIC_LIGHT_SENSOR_RATE_MILLIS);
         }
     }
 
     private void debounceLightSensor() {
-        updateAmbientLux(SystemClock.uptimeMillis());
+        if (mLightSensorEnabled) {
+            long time = SystemClock.uptimeMillis();
+            if (time >= mLastObservedLuxTime + SYNTHETIC_LIGHT_SENSOR_RATE_MILLIS) {
+                if (DEBUG) {
+                    Slog.d(TAG, "debounceLightSensor: Synthesizing light sensor measurement "
+                            + "after " + (time - mLastObservedLuxTime) + " ms.");
+                }
+                applyLightSensorMeasurement(time, mLastObservedLux);
+            }
+            updateAmbientLux(time);
+        }
     }
 
     private void updateAutoBrightness(boolean sendUpdate) {
@@ -1124,16 +1205,14 @@
                 + TimeUtils.formatUptime(mLightSensorEnableTime));
         pw.println("  mAmbientLux=" + mAmbientLux);
         pw.println("  mAmbientLuxValid=" + mAmbientLuxValid);
-        pw.println("  mLastAmbientBrightenTime="
-                + TimeUtils.formatUptime(mLastAmbientBrightenTime));
-        pw.println("  mLastAmbientDimTime="
-                + TimeUtils.formatUptime(mLastAmbientDarkenTime));
         pw.println("  mLastObservedLux=" + mLastObservedLux);
         pw.println("  mLastObservedLuxTime="
                 + TimeUtils.formatUptime(mLastObservedLuxTime));
         pw.println("  mRecentLightSamples=" + mRecentLightSamples);
         pw.println("  mRecentShortTermAverageLux=" + mRecentShortTermAverageLux);
         pw.println("  mRecentLongTermAverageLux=" + mRecentLongTermAverageLux);
+        pw.println("  mDebounceLuxDirection=" + mDebounceLuxDirection);
+        pw.println("  mDebounceLuxTime=" + TimeUtils.formatUptime(mDebounceLuxTime));
         pw.println("  mScreenAutoBrightness=" + mScreenAutoBrightness);
         pw.println("  mUsingScreenAutoBrightness=" + mUsingScreenAutoBrightness);
         pw.println("  mLastScreenAutoBrightnessGamma=" + mLastScreenAutoBrightnessGamma);
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index fd76fc8d..040ff24 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -2940,6 +2940,7 @@
                     transitionTo(mTransitionToState);
                     break;
                 /* Defer wifi start/shut and driver commands */
+                case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT:
                 case CMD_LOAD_DRIVER:
                 case CMD_UNLOAD_DRIVER:
                 case CMD_START_SUPPLICANT:
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index f0aef92..03a0434 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -1079,7 +1079,21 @@
                        // remain at this state.
                    }
                    break;
-              default:
+                case WifiMonitor.P2P_GROUP_STARTED_EVENT:
+                   mGroup = (WifiP2pGroup) message.obj;
+                   if (DBG) logd(getName() + " group started");
+
+                    // We hit this scenario when a persistent group is reinvoked
+                   if (mGroup.getNetworkId() == WifiP2pGroup.PERSISTENT_NET_ID) {
+                       mAutonomousGroup = false;
+                       deferMessage(message);
+                       transitionTo(mGroupNegotiationState);
+                   } else {
+                       loge("Unexpected group creation, remove " + mGroup);
+                       mWifiNative.p2pGroupRemove(mGroup.getInterface());
+                   }
+                   break;
+                default:
                    return NOT_HANDLED;
             }
             return HANDLED;
@@ -2338,6 +2352,10 @@
         }
         NetworkUtils.resetConnections(mGroup.getInterface(), NetworkUtils.RESET_ALL_ADDRESSES);
 
+        // Clear any timeout that was set. This is essential for devices
+        // that reuse the main p2p interface for a created group.
+        mWifiNative.setP2pGroupIdle(mGroup.getInterface(), 0);
+
         mGroup = null;
         mWifiNative.p2pFlush();
         if (mPeers.remove(mPeersLostDuringConnection)) sendP2pPeersChangedBroadcast();
@@ -2349,7 +2367,7 @@
             mWifiChannel.sendMessage(WifiP2pService.DISCONNECT_WIFI_REQUEST, 0);
             mTempoarilyDisconnectedWifi = false;
         }
-    }
+   }
 
     //State machine initiated requests can have replyTo set to null indicating
     //there are no recipients, we ignore those reply actions