Merge "Only inform DisplayManager of visible content." into jb-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index 5406157..5205856 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -331,6 +331,7 @@
     field public static final int checkboxStyle = 16842860; // 0x101006c
     field public static final int checked = 16843014; // 0x1010106
     field public static final int checkedButton = 16843080; // 0x1010148
+    field public static final int checkedTextViewStyle = 16843720; // 0x10103c8
     field public static final int childDivider = 16843025; // 0x1010111
     field public static final int childIndicator = 16843020; // 0x101010c
     field public static final int childIndicatorLeft = 16843023; // 0x101010f
@@ -1789,6 +1790,7 @@
     field public static final int Widget_DeviceDefault_Button_Small = 16974146; // 0x1030142
     field public static final int Widget_DeviceDefault_Button_Toggle = 16974148; // 0x1030144
     field public static final int Widget_DeviceDefault_CalendarView = 16974190; // 0x103016e
+    field public static final int Widget_DeviceDefault_CheckedTextView = 16974299; // 0x10301db
     field public static final int Widget_DeviceDefault_CompoundButton_CheckBox = 16974152; // 0x1030148
     field public static final int Widget_DeviceDefault_CompoundButton_RadioButton = 16974169; // 0x1030159
     field public static final int Widget_DeviceDefault_CompoundButton_Star = 16974173; // 0x103015d
@@ -1822,6 +1824,7 @@
     field public static final int Widget_DeviceDefault_Light_Button_Small = 16974198; // 0x1030176
     field public static final int Widget_DeviceDefault_Light_Button_Toggle = 16974200; // 0x1030178
     field public static final int Widget_DeviceDefault_Light_CalendarView = 16974238; // 0x103019e
+    field public static final int Widget_DeviceDefault_Light_CheckedTextView = 16974300; // 0x10301dc
     field public static final int Widget_DeviceDefault_Light_CompoundButton_CheckBox = 16974204; // 0x103017c
     field public static final int Widget_DeviceDefault_Light_CompoundButton_RadioButton = 16974224; // 0x1030190
     field public static final int Widget_DeviceDefault_Light_CompoundButton_Star = 16974228; // 0x1030194
@@ -1907,6 +1910,7 @@
     field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c
     field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e
     field public static final int Widget_Holo_CalendarView = 16974060; // 0x10300ec
+    field public static final int Widget_Holo_CheckedTextView = 16974297; // 0x10301d9
     field public static final int Widget_Holo_CompoundButton_CheckBox = 16973969; // 0x1030091
     field public static final int Widget_Holo_CompoundButton_RadioButton = 16973986; // 0x10300a2
     field public static final int Widget_Holo_CompoundButton_Star = 16973990; // 0x10300a6
@@ -1940,6 +1944,7 @@
     field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7
     field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9
     field public static final int Widget_Holo_Light_CalendarView = 16974061; // 0x10300ed
+    field public static final int Widget_Holo_Light_CheckedTextView = 16974298; // 0x10301da
     field public static final int Widget_Holo_Light_CompoundButton_CheckBox = 16974012; // 0x10300bc
     field public static final int Widget_Holo_Light_CompoundButton_RadioButton = 16974032; // 0x10300d0
     field public static final int Widget_Holo_Light_CompoundButton_Star = 16974036; // 0x10300d4
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 396771f..a276225 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -271,11 +271,11 @@
     return 0;
 }
 
-int delete_cache(const char *pkgname)
+int delete_cache(const char *pkgname, uid_t persona)
 {
     char cachedir[PKG_PATH_MAX];
 
-    if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, 0))
+    if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, persona))
         return -1;
 
         /* delete contents, not the directory, no exceptions */
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index a099537..19298a3 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -72,7 +72,7 @@
 
 static int do_rm_cache(char **arg, char reply[REPLY_MAX])
 {
-    return delete_cache(arg[0]); /* pkgname */
+    return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */
 }
 
 static int do_get_size(char **arg, char reply[REPLY_MAX])
@@ -142,7 +142,7 @@
     { "rename",               2, do_rename },
     { "fixuid",               3, do_fixuid },
     { "freecache",            1, do_free_cache },
-    { "rmcache",              1, do_rm_cache },
+    { "rmcache",              2, do_rm_cache },
     { "getsize",              5, do_get_size },
     { "rmuserdata",           2, do_rm_user_data },
     { "movefiles",            0, do_movefiles },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index a229b970..2540dbe 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -199,7 +199,7 @@
 int make_user_data(const char *pkgname, uid_t uid, uid_t persona);
 int delete_persona(uid_t persona);
 int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy);
