Merge "Use app's best locale if they override LocaleList" into nyc-dev
diff --git a/api/current.txt b/api/current.txt
index 7215318..f9e1d58 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6457,7 +6457,7 @@
   public class NetworkStatsManager {
     method public android.app.usage.NetworkStats queryDetails(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats queryDetailsForUid(int, java.lang.String, long, long, int) throws android.os.RemoteException, java.lang.SecurityException;
-    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int);
+    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int) throws java.lang.SecurityException;
     method public android.app.usage.NetworkStats querySummary(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForDevice(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForUser(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
@@ -28268,7 +28268,7 @@
     field public static final int LOLLIPOP = 21; // 0x15
     field public static final int LOLLIPOP_MR1 = 22; // 0x16
     field public static final int M = 23; // 0x17
-    field public static final int N = 10000; // 0x2710
+    field public static final int N = 24; // 0x18
   }
 
   public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
@@ -36609,11 +36609,9 @@
 package android.telephony {
 
   public class CarrierConfigManager {
-    method public android.os.PersistableBundle getConfig(int);
     method public android.os.PersistableBundle getConfig();
-    method public deprecated android.os.PersistableBundle getConfigForSubId(int);
-    method public void notifyConfigChanged(int);
-    method public deprecated void notifyConfigChangedForSubId(int);
+    method public android.os.PersistableBundle getConfigForSubId(int);
+    method public void notifyConfigChangedForSubId(int);
     field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
     field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
     field public static final java.lang.String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
@@ -37764,7 +37762,7 @@
     ctor public MockApplication();
   }
 
-  public deprecated class MockContentProvider extends android.content.ContentProvider {
+  public class MockContentProvider extends android.content.ContentProvider {
     ctor protected MockContentProvider();
     ctor public MockContentProvider(android.content.Context);
     ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]);
@@ -37776,13 +37774,13 @@
     method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]);
   }
 
