Merge "TIF: fix parental control data inconsistency" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index dbc1dcc..4ab730d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -25886,8 +25886,10 @@
     field public static final java.lang.String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
     field public static final java.lang.String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS";
     field public static final java.lang.String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS";
+    field public static final java.lang.String ACTION_USAGE_ACCESS_SETTINGS = "android.settings.USAGE_ACCESS_SETTINGS";
     field public static final java.lang.String ACTION_USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS";
     field public static final java.lang.String ACTION_VOICE_CONTROL_AIRPLANE_MODE = "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
+    field public static final java.lang.String ACTION_VOICE_INPUT_SETTINGS = "android.settings.VOICE_INPUT_SETTINGS";
     field public static final java.lang.String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS";
     field public static final java.lang.String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS";
     field public static final java.lang.String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS";
@@ -32622,6 +32624,7 @@
     method public void setTo(android.util.DisplayMetrics);
     method public void setToDefaults();
     field public static final int DENSITY_400 = 400; // 0x190
+    field public static final int DENSITY_560 = 560; // 0x230
     field public static final int DENSITY_DEFAULT = 160; // 0xa0
     field public static final int DENSITY_HIGH = 240; // 0xf0
     field public static final int DENSITY_LOW = 120; // 0x78
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 90b8b86..d8a219f 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -2574,9 +2574,21 @@
         }
 
         private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) {
+            final boolean largeFontScale
+                    = mContext.getResources().getConfiguration().fontScale >= 1.25f;
+
             Bitmap profileIcon = getProfileBadge();
             RemoteViews contentView = new BuilderRemoteViews(mContext.getPackageName(),
                     mOriginatingUserId, resId);
+
+            if (largeFontScale) {
+                // Make a little extra room for the bigger text.
+                final int margin = (int) mContext.getResources()
+                        .getDimensionPixelSize(R.dimen.notification_large_font_vert_pad);
+                contentView.setViewPadding(R.id.line1, 0, margin, 0, 0);
+                contentView.setViewPadding(R.id.line3, 0, 0, 0, margin);
+            }
+
             boolean showLine3 = false;
             boolean showLine2 = false;
 
@@ -3218,7 +3230,7 @@
         }
 
         private int getBigTextLayoutResource() {
-            return R.layout.notification_template_material_big_text;
+            return getBigBaseLayoutResource();
         }
 
         private int getInboxLayoutResource() {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 55ba9e9..9a41e20 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -170,6 +170,20 @@
             "android.settings.ACCESSIBILITY_SETTINGS";
 
     /**
+     * Activity Action: Show settings to control access to usage information.
+     * <p>
+     * In some cases, a matching Activity may not exist, so ensure you
+     * safeguard against this.
+     * <p>
+     * Input: Nothing.
+     * <p>
+     * Output: Nothing.
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_USAGE_ACCESS_SETTINGS =
+            "android.settings.USAGE_ACCESS_SETTINGS";
+
+    /**
      * Activity Action: Show settings to allow configuration of security and
      * location privacy.
      * <p>
@@ -372,6 +386,21 @@
      * Output: Nothing.
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_VOICE_INPUT_SETTINGS =
+            "android.settings.VOICE_INPUT_SETTINGS";
+
+    /**
+     * Activity Action: Show settings to configure input methods, in particular
+     * allowing the user to enable input methods.
+     * <p>
+     * In some cases, a matching Activity may not exist, so ensure you
+     * safeguard against this.
+     * <p>
+     * Input: Nothing.
+     * <p>
+     * Output: Nothing.
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_INPUT_METHOD_SETTINGS =
             "android.settings.INPUT_METHOD_SETTINGS";
 
@@ -6343,7 +6372,7 @@
 
         /**
          * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
-         * the caller is done with this, they should call {@link ContentResolver#delete(Uri)} to
+         * the caller is done with this, they should call {@link ContentResolver#delete} to
          * clean up any value that they may have written.
          *
          * @hide
diff --git a/core/java/android/service/voice/VoiceInteractionServiceInfo.java b/core/java/android/service/voice/VoiceInteractionServiceInfo.java
index bacda04..0d2f863 100644
--- a/core/java/android/service/voice/VoiceInteractionServiceInfo.java
+++ b/core/java/android/service/voice/VoiceInteractionServiceInfo.java
@@ -99,6 +99,10 @@
                 mParseError = "No sessionService specified";
                 return;
             }
+            if (mRecognitionService == null) {
+                mParseError = "No recogitionService specified";
+                return;
+            }
         } catch (XmlPullParserException e) {
             mParseError = "Error parsing voice interation service meta-data: " + e;
             Log.w(TAG, "error parsing voice interaction service meta-data", e);
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index 9a0b7fc..3bdd58a 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -410,7 +410,7 @@
 
     /**
      * Add a new value to the array map.
-     * @param key The key under which to store the value.  <b>Must not be null.</b>  If
+     * @param key The key under which to store the value.  If
      * this key already exists in the array, its value will be replaced.
      * @param value The value to store for the given key.
      * @return Returns the old value that was stored for the given key, or null if there
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java
index 3f10b92..946a3f7 100644
--- a/core/java/android/util/DisplayMetrics.java
+++ b/core/java/android/util/DisplayMetrics.java
@@ -68,7 +68,7 @@
 
     /**
      * Intermediate density for screens that sit somewhere between
-     * {@link #DENSITY_XHIGH} (320dpi) and {@link #DENSITY_XXHIGH} (480 dpi).
+     * {@link #DENSITY_XHIGH} (320 dpi) and {@link #DENSITY_XXHIGH} (480 dpi).
      * This is not a density that applications should target, instead relying
      * on the system to scale their {@link #DENSITY_XXHIGH} assets for them.
      */
@@ -80,6 +80,14 @@
     public static final int DENSITY_XXHIGH = 480;
 
     /**
+     * Intermediate density for screens that sit somewhere between
+     * {@link #DENSITY_XXHIGH} (480 dpi) and {@link #DENSITY_XXXHIGH} (560 dpi).
+     * This is not a density that applications should target, instead relying
+     * on the system to scale their {@link #DENSITY_XXXHIGH} assets for them.
+     */
+    public static final int DENSITY_560 = 560;
+
+    /**
      * Standard quantized DPI for extra-extra-extra-high-density screens.  Applications
      * should not generally worry about this density; relying on XHIGH graphics
      * being scaled up to it should be sufficient for almost all cases.  A typical
diff --git a/core/java/android/view/accessibility/AccessibilityCache.java b/core/java/android/view/accessibility/AccessibilityCache.java
index 4f34231..ca6437a 100644
--- a/core/java/android/view/accessibility/AccessibilityCache.java
+++ b/core/java/android/view/accessibility/AccessibilityCache.java
@@ -36,7 +36,7 @@
 
     private static final boolean DEBUG = false;
 
-    private static final boolean CHECK_INTEGRITY = Build.IS_DEBUGGABLE;
+    private static final boolean CHECK_INTEGRITY = "eng".equals(Build.TYPE);
 
     private final Object mLock = new Object();
 
diff --git a/core/res/res/layout/notification_material_action.xml b/core/res/res/layout/notification_material_action.xml
index 7ccaad5..8f8c4fb 100644
--- a/core/res/res/layout/notification_material_action.xml
+++ b/core/res/res/layout/notification_material_action.xml
@@ -21,11 +21,12 @@
     android:layout_width="0dp"
     android:layout_height="48dp"
     android:layout_weight="1"
+    android:layout_margin="0dp"
     android:gravity="start|center_vertical"
     android:drawablePadding="8dp"
     android:paddingStart="8dp"
     android:textColor="#555555"
-    android:textSize="14dp"
+    android:textSize="@dimen/notification_text_size"
     android:singleLine="true"
     android:ellipsize="end"
     />
diff --git a/core/res/res/layout/notification_material_action_tombstone.xml b/core/res/res/layout/notification_material_action_tombstone.xml
index 8bf456e..976448b 100644
--- a/core/res/res/layout/notification_material_action_tombstone.xml
+++ b/core/res/res/layout/notification_material_action_tombstone.xml
@@ -25,7 +25,7 @@
     android:drawablePadding="8dp"
     android:paddingStart="8dp"
     android:textColor="#555555"
-    android:textSize="14dp"
+    android:textSize="@dimen/notification_text_size"
     android:singleLine="true"
     android:ellipsize="end"
     android:alpha="0.5"
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml
index ab13b98..5e51db9 100644
--- a/core/res/res/layout/notification_template_material_base.xml
+++ b/core/res/res/layout/notification_template_material_base.xml
@@ -29,106 +29,27 @@
         />
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-
-        android:layout_gravity="fill_vertical"
+        android:layout_height="match_parent"
+        android:layout_gravity="top"
+        android:layout_marginEnd="8dp"
         android:layout_marginStart="@dimen/notification_large_icon_width"
         android:minHeight="@dimen/notification_large_icon_height"
         android:orientation="vertical"
-        android:paddingEnd="8dp"
-        android:paddingTop="2dp"
-        android:paddingBottom="2dp"
-        android:gravity="top"
         >
-        <LinearLayout
-            android:id="@+id/line1"
+        <include layout="@layout/notification_template_part_line1"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:paddingTop="6dp"
-            android:layout_marginStart="8dp"
-            android:orientation="horizontal"
-            >
-            <TextView android:id="@+id/title"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:fadingEdge="horizontal"
-                android:layout_weight="1"
-                />
-            <ViewStub android:id="@+id/time"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="0"
-                android:visibility="gone"
-                android:layout="@layout/notification_template_part_time"
-                />
-            <ViewStub android:id="@+id/chronometer"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="0"
-                android:visibility="gone"
-                android:layout="@layout/notification_template_part_chronometer"
-                />
-        </LinearLayout>
-        <TextView android:id="@+id/text2"
-            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="-2dp"
-            android:layout_marginBottom="-2dp"
-            android:layout_marginStart="8dp"
-            android:singleLine="true"
-            android:fadingEdge="horizontal"
-            android:ellipsize="marquee"
-            android:visibility="gone"
+            android:layout_weight="1"
             />
-        <ProgressBar
-            android:id="@android:id/progress"
-            android:layout_width="match_parent"
-            android:layout_height="12dp"
-            android:layout_marginStart="8dp"
-            android:visibility="gone"
-            style="@style/Widget.StatusBar.Material.ProgressBar"
-            />
-        <LinearLayout
-            android:id="@+id/line3"
+        <include layout="@layout/notification_template_part_line2"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:gravity="center_vertical"
-            android:layout_marginStart="8dp"
-            >
-            <TextView android:id="@+id/text"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_gravity="center"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:fadingEdge="horizontal"
-                />
-            <TextView android:id="@+id/info"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Info"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:singleLine="true"
-                android:gravity="center"
-                android:paddingStart="8dp"
-                />
-            <ImageView android:id="@+id/profile_icon"
-                android:layout_width="24dp"
-                android:layout_height="24dp"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:layout_marginStart="8dp"
-                android:scaleType="centerInside"
-                android:visibility="gone"
-                />
-        </LinearLayout>
+            android:layout_weight="1"
+            />
+        <include layout="@layout/notification_template_part_line3"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml
index 0564a8f..2243a09 100644
--- a/core/res/res/layout/notification_template_material_big_base.xml
+++ b/core/res/res/layout/notification_template_material_big_base.xml
@@ -30,124 +30,24 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="fill_vertical"
+        android:layout_gravity="top"
+        android:layout_marginEnd="8dp"
+        android:layout_marginStart="@dimen/notification_large_icon_width"
         android:minHeight="@dimen/notification_large_icon_height"
         android:orientation="vertical"
-        android:gravity="top"
         >
-        <LinearLayout
+        <include layout="@layout/notification_template_part_line1" />
+        <include layout="@layout/notification_template_part_line2" />
+        <TextView android:id="@+id/big_text"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/notification_large_icon_width"
             android:minHeight="@dimen/notification_large_icon_height"
-            android:paddingTop="2dp"
-            android:orientation="vertical"
-            >
-            <LinearLayout
-                android:id="@+id/line1"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="6dp"
-                android:layout_marginEnd="8dp"
-                android:layout_marginStart="8dp"
-                android:orientation="horizontal"
-                >
-                <TextView android:id="@+id/title"
-                    android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:singleLine="true"
-                    android:ellipsize="marquee"
-                    android:fadingEdge="horizontal"
-                    android:layout_weight="1"
-                    />
-                <ViewStub android:id="@+id/time"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_time"
-                    />
-                <ViewStub android:id="@+id/chronometer"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_chronometer"
-                    />
-            </LinearLayout>
-            <TextView android:id="@+id/text2"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="-2dp"
-                android:layout_marginBottom="-2dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:fadingEdge="horizontal"
-                android:ellipsize="marquee"
-                android:visibility="gone"
-                />
-            <TextView android:id="@+id/big_text"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="false"
-                android:visibility="gone"
-                />
-            <LinearLayout
-                android:id="@+id/line3"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:orientation="horizontal"
-                android:gravity="center_vertical"
-                >
-                <TextView android:id="@+id/text"
-                    android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:layout_gravity="center"
-                    android:singleLine="true"
-                    android:ellipsize="marquee"
-                    android:fadingEdge="horizontal"
-                    />
-                <TextView android:id="@+id/info"
-                    android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Info"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center"
-                    android:layout_weight="0"
-                    android:singleLine="true"
-                    android:gravity="center"
-                    android:paddingStart="8dp"
-                    />
-                <ImageView android:id="@+id/profile_icon"
-                    android:layout_width="24dp"
-                    android:layout_height="24dp"
-                    android:layout_gravity="center"
-                    android:layout_weight="0"
-                    android:layout_marginStart="8dp"
-                    android:scaleType="centerInside"
-                    android:visibility="gone"
-                    />
-            </LinearLayout>
-            <ProgressBar
-                android:id="@android:id/progress"
-                android:layout_width="match_parent"
-                android:layout_height="12dp"
-                android:layout_marginBottom="8dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:visibility="gone"
-                style="@style/Widget.StatusBar.Material.ProgressBar"
-                />
-        </LinearLayout>
+            android:layout_weight="1"
+            android:singleLine="false"
+            android:visibility="gone"
+            />
+        <include layout="@layout/notification_template_part_line3" />
         <ImageView
             android:layout_width="match_parent"
             android:layout_height="1dp"
@@ -156,9 +56,10 @@
             android:background="@drawable/list_divider_holo_light" />
         <include
             layout="@layout/notification_material_action_list"
+            android:layout_marginLeft="-8dp"
+            android:layout_marginRight="-8dp"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/notification_large_icon_width"
             />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_big_picture.xml b/core/res/res/layout/notification_template_material_big_picture.xml
index 74819fd..302e651 100644
--- a/core/res/res/layout/notification_template_material_big_picture.xml
+++ b/core/res/res/layout/notification_template_material_big_picture.xml
@@ -40,13 +40,13 @@
         />
     <include layout="@layout/notification_template_material_base"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="64dp"
         />
   <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="208dp"
-        android:paddingStart="64dp"
+        android:paddingStart="@dimen/notification_large_icon_width"
         android:layout_gravity="bottom"
         android:background="#CCEEEEEE"
         >
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
deleted file mode 100644
index 1de5add..0000000
--- a/core/res/res/layout/notification_template_material_big_text.xml
+++ /dev/null
@@ -1,179 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2014 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
-  -->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:internal="http://schemas.android.com/apk/prv/res/android"
-    android:id="@+id/status_bar_latest_event_content"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    internal:layout_minHeight="65dp"
-    internal:layout_maxHeight="unbounded"
-    >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        />
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="fill_vertical"
-        android:layout_marginStart="@dimen/notification_large_icon_width"
-        android:orientation="vertical"
-        android:paddingTop="0dp"
-        android:paddingBottom="2dp"
-        android:gravity="top"
-        >
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:minHeight="@dimen/notification_large_icon_height"
-            android:orientation="vertical"
-            android:layout_marginStart="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_weight="1"
-            >
-            <LinearLayout
-                android:id="@+id/line1"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="8dp"
-                android:orientation="horizontal"
-                android:layout_gravity="top"
-                android:layout_weight="0"
-                >
-                <TextView android:id="@+id/title"
-                    android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:singleLine="true"
-                    android:ellipsize="marquee"
-                    android:fadingEdge="horizontal"
-                    android:layout_weight="1"
-                    />
-                <ViewStub android:id="@+id/time"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_time"
-                    />
-                <ViewStub android:id="@+id/chronometer"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_chronometer"
-                    />
-            </LinearLayout>
-            <TextView android:id="@+id/text2"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="-2dp"
-                android:layout_marginBottom="-2dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:fadingEdge="horizontal"
-                android:ellipsize="marquee"
-                android:layout_weight="0"
-                android:visibility="gone"
-                />
-            <ProgressBar
-                android:id="@android:id/progress"
-                android:layout_width="match_parent"
-                android:layout_height="12dp"
-                android:layout_marginBottom="8dp"
-                android:layout_marginEnd="8dp"
-                android:visibility="gone"
-                android:layout_weight="0"
-                style="@style/Widget.StatusBar.Material.ProgressBar"
-                />
-            <TextView android:id="@+id/big_text"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginBottom="10dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="false"
-                android:visibility="gone"
-                android:maxLines="8"
-                android:ellipsize="end"
-                android:layout_weight="1"
-                />
-        </LinearLayout>
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:id="@+id/action_divider"
-            android:visibility="gone"
-            android:background="@drawable/list_divider_holo_light" />
-        <include
-            layout="@layout/notification_material_action_list"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:visibility="gone"
-            android:layout_weight="1"
-            />
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dp"
-            android:id="@+id/overflow_divider"
-            android:layout_marginBottom="8dp"
-            android:visibility="visible"
-            android:background="@drawable/list_divider_holo_light" />
-        <LinearLayout
-            android:id="@+id/line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="8dp"
-            android:layout_marginBottom="8dp"
-            android:layout_marginEnd="8dp"
-            android:orientation="horizontal"
-            android:layout_weight="0"
-            android:gravity="center_vertical"
-            >
-            <TextView android:id="@+id/text"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_gravity="center"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:fadingEdge="horizontal"
-                />
-            <TextView android:id="@+id/info"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Info"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:singleLine="true"
-                android:gravity="center"
-                android:paddingStart="8dp"
-                />
-            <ImageView android:id="@+id/profile_icon"
-                android:layout_width="24dp"
-                android:layout_height="24dp"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:layout_marginStart="8dp"
-                android:scaleType="centerInside"
-                android:visibility="gone"
-                />
-        </LinearLayout>
-    </LinearLayout>
-</FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml
index 8411ff5..6133791 100644
--- a/core/res/res/layout/notification_template_material_inbox.xml
+++ b/core/res/res/layout/notification_template_material_inbox.xml
@@ -30,175 +30,93 @@
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="fill_vertical"
+        android:layout_gravity="top"
         android:layout_marginStart="@dimen/notification_large_icon_width"
         android:minHeight="@dimen/notification_large_icon_height"
         android:orientation="vertical"
-        android:paddingTop="0dp"
-        android:paddingBottom="2dp"
-        android:gravity="top"
         >
-        <LinearLayout
+        <include layout="@layout/notification_template_part_line1" />
+        <include layout="@layout/notification_template_part_line2" />
+        <TextView android:id="@+id/inbox_text0"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:minHeight="@dimen/notification_large_icon_height"
-            android:paddingTop="2dp"
-            android:orientation="vertical"
-            >
-            <LinearLayout
-                android:id="@+id/line1"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:paddingTop="6dp"
-                android:orientation="horizontal"
-                android:layout_weight="0"
-                >
-                <TextView android:id="@+id/title"
-                    android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:singleLine="true"
-                    android:ellipsize="marquee"
-                    android:fadingEdge="horizontal"
-                    android:layout_weight="1"
-                    />
-                <ViewStub android:id="@+id/time"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_time"
-                    />
-                <ViewStub android:id="@+id/chronometer"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:visibility="gone"
-                    android:layout="@layout/notification_template_part_chronometer"
-                    />
-            </LinearLayout>
-            <TextView android:id="@+id/text2"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="-2dp"
-                android:layout_marginBottom="-2dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:fadingEdge="horizontal"
-                android:ellipsize="marquee"
-                android:visibility="gone"
-                android:layout_weight="0"
-                />
-            <ProgressBar
-                android:id="@android:id/progress"
-                android:layout_width="match_parent"
-                android:layout_height="12dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:visibility="gone"
-                android:layout_weight="0"
-                style="@style/Widget.Material.Light.ProgressBar.Horizontal"
-                />
-            <TextView android:id="@+id/inbox_text0"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text1"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text2"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text3"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text4"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text5"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_text6"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                />
-            <TextView android:id="@+id/inbox_more"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_marginStart="8dp"
-                android:layout_marginEnd="8dp"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:visibility="gone"
-                android:layout_weight="1"
-                android:text="@android:string/ellipsis"
-                />
-            <FrameLayout
-                android:id="@+id/inbox_end_pad"
-                android:layout_width="match_parent"
-                android:layout_height="8dip"
-                android:visibility="gone"
-                android:layout_weight="0"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
             />
-        </LinearLayout>
+        <TextView android:id="@+id/inbox_text1"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_text2"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_text3"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_text4"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_text5"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_text6"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            />
+        <TextView android:id="@+id/inbox_more"
+            android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:visibility="gone"
+            android:layout_weight="1"
+            android:text="@android:string/ellipsis"
+            />
+        <FrameLayout
+            android:id="@+id/inbox_end_pad"
+            android:layout_width="match_parent"
+            android:layout_height="8dip"
+            android:visibility="gone"
+            android:layout_weight="0"
+        />
         <ImageView
             android:layout_width="match_parent"
             android:layout_height="1dip"
@@ -209,6 +127,8 @@
             layout="@layout/notification_material_action_list"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_marginLeft="-8dp"
+            android:layout_marginRight="-8dp"
             android:layout_weight="0"
             />
         <ImageView
@@ -217,47 +137,6 @@
             android:id="@+id/overflow_divider"
             android:visibility="visible"
             android:background="@drawable/list_divider_holo_light" />
-        <LinearLayout
-            android:id="@+id/line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginBottom="8dp"
-            android:layout_marginEnd="8dp"
-            android:orientation="horizontal"
-            android:layout_weight="0"
-            android:gravity="center_vertical"
-            >
-            <TextView android:id="@+id/text"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_gravity="center"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:fadingEdge="horizontal"
-                />
-            <TextView android:id="@+id/info"
-                android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Info"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:singleLine="true"
-                android:gravity="center"
-                android:paddingStart="8dp"
-                />
-            <ImageView android:id="@+id/profile_icon"
-                android:layout_width="24dp"
-                android:layout_height="24dp"
-                android:layout_gravity="center"
-                android:layout_weight="0"
-                android:layout_marginStart="8dp"
-                android:scaleType="centerInside"
-                android:visibility="gone"
-                />
-        </LinearLayout>
+        <include layout="@layout/notification_template_part_line3" />
     </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_part_line1.xml b/core/res/res/layout/notification_template_part_line1.xml
new file mode 100644
index 0000000..d652959
--- /dev/null
+++ b/core/res/res/layout/notification_template_part_line1.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/line1"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingTop="@dimen/notification_vert_pad"
+    android:layout_weight="0"
+    >
+    <TextView android:id="@+id/title"
+        android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:fadingEdge="horizontal"
+        android:layout_weight="1"
+        />
+    <ViewStub android:id="@+id/time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="0"
+        android:visibility="gone"
+        android:layout="@layout/notification_template_part_time"
+        />
+    <ViewStub android:id="@+id/chronometer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="0"
+        android:visibility="gone"
+        android:layout="@layout/notification_template_part_chronometer"
+        />
+</LinearLayout>
diff --git a/core/res/res/layout/notification_template_part_line2.xml b/core/res/res/layout/notification_template_part_line2.xml
new file mode 100644
index 0000000..1e19df1
--- /dev/null
+++ b/core/res/res/layout/notification_template_part_line2.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 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
+  -->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <TextView 
+        android:id="@+id/text2"
+        android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="-2dp"
+        android:layout_marginBottom="-2dp"
+        android:singleLine="true"
+        android:fadingEdge="horizontal"
+        android:ellipsize="marquee"
+        android:visibility="gone"
+        android:layout_weight="0"
+        />
+    <ProgressBar
+        android:id="@android:id/progress"
+        android:layout_width="match_parent"
+        android:layout_height="8dp"
+        android:visibility="gone"
+        android:layout_weight="0"
+        style="@style/Widget.Material.Light.ProgressBar.Horizontal"
+        />
+</merge>
diff --git a/core/res/res/layout/notification_template_part_line3.xml b/core/res/res/layout/notification_template_part_line3.xml
new file mode 100644
index 0000000..2c8c704c
--- /dev/null
+++ b/core/res/res/layout/notification_template_part_line3.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/line3"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:layout_weight="0"
+    android:gravity="center_vertical"
+    android:paddingBottom="@dimen/notification_vert_pad"
+    >
+    <TextView android:id="@+id/text"
+        android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_gravity="center"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:fadingEdge="horizontal"
+        />
+    <TextView android:id="@+id/info"
+        android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Info"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_weight="0"
+        android:singleLine="true"
+        android:gravity="center"
+        android:paddingStart="8dp"
+        />
+    <ImageView android:id="@+id/profile_icon"
+        android:layout_width="24dp"
+        android:layout_height="24dp"
+        android:layout_gravity="center"
+        android:layout_weight="0"
+        android:layout_marginStart="8dp"
+        android:scaleType="centerInside"
+        android:visibility="gone"
+        />
+</LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index f6c0d71..3e18a25 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -6855,9 +6855,11 @@
          its {@link android.service.voice.VoiceInteractionService#SERVICE_META_DATA} meta-data entry.
          Described here are the attributes that can be included in that tag. -->
     <declare-styleable name="VoiceInteractionService">
-        <!-- The service that hosts active voice interaction sessions. -->
+        <!-- The service that hosts active voice interaction sessions.  This is required. -->
         <attr name="sessionService" format="string" />
-        <!-- The service that provides voice recognition. -->
+        <!-- The service that provides voice recognition.  This is required.  When the user
+             selects this voice interaction service, they will also be implicitly selecting
+             the component here for their recognition service. -->
         <attr name="recognitionService" format="string" />
         <attr name="settingsActivity" />
     </declare-styleable>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index bacdc3f..9d6c36d 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -42,11 +42,6 @@
     <dimen name="status_bar_icon_size">24dip</dimen>
     <!-- Size of the giant number (unread count) in the notifications -->
     <dimen name="status_bar_content_number_size">48sp</dimen>
-    <!-- Height of the system bar (combined status & navigation); used by
-         SystemUI internally, not respected by the window manager. -->
-    <dimen name="system_bar_height">@dimen/navigation_bar_height</dimen>
-    <!-- Height of notification icons in the system bar -->
-    <dimen name="system_bar_icon_size">32dip</dimen>
     <!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
     <dimen name="status_bar_edge_ignore">5dp</dimen>
 
@@ -220,11 +215,17 @@
     <dimen name="action_bar_stacked_tab_max_width">180dp</dimen>
 
     <!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
-    <dimen name="notification_text_size">13dp</dimen>
+    <dimen name="notification_text_size">13sp</dimen>
     <!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
-    <dimen name="notification_title_text_size">16dp</dimen>
+    <dimen name="notification_title_text_size">16sp</dimen>
     <!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
-    <dimen name="notification_subtext_size">12dp</dimen>
+    <dimen name="notification_subtext_size">12sp</dimen>
+
+    <!-- 8dp at the top/bottom of the notification view -->
+    <dimen name="notification_vert_pad">10dp</dimen>
+
+    <!-- Replacement for @dimen/notification_vert_pad when the text is large -->
+    <dimen name="notification_large_font_vert_pad">3dp</dimen>
 
     <!-- Keyguard dimensions -->
     <!-- TEMP -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0ebf0b5..eaacedd 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -349,6 +349,7 @@
   <java-symbol type="dimen" name="notification_text_size" />
   <java-symbol type="dimen" name="notification_title_text_size" />
   <java-symbol type="dimen" name="notification_subtext_size" />
+  <java-symbol type="dimen" name="notification_large_font_vert_pad" />
   <java-symbol type="dimen" name="immersive_mode_cling_width" />
   <java-symbol type="dimen" name="circular_display_mask_offset" />
 
@@ -1699,7 +1700,6 @@
   <java-symbol type="layout" name="notification_template_material_base" />
   <java-symbol type="layout" name="notification_template_material_big_base" />
   <java-symbol type="layout" name="notification_template_material_big_picture" />
-  <java-symbol type="layout" name="notification_template_material_big_text" />
   <java-symbol type="layout" name="notification_template_material_inbox" />
   <java-symbol type="layout" name="notification_template_material_media" />
   <java-symbol type="layout" name="notification_template_material_big_media" />
@@ -1725,7 +1725,6 @@
 
   <java-symbol type="bool" name="config_alwaysUseCdmaRssi" />
   <java-symbol type="dimen" name="status_bar_icon_size" />
-  <java-symbol type="dimen" name="system_bar_icon_size" />
   <java-symbol type="drawable" name="list_selector_pressed_holo_dark" />
   <java-symbol type="drawable" name="scrubber_control_disabled_holo" />
   <java-symbol type="drawable" name="scrubber_control_selector_holo" />
diff --git a/packages/PrintSpooler/res/drawable/ic_savetopdf.xml b/packages/PrintSpooler/res/drawable/ic_savetopdf.xml
new file mode 100644
index 0000000..60ed33a
--- /dev/null
+++ b/packages/PrintSpooler/res/drawable/ic_savetopdf.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_menu_savetopdf"
+    android:tint="@color/promoted_action_background_color" />
diff --git a/packages/PrintSpooler/res/layout/preview_page.xml b/packages/PrintSpooler/res/layout/preview_page.xml
index 509a1d2..76dd76b 100644
--- a/packages/PrintSpooler/res/layout/preview_page.xml
+++ b/packages/PrintSpooler/res/layout/preview_page.xml
@@ -31,7 +31,7 @@
     <RelativeLayout
         android:id="@+id/page_footer"
         android:layout_width="fill_parent"
-        android:layout_height="32dip"
+        android:layout_height="@dimen/preview_page_footer_height"
         android:background="@*android:color/material_grey_500"
         android:orientation="horizontal">
 
diff --git a/packages/PrintSpooler/res/layout/print_activity.xml b/packages/PrintSpooler/res/layout/print_activity.xml
index 3905646..ee5d42a 100644
--- a/packages/PrintSpooler/res/layout/print_activity.xml
+++ b/packages/PrintSpooler/res/layout/print_activity.xml
@@ -27,7 +27,6 @@
         android:id="@+id/static_content"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:padding="16dip"
         android:elevation="@dimen/preview_controls_elevation"
         android:background="?android:attr/colorPrimary">
 
@@ -35,6 +34,7 @@
             android:id="@+id/destination_spinner"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_marginTop="4dip"
             android:dropDownWidth="wrap_content"
             android:minHeight="?android:attr/listPreferredItemHeightSmall">
         </Spinner>
@@ -56,7 +56,6 @@
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="8dip"
             android:layout_marginStart="12dip"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:labelFor="@+id/copies_count_summary"
@@ -67,7 +66,6 @@
             android:id="@+id/copies_count_summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="8dip"
             android:layout_marginStart="16dip"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textColor="?android:attr/textColorPrimary">
@@ -76,7 +74,6 @@
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="8dip"
             android:layout_marginStart="32dip"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:labelFor="@+id/paper_size_summary"
@@ -87,7 +84,6 @@
             android:id="@+id/paper_size_summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="8dip"
             android:layout_marginStart="16dip"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textColor="?android:attr/textColorPrimary">
diff --git a/packages/PrintSpooler/res/layout/print_activity_controls.xml b/packages/PrintSpooler/res/layout/print_activity_controls.xml
index ef6044a..31bda7e 100644
--- a/packages/PrintSpooler/res/layout/print_activity_controls.xml
+++ b/packages/PrintSpooler/res/layout/print_activity_controls.xml
@@ -267,8 +267,8 @@
              android:id="@+id/expand_collapse_icon"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
-             android:layout_marginTop="8dip"
-             android:layout_marginBottom="8dip"
+             android:layout_marginTop="4dip"
+             android:layout_marginBottom="4dip"
              android:layout_gravity="center"
              android:background="@drawable/ic_expand_more">
          </ImageView>
diff --git a/packages/PrintSpooler/res/values/constants.xml b/packages/PrintSpooler/res/values/constants.xml
index faad527..b95703b 100644
--- a/packages/PrintSpooler/res/values/constants.xml
+++ b/packages/PrintSpooler/res/values/constants.xml
@@ -45,4 +45,7 @@
     <fraction name="page_selected_alpha">100%</fraction>
     <fraction name="page_unselected_alpha">50%</fraction>
 
+    <dimen name="preview_page_footer_height">32dip</dimen>
+    <dimen name="preview_page_min_width">130dip</dimen>
+
 </resources>
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
index e976936..5bcdb9f 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
@@ -96,6 +96,7 @@
     private float mUnselectedPageAlpha;
 
     private int mPreviewPageMargin;
+    private int mPreviewPageMinWidth;
     private int mPreviewListPadding;
     private int mFooterHeight;
 
@@ -141,17 +142,17 @@
         mPreviewPageMargin = mContext.getResources().getDimensionPixelSize(
                 R.dimen.preview_page_margin);
 
+        mPreviewPageMinWidth = mContext.getResources().getDimensionPixelSize(
+                R.dimen.preview_page_min_width);
+
         mPreviewListPadding = mContext.getResources().getDimensionPixelSize(
                 R.dimen.preview_list_padding);
 
         mColumnCount = mContext.getResources().getInteger(
                 R.integer.preview_page_per_row_count);
 
-        TypedValue outValue = new TypedValue();
-        mContext.getTheme().resolveAttribute(
-                com.android.internal.R.attr.listPreferredItemHeightSmall, outValue, true);
-        mFooterHeight = TypedValue.complexToDimensionPixelSize(outValue.data,
-                mContext.getResources().getDisplayMetrics());
+        mFooterHeight = mContext.getResources().getDimensionPixelSize(
+                R.dimen.preview_page_footer_height);
 
         mPreviewArea = previewArea;
 
@@ -428,8 +429,12 @@
         // Compute max page height.
         final int pageContentDesiredHeight = (int) (((float) pageContentDesiredWidth
                 / pageAspectRatio) + 0.5f);
-        final int pageContentMaxHeight = availableHeight - 2 * (mPreviewListPadding
-                + mPreviewPageMargin) - mFooterHeight;
+
+        // If the page does not fit entirely in a vertial direction,
+        // we shirk it but not less than the minimal page width.
+        final int pageContentMinHeight = (int) (mPreviewPageMinWidth / pageAspectRatio + 0.5f);
+        final int pageContentMaxHeight = Math.max(pageContentMinHeight,
+                availableHeight - 2 * (mPreviewListPadding + mPreviewPageMargin) - mFooterHeight);
 
         mPageContentHeight = Math.min(pageContentDesiredHeight, pageContentMaxHeight);
         mPageContentWidth = (int) ((mPageContentHeight * pageAspectRatio) + 0.5f);
@@ -439,10 +444,17 @@
 
         final int rowCount = mSelectedPageCount / columnCount
                 + ((mSelectedPageCount % columnCount) > 0 ? 1 : 0);
-        final int totalContentHeight = rowCount* (mPageContentHeight + mFooterHeight + 2
+        final int totalContentHeight = rowCount * (mPageContentHeight + mFooterHeight + 2
                 * mPreviewPageMargin);
-        final int verticalPadding = Math.max(mPreviewListPadding,
-                (availableHeight - totalContentHeight) / 2);
+
+        final int verticalPadding;
+        if (mPageContentHeight + mFooterHeight + mPreviewListPadding > availableHeight) {
+            verticalPadding = Math.max(mPreviewPageMargin,
+                    (availableHeight - totalContentHeight) / 2);
+        } else {
+            verticalPadding = Math.max(mPreviewListPadding,
+                    (availableHeight - totalContentHeight) / 2);
+        }
 
         mPreviewArea.setPadding(horizontalPadding, verticalPadding,
                 horizontalPadding, verticalPadding);
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index a1b1aec..6b29e5f 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -1704,7 +1704,7 @@
                 if (position == 0 && getPdfPrinter() != null) {
                     PrinterHolder printerHolder = (PrinterHolder) getItem(position);
                     title = printerHolder.printer.getName();
-                    icon = getResources().getDrawable(com.android.internal.R.drawable.ic_menu_save);
+                    icon = getResources().getDrawable(R.drawable.ic_savetopdf);
                 } else if (position == 1) {
                     title = getString(R.string.all_printers);
                 }
@@ -1712,7 +1712,7 @@
                 if (position == 1 && getPdfPrinter() != null) {
                     PrinterHolder printerHolder = (PrinterHolder) getItem(position);
                     title = printerHolder.printer.getName();
-                    icon = getResources().getDrawable(com.android.internal.R.drawable.ic_menu_save);
+                    icon = getResources().getDrawable(R.drawable.ic_savetopdf);
                 } else if (position == getCount() - 1) {
                     title = getString(R.string.all_printers);
                 } else {
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
index 4d2cb6c..8365373 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
@@ -94,7 +94,7 @@
         mMinMargins = minMargins;
         mContentRequested = false;
 
-        // If there is not provider we want immediately to switch to
+        // If there is no provider we want immediately to switch to
         // the empty state, so pages with no content appear blank.
         if (mProvider == null && getBackground() != mEmptyState) {
             setBackground(mEmptyState);
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
index 01f4a04..71f4aa7 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
@@ -162,7 +162,7 @@
             }
 
             cellStart = getPaddingStart();
-            cellTop += cellTop + rowHeight;
+            cellTop += rowHeight;
         }
     }
 
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 0d3a487..7301c99 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -108,49 +108,6 @@
     <style name="TextAppearance.StatusBar.Expanded.UserSwitcher.UserName" />
 
     <style name="TextAppearance" />
-    <style name="TextAppearance.QuickSettings" />
-
-    <style name="TextAppearance.QuickSettings.TileView">
-        <item name="android:textSize">12dp</item>
-        <item name="android:textStyle">normal</item>
-        <item name="android:textColor">#CCCCCC</item>
-        <item name="android:textAllCaps">true</item>
-        <item name="android:paddingStart">6dp</item>
-        <item name="android:paddingEnd">6dp</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.TileView.AllInOne" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:lines">2</item>
-        <item name="android:gravity">top</item>
-        <item name="android:paddingBottom">2dp</item>
-        <item name="android:paddingTop">16dp</item>
-        <item name="android:drawablePadding">8dp</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.Clock" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:textSize">20dp</item>
-        <item name="android:textColor">@android:color/holo_blue_light</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.Date" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:textSize">14dp</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.Alarm" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:textSize">14dp</item>
-        <item name="android:textColor">#ff3a3b39</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.CaCertWarning" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:textAllCaps">false</item>
-    </style>
-
-    <style name="TextAppearance.QuickSettings.TileView.User" parent="@style/TextAppearance.QuickSettings.TileView">
-        <item name="android:background">#CC000000</item>
-        <item name="android:padding">4dp</item>
-        <item name="android:singleLine">true</item>
-        <item name="android:fadingEdge">horizontal</item>
-    </style>
 
     <style name="TextAppearance.QS">
         <item name="android:textStyle">normal</item>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index c23a4cd..5dbe1b7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -156,6 +156,8 @@
 
     protected int mLayoutDirection = -1; // invalid
     private Locale mLocale;
+    private float mFontScale;
+
     protected boolean mUseHeadsUp = false;
     protected boolean mHeadsUpTicker = false;
     protected boolean mDisableNotificationAlerts = false;
@@ -419,8 +421,10 @@
         mRecents = getComponent(RecentsComponent.class);
         mRecents.setCallback(this);
 
-        mLocale = mContext.getResources().getConfiguration().locale;
+        final Configuration currentConfig = mContext.getResources().getConfiguration();
+        mLocale = currentConfig.locale;
         mLayoutDirection = TextUtils.getLayoutDirectionFromLocale(mLocale);
+        mFontScale = currentConfig.fontScale;
 
         mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
 
@@ -527,7 +531,9 @@
     protected void onConfigurationChanged(Configuration newConfig) {
         final Locale locale = mContext.getResources().getConfiguration().locale;
         final int ld = TextUtils.getLayoutDirectionFromLocale(locale);
-        if (! locale.equals(mLocale) || ld != mLayoutDirection) {
+        final float fontScale = newConfig.fontScale;
+
+        if (! locale.equals(mLocale) || ld != mLayoutDirection || fontScale != mFontScale) {
             if (DEBUG) {
                 Log.v(TAG, String.format(
                         "config changed locale/LD: %s (%d) -> %s (%d)", mLocale, mLayoutDirection,
diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
index 72ac29a..e39f0b1 100644
--- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
@@ -265,7 +265,7 @@
                     mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE
                             | DisplayDeviceInfo.FLAG_NEVER_BLANK;
                 }
-                if ((mInfo.flags & DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) {
+                if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) {
                     mInfo.flags &= ~DisplayDeviceInfo.FLAG_NEVER_BLANK;
                 } else {
                     mInfo.flags |= DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY;
diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java
index 591cf25..2407253 100644
--- a/services/core/java/com/android/server/hdmi/Constants.java
+++ b/services/core/java/com/android/server/hdmi/Constants.java
@@ -258,6 +258,12 @@
     static final int MHL_RAP_ACTION_CONTENT_ON = 0x10;
     static final int MHL_RAP_ACTION_CONTENT_OFF = 0x11;
 
+    // MHL RAPK messages.
+    static final int MHL_RAPK_NO_ERROR = 0x00;
+    static final int MHL_RAPK_UNRECOGNIZED_ACTION = 0x01;
+    static final int MHL_RAPK_UNSUPPORTED_ACTION = 0x02;
+    static final int MHL_RAPK_RESPONDER_BUSY = 0x03;
+
     static final int MHL_INVALID_ADOPTER_ID = -1;
     static final int MHL_INVALID_DEVICE_ID = -1;
 
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 0e57afd..e49d831 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -198,6 +198,10 @@
     @GuardedBy("mLock")
     private boolean mProhibitMode;
 
+    // Set to true while the input change by MHL is allowed.
+    @GuardedBy("mLock")
+    private boolean mMhlInputChangeEnabled;
+
     // List of listeners registered by callers that want to get notified of
     // system audio mode changes.
     private final ArrayList<IHdmiSystemAudioModeChangeListener>
@@ -269,6 +273,7 @@
         mPowerStatus = HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON;
         mProhibitMode = false;
         mHdmiControlEnabled = readBooleanSetting(Global.HDMI_CONTROL_ENABLED, true);
+        mMhlInputChangeEnabled = readBooleanSetting(Global.MHL_INPUT_SWITCHING_ENABLED, true);
 
         mCecController = HdmiCecController.create(this);
         if (mCecController != null) {
@@ -353,10 +358,12 @@
                     // No need to propagate to HAL.
                     break;
                 case Global.MHL_INPUT_SWITCHING_ENABLED:
-                    setOption(OPTION_MHL_INPUT_SWITCHING, toInt(enabled));
+                    setMhlInputChangeEnabled(enabled);
                     break;
                 case Global.MHL_POWER_CHARGE_ENABLED:
-                    setOption(OPTION_MHL_POWER_CHARGE, toInt(enabled));
+                    if (mMhlController != null) {
+                        mMhlController.setOption(OPTION_MHL_POWER_CHARGE, toInt(enabled));
+                    }
                     break;
             }
         }
@@ -1741,4 +1748,20 @@
         assertRunOnServiceThread();
         mActivePortId = portId;
     }
+
+    void setMhlInputChangeEnabled(boolean enabled) {
+        if (mMhlController != null) {
+            mMhlController.setOption(OPTION_MHL_INPUT_SWITCHING, toInt(enabled));
+        }
+
+        synchronized (mLock) {
+            mMhlInputChangeEnabled = enabled;
+        }
+    }
+
+    boolean isMhlInputChangeEnabled() {
+        synchronized (mLock) {
+            return mMhlInputChangeEnabled;
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java
index dc5bc84..3378171 100644
--- a/services/core/java/com/android/server/tv/TvInputManagerService.java
+++ b/services/core/java/com/android/server/tv/TvInputManagerService.java
@@ -996,12 +996,13 @@
         }
 
         private void ensureParentalControlsPermission() {
-            if (mContext.checkCallingPermission(
-                    android.Manifest.permission.MODIFY_PARENTAL_CONTROLS)
-                    != PackageManager.PERMISSION_GRANTED) {
-                throw new SecurityException(
-                        "The caller does not have parental controls permission");
-            }
+            // STOPSHIP: Uncomment when b/16984416 is resolved.
+            //if (mContext.checkCallingPermission(
+            //        android.Manifest.permission.MODIFY_PARENTAL_CONTROLS)
+            //        != PackageManager.PERMISSION_GRANTED) {
+            //    throw new SecurityException(
+            //            "The caller does not have parental controls permission");
+            //}
         }
 
         @Override