-int delete_cache(const char *pkgname);
+int delete_cache(const char *pkgname, uid_t persona);
 int move_dex(const char *src, const char *dst);
 int rm_dex(const char *path);
 int protect(char *pkgname, gid_t gid);
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 9d57467..d36d99d 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -395,6 +395,31 @@
     }
 
     /**
+     * @hide
+     * Note that UserHandle.CURRENT will be interpreted at the time the
+     * activity is started, not when the pending intent is created.
+     */
+    public static PendingIntent getActivitiesAsUser(Context context, int requestCode,
+            Intent[] intents, int flags, Bundle options, UserHandle user) {
+        String packageName = context.getPackageName();
+        String[] resolvedTypes = new String[intents.length];
+        for (int i=0; i<intents.length; i++) {
+            intents[i].setAllowFds(false);
+            resolvedTypes[i] = intents[i].resolveTypeIfNeeded(context.getContentResolver());
+        }
+        try {
+            IIntentSender target =
+                ActivityManagerNative.getDefault().getIntentSender(
+                    ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
+                    null, null, requestCode, intents, resolvedTypes,
+                    flags, options, user.getIdentifier());
+            return target != null ? new PendingIntent(target) : null;
+        } catch (RemoteException e) {
+        }
+        return null;
+    }
+
+    /**
      * Retrieve a PendingIntent that will perform a broadcast, like calling
      * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}.
      *
diff --git a/core/java/android/app/TaskStackBuilder.java b/core/java/android/app/TaskStackBuilder.java
index 9d5bcc6..3e0ac7e 100644
--- a/core/java/android/app/TaskStackBuilder.java
+++ b/core/java/android/app/TaskStackBuilder.java
@@ -274,6 +274,20 @@
     }
 
     /**
+     * @hide
+     */
+    public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options,
+            UserHandle user) {
+        if (mIntents.isEmpty()) {
+            throw new IllegalStateException(
+                    "No intents added to TaskStackBuilder; cannot getPendingIntent");
+        }
+
+        return PendingIntent.getActivitiesAsUser(mSourceContext, requestCode, getIntents(), flags,
+                options, user);
+    }
+
+    /**
      * Return an array containing the intents added to this builder. The intent at the
      * root of the task stack will appear as the first item in the array and the
      * intent at the top of the stack will appear as the last item.
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 8bfefd4..5345a6d 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -40,7 +40,6 @@
     void reboot(String reason);
     void crash(String message);
 
-    void clearUserActivityTimeout(long now, long timeout);
     void setPokeLock(int pokey, IBinder lock, String tag);
     void setStayOnSetting(int val);
     void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 8825f58..8f1210b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3078,30 +3078,6 @@
         public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
 
         /**
-         * Get the key that retrieves a bluetooth headset's priority.
-         * @hide
-         */
-        public static final String getBluetoothHeadsetPriorityKey(String address) {
-            return ("bluetooth_headset_priority_" + address.toUpperCase());
-        }
-
-        /**
-         * Get the key that retrieves a bluetooth a2dp sink's priority.
-         * @hide
-         */
-        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
-            return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
-        }
-
-        /**
-         * Get the key that retrieves a bluetooth Input Device's priority.
-         * @hide
-         */
-        public static final String getBluetoothInputDevicePriorityKey(String address) {
-            return ("bluetooth_input_device_priority_" + address.toUpperCase());
-        }
-
-        /**
          * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
          */
         @Deprecated
@@ -5160,6 +5136,40 @@
          */
         public static final String DEFAULT_DNS_SERVER = "default_dns_server";
 