-  public deprecated class MockContentResolver extends android.content.ContentResolver {
+  public class MockContentResolver extends android.content.ContentResolver {
     ctor public MockContentResolver();
     ctor public MockContentResolver(android.content.Context);
     method public void addProvider(java.lang.String, android.content.ContentProvider);
   }
 
-  public deprecated class MockContext extends android.content.Context {
+  public class MockContext extends android.content.Context {
     ctor public MockContext();
     method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int);
     method public int checkCallingOrSelfPermission(java.lang.String);
diff --git a/api/removed.txt b/api/removed.txt
index 42c64ea..0ff2476 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -31,37 +31,6 @@
 
 }
 
-package android.app.usage {
-
-  public class DataUsagePolicy {
-    field public final int networkType;
-    field public final java.lang.String[] subscriberIds;
-    field public final long thresholdInBytes;
-    field public final int[] uids;
-  }
-
-  public static class DataUsagePolicy.Builder {
-    ctor public DataUsagePolicy.Builder();
-    method public android.app.usage.DataUsagePolicy.Builder addSubscriberId(java.lang.String);
-    method public android.app.usage.DataUsagePolicy.Builder addUid(int);
-    method public android.app.usage.DataUsagePolicy build();
-    method public android.app.usage.DataUsagePolicy.Builder setNetworkType(int);
-    method public android.app.usage.DataUsagePolicy.Builder setThreshold(long);
-  }
-
-  public class NetworkStatsManager {
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.DataUsageCallback, android.os.Handler);
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.UsageCallback, android.os.Handler);
-    method public void unregisterDataUsageCallback(android.app.usage.NetworkStatsManager.DataUsageCallback);
-  }
-
-  public static abstract class NetworkStatsManager.DataUsageCallback {
-    ctor public NetworkStatsManager.DataUsageCallback();
-    method public deprecated void onLimitReached();
-  }
-
-}
-
 package android.content {
 
   public abstract class Context {
diff --git a/api/system-current.txt b/api/system-current.txt
index 2ebe0ab..24ed720 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6738,7 +6738,7 @@
   public class NetworkStatsManager {
     method public android.app.usage.NetworkStats queryDetails(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats queryDetailsForUid(int, java.lang.String, long, long, int) throws android.os.RemoteException, java.lang.SecurityException;
-    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int);
+    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int) throws java.lang.SecurityException;
     method public android.app.usage.NetworkStats querySummary(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForDevice(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForUser(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
@@ -30707,7 +30707,7 @@
     field public static final int LOLLIPOP = 21; // 0x15
     field public static final int LOLLIPOP_MR1 = 22; // 0x16
     field public static final int M = 23; // 0x17
-    field public static final int N = 10000; // 0x2710
+    field public static final int N = 24; // 0x18
   }
 
   public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
@@ -39540,12 +39540,10 @@
 package android.telephony {
 
   public class CarrierConfigManager {
-    method public android.os.PersistableBundle getConfig(int);
     method public android.os.PersistableBundle getConfig();
-    method public deprecated android.os.PersistableBundle getConfigForSubId(int);
+    method public android.os.PersistableBundle getConfigForSubId(int);
     method public static android.os.PersistableBundle getDefaultConfig();
-    method public void notifyConfigChanged(int);
-    method public deprecated void notifyConfigChangedForSubId(int);
+    method public void notifyConfigChangedForSubId(int);
     method public void updateConfigForPhoneId(int, java.lang.String);
     field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
     field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
@@ -40750,7 +40748,7 @@
     ctor public MockApplication();
   }
 
-  public deprecated class MockContentProvider extends android.content.ContentProvider {
+  public class MockContentProvider extends android.content.ContentProvider {
     ctor protected MockContentProvider();
     ctor public MockContentProvider(android.content.Context);
     ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]);
@@ -40762,13 +40760,13 @@
     method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]);
   }
 
-  public deprecated class MockContentResolver extends android.content.ContentResolver {
+  public class MockContentResolver extends android.content.ContentResolver {
     ctor public MockContentResolver();
     ctor public MockContentResolver(android.content.Context);
     method public void addProvider(java.lang.String, android.content.ContentProvider);
   }
 
-  public deprecated class MockContext extends android.content.Context {
+  public class MockContext extends android.content.Context {
     ctor public MockContext();
     method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int);
     method public int checkCallingOrSelfPermission(java.lang.String);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 4873605..715312f 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -29,37 +29,6 @@
 
 }
 
-package android.app.usage {
-
-  public class DataUsagePolicy {
-    field public final int networkType;
-    field public final java.lang.String[] subscriberIds;
-    field public final long thresholdInBytes;
-    field public final int[] uids;
-  }
-
-  public static class DataUsagePolicy.Builder {
-    ctor public DataUsagePolicy.Builder();
-    method public android.app.usage.DataUsagePolicy.Builder addSubscriberId(java.lang.String);
-    method public android.app.usage.DataUsagePolicy.Builder addUid(int);
-    method public android.app.usage.DataUsagePolicy build();
-    method public android.app.usage.DataUsagePolicy.Builder setNetworkType(int);
-    method public android.app.usage.DataUsagePolicy.Builder setThreshold(long);
-  }
-
-  public class NetworkStatsManager {
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.DataUsageCallback, android.os.Handler);
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.UsageCallback, android.os.Handler);
-    method public void unregisterDataUsageCallback(android.app.usage.NetworkStatsManager.DataUsageCallback);
-  }
-
-  public static abstract class NetworkStatsManager.DataUsageCallback {
-    ctor public NetworkStatsManager.DataUsageCallback();
-    method public deprecated void onLimitReached();
-  }
-
-}
-
 package android.content {
 
   public abstract class Context {
diff --git a/api/test-current.txt b/api/test-current.txt
index e948022..b6ebf8a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -6463,7 +6463,7 @@
   public class NetworkStatsManager {
     method public android.app.usage.NetworkStats queryDetails(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats queryDetailsForUid(int, java.lang.String, long, long, int) throws android.os.RemoteException, java.lang.SecurityException;
-    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int);
+    method public android.app.usage.NetworkStats queryDetailsForUidTag(int, java.lang.String, long, long, int, int) throws java.lang.SecurityException;
     method public android.app.usage.NetworkStats querySummary(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForDevice(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
     method public android.app.usage.NetworkStats.Bucket querySummaryForUser(int, java.lang.String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
@@ -28337,7 +28337,7 @@
     field public static final int LOLLIPOP = 21; // 0x15
     field public static final int LOLLIPOP_MR1 = 22; // 0x16
     field public static final int M = 23; // 0x17
-    field public static final int N = 10000; // 0x2710
+    field public static final int N = 24; // 0x18
   }
 
   public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
@@ -36686,11 +36686,9 @@
 package android.telephony {
 
   public class CarrierConfigManager {
-    method public android.os.PersistableBundle getConfig(int);
     method public android.os.PersistableBundle getConfig();
-    method public deprecated android.os.PersistableBundle getConfigForSubId(int);
-    method public void notifyConfigChanged(int);
-    method public deprecated void notifyConfigChangedForSubId(int);
+    method public android.os.PersistableBundle getConfigForSubId(int);
+    method public void notifyConfigChangedForSubId(int);
     field public static final java.lang.String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
     field public static final java.lang.String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
     field public static final java.lang.String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
@@ -37841,7 +37839,7 @@
     ctor public MockApplication();
   }
 
-  public deprecated class MockContentProvider extends android.content.ContentProvider {
+  public class MockContentProvider extends android.content.ContentProvider {
     ctor protected MockContentProvider();
     ctor public MockContentProvider(android.content.Context);
     ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]);
@@ -37853,13 +37851,13 @@
     method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]);
   }
 
-  public deprecated class MockContentResolver extends android.content.ContentResolver {
+  public class MockContentResolver extends android.content.ContentResolver {
     ctor public MockContentResolver();
     ctor public MockContentResolver(android.content.Context);
     method public void addProvider(java.lang.String, android.content.ContentProvider);
   }
 
-  public deprecated class MockContext extends android.content.Context {
+  public class MockContext extends android.content.Context {
     ctor public MockContext();
     method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int);
     method public int checkCallingOrSelfPermission(java.lang.String);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 42c64ea..0ff2476 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -31,37 +31,6 @@
 
 }
 
-package android.app.usage {
-
-  public class DataUsagePolicy {
-    field public final int networkType;
-    field public final java.lang.String[] subscriberIds;
-    field public final long thresholdInBytes;
-    field public final int[] uids;
-  }
-
-  public static class DataUsagePolicy.Builder {
-    ctor public DataUsagePolicy.Builder();
-    method public android.app.usage.DataUsagePolicy.Builder addSubscriberId(java.lang.String);
-    method public android.app.usage.DataUsagePolicy.Builder addUid(int);
-    method public android.app.usage.DataUsagePolicy build();
-    method public android.app.usage.DataUsagePolicy.Builder setNetworkType(int);
-    method public android.app.usage.DataUsagePolicy.Builder setThreshold(long);
-  }
-
-  public class NetworkStatsManager {
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.DataUsageCallback, android.os.Handler);
-    method public void registerDataUsageCallback(android.app.usage.DataUsagePolicy, android.app.usage.NetworkStatsManager.UsageCallback, android.os.Handler);
-    method public void unregisterDataUsageCallback(android.app.usage.NetworkStatsManager.DataUsageCallback);
-  }
-
-  public static abstract class NetworkStatsManager.DataUsageCallback {
-    ctor public NetworkStatsManager.DataUsageCallback();
-    method public deprecated void onLimitReached();
-  }
-
-}
-
 package android.content {
 
   public abstract class Context {
diff --git a/core/java/android/app/usage/DataUsagePolicy.java b/core/java/android/app/usage/DataUsagePolicy.java
deleted file mode 100644
index ee6b60c..0000000
--- a/core/java/android/app/usage/DataUsagePolicy.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package android.app.usage;
-
-import android.net.ConnectivityManager;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.IntArray;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Defines a policy for data usage callbacks, made through {@link DataUsagePolicy.Builder} and used
- * to be notified on data usage via {@link NetworkStatsManager#registerDataUsageCallback}.
- * @removed
- */
-public class DataUsagePolicy {
-
-    /**
-     * Network type to be monitored, as defined in {@link ConnectivityManager}, e.g.
-     * {@link ConnectivityManager#TYPE_MOBILE}, {@link ConnectivityManager#TYPE_WIFI} etc.
-     */
-    public final int networkType;
-
-    /**
-     * Set of subscriber ids to be monitored for the given network type. May be empty if not
-     * applicable.
-     * <p>Should not be modified once created.
-     */
-    public final String[] subscriberIds;
-
-    /**
-     * Set of UIDs of which to monitor data usage.
-     *
-     * <p>If not {@code null}, the caller will be notified when any of the uids exceed
-     * the given threshold. If empty all uids for which the calling process has access
-     * to stats will be monitored.
-     * <p>Should not be modified once created.
-     */
-    public final int[] uids;
-
-    /**
-     * Threshold in bytes to be notified on.
-     */
-    public final long thresholdInBytes;
-
-    /**
-     * @hide
-     */
-    DataUsagePolicy(int networkType, String[] subscriberIds, int[] uids,
-                long thresholdInBytes) {
-        this.networkType = networkType;
-        this.subscriberIds = subscriberIds;
-        this.uids = uids;
-        this.thresholdInBytes = thresholdInBytes;
-    }
-
-    /**
-     * Builder used to create {@link DataUsagePolicy} objects.
-     */
-    public static class Builder {
-        private static final int INVALID_NETWORK_TYPE = -1;
-        private int mNetworkType = INVALID_NETWORK_TYPE;
-        private List<String> mSubscriberList = new ArrayList<>();
-        private IntArray mUids = new IntArray();
-        private long mThresholdInBytes;
-
-        /**
-         * Default constructor for Builder.
-         */
-        public Builder() {}
-
-        /**
-         * Build {@link DataUsagePolicy} given the current policies.
-         */
-        public DataUsagePolicy build() {
-            if (mNetworkType == INVALID_NETWORK_TYPE) {
-                throw new IllegalArgumentException(
-                        "DataUsagePolicy requires a valid network type to be set");
-            }
-            return new DataUsagePolicy(mNetworkType,
-                    mSubscriberList.toArray(new String[mSubscriberList.size()]),
-                    mUids.toArray(), mThresholdInBytes);
-        }
-
-        /**
-         * Specifies that the given {@code subscriberId} should be monitored.
-         *
-         * @param subscriberId the subscriber id of the network interface.
-         */
-        public Builder addSubscriberId(String subscriberId) {
-            mSubscriberList.add(subscriberId);
-            return this;
-        }
-
-        /**
-         * Specifies that the given {@code uid} should be monitored.
-         */
-        public Builder addUid(int uid) {
-            mUids.add(uid);
-            return this;
-        }
-
-        /**
-         * Specifies that the callback should monitor the given network. It is mandatory
-         * to set one.
-         *
-         * @param networkType As defined in {@link ConnectivityManager}, e.g.
-         *            {@link ConnectivityManager#TYPE_MOBILE},
-         *            {@link ConnectivityManager#TYPE_WIFI}, etc.
-         */
-        public Builder setNetworkType(int networkType) {
-            mNetworkType = networkType;
-            return this;
-        }
-
-        /**
-         * Sets the threshold in bytes on which the listener should be called. The framework may
-         * impose a minimum threshold to avoid too many notifications to be triggered.
-         */
-        public Builder setThreshold(long thresholdInBytes) {
-            mThresholdInBytes = thresholdInBytes;
-            return this;
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "DataUsagePolicy [ networkType=" + networkType
-                + ", subscriberIds=" + Arrays.toString(subscriberIds)
-                + ", uids=" + Arrays.toString(uids)
-                + ", thresholdInBytes=" + thresholdInBytes + " ]";
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof DataUsagePolicy == false) return false;
-        DataUsagePolicy that = (DataUsagePolicy) obj;
-        return that.networkType == this.networkType
-                && Arrays.deepEquals(that.subscriberIds, this.subscriberIds)
-                && Arrays.equals(that.uids, this.uids)
-                && that.thresholdInBytes == this.thresholdInBytes;
-    }
-
-    @Override
-    public int hashCode() {
-        // Start with a non-zero constant.
-        int result = 17;
-
-        // Include a hash for each field.
-        result = 31 * result + networkType;
-        result = 31 * result + Arrays.deepHashCode(subscriberIds);
-        result = 31 * result + Arrays.hashCode(uids);
-        result = 31 * result + (int) (thresholdInBytes ^ (thresholdInBytes >>> 32));
-
-        return result;
-   }
-}
diff --git a/core/java/android/app/usage/NetworkStatsManager.java b/core/java/android/app/usage/NetworkStatsManager.java
index 4a28117..720c84a 100644
--- a/core/java/android/app/usage/NetworkStatsManager.java
+++ b/core/java/android/app/usage/NetworkStatsManager.java
@@ -240,18 +240,13 @@
      *            {@link java.lang.System#currentTimeMillis}.
      * @param uid UID of app
      * @param tag TAG of interest. Use {@link NetworkStats.Bucket#TAG_NONE} for no tags.
-     * @return Statistics object or null if permissions are insufficient or error happened during
-     *         statistics collection.
+     * @return Statistics object or null if an error happened during statistics collection.
+     * @throws SecurityException if permissions are insufficient to read network statistics.
      */
     public NetworkStats queryDetailsForUidTag(int networkType, String subscriberId,
-            long startTime, long endTime, int uid, int tag) {
+            long startTime, long endTime, int uid, int tag) throws SecurityException {
         NetworkTemplate template;
-        try {
-            template = createTemplate(networkType, subscriberId);
-        } catch (IllegalArgumentException e) {
-            if (DBG) Log.e(TAG, "Cannot create template", e);
-            return null;
-        }
+        template = createTemplate(networkType, subscriberId);
 
         NetworkStats result;
         try {
@@ -303,17 +298,6 @@
         return result;
     }
 
-    /** @removed */
-    public void registerDataUsageCallback(DataUsagePolicy policy, DataUsageCallback callback,
-                @Nullable Handler handler) {}
-
-    /** @removed */
-    public void registerDataUsageCallback(DataUsagePolicy policy, UsageCallback callback,
-                @Nullable Handler handler) {}
-
-    /** @removed */
-    public void unregisterDataUsageCallback(DataUsageCallback callback) {}
-
     /**
      * Registers to receive notifications about data usage on specified networks.
      *
@@ -396,13 +380,6 @@
         }
     }
 
-    /** @removed */
-    public static abstract class DataUsageCallback {
-        /** @removed */
-        @Deprecated
-        public void onLimitReached() {}
-    }
-
     /**
      * Base class for usage callbacks. Should be extended by applications wanting notifications.
      */
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 7e1fc15..dc7be6b 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -671,7 +671,7 @@
         /**
          * N is for ¯\_(ツ)_/¯.
          */
-        public static final int N = CUR_DEVELOPMENT;
+        public static final int N = 24;
     }
 
     /** The type of build, like "user" or "eng". */
diff --git a/core/java/android/view/accessibility/AccessibilityWindowInfo.java b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
index d0d4507..52f35de 100644
--- a/core/java/android/view/accessibility/AccessibilityWindowInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityWindowInfo.java
@@ -16,6 +16,7 @@
 
 package android.view.accessibility;
 
+import android.annotation.Nullable;
 import android.graphics.Rect;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -101,8 +102,9 @@
     /**
      * Gets the title of the window.
      *
-     * @return The title.
+     * @return The title of the window, or {@code null} if none is available.
      */
+    @Nullable
     public CharSequence getTitle() {
         return mTitle;
     }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index fc120eb..3711b94 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6983,14 +6983,19 @@
         return false;
     }
 
-    private static int desired(Layout layout) {
+    private static int desired(Layout layout, int maxLines) {
         int n = layout.getLineCount();
         CharSequence text = layout.getText();
         float max = 0;
 
+        // if maxLines is set, and the text length is greater that the length of the text in the
+        // layout, it means that there is a cut-off and we cannot use it.
+        if (maxLines != -1 && text.length() > layout.getLineEnd(n - 1)) {
+            return -1;
+        }
+
         // if any line was wrapped, we can't use it.
         // but it's ok for the last line not to have a newline
-
         for (int i = 0; i < n - 1; i++) {
             if (text.charAt(layout.getLineEnd(i) - 1) != '\n')
                 return -1;
@@ -7063,7 +7068,7 @@
             width = widthSize;
         } else {
             if (mLayout != null && mEllipsize == null) {
-                des = desired(mLayout);
+                des = desired(mLayout, getMaxLines());
             }
 
             if (des < 0) {
@@ -7095,7 +7100,7 @@
                 int hintWidth;
 
                 if (mHintLayout != null && mEllipsize == null) {
-                    hintDes = desired(mHintLayout);
+                    hintDes = desired(mHintLayout, getMaxLines());
                 }
 
                 if (hintDes < 0) {
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 5bb8969..4f15ece 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -521,16 +521,22 @@
 
     @Override
     public void setTitle(CharSequence title) {
+        setTitle(title, true);
+    }
+
+    public void setTitle(CharSequence title, boolean updateAccessibilityTitle) {
         if (mTitleView != null) {
             mTitleView.setText(title);
         } else if (mDecorContentParent != null) {
             mDecorContentParent.setWindowTitle(title);
         }
         mTitle = title;
-        WindowManager.LayoutParams params = getAttributes();
-        if (!TextUtils.equals(title, params.accessibilityTitle)) {
-            params.accessibilityTitle = TextUtils.stringOrSpannedString(title);
-            dispatchWindowAttributesChanged(getAttributes());
+        if (updateAccessibilityTitle) {
+            WindowManager.LayoutParams params = getAttributes();
+            if (!TextUtils.equals(title, params.accessibilityTitle)) {
+                params.accessibilityTitle = TextUtils.stringOrSpannedString(title);
+                dispatchWindowAttributesChanged(getAttributes());
+            }
         }
     }
 
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index c0060fd..bb07834 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -303,7 +303,7 @@
     </style>
 
     <style name="TextAppearance.Material.Widget.Button.Borderless.Colored" parent="TextAppearance.Material.Widget.Button">
-        <item name="textColor">@color/btn_colored_text_material</item>
+        <item name="textColor">@color/btn_colored_borderless_text_material</item>
     </style>
 
     <style name="TextAppearance.Material.Widget.EditText">
diff --git a/docs/html-intl/intl/es/preview/setup-sdk.jd b/docs/html-intl/intl/es/preview/setup-sdk.jd
index 769121d..39e84a8 100644
--- a/docs/html-intl/intl/es/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/es/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 y <a href="{@docRoot}preview/api-overview.html">API y funciones de Android N
 </a>.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/in/preview/setup-sdk.jd b/docs/html-intl/intl/in/preview/setup-sdk.jd
index c6e43f1..2502d7d 100644
--- a/docs/html-intl/intl/in/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/in/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 dan <a href="{@docRoot}preview/api-overview.html">Android N API
 dan Fiturnya</a>.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/ja/preview/setup-sdk.jd b/docs/html-intl/intl/ja/preview/setup-sdk.jd
index 4331641..36c2144 100644
--- a/docs/html-intl/intl/ja/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/ja/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 
 </li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/ko/preview/setup-sdk.jd b/docs/html-intl/intl/ko/preview/setup-sdk.jd
index 91f17c1..d04acef 100644
--- a/docs/html-intl/intl/ko/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/ko/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 및 기능</a>에서 Android N 플랫폼에
 대해 자세히 알아봅니다.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/pt-br/preview/setup-sdk.jd b/docs/html-intl/intl/pt-br/preview/setup-sdk.jd
index 9035e50..a917da3 100644
--- a/docs/html-intl/intl/pt-br/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/pt-br/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 e <a href="{@docRoot}preview/api-overview.html">Recursos de APIs do
 Android N</a>.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/ru/preview/setup-sdk.jd b/docs/html-intl/intl/ru/preview/setup-sdk.jd
index 582fe9f..6ae86e9 100644
--- a/docs/html-intl/intl/ru/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/ru/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 и в описании <a href="{@docRoot}preview/api-overview.html">API-интерфейсов и возможностей Android N</a>.
 </li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/vi/preview/setup-sdk.jd b/docs/html-intl/intl/vi/preview/setup-sdk.jd
index 6f6cd20..bdba713 100644
--- a/docs/html-intl/intl/vi/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/vi/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1: 6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 và<a href="{@docRoot}preview/api-overview.html">API Android N
 và Các tính năng</a>.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/zh-cn/preview/setup-sdk.jd b/docs/html-intl/intl/zh-cn/preview/setup-sdk.jd
index eaef7a1..69971d8 100644
--- a/docs/html-intl/intl/zh-cn/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/zh-cn/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1:6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 
 </li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html-intl/intl/zh-tw/preview/setup-sdk.jd b/docs/html-intl/intl/zh-tw/preview/setup-sdk.jd
index 7a46aca..b486ed4 100644
--- a/docs/html-intl/intl/zh-tw/preview/setup-sdk.jd
+++ b/docs/html-intl/intl/zh-tw/preview/setup-sdk.jd
@@ -130,7 +130,7 @@
       SHA-1:6a3880b3ccd19614daae5a4d0698ea6ae11c20a5
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -221,4 +221,3 @@
 
 </li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html/preview/setup-sdk.jd b/docs/html/preview/setup-sdk.jd
index ebeae74..3b479e2 100644
--- a/docs/html/preview/setup-sdk.jd
+++ b/docs/html/preview/setup-sdk.jd
@@ -98,7 +98,7 @@
       SHA-1: 9224bd4445cd7f653c4c294d362ccb195a2101e7 
     </td>
   </tr>
-<table>
+</table>
 
 
 
@@ -189,4 +189,3 @@
 and <a href="{@docRoot}preview/api-overview.html">Android N APIs
 and Features</a>.</li>
 </ul>
-<div class="end-content-title"></div>
diff --git a/docs/html/topic/instant-apps/faqs.jd b/docs/html/topic/instant-apps/faqs.jd
index 0a1f571..bf37241 100644
--- a/docs/html/topic/instant-apps/faqs.jd
+++ b/docs/html/topic/instant-apps/faqs.jd
@@ -63,7 +63,9 @@
   <strong>How can developers get involved?</strong>
   <br/>
   Developers interested in upgrading their Android apps can visit
-  <a class="external-link" href="g.co/InstantApps">g.co/InstantApps</a> to
+  <a class="external-link"
+  href="http://g.co/InstantApps">
+  g.co/InstantApps</a> to
   sign up. We will be reaching out to interested
   developers in the coming months.
 </p>
\ No newline at end of file
diff --git a/docs/html/topic/instant-apps/index.jd b/docs/html/topic/instant-apps/index.jd
index d8de0b5..e2da9c5 100644
--- a/docs/html/topic/instant-apps/index.jd
+++ b/docs/html/topic/instant-apps/index.jd
@@ -12,17 +12,8 @@
 <!-- Hero section -->
 <section class="dac-expand dac-hero dac-section-light">
 <div class="wrap">
-  <div class="cols dac-hero-content">
-
-    <div class="col-1of2 col-push-1of2 dac-hero-figure">
-      <div class="dev-bytes-video">
-        <iframe width="560" height="350" src=
-        "https://www.youtube.com/embed/cosqlfqrpFA" frameborder="0"
-        allowfullscreen=""></iframe>
-      </div>
-    </div>
-
-    <div class="col-1of2 col-pull-1of2" style="margin-bottom:40px">
+  <div class="dac-hero-content">
+    <div style="margin-bottom:40px">
       <h1>
         Android Instant Apps
       </h1>
@@ -47,6 +38,11 @@
         <a class="landing-button green download-bundle-button" href=
         "https://docs.google.com/a/google.com/forms/d/1S3MzsMVIlchLCqyNLaFbv64llxWaf90QSeYLeswco90/viewform"
         target="_blank">I'M INTERESTED IN ANDROID INSTANT APPS<br></a>
+        <a class="dac-hero-cta dev-bytes"
+          href="https://www.youtube.com/watch?v=cosqlfqrpFA">
+          <span class="dac-sprite dac-auto-chevron"></span>
+          Watch a video about Instant Apps
+        </a>
       </p>
     </div>
 
@@ -56,7 +52,7 @@
 
 <!-- Second section -->
 
-<div class="wrap" style="margin-top:60px">
+<div class="wrap sub-section">
 <div class="cols dac-hero-content">
   <div class="col-1of2 dac-hero-figure">
     <img src="/images/topic/instant-apps/instant-apps-section-2.png">
@@ -64,7 +60,7 @@
 <div class="col-1of2">
 <div class="dac-hero-tag"></div>
 
-  <h2 id="section-2">Run Android Apps Without Installation</h2>
+  <h2 id="section-2" class="norule">Run Android Apps Without Installation</h2>
   <p class="dac-hero-description">
     Android Instant Apps lets you experience beautiful and immersive
     apps, with material design and smooth animations, without installing them
@@ -77,9 +73,9 @@
 
 <!-- Third section -->
 
-<div class="wrap" style="margin-top:60px">
+<div class="wrap sub-section">
 
-  <h2 id="section-3">Access Apps From Anywhere</h2>
+  <h2 id="section-3" class="norule">Access Apps From Anywhere</h2>
 
   <p>
     Get people to your flagship Android experience from links that would
@@ -126,7 +122,7 @@
 
 <!-- Fourth section -->
 
-<div class="wrap" style="margin-top:60px">
+<div class="wrap sub-section">
 <div class="cols dac-hero-content">
   <div class="col-1of2 dac-hero-figure">
     <img src="/images/topic/instant-apps/instant-apps-section-4.png">
@@ -134,9 +130,10 @@
 <div class="col-1of2">
 <div class="dac-hero-tag"></div>
 
-  <h2 id="section-4">Built On Google Play Services</h2>
+  <h2 id="section-4" class="norule">Built On Google Play Services</h2>
   <p class="dac-hero-description">
-    Take advantage of Google Play services features &mdash; like location, identity,
+    Take advantage of Google Play services features &mdash; like location,
+    identity,
     payments, and Firebase &mdash; which are built right in for a seamless user
     experience.
   </p>
@@ -147,17 +144,16 @@
 
 <!-- Fifth section -->
 
-<div class="wrap" style="margin-top:60px">
+<div class="wrap sub-section">
 <div class="cols dac-hero-content">
   <div class="col-1of2 col-push-1of2 dac-hero-figure">
     <img src="/images/topic/instant-apps/instant-apps-section-5.png">
   </div>
 <div class="col-1of2 col-pull-1of2">
 <div class="dac-hero-tag"></div>
-  <h2 id="section-5">Works On Most Android Devices</h2>
+  <h2 id="section-5" class="norule">Works On Most Android Devices</h2>
 
   <p class="dac-hero-description">
-
     Android Instant Apps can work on Android devices running Android 4.1+
     (API Level 16) or higher with Google Play services.
   </p>
@@ -168,7 +164,7 @@
 
 <!-- Sixth section -->
 
-<div class="wrap" style="margin-top:60px">
+<div class="wrap sub-section">
 <div class="cols dac-hero-content">
   <div class="col-1of2 dac-hero-figure">
     <img src="/images/topic/instant-apps/upgrade-your-app-2x.png">
@@ -176,7 +172,7 @@
 <div class="col-1of2">
 <div class="dac-hero-tag"></div>
 
-  <h2 id="section-6">Upgrade Your Existing App</h2>
+  <h2 id="section-6" class="norule">Upgrade Your Existing App</h2>
   <p class="dac-hero-description">
     Android Instant Apps functionality is an upgrade to your existing Android
     app, not a new, separate app. It's the same Android APIs, the same
@@ -192,18 +188,18 @@
 
 <!-- Seventh section -->
 
-<div class="wrap" style="margin-top:60px" id="section-7">
-  <h2 id="sign-up-docs" style="margin-bottom: 0px;">
+<div class="wrap sub-section" id="section-7">
+  <h2 id="sign-up-docs" class="dac-section-title norule" style="margin-bottom: 0px;">
     Sign up for access to Android Instant Apps documentation
   </h2>
 
-  <p>
+  <p class="dac-section-subtitle" style="margin-top:0px">
     We’ll let you know if you’re selected for early access
     to Android Instant
     Apps.
   </p>
 
-  <p>
+  <p class="dac-section-subtitle">
     <a class="landing-button green download-bundle-button"
       href="https://docs.google.com/forms/d/1S3MzsMVIlchLCqyNLaFbv64llxWaf90QSeYLeswco90/viewform"
       target="_blank">
@@ -211,7 +207,7 @@
     </a>
   </p>
 
-  <p style="margin-top:24px">
+  <p  class="dac-section-subtitle" style="margin-top:24px">
     Check out our <a href="faqs.html">frequently asked questions</a> to find out
     more about Android Instant Apps.
   </p>
@@ -230,28 +226,14 @@
     background: #B0BEC5;
   }
 
-  /* Styling and layout for video. */
-  .dev-bytes-video {
-    margin-top: 30px;
-    position: relative;
-    padding-bottom: 56.25%; /* 16:9 */
-    padding-top: 30px;
-    height: 0;
-  }
-
-  .dev-bytes-video iframe,
-  .dev-bytes-video object,
-  .dev-bytes-video embed {
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-  }
-
   /* Increase top margin for sections */
-  .wrap {
-    margin-top: 1.5em;
+  .sub-section {
+    margin-top: 2em;
+  }
+
+  a.dev-bytes {
+   padding-top: 1em;
+   padding-left: 1em;
   }
 
   #section-3, #sign-up-docs {
@@ -259,11 +241,6 @@
     border-top: 0px;
   }
 
-  /* Align the seventh section in the center. */
-  #section-7 {
-    text-align: center;
-  }
-
   /* GIF section styling */
   .figure-caption {
     text-align: center;
diff --git a/packages/PrintSpooler/res/layout/add_printer_list_header.xml b/packages/PrintSpooler/res/layout/add_printer_list_header.xml
index 9eee0c4..488b3ab 100644
--- a/packages/PrintSpooler/res/layout/add_printer_list_header.xml
+++ b/packages/PrintSpooler/res/layout/add_printer_list_header.xml
@@ -24,6 +24,7 @@
         android:gravity="start|center_vertical">
 
     <TextView android:id="@+id/text"
-            style="?android:attr/listSeparatorTextViewStyle" />
+            style="?android:attr/listSeparatorTextViewStyle"
+            android:textAlignment="viewStart" />
 
 </LinearLayout>
diff --git a/packages/SystemUI/res/layout-television/recents_on_tv.xml b/packages/SystemUI/res/layout-television/recents_on_tv.xml
index 1dbd1b3..82b9f8c 100644
--- a/packages/SystemUI/res/layout-television/recents_on_tv.xml
+++ b/packages/SystemUI/res/layout-television/recents_on_tv.xml
@@ -40,4 +40,16 @@
         android:focusable="true"
         android:visibility="visible" />
 
+    <!-- Placeholder to dismiss during talkback. -->
+    <ImageView
+            android:id="@+id/dismiss_placeholder"
+            android:layout_width="@dimen/recents_tv_dismiss_icon_size"
+            android:layout_height="@dimen/recents_tv_dismiss_icon_size"
+            android:layout_gravity="bottom|center_horizontal"
+            android:layout_marginBottom="50dp"
+            android:src="@drawable/ic_cancel_white_24dp"
+            android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
+            android:focusable="true"
+            android:visibility="gone" />
+
 </com.android.systemui.recents.tv.views.RecentsTvView>
diff --git a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
index 36df924..201f47d 100644
--- a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
+++ b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
@@ -19,7 +19,6 @@
         android:layout_height="wrap_content"
         android:focusable="true"
         android:focusableInTouchMode="true"
-        android:contentDescription="@string/status_bar_recent_inspect_item_title"
         android:layout_gravity="center"
         android:layout_centerInParent="true"
         android:clipToPadding="false"
@@ -50,7 +49,6 @@
             android:layout_gravity="center_horizontal"
             android:layout_marginTop="@dimen/recents_tv_dismiss_icon_top_margin"
             android:layout_marginBottom="@dimen/recents_tv_dismiss_icon_bottom_margin"
-            android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
             android:alpha="@integer/dismiss_unselected_alpha"
             android:src="@drawable/recents_tv_dismiss_icon" />
     <TextView
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
index ecb64f6..1a55958 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
@@ -388,6 +388,26 @@
             mTaskStackHorizontalGridView.setSelectedPosition(0);
         }
 
+        View dismissPlaceholder = findViewById(R.id.dismiss_placeholder);
+        if (ssp.isTouchExplorationEnabled()) {
+            dismissPlaceholder.setAccessibilityTraversalBefore(R.id.task_list);
+            dismissPlaceholder.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
+            mTaskStackHorizontalGridView.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
+            mTaskStackHorizontalGridView.setAccessibilityTraversalBefore(R.id.pip);
+            dismissPlaceholder.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mTaskStackHorizontalGridView.requestFocus();
+                    mTaskStackHorizontalGridView.
+                            sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
+                    Task focusedTask = mTaskStackHorizontalGridView.getFocusedTask();
+                    if (focusedTask != null) {
+                        mTaskStackViewAdapter.removeTask(focusedTask);
+                        EventBus.getDefault().send(new DeleteTaskDataEvent(focusedTask));
+                    }
+                }
+            });
+        }
         updatePipUI();
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
index b082658..06b2441 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
@@ -54,6 +54,7 @@
     private TaskStack mStack;
     private TaskStackHorizontalGridView mTaskStackHorizontalView;
     private View mEmptyView;
+    private View mDismissPlaceholder;
     private RecentsRowFocusAnimationHolder mEmptyViewFocusAnimationHolder;
     private boolean mAwaitingFirstLayout = true;
     private Rect mSystemInsets = new Rect();
@@ -86,6 +87,12 @@
         mTransitionHelper = new RecentsTvTransitionHelper(mContext, mHandler);
     }
 
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        mDismissPlaceholder = findViewById(R.id.dismiss_placeholder);
+    }
+
     public void setTaskStack(TaskStack stack) {
         RecentsConfiguration config = Recents.getConfiguration();
         RecentsActivityLaunchState launchState = config.getLaunchState();
@@ -198,6 +205,9 @@
     public void showEmptyView() {
         mEmptyView.setVisibility(View.VISIBLE);
         mTaskStackHorizontalView.setVisibility(View.GONE);
+        if (Recents.getSystemServices().isTouchExplorationEnabled()) {
+            mDismissPlaceholder.setVisibility(View.GONE);
+        }
     }
 
     /**
@@ -206,6 +216,9 @@
     public void hideEmptyView() {
         mEmptyView.setVisibility(View.GONE);
         mTaskStackHorizontalView.setVisibility(View.VISIBLE);
+        if (Recents.getSystemServices().isTouchExplorationEnabled()) {
+            mDismissPlaceholder.setVisibility(View.VISIBLE);
+        }
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
index bd85748..758f93a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
@@ -88,22 +88,10 @@
                 R.dimen.recents_task_view_rounded_corners_radius);
         mRecentsRowFocusAnimationHolder = new RecentsRowFocusAnimationHolder(this, title);
         SystemServicesProxy ssp = Recents.getSystemServices();
-        if (ssp.isTouchExplorationEnabled()) {
-            mDismissIconView.setFocusable(true);
-            mDismissIconView.setFocusableInTouchMode(true);
-            mDismissIconView.setOnFocusChangeListener(new OnFocusChangeListener() {
-                @Override
-                public void onFocusChange(View v, boolean hasFocus) {
-                    if (hasFocus) {
-                        setDismissState(true);
-                    } else {
-                        setDismissState(false);
-                    }
-                }
-            });
+        if (!ssp.isTouchExplorationEnabled()) {
+            mDismissIconView.setVisibility(VISIBLE);
         } else {
-            mDismissIconView.setFocusable(false);
-            mDismissIconView.setFocusableInTouchMode(false);
+            mDismissIconView.setVisibility(GONE);
         }
         mViewFocusAnimator = new ViewFocusAnimator(this);
     }
@@ -113,6 +101,7 @@
         mTitleTextView.setText(task.title);
         mBadgeView.setImageDrawable(task.icon);
         setThumbnailView();
+        setContentDescription(task.titleDescription);
     }
 
     public Task getTask() {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index a8a8553..007a7f1 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -17520,13 +17520,13 @@
                                 final boolean killProcess =
                                         !intent.getBooleanExtra(Intent.EXTRA_DONT_KILL_APP, false);
                                 final boolean fullUninstall = removed && !replacing;
-                                if (killProcess) {
-                                    forceStopPackageLocked(ssp, UserHandle.getAppId(
-                                            intent.getIntExtra(Intent.EXTRA_UID, -1)),
-                                            false, true, true, false, fullUninstall, userId,
-                                            removed ? "pkg removed" : "pkg changed");
-                                }
                                 if (removed) {
+                                    if (killProcess) {
+                                        forceStopPackageLocked(ssp, UserHandle.getAppId(
+                                                intent.getIntExtra(Intent.EXTRA_UID, -1)),
+                                                false, true, true, false, fullUninstall, userId,
+                                                removed ? "pkg removed" : "pkg changed");
+                                    }
                                     final int cmd = killProcess
                                             ? IApplicationThread.PACKAGE_REMOVED
                                             : IApplicationThread.PACKAGE_REMOVED_DONT_KILL;
@@ -17543,6 +17543,12 @@
                                         mBatteryStatsService.notePackageUninstalled(ssp);
                                     }
                                 } else {
+                                    if (killProcess) {
+                                        killPackageProcessesLocked(ssp, UserHandle.getAppId(
+                                                intent.getIntExtra(Intent.EXTRA_UID, -1)),
+                                                userId, ProcessList.INVALID_ADJ,
+                                                false, true, true, false, "change " + ssp);
+                                    }
                                     cleanupDisabledPackageComponentsLocked(ssp, userId, killProcess,
                                             intent.getStringArrayExtra(
                                                     Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST));
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index b4df10f..def6828 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -88,6 +88,9 @@
      */
     private static final long EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS = 2000;
 
+    // There is some accuracy error in wifi reports so allow some slop in the results.
+    private static final long MAX_WIFI_STATS_SAMPLE_ERROR_MILLIS = 750;
+
     private static IBatteryStats sService;
 
     final BatteryStatsImpl mStats;
@@ -1338,32 +1341,33 @@
         } else {
             final long totalActiveTimeMs = txTimeMs + rxTimeMs;
             long maxExpectedIdleTimeMs;
-            // Active time can never be greater than the total time, the stats received seem
-            // to be corrupt.
             if (totalActiveTimeMs > timePeriodMs) {
-                maxExpectedIdleTimeMs = timePeriodMs;
-                StringBuilder sb = new StringBuilder();
-                sb.append("Total Active time ");
-                TimeUtils.formatDuration(totalActiveTimeMs, sb);
-                sb.append(" is longer than sample period ");
-                TimeUtils.formatDuration(timePeriodMs, sb);
-                sb.append(".\n");
-                sb.append("Previous WiFi snapshot: ").append("idle=");
-                TimeUtils.formatDuration(lastIdleMs, sb);
-                sb.append(" rx=");
-                TimeUtils.formatDuration(lastRxMs, sb);
-                sb.append(" tx=");
-                TimeUtils.formatDuration(lastTxMs, sb);
-                sb.append(" e=").append(lastEnergy);
-                sb.append("\n");
-                sb.append("Current WiFi snapshot: ").append("idle=");
-                TimeUtils.formatDuration(latest.mControllerIdleTimeMs, sb);
-                sb.append(" rx=");
-                TimeUtils.formatDuration(latest.mControllerRxTimeMs, sb);
-                sb.append(" tx=");
-                TimeUtils.formatDuration(latest.mControllerTxTimeMs, sb);
-                sb.append(" e=").append(latest.mControllerEnergyUsed);
-                Slog.wtf(TAG, sb.toString());
+                // Cap the max idle time at zero since the active time consumed the whole time
+                maxExpectedIdleTimeMs = 0;
+                if (totalActiveTimeMs > timePeriodMs + MAX_WIFI_STATS_SAMPLE_ERROR_MILLIS) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append("Total Active time ");
+                    TimeUtils.formatDuration(totalActiveTimeMs, sb);
+                    sb.append(" is longer than sample period ");
+                    TimeUtils.formatDuration(timePeriodMs, sb);
+                    sb.append(".\n");
+                    sb.append("Previous WiFi snapshot: ").append("idle=");
+                    TimeUtils.formatDuration(lastIdleMs, sb);
+                    sb.append(" rx=");
+                    TimeUtils.formatDuration(lastRxMs, sb);
+                    sb.append(" tx=");
+                    TimeUtils.formatDuration(lastTxMs, sb);
+                    sb.append(" e=").append(lastEnergy);
+                    sb.append("\n");
+                    sb.append("Current WiFi snapshot: ").append("idle=");
+                    TimeUtils.formatDuration(latest.mControllerIdleTimeMs, sb);
+                    sb.append(" rx=");
+                    TimeUtils.formatDuration(latest.mControllerRxTimeMs, sb);
+                    sb.append(" tx=");
+                    TimeUtils.formatDuration(latest.mControllerTxTimeMs, sb);
+                    sb.append(" e=").append(latest.mControllerEnergyUsed);
+                    Slog.wtf(TAG, sb.toString());
+                }
             } else {
                 maxExpectedIdleTimeMs = timePeriodMs - totalActiveTimeMs;
             }
diff --git a/services/core/java/com/android/server/net/NetworkStatsObservers.java b/services/core/java/com/android/server/net/NetworkStatsObservers.java
index 230c2e9..ea36170 100644
--- a/services/core/java/com/android/server/net/NetworkStatsObservers.java
+++ b/services/core/java/com/android/server/net/NetworkStatsObservers.java
@@ -190,11 +190,9 @@
 
     private void handleUpdateStats(StatsContext statsContext) {
         if (mDataUsageRequests.size() == 0) {
-            if (LOGV) Slog.v(TAG, "No registered listeners of data usage");
             return;
         }
 
-        if (LOGV) Slog.v(TAG, "Checking if any registered observer needs to be notified");
         for (int i = 0; i < mDataUsageRequests.size(); i++) {
             RequestInfo requestInfo = mDataUsageRequests.valueAt(i);
             requestInfo.updateStats(statsContext);
@@ -371,9 +369,6 @@
             NetworkStats stats = mCollection.getSummary(template,
                     Long.MIN_VALUE /* start */, Long.MAX_VALUE /* end */,
                     mAccessLevel, mCallingUid);
-            if (LOGV) {
-                Slog.v(TAG, "Netstats for " + template + ": " + stats);
-            }
             return stats.getTotalBytes();
         }
     }
@@ -391,11 +386,6 @@
 
             for (int i = 0; i < uidsToMonitor.length; i++) {
                 long bytesSoFar = getTotalBytesForNetworkUid(mRequest.template, uidsToMonitor[i]);
-
-                if (LOGV) {
-                    Slog.v(TAG, bytesSoFar + " bytes so far since notification for "
-                            + mRequest.template + " for uid=" + uidsToMonitor[i]);
-                }
                 if (bytesSoFar > mRequest.thresholdInBytes) {
                     return true;
                 }
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5fdb1e8..0cafb93 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2589,8 +2589,15 @@
             final PhoneWindow win = new PhoneWindow(context);
             win.setIsStartingWindow(true);
 
+            final WindowManager.LayoutParams params = win.getAttributes();
             final Resources r = context.getResources();
-            win.setTitle(r.getText(labelRes, nonLocalizedLabel));
+            CharSequence label = r.getText(labelRes);
+            // Only change the accessibility title if the label is localized
+            if (label != null) {
+                win.setTitle(label, true);
+            } else {
+                win.setTitle(nonLocalizedLabel, false);
+            }
 
             win.setType(
                 WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
@@ -2624,7 +2631,6 @@
             win.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
                     WindowManager.LayoutParams.MATCH_PARENT);
 
-            final WindowManager.LayoutParams params = win.getAttributes();
             params.token = appToken;
             params.packageName = packageName;
             params.windowAnimations = win.getWindowStyle().getResourceId(
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index 101f56f..8be5dfb 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -1203,9 +1203,6 @@
             window.layer = windowState.mLayer;
             window.token = windowState.mClient.asBinder();
             window.title = windowState.mAttrs.accessibilityTitle;
-            if (window.title == null) {
-                window.title = windowState.mAttrs.getTitle();
-            }
             window.accessibilityIdOfAnchor = windowState.mAttrs.accessibilityIdOfAnchor;
 
             WindowState attachedWindow = windowState.mAttachedWindow;
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index f51fd8a..114d9be 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -17,6 +17,7 @@
 package com.android.server.wm;
 
 import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
+import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
 import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
 import static android.app.ActivityManager.StackId.HOME_STACK_ID;
 import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
@@ -380,6 +381,11 @@
     }
 
     private boolean updateBoundsAfterConfigChange() {
+        if (mDisplayContent == null) {
+            // If the stack is already detached we're not updating anything,
+            // as it's going away soon anyway.
+            return false;
+        }
         final int newRotation = getDisplayInfo().rotation;
         final int newDensity = getDisplayInfo().logicalDensityDpi;
 
@@ -403,6 +409,13 @@
             snapDockedStackAfterRotation(mTmpRect2);
             final int newDockSide = getDockSide(mTmpRect2);
             if (oldDockSide != newDockSide) {
+                // Update the dock create mode and clear the dock create bounds, these
+                // might change after a rotation and the original values will be invalid.
+                mService.setDockedStackCreateStateLocked(
+                        (newDockSide == DOCKED_LEFT || newDockSide == DOCKED_TOP)
+                        ? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT
+                        : DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT,
+                        null);
                 mDisplayContent.getDockedDividerController().notifyDockSideChanged(newDockSide);
             }
         }
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index d496510..c7148c1 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -4959,11 +4959,15 @@
 
     public void setDockedStackCreateState(int mode, Rect bounds) {
         synchronized (mWindowMap) {
-            mDockedStackCreateMode = mode;
-            mDockedStackCreateBounds = bounds;
+            setDockedStackCreateStateLocked(mode, bounds);
         }
     }
 
+    void setDockedStackCreateStateLocked(int mode, Rect bounds) {
+        mDockedStackCreateMode = mode;
+        mDockedStackCreateBounds = bounds;
+    }
+
     /**
      * Create a new TaskStack and place it on a DisplayContent.
      * @param stackId The unique identifier of the new stack.
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 78efd05..613fae4 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -837,28 +837,9 @@
      * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
      * @return A {@link PersistableBundle} containing the config for the given subId, or default
      *         values for an invalid subId.
-     *
-     * @deprecated use getConfig.
      */
     @Nullable
     public PersistableBundle getConfigForSubId(int subId) {
-        return getConfig(subId);
-    }
-
-    /**
-     * Gets the configuration values for a particular subscription, which is associated with a
-     * specific SIM card. If an invalid subId is used, the returned config will contain default
-     * values.
-     *
-     * <p>Requires Permission:
-     * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
-     *
-     * @param subId the subscription ID, normally obtained from {@link SubscriptionManager}.
-     * @return A {@link PersistableBundle} containing the config for the given subId, or default
-     *         values for an invalid subId.
-     */
-    @Nullable
-    public PersistableBundle getConfig(int subId) {
         try {
             ICarrierConfigLoader loader = getICarrierConfigLoader();
             if (loader == null) {
@@ -880,11 +861,11 @@
      * <p>Requires Permission:
      * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
      *
-     * @return A {@link PersistableBundle} containing the config for the default subscription.
+     * @see #getConfigForSubId
      */
     @Nullable
     public PersistableBundle getConfig() {
-        return getConfig(SubscriptionManager.getDefaultSubscriptionId());
+        return getConfigForSubId(SubscriptionManager.getDefaultSubscriptionId());
     }
 
     /**
@@ -901,29 +882,8 @@
      * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an
      * arbitrary thread.
      * </p>
-     *
-     * @deprecated use notifyConfigChanged.
      */
     public void notifyConfigChangedForSubId(int subId) {
-        notifyConfigChanged(subId);
-    }
-
-    /**
-     * Calling this method triggers telephony services to fetch the current carrier configuration.
-     * <p>
-     * Normally this does not need to be called because the platform reloads config on its own.
-     * This should be called by a carrier service app if it wants to update config at an arbitrary
-     * moment.
-     * </p>
-     * <p>Requires that the calling app has carrier privileges.
-     * @see #hasCarrierPrivileges
-     * <p>
-     * This method returns before the reload has completed, and
-     * {@link android.service.carrier.CarrierService#onLoadConfig} will be called from an
-     * arbitrary thread.
-     * </p>
-     */
-    public void notifyConfigChanged(int subId) {
         try {
             ICarrierConfigLoader loader = getICarrierConfigLoader();
             if (loader == null) {
diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java
index 3743fb08..5ef71df 100644
--- a/test-runner/src/android/test/mock/MockContentProvider.java
+++ b/test-runner/src/android/test/mock/MockContentProvider.java
@@ -41,12 +41,7 @@
  * Mock implementation of ContentProvider.  All methods are non-functional and throw
  * {@link java.lang.UnsupportedOperationException}.  Tests can extend this class to
  * implement behavior needed for tests.
- *
- * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>.
- * New tests should be written using the
- * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>.
  */
-@Deprecated
 public class MockContentProvider extends ContentProvider {
     /*
      * Note: if you add methods to ContentProvider, you must add similar methods to
diff --git a/test-runner/src/android/test/mock/MockContentResolver.java b/test-runner/src/android/test/mock/MockContentResolver.java
index 75c8335..d8e0977 100644
--- a/test-runner/src/android/test/mock/MockContentResolver.java
+++ b/test-runner/src/android/test/mock/MockContentResolver.java
@@ -49,12 +49,7 @@
  * <p>For more information about application testing, read the
  * <a href="{@docRoot}guide/topics/testing/index.html">Testing</a> developer guide.</p>
  * </div>
- *
- * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>.
- * New tests should be written using the
- * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>.
  */
-@Deprecated
 public class MockContentResolver extends ContentResolver {
     Map<String, ContentProvider> mProviders;
 
diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java
index c7cbf97..b14fc41 100644
--- a/test-runner/src/android/test/mock/MockContext.java
+++ b/test-runner/src/android/test/mock/MockContext.java
@@ -55,12 +55,7 @@
  * A mock {@link android.content.Context} class.  All methods are non-functional and throw
  * {@link java.lang.UnsupportedOperationException}.  You can use this to inject other dependencies,
  * mocks, or monitors into the classes you are testing.
- *
- * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>.
- * New tests should be written using the
- * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>.
  */
-@Deprecated
 public class MockContext extends Context {
 
     @Override