+        /** {@hide} */
+        public static final String
+                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
+        /** {@hide} */
+        public static final String
+                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
+        /** {@hide} */
+        public static final String
+                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
+
+        /**
+         * Get the key that retrieves a bluetooth headset's priority.
+         * @hide
+         */
+        public static final String getBluetoothHeadsetPriorityKey(String address) {
+            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase();
+        }
+
+        /**
+         * Get the key that retrieves a bluetooth a2dp sink's priority.
+         * @hide
+         */
+        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
+            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase();
+        }
+
+        /**
+         * Get the key that retrieves a bluetooth Input Device's priority.
+         * @hide
+         */
+        public static final String getBluetoothInputDevicePriorityKey(String address) {
+            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase();
+        }
+
         // Populated lazily, guarded by class object:
         private static NameValueCache sNameValueCache = new NameValueCache(
                     SYS_PROP_SETTING_VERSION,
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index d6fd4ff..e74e37c 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -55,7 +55,7 @@
     }
 
     public CheckedTextView(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
+        this(context, attrs, R.attr.checkedTextViewStyle);
     }
 
     public CheckedTextView(Context context, AttributeSet attrs, int defStyle) {
diff --git a/core/res/res/layout-xlarge/select_dialog_holo.xml b/core/res/res/layout-xlarge/select_dialog_holo.xml
deleted file mode 100644
index f931cf2..0000000
--- a/core/res/res/layout-xlarge/select_dialog_holo.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<!--
-    This layout file is used by the AlertDialog when displaying a list of items.
-    This layout file is inflated and used as the ListView to display the items.
-    Assign an ID so its state will be saved/restored.
--->
-<view class="com.android.internal.app.AlertController$RecycleListView"
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+android:id/select_dialog_listview"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginTop="5dip"
-    android:paddingStart="16dip"
-    android:paddingEnd="16dip"
-    android:cacheColorHint="@null"
-    android:divider="?android:attr/listDividerAlertDialog"
-    android:scrollbars="vertical"
-    android:overScrollMode="ifContentScrolls" />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index ea89633..9ce7f8a 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -483,6 +483,8 @@
         <attr name="autoCompleteTextViewStyle" format="reference" />
         <!-- Default Checkbox style. -->
         <attr name="checkboxStyle" format="reference" />
+        <!-- Default CheckedTextView style. -->
+        <attr name="checkedTextViewStyle" format="reference" />
         <!-- Default ListView style for drop downs. -->
         <attr name="dropDownListViewStyle" format="reference" />
         <!-- Default EditText style. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 76fa2b0..ffc09de 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2018,10 +2018,10 @@
   <public type="attr" name="permissionGroupFlags" id="0x010103c5" />
   <public type="attr" name="labelFor" id="0x010103c6" />
   <public type="attr" name="permissionFlags" id="0x010103c7" />
-  
-
-<!-- ===============================================================
-     Resources added in next version of platform
-     =============================================================== -->
+  <public type="attr" name="checkedTextViewStyle" />
+  <public type="style" name="Widget.Holo.CheckedTextView" />
+  <public type="style" name="Widget.Holo.Light.CheckedTextView" />
+  <public type="style" name="Widget.DeviceDefault.CheckedTextView" />
+  <public type="style" name="Widget.DeviceDefault.Light.CheckedTextView" />
 
 </resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 74e2425..4371aec 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -464,7 +464,11 @@
         <item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item>
         <item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item>
     </style>
-    
+
+    <style name="Widget.CheckedTextView">
+        <item name="android:textAlignment">viewStart</item>
+    </style>
+
     <style name="Widget.TextView.ListSeparator">
         <item name="android:background">@android:drawable/dark_header_dither</item>
         <item name="android:layout_width">match_parent</item>
@@ -1589,6 +1593,9 @@
     <style name="Widget.Holo.TextView" parent="Widget.TextView">
     </style>
 
+    <style name="Widget.Holo.CheckedTextView" parent="Widget.CheckedTextView">
+    </style>
+
     <style name="Widget.Holo.TextView.ListSeparator" parent="Widget.TextView.ListSeparator">
         <item name="android:background">@android:drawable/list_section_divider_holo_dark</item>
         <item name="android:textAllCaps">true</item>
@@ -2017,6 +2024,9 @@
     <style name="Widget.Holo.Light.TextView" parent="Widget.TextView">
     </style>
 
+    <style name="Widget.Holo.Light.CheckedTextView" parent="Widget.CheckedTextView">
+    </style>
+
     <style name="Widget.Holo.Light.TextView.ListSeparator" parent="Widget.TextView.ListSeparator">
         <item name="android:background">@android:drawable/list_section_divider_holo_light</item>
         <item name="android:textAllCaps">true</item>
diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml
index d465356..edeba02 100644
--- a/core/res/res/values/styles_device_defaults.xml
+++ b/core/res/res/values/styles_device_defaults.xml
@@ -50,6 +50,9 @@
     <style name="Widget.DeviceDefault.TextView" parent="Widget.Holo.TextView" >
 
     </style>
+    <style name="Widget.DeviceDefault.CheckedTextView" parent="Widget.Holo.CheckedTextView" >
+
+    </style>
     <style name="Widget.DeviceDefault.AutoCompleteTextView" parent="Widget.Holo.AutoCompleteTextView" >
 
     </style>
@@ -288,6 +291,9 @@
     <style name="Widget.DeviceDefault.Light.TextView" parent="Widget.Holo.Light.TextView" >
 
     </style>
+    <style name="Widget.DeviceDefault.Light.CheckedTextView" parent="Widget.Holo.Light.CheckedTextView" >
+
+    </style>
     <style name="Widget.DeviceDefault.Light.AutoCompleteTextView" parent="Widget.Holo.Light.AutoCompleteTextView" >
 
     </style>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 215551b..75850dd 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -241,6 +241,7 @@
         <item name="absListViewStyle">@android:style/Widget.AbsListView</item>
         <item name="autoCompleteTextViewStyle">@android:style/Widget.AutoCompleteTextView</item>        
         <item name="checkboxStyle">@android:style/Widget.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@android:style/Widget.CheckedTextView</item>
         <item name="dropDownListViewStyle">@android:style/Widget.ListView.DropDown</item>
         <item name="editTextStyle">@android:style/Widget.EditText</item>
         <item name="expandableListViewStyle">@android:style/Widget.ExpandableListView</item>
@@ -648,6 +649,8 @@
         <item name="listPreferredItemPaddingRight">10dip</item>
         <item name="listPreferredItemPaddingStart">10dip</item>
         <item name="listPreferredItemPaddingEnd">10dip</item>
+
+        <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
     </style>
 
     <!-- Variant of {@link Theme_Dialog} that does not include a frame (or background).
@@ -874,12 +877,12 @@
          <p>This is the default system theme for apps that target API level 11 - 13. Starting
          with API level 14, the default system theme is supplied by {@link #Theme_DeviceDefault},
          which might apply a different style on different devices. If you want to ensure that your
-         app consistenly uses the Holo theme at all times, you must explicitly declare it in your
+         app consistently uses the Holo theme at all times, you must explicitly declare it in your
          manifest. For example, {@code &lt;application android:theme="@android:style/Theme.Holo"&gt;}.
          For more information, read <a
          href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">Holo
          Everywhere</a>.</p>
-         <p>The widgets in the holographic theme are translucent on their brackground, so
+         <p>The widgets in the holographic theme are translucent on their background, so
          applications must ensure that any background they use with this theme is itself
          dark; otherwise, it will be difficult to see the widgets. This UI style also includes a
          full action bar by default.</p>
@@ -1069,6 +1072,7 @@
         <item name="absListViewStyle">@android:style/Widget.Holo.AbsListView</item>
         <item name="autoCompleteTextViewStyle">@android:style/Widget.Holo.AutoCompleteTextView</item>
         <item name="checkboxStyle">@android:style/Widget.Holo.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@android:style/Widget.Holo.CheckedTextView</item>
         <item name="dropDownListViewStyle">@android:style/Widget.Holo.ListView.DropDown</item>
         <item name="editTextStyle">@android:style/Widget.Holo.EditText</item>
         <item name="expandableListViewStyle">@android:style/Widget.Holo.ExpandableListView</item>
@@ -1382,6 +1386,7 @@
         <item name="absListViewStyle">@android:style/Widget.Holo.Light.AbsListView</item>
         <item name="autoCompleteTextViewStyle">@android:style/Widget.Holo.Light.AutoCompleteTextView</item>
         <item name="checkboxStyle">@android:style/Widget.Holo.Light.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@android:style/Widget.Holo.Light.CheckedTextView</item>
         <item name="dropDownListViewStyle">@android:style/Widget.Holo.ListView.DropDown</item>
         <item name="editTextStyle">@android:style/Widget.Holo.Light.EditText</item>
         <item name="expandableListViewStyle">@android:style/Widget.Holo.Light.ExpandableListView</item>
@@ -1605,6 +1610,8 @@
         <item name="listPreferredItemPaddingRight">16dip</item>
         <item name="listPreferredItemPaddingStart">16dip</item>
         <item name="listPreferredItemPaddingEnd">16dip</item>
+
+        <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
     </style>
 
     <!-- Variant of Theme.Holo.Dialog that has a nice minimum width for
@@ -1719,6 +1726,8 @@
         <item name="listPreferredItemPaddingRight">16dip</item>
         <item name="listPreferredItemPaddingStart">16dip</item>
         <item name="listPreferredItemPaddingEnd">16dip</item>
+
+        <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
     </style>
 
     <!-- Variant of Theme.Holo.Light.Dialog that has a nice minimum width for
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 2a2b9e0..4178cc4 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -104,6 +104,7 @@
         <item name="absListViewStyle">@android:style/Widget.DeviceDefault.AbsListView</item>
         <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.AutoCompleteTextView</item>
         <item name="checkboxStyle">@android:style/Widget.DeviceDefault.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.CheckedTextView</item>
         <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.ListView.DropDown</item>
         <item name="editTextStyle">@android:style/Widget.DeviceDefault.EditText</item>
         <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.ExpandableListView</item>
@@ -261,7 +262,8 @@
         <item name="absListViewStyle">@android:style/Widget.DeviceDefault.Light.AbsListView</item>
         <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.Light.AutoCompleteTextView</item>
         <item name="checkboxStyle">@android:style/Widget.DeviceDefault.Light.CompoundButton.CheckBox</item>
-        <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.ListView.DropDown</item>
+        <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.Light.CheckedTextView</item>
+        <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.Light.ListView.DropDown</item>
         <item name="editTextStyle">@android:style/Widget.DeviceDefault.Light.EditText</item>
         <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView</item>
         <item name="expandableListViewWhiteStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView.White</item>
@@ -296,7 +298,7 @@
         <item name="webViewStyle">@android:style/Widget.DeviceDefault.Light.WebView</item>
         <item name="dropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem</item>
         <item name="spinnerDropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem.Spinner</item>
-        <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.TextView.SpinnerItem</item>
+        <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.Light.TextView.SpinnerItem</item>
         <item name="dropDownHintAppearance">@android:style/TextAppearance.DeviceDefault.Widget.DropDownHint</item>
         <item name="keyboardViewStyle">@android:style/Widget.DeviceDefault.KeyboardView</item>
         <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item>
diff --git a/docs/html/distribute/googleplay/promote/brand.jd b/docs/html/distribute/googleplay/promote/brand.jd
index 875794a..cb6bf48 100644
--- a/docs/html/distribute/googleplay/promote/brand.jd
+++ b/docs/html/distribute/googleplay/promote/brand.jd
@@ -95,7 +95,7 @@
 
 <p>When referring to the mobile experience, use "Google Play" unless the text is clearly
 instructional for the user. For example, a marketing headline might read "Download our
-games on Google Play&trade;," but instructional text woud read "Download our games using the Google
+games on Google Play&trade;," but instructional text would read "Download our games using the Google
 Play&trade; Store app."
 
  <p>Any use of the Google Play name or icon needs to include this
@@ -117,8 +117,9 @@
 
 <p>You may use the Google Play Store icon, but you may not modify it.</p>
 
-<p>When labeling or referring to the icon, the name can be either the full app
-name, Google Play Store, or the app display name, Play Store.</p>
+<p>As mentioned above, when referring to the Google Play Store app in copy, use the full name:
+"Google Play Store." However, when labelling the Google Play Store icon directly, it's OK to use
+"Play Store" without "Google" (which is how the icon is labelled on a device).</p>
 
         
 <h4>Google Play badge</h4>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index c8ce3cd..06c8e11 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -68,7 +68,7 @@
     // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
     // is properly propagated through your change.  Not doing so will result in a loss of user
     // settings.
-    private static final int DATABASE_VERSION = 89;
+    private static final int DATABASE_VERSION = 90;
 
     private Context mContext;
     private int mUserHandle;
@@ -1380,6 +1380,26 @@
             upgradeVersion = 89;
         }
 
+        if (upgradeVersion == 89) {
+            if (mUserHandle == UserHandle.USER_OWNER) {
+                db.beginTransaction();
+                try {
+                    String[] prefixesToMove = {
+                            Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX,
+                            Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX,
+                            Settings.Global.BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX,
+                    };
+
+                    movePrefixedSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, prefixesToMove);
+
+                    db.setTransactionSuccessful();
+                } finally {
+                    db.endTransaction();
+                }
+            }
+            upgradeVersion = 90;
+        }
+
         // *** Remember to update DATABASE_VERSION above!
 
         if (upgradeVersion != currentVersion) {
@@ -1446,6 +1466,44 @@
         }
     }
 
+    /**
+     * Move any settings with the given prefixes from the source table to the
+     * destination table.
+     */
+    private void movePrefixedSettingsToNewTable(
+            SQLiteDatabase db, String sourceTable, String destTable, String[] prefixesToMove) {
+        SQLiteStatement insertStmt = null;
+        SQLiteStatement deleteStmt = null;
+
+        db.beginTransaction();
+        try {
+            insertStmt = db.compileStatement("INSERT INTO " + destTable
+                    + " (name,value) SELECT name,value FROM " + sourceTable
+                    + " WHERE substr(name,0,?)=?");
+            deleteStmt = db.compileStatement(
+                    "DELETE FROM " + sourceTable + " WHERE substr(name,0,?)=?");
+
+            for (String prefix : prefixesToMove) {
+                insertStmt.bindLong(1, prefix.length() + 1);
+                insertStmt.bindString(2, prefix);
+                insertStmt.execute();
+
+                deleteStmt.bindLong(1, prefix.length() + 1);
+                deleteStmt.bindString(2, prefix);
+                deleteStmt.execute();
+            }
+            db.setTransactionSuccessful();
+        } finally {
+            db.endTransaction();
+            if (insertStmt != null) {
+                insertStmt.close();
+            }
+            if (deleteStmt != null) {
+                deleteStmt.close();
+            }
+        }
+    }
+
     private void upgradeLockPatternLocation(SQLiteDatabase db) {
         Cursor c = db.query(TABLE_SYSTEM, new String[] {"_id", "value"}, "name='lock_pattern'",
                 null, null, null, null);
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 0671e44..a98c4dc 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -261,6 +261,19 @@
             }
         }
 
+        @Override
+        public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
+            if (DEBUG) {
+                Log.d(TAG, "onSurfaceRedrawNeeded:");
+            }
+            super.onSurfaceRedrawNeeded(holder);
+
+            synchronized (mLock) {
+                mRedrawNeeded = true;
+                drawFrameLocked();
+            }
+        }
+
         void drawFrameLocked() {
             if (!mVisible) {
                 if (DEBUG) {
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 3fea0a0..12e749d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1376,12 +1376,34 @@
 
     private void setStatusBarLowProfile(boolean lightsOut) {
         if (mLightsOutAnimation == null) {
-            mLightsOutAnimation = ObjectAnimator.ofFloat(mStatusBarContents, View.ALPHA, 0);
-            mLightsOutAnimation.setDuration(750);
+            final View notifications = mStatusBarView.findViewById(R.id.notification_icon_area);
+            final View systemIcons = mStatusBarView.findViewById(R.id.statusIcons);
+            final View signal = mStatusBarView.findViewById(R.id.signal_cluster);
+            final View battery = mStatusBarView.findViewById(R.id.battery);
+            final View clock = mStatusBarView.findViewById(R.id.clock);
 
-            mLightsOnAnimation = new AnimatorSet();
-            mLightsOnAnimation = ObjectAnimator.ofFloat(mStatusBarContents, View.ALPHA, 1);
-            mLightsOnAnimation.setDuration(250);
+            final AnimatorSet lightsOutAnim = new AnimatorSet();
+            lightsOutAnim.playTogether(
+                    ObjectAnimator.ofFloat(notifications, View.ALPHA, 0),
+                    ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 0),
+                    ObjectAnimator.ofFloat(signal, View.ALPHA, 0),
+                    ObjectAnimator.ofFloat(battery, View.ALPHA, 0.5f),
+                    ObjectAnimator.ofFloat(clock, View.ALPHA, 0.5f)
+                );
+            lightsOutAnim.setDuration(750);
+
+            final AnimatorSet lightsOnAnim = new AnimatorSet();
+            lightsOnAnim.playTogether(
+                    ObjectAnimator.ofFloat(notifications, View.ALPHA, 1),
+                    ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 1),
+                    ObjectAnimator.ofFloat(signal, View.ALPHA, 1),
+                    ObjectAnimator.ofFloat(battery, View.ALPHA, 1),
+                    ObjectAnimator.ofFloat(clock, View.ALPHA, 1)
+                );
+            lightsOnAnim.setDuration(250);
+
+            mLightsOutAnimation = lightsOutAnim;
+            mLightsOnAnimation = lightsOnAnim;
         }
 
         mLightsOutAnimation.cancel();
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index adb63f9..98794c9 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -21,6 +21,7 @@
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
+import android.app.TaskStackBuilder;
 import android.bluetooth.BluetoothAdapter;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
@@ -1766,9 +1767,10 @@
                 mNotification.when = 0;
                 mNotification.icon = ICON_NETWORKS_AVAILABLE;
                 mNotification.flags = Notification.FLAG_AUTO_CANCEL;
-                mNotification.contentIntent = PendingIntent.getActivityAsUser(mContext, 0,
-                        new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK), 0,
-                        null, UserHandle.CURRENT);
+                mNotification.contentIntent = TaskStackBuilder.create(mContext)
+                        .addNextIntentWithParentStack(
+                                new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK))
+                        .getPendingIntent(0, 0, null, UserHandle.CURRENT);
             }
 
             CharSequence title = mContext.getResources().getQuantityText(
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3428326..35f1b59 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -11745,7 +11745,7 @@
             users = mStartedUserArray;
         } else {
             // Caller wants broadcast to go to one specific user.
-            users = mCurrentUserArray;
+            users = new int[] {userId};
         }
 
         // Figure out who all will receive this broadcast.
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index ad85c0d..8b1e80f 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -254,10 +254,12 @@
         return execute(builder.toString());
     }
 
-    public int deleteCacheFiles(String name) {
+    public int deleteCacheFiles(String name, int userId) {
         StringBuilder builder = new StringBuilder("rmcache");
         builder.append(' ');
         builder.append(name);
+        builder.append(' ');
+        builder.append(userId);
         return execute(builder.toString());
     }
 
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index f096089..75bc265 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -8540,11 +8540,10 @@
             Slog.w(TAG, "Package " + packageName + " has no applicationInfo.");
             return false;
         }
-        // TODO: Pass userId to deleteCacheFiles
-        int retCode = mInstaller.deleteCacheFiles(packageName);
+        int retCode = mInstaller.deleteCacheFiles(packageName, userId);
         if (retCode < 0) {
             Slog.w(TAG, "Couldn't remove cache files for package: "
-                       + packageName);
+                       + packageName + " u" + userId);
             return false;
         }
         return true;
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index c2d47e5..b35fa11 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -1574,12 +1574,6 @@
     }
 
     @Override // Binder call
-    public void clearUserActivityTimeout(long now, long timeout) {
-        // TODO Auto-generated method stub
-        // Only used by phone app, delete this
-    }
-
-    @Override // Binder call
     public void setPokeLock(int pokey, IBinder lock, String tag) {
         // TODO Auto-generated method stub
         // Only used by phone app, delete this
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java
index cd54c2e..8618cc8 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java
@@ -45,19 +45,40 @@
         mScript.set_gNoiseStrength(s);
     }
 
+    private int findHighBit(int v) {
+        int bit = 0;
+        while (v > 1) {
+            bit++;
+            v >>= 1;
+        }
+        return bit;
+    }
+
+
     public void createTest(android.content.res.Resources res) {
         int width = mInPixelsAllocation.getType().getX();
         int height = mInPixelsAllocation.getType().getY();
 
+        int noiseW = findHighBit(width);
+        int noiseH = findHighBit(height);
+        if (noiseW > 9) {
+            noiseW = 9;
+        }
+        if (noiseH > 9) {
+            noiseH = 9;
+        }
+        noiseW = 1 << noiseW;
+        noiseH = 1 << noiseH;
+
         Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(width);
-        tb.setY(height);
+        tb.setX(noiseW);
+        tb.setY(noiseH);
         mNoise = Allocation.createTyped(mRS, tb.create());
         mNoise2 = Allocation.createTyped(mRS, tb.create());
 
         mScript = new ScriptC_grain(mRS, res, R.raw.grain);
-        mScript.set_gWidth(width);
-        mScript.set_gHeight(height);
+        mScript.set_gWMask(noiseW - 1);
+        mScript.set_gHMask(noiseH - 1);
         mScript.set_gNoiseStrength(0.5f);
         mScript.set_gBlendSource(mNoise);
         mScript.set_gNoise(mNoise2);
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
index ea42524..c8531f3 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
@@ -38,15 +38,15 @@
  *  1  2  1
  */
 
-int32_t gWidth;
-int32_t gHeight;
+int32_t gWMask;
+int32_t gHMask;
 
 rs_allocation gBlendSource;
 void blend9(uchar *out, uint32_t x, uint32_t y) {
-    uint32_t x1 = min((int32_t)x+1, (int32_t)(gWidth -1));
-    uint32_t x2 = max((int32_t)x-1, (int32_t)0);
-    uint32_t y1 = min((int32_t)y+1, (int32_t)(gHeight -1));
-    uint32_t y2 = max((int32_t)y-1, (int32_t)0);
+    uint32_t x1 = (x-1) & gWMask;
+    uint32_t x2 = (x+1) & gWMask;
+    uint32_t y1 = (y-1) & gHMask;
+    uint32_t y2 = (y+1) & gHMask;
 
     uint p00 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y1);
     uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1);
@@ -78,7 +78,7 @@
 rs_allocation gNoise;
 void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
     float4 ip = convert_float4(*in);
-    float pnoise = (float) rsGetElementAt_uchar(gNoise, x, y);
+    float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask);
 
     float energy_level = ip.r + ip.g + ip.b;
     float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f;
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java
index f21331f..89eec2c 100644
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java
+++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java
@@ -305,8 +305,7 @@
 
             long t1 = java.lang.System.currentTimeMillis();
 
-            mFilterYuv.execute(data);
-            mFilterYuv.copyOut(mCallbackBitmap);
+            mFilterYuv.execute(data, mCallbackBitmap);
 
             long t2 = java.lang.System.currentTimeMillis();
             mTiming[mTimingSlot++] = t2 - t1;
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
index cced198..978ae12 100644
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
+++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
@@ -42,6 +42,7 @@
     private Allocation mAllocationOut;
     private Allocation mAllocationIn;
     private ScriptC_yuv mScript;
+    private ScriptIntrinsicYuvToRGB mYuv;
 
     RsYuv(RenderScript rs, Resources res, int width, int height) {
         mHeight = height;
@@ -50,6 +51,8 @@
         mScript = new ScriptC_yuv(mRS, res, R.raw.yuv);
         mScript.invoke_setSize(mWidth, mHeight);
 
+        mYuv = ScriptIntrinsicYuvToRGB.create(rs, Element.RGBA_8888(mRS));
+
         Type.Builder tb = new Type.Builder(mRS, Element.RGBA_8888(mRS));
         tb.setX(mWidth);
         tb.setY(mHeight);
@@ -58,34 +61,16 @@
         mAllocationIn = Allocation.createSized(rs, Element.U8(mRS), (mHeight * mWidth) +
                                                ((mHeight / 2) * (mWidth / 2) * 2));
 
-        mScript.bind_gYuvIn(mAllocationIn);
+        mYuv.setInput(mAllocationIn);
     }
 
     private long mTiming[] = new long[50];
     private int mTimingSlot = 0;
 
-    void execute(byte[] yuv) {
+    void execute(byte[] yuv, Bitmap b) {
         mAllocationIn.copyFrom(yuv);
-        mRS.finish();
-
-        long t1 = java.lang.System.currentTimeMillis();
-        mScript.forEach_root(mAllocationOut);
-        mRS.finish();
-        long t2 = java.lang.System.currentTimeMillis();
-
-        mTiming[mTimingSlot++] = t2 - t1;
-        if (mTimingSlot >= mTiming.length) {
-            float total = 0;
-            for (int i=0; i<mTiming.length; i++) {
-                total += (float)mTiming[i];
-            }
-            total /= mTiming.length;
-            Log.e("yuv", "core time = " + total);
-            mTimingSlot = 0;
-        }
-    }
-
-    void copyOut(Bitmap b) {
+        mYuv.forEach(mAllocationOut);
+        mScript.forEach_root(mAllocationOut, mAllocationOut);
         mAllocationOut.copyTo(b);
     }
 
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs
index 6057eff..884812d 100644
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs
+++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs
@@ -3,8 +3,6 @@
 #pragma rs java_package_name(com.android.rs.livepreview)
 #pragma rs_fp_relaxed
 
-uchar *gYuvIn;
-
 static int gWidth;
 static int gHeight;
 static uchar crossProcess_tableR[256];
@@ -80,13 +78,9 @@
     return convert_uchar4(c);
 }
 
-void root(uchar4 *out, uint32_t x, uint32_t y) {
-    uchar Y = gYuvIn[(y * gWidth) + x];
-    uchar *uv = &gYuvIn[gWidth * gHeight];
-    uv += (((x>>1)<<1) + (y>>1) * gWidth);
-
-    uchar4 p = rsYuvToRGBA_uchar4(Y, uv[1], uv[0]);
-    p = crossProcess_i(p);
+void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
+    uchar4 p;
+    p = crossProcess_i(*in);
     p = vignette(p, x, y);
 
     out->rgba = p;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
index e882440..6175b0d 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -45,11 +45,6 @@
     }
 
     @Override
-    public void clearUserActivityTimeout(long arg0, long arg1) throws RemoteException {
-        // pass for now.
-    }
-
-    @Override
     public void crash(String arg0) throws RemoteException {
         // pass for now.
     }