Merge "Make Work Directory API as Enterprise API"
diff --git a/Android.mk b/Android.mk
index f5d5a11..2673cd8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -261,6 +261,7 @@
 	core/java/android/view/IApplicationToken.aidl \
 	core/java/android/view/IAppTransitionAnimationSpecsFuture.aidl \
 	core/java/android/view/IAssetAtlas.aidl \
+	core/java/android/view/IDockDividerVisibilityListener.aidl \
 	core/java/android/view/IGraphicsStats.aidl \
 	core/java/android/view/IInputFilter.aidl \
 	core/java/android/view/IInputFilterHost.aidl \
@@ -676,6 +677,16 @@
   $(fwbase_dirs_to_document) \
 	$(non_base_dirs)
 
+###########################################################
+## Return all directories that have a 'NO_DOCS' file in
+## them, appending a '%' to them to form a pattern to
+## filter out files under those directories.
+## $(1): A list of base directories to look at.
+###########################################################
+define find-no-docs-pattern
+$(addsuffix %, $(dir $(foreach dir, $(1), $(shell cd $(LOCAL_PATH); find $(dir) -name NO_DOCS))))
+endef
+
 # These are relative to frameworks/base
 # FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk
 dirs_to_document := \
@@ -683,6 +694,9 @@
   $(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS)) \
   $(addprefix ../../, $(FRAMEWORKS_SUPPORT_JAVA_SRC_DIRS)) \
 
+patterns_to_not_document := \
+	$(call find-no-docs-pattern, $(dirs_to_document))
+
 # These are relative to frameworks/base
 html_dirs := \
 	$(FRAMEWORKS_BASE_SUBDIRS) \
@@ -696,9 +710,11 @@
 
 # These are relative to frameworks/base
 framework_docs_LOCAL_SRC_FILES := \
-	$(call find-other-java-files, $(dirs_to_document)) \
+	$(filter-out $(patterns_to_not_document), $(call find-other-java-files, $(dirs_to_document))) \
 	$(common_src_files)
 
+#	$(call find-other-java-files, $(dirs_to_document)) \
+
 # These are relative to frameworks/base
 framework_docs_LOCAL_API_CHECK_SRC_FILES := \
 	$(call find-other-java-files, $(dirs_to_check_apis)) \
diff --git a/api/current.txt b/api/current.txt
index e05f0e6..aba695e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28,6 +28,7 @@
     field public static final java.lang.String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD";
     field public static final java.lang.String BIND_MIDI_DEVICE_SERVICE = "android.permission.BIND_MIDI_DEVICE_SERVICE";
     field public static final java.lang.String BIND_NFC_SERVICE = "android.permission.BIND_NFC_SERVICE";
+    field public static final java.lang.String BIND_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
     field public static final java.lang.String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
     field public static final java.lang.String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE";
     field public static final java.lang.String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
@@ -5529,6 +5530,8 @@
     method public void enableCarMode(int);
     method public int getCurrentModeType();
     method public int getNightMode();
+    method public boolean isNightModeLocked();
+    method public boolean isUiModeLocked();
     method public void setNightMode(int);
     field public static java.lang.String ACTION_ENTER_CAR_MODE;
     field public static java.lang.String ACTION_ENTER_DESK_MODE;
@@ -7441,12 +7444,16 @@
     method public static boolean compareMimeTypes(java.lang.String, java.lang.String);
     method public int describeContents();
     method public java.lang.String[] filterMimeTypes(java.lang.String);
+    method public android.os.PersistableBundle getExtras();
     method public java.lang.CharSequence getLabel();
     method public java.lang.String getMimeType(int);
     method public int getMimeTypeCount();
     method public boolean hasMimeType(java.lang.String);
+    method public void setExtras(android.os.PersistableBundle);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
+    field public static final java.lang.String EXTRA_TARGET_COMPONENT_NAME = "android.content.extra.TARGET_COMPONENT_NAME";
+    field public static final java.lang.String EXTRA_USER_SERIAL_NUMBER = "android.content.extra.USER_SERIAL_NUMBER";
     field public static final java.lang.String MIMETYPE_TEXT_HTML = "text/html";
     field public static final java.lang.String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
     field public static final java.lang.String MIMETYPE_TEXT_PLAIN = "text/plain";
@@ -7809,6 +7816,7 @@
     method public abstract java.lang.String getPackageResourcePath();
     method public abstract android.content.res.Resources getResources();
     method public abstract android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public final java.lang.String getString(int);
     method public final java.lang.String getString(int, java.lang.Object...);
     method public abstract java.lang.Object getSystemService(java.lang.String);
@@ -7907,6 +7915,7 @@
     field public static final int MODE_APPEND = 32768; // 0x8000
     field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
     field public static final deprecated int MODE_MULTI_PROCESS = 4; // 0x4
+    field public static final int MODE_NO_LOCALIZED_COLLATORS = 16; // 0x10
     field public static final int MODE_PRIVATE = 0; // 0x0
     field public static final deprecated int MODE_WORLD_READABLE = 1; // 0x1
     field public static final deprecated int MODE_WORLD_WRITEABLE = 2; // 0x2
@@ -7991,6 +8000,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -8278,6 +8288,7 @@
     field public static final java.lang.String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT";
     field public static final java.lang.String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE";
     field public static final java.lang.String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
+    field public static final java.lang.String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
     field public static final java.lang.String ACTION_MAIN = "android.intent.action.MAIN";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_ADDED = "android.intent.action.MANAGED_PROFILE_ADDED";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_REMOVED = "android.intent.action.MANAGED_PROFILE_REMOVED";
@@ -8344,6 +8355,7 @@
     field public static final java.lang.String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND";
     field public static final java.lang.String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE";
     field public static final java.lang.String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
+    field public static final java.lang.String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
     field public static final java.lang.String ACTION_VIEW = "android.intent.action.VIEW";
     field public static final java.lang.String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
     field public static final deprecated java.lang.String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
@@ -13880,7 +13892,7 @@
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
     field public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_DYNAMIC_BLACK_LEVEL;
+    field public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
@@ -28057,6 +28069,7 @@
     method public boolean isUserAGoat();
     method public boolean isUserRunning(android.os.UserHandle);
     method public boolean isUserRunningOrStopping(android.os.UserHandle);
+    method public boolean isUserRunningUnlocked(android.os.UserHandle);
     method public deprecated boolean setRestrictionsChallenge(java.lang.String);
     method public deprecated void setUserRestriction(java.lang.String, boolean);
     method public deprecated void setUserRestrictions(android.os.Bundle);
@@ -28861,6 +28874,8 @@
     method public boolean isFailed();
     method public boolean isQueued();
     method public boolean isStarted();
+    method public void setProgress(float);
+    method public void setStatus(java.lang.CharSequence);
     method public boolean setTag(java.lang.String);
     method public boolean start();
   }
@@ -29620,6 +29635,7 @@
     ctor public ContactsContract.CommonDataKinds.Callable();
     field public static final android.net.Uri CONTENT_FILTER_URI;
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -29766,6 +29782,7 @@
     field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
     field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -30424,6 +30441,7 @@
     field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type";
     field public static final java.lang.String COLUMN_SIZE = "_size";
     field public static final java.lang.String COLUMN_SUMMARY = "summary";
+    field public static final int FLAG_ARCHIVE = 2048; // 0x800
     field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10
     field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20
     field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8
@@ -31403,7 +31421,10 @@
   public static final class Telephony.Sms.Intents {
     method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent);
     field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
+    field public static final java.lang.String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
+    field public static final java.lang.String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
     field public static final java.lang.String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
+    field public static final java.lang.String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP";
     field public static final java.lang.String EXTRA_PACKAGE_NAME = "package";
     field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5
     field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2
@@ -33134,6 +33155,35 @@
     field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
   }
 
+  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
+    ctor public NotificationAssistantService();
+    method public final void adjustImportance(java.lang.String, android.service.notification.NotificationAssistantService.Adjustment);
+    method public final void clearAnnotation(java.lang.String);
+    method public void onNotificationActionClick(java.lang.String, long, int);
+    method public void onNotificationClick(java.lang.String, long);
+    method public abstract android.service.notification.NotificationAssistantService.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification, int, boolean);
+    method public void onNotificationRemoved(java.lang.String, long, int);
+    method public void onNotificationVisibilityChanged(java.lang.String, long, boolean);
+    method public final void setAnnotation(java.lang.String, android.app.Notification);
+    field public static final int REASON_APP_CANCEL = 8; // 0x8
+    field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9
+    field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2
+    field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3
+    field public static final int REASON_DELEGATE_CLICK = 1; // 0x1
+    field public static final int REASON_DELEGATE_ERROR = 4; // 0x4
+    field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd
+    field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc
+    field public static final int REASON_LISTENER_CANCEL = 10; // 0xa
+    field public static final int REASON_LISTENER_CANCEL_ALL = 11; // 0xb
+    field public static final int REASON_PACKAGE_BANNED = 7; // 0x7
+    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
+    field public static final int REASON_USER_STOPPED = 6; // 0x6
+  }
+
+  public class NotificationAssistantService.Adjustment {
+    ctor public NotificationAssistantService.Adjustment(int, java.lang.CharSequence, android.net.Uri);
+  }
+
   public abstract class NotificationListenerService extends android.app.Service {
     ctor public NotificationListenerService();
     method public final void cancelAllNotifications();
@@ -33170,11 +33220,19 @@
 
   public static class NotificationListenerService.Ranking {
     ctor public NotificationListenerService.Ranking();
+    method public int getImportance();
+    method public java.lang.CharSequence getImportanceExplanation();
     method public java.lang.String getKey();
     method public int getRank();
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
+    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
+    field public static final int IMPORTANCE_HIGH = 1; // 0x1
+    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
+    field public static final int IMPORTANCE_MAX = 2; // 0x2
+    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
   public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
@@ -33231,6 +33289,7 @@
     method public void onStopListening();
     method public void onTileAdded();
     method public void onTileRemoved();
+    method public final void showDialog(android.app.Dialog);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
   }
 
@@ -36197,6 +36256,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -38594,10 +38654,11 @@
     field public static final int RTL = 1; // 0x1
   }
 
-  public final class LocaleList {
+  public final class LocaleList implements android.os.Parcelable {
     ctor public LocaleList();
     ctor public LocaleList(java.util.Locale);
     ctor public LocaleList(java.util.Locale[]);
+    method public int describeContents();
     method public static android.util.LocaleList forLanguageTags(java.lang.String);
     method public java.util.Locale get(int);
     method public java.util.Locale getBestMatch(java.lang.String[]);
@@ -38607,6 +38668,8 @@
     method public boolean isEmpty();
     method public int size();
     method public java.lang.String toLanguageTags();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR;
   }
 
   public final class Log {
@@ -42890,6 +42953,7 @@
     field public int initialSelStart;
     field public int inputType;
     field public java.lang.CharSequence label;
+    field public android.util.LocaleList locales;
     field public java.lang.String packageName;
     field public java.lang.String privateImeOptions;
   }
@@ -64028,4 +64092,3 @@
   }
 
 }
-
diff --git a/api/system-current.txt b/api/system-current.txt
index ee7ece8..524cda8 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -41,6 +41,7 @@
     field public static final java.lang.String BIND_KEYGUARD_APPWIDGET = "android.permission.BIND_KEYGUARD_APPWIDGET";
     field public static final java.lang.String BIND_MIDI_DEVICE_SERVICE = "android.permission.BIND_MIDI_DEVICE_SERVICE";
     field public static final java.lang.String BIND_NFC_SERVICE = "android.permission.BIND_NFC_SERVICE";
+    field public static final java.lang.String BIND_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
     field public static final java.lang.String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
     field public static final java.lang.String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE";
     field public static final java.lang.String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
@@ -100,6 +101,7 @@
     field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
     field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE";
     field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE";
+    field public static final java.lang.String GET_PROCESS_STATE_AND_OOM_SCORE = "android.permission.GET_PROCESS_STATE_AND_OOM_SCORE";
     field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS";
     field public static final java.lang.String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO";
     field public static final java.lang.String GLOBAL_SEARCH = "android.permission.GLOBAL_SEARCH";
@@ -132,6 +134,7 @@
     field public static final java.lang.String MODIFY_AUDIO_ROUTING = "android.permission.MODIFY_AUDIO_ROUTING";
     field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
     field public static final java.lang.String MODIFY_CELL_BROADCASTS = "android.permission.MODIFY_CELL_BROADCASTS";
+    field public static final java.lang.String MODIFY_DAY_NIGHT_MODE = "android.permission.MODIFY_DAY_NIGHT_MODE";
     field public static final java.lang.String MODIFY_NETWORK_ACCOUNTING = "android.permission.MODIFY_NETWORK_ACCOUNTING";
     field public static final java.lang.String MODIFY_PARENTAL_CONTROLS = "android.permission.MODIFY_PARENTAL_CONTROLS";
     field public static final java.lang.String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
@@ -5647,6 +5650,8 @@
     method public void enableCarMode(int);
     method public int getCurrentModeType();
     method public int getNightMode();
+    method public boolean isNightModeLocked();
+    method public boolean isUiModeLocked();
     method public void setNightMode(int);
     field public static java.lang.String ACTION_ENTER_CAR_MODE;
     field public static java.lang.String ACTION_ENTER_DESK_MODE;
@@ -7682,12 +7687,16 @@
     method public static boolean compareMimeTypes(java.lang.String, java.lang.String);
     method public int describeContents();
     method public java.lang.String[] filterMimeTypes(java.lang.String);
+    method public android.os.PersistableBundle getExtras();
     method public java.lang.CharSequence getLabel();
     method public java.lang.String getMimeType(int);
     method public int getMimeTypeCount();
     method public boolean hasMimeType(java.lang.String);
+    method public void setExtras(android.os.PersistableBundle);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
+    field public static final java.lang.String EXTRA_TARGET_COMPONENT_NAME = "android.content.extra.TARGET_COMPONENT_NAME";
+    field public static final java.lang.String EXTRA_USER_SERIAL_NUMBER = "android.content.extra.USER_SERIAL_NUMBER";
     field public static final java.lang.String MIMETYPE_TEXT_HTML = "text/html";
     field public static final java.lang.String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
     field public static final java.lang.String MIMETYPE_TEXT_PLAIN = "text/plain";
@@ -8052,6 +8061,7 @@
     method public abstract java.lang.String getPackageResourcePath();
     method public abstract android.content.res.Resources getResources();
     method public abstract android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public final java.lang.String getString(int);
     method public final java.lang.String getString(int, java.lang.Object...);
     method public abstract java.lang.Object getSystemService(java.lang.String);
@@ -8154,6 +8164,7 @@
     field public static final int MODE_APPEND = 32768; // 0x8000
     field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
     field public static final deprecated int MODE_MULTI_PROCESS = 4; // 0x4
+    field public static final int MODE_NO_LOCALIZED_COLLATORS = 16; // 0x10
     field public static final int MODE_PRIVATE = 0; // 0x0
     field public static final deprecated int MODE_WORLD_READABLE = 1; // 0x1
     field public static final deprecated int MODE_WORLD_WRITEABLE = 2; // 0x2
@@ -8243,6 +8254,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -8534,6 +8546,7 @@
     field public static final java.lang.String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE";
     field public static final java.lang.String ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION";
     field public static final java.lang.String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
+    field public static final java.lang.String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
     field public static final java.lang.String ACTION_MAIN = "android.intent.action.MAIN";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_ADDED = "android.intent.action.MANAGED_PROFILE_ADDED";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_REMOVED = "android.intent.action.MANAGED_PROFILE_REMOVED";
@@ -8602,6 +8615,7 @@
     field public static final java.lang.String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND";
     field public static final java.lang.String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE";
     field public static final java.lang.String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
+    field public static final java.lang.String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
     field public static final java.lang.String ACTION_VIEW = "android.intent.action.VIEW";
     field public static final java.lang.String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
     field public static final deprecated java.lang.String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
@@ -14228,7 +14242,7 @@
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
     field public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_DYNAMIC_BLACK_LEVEL;
+    field public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
@@ -30040,6 +30054,7 @@
     method public boolean isUserAGoat();
     method public boolean isUserRunning(android.os.UserHandle);
     method public boolean isUserRunningOrStopping(android.os.UserHandle);
+    method public boolean isUserRunningUnlocked(android.os.UserHandle);
     method public deprecated boolean setRestrictionsChallenge(java.lang.String);
     method public deprecated void setUserRestriction(java.lang.String, boolean);
     method public deprecated void setUserRestrictions(android.os.Bundle);
@@ -30844,6 +30859,8 @@
     method public boolean isFailed();
     method public boolean isQueued();
     method public boolean isStarted();
+    method public void setProgress(float);
+    method public void setStatus(java.lang.CharSequence);
     method public boolean setTag(java.lang.String);
     method public boolean start();
   }
@@ -31603,6 +31620,7 @@
     ctor public ContactsContract.CommonDataKinds.Callable();
     field public static final android.net.Uri CONTENT_FILTER_URI;
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -31749,6 +31767,7 @@
     field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
     field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -32437,6 +32456,7 @@
     field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type";
     field public static final java.lang.String COLUMN_SIZE = "_size";
     field public static final java.lang.String COLUMN_SUMMARY = "summary";
+    field public static final int FLAG_ARCHIVE = 2048; // 0x800
     field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10
     field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20
     field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8
@@ -33519,7 +33539,10 @@
   public static final class Telephony.Sms.Intents {
     method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent);
     field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
+    field public static final java.lang.String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
+    field public static final java.lang.String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
     field public static final java.lang.String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
+    field public static final java.lang.String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP";
     field public static final java.lang.String EXTRA_PACKAGE_NAME = "package";
     field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5
     field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2
@@ -35250,6 +35273,35 @@
     field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
   }
 
+  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
+    ctor public NotificationAssistantService();
+    method public final void adjustImportance(java.lang.String, android.service.notification.NotificationAssistantService.Adjustment);
+    method public final void clearAnnotation(java.lang.String);
+    method public void onNotificationActionClick(java.lang.String, long, int);
+    method public void onNotificationClick(java.lang.String, long);
+    method public abstract android.service.notification.NotificationAssistantService.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification, int, boolean);
+    method public void onNotificationRemoved(java.lang.String, long, int);
+    method public void onNotificationVisibilityChanged(java.lang.String, long, boolean);
+    method public final void setAnnotation(java.lang.String, android.app.Notification);
+    field public static final int REASON_APP_CANCEL = 8; // 0x8
+    field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9
+    field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2
+    field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3
+    field public static final int REASON_DELEGATE_CLICK = 1; // 0x1
+    field public static final int REASON_DELEGATE_ERROR = 4; // 0x4
+    field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd
+    field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc
+    field public static final int REASON_LISTENER_CANCEL = 10; // 0xa
+    field public static final int REASON_LISTENER_CANCEL_ALL = 11; // 0xb
+    field public static final int REASON_PACKAGE_BANNED = 7; // 0x7
+    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
+    field public static final int REASON_USER_STOPPED = 6; // 0x6
+  }
+
+  public class NotificationAssistantService.Adjustment {
+    ctor public NotificationAssistantService.Adjustment(int, java.lang.CharSequence, android.net.Uri);
+  }
+
   public abstract class NotificationListenerService extends android.app.Service {
     ctor public NotificationListenerService();
     method public final void cancelAllNotifications();
@@ -35293,11 +35345,19 @@
 
   public static class NotificationListenerService.Ranking {
     ctor public NotificationListenerService.Ranking();
+    method public int getImportance();
+    method public java.lang.CharSequence getImportanceExplanation();
     method public java.lang.String getKey();
     method public int getRank();
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
+    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
+    field public static final int IMPORTANCE_HIGH = 1; // 0x1
+    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
+    field public static final int IMPORTANCE_MAX = 2; // 0x2
+    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
   public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
@@ -35379,6 +35439,7 @@
     method public void onStopListening();
     method public void onTileAdded();
     method public void onTileRemoved();
+    method public final void showDialog(android.app.Dialog);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
   }
 
@@ -38512,6 +38573,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -40918,10 +40980,11 @@
     field public static final int RTL = 1; // 0x1
   }
 
-  public final class LocaleList {
+  public final class LocaleList implements android.os.Parcelable {
     ctor public LocaleList();
     ctor public LocaleList(java.util.Locale);
     ctor public LocaleList(java.util.Locale[]);
+    method public int describeContents();
     method public static android.util.LocaleList forLanguageTags(java.lang.String);
     method public java.util.Locale get(int);
     method public java.util.Locale getBestMatch(java.lang.String[]);
@@ -40931,6 +40994,8 @@
     method public boolean isEmpty();
     method public int size();
     method public java.lang.String toLanguageTags();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR;
   }
 
   public final class Log {
@@ -45217,6 +45282,7 @@
     field public int initialSelStart;
     field public int inputType;
     field public java.lang.CharSequence label;
+    field public android.util.LocaleList locales;
     field public java.lang.String packageName;
     field public java.lang.String privateImeOptions;
   }
diff --git a/api/test-current.txt b/api/test-current.txt
index e05f0e6..8ab19c4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -28,6 +28,7 @@
     field public static final java.lang.String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD";
     field public static final java.lang.String BIND_MIDI_DEVICE_SERVICE = "android.permission.BIND_MIDI_DEVICE_SERVICE";
     field public static final java.lang.String BIND_NFC_SERVICE = "android.permission.BIND_NFC_SERVICE";
+    field public static final java.lang.String BIND_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
     field public static final java.lang.String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
     field public static final java.lang.String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE";
     field public static final java.lang.String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
@@ -5529,6 +5530,8 @@
     method public void enableCarMode(int);
     method public int getCurrentModeType();
     method public int getNightMode();
+    method public boolean isNightModeLocked();
+    method public boolean isUiModeLocked();
     method public void setNightMode(int);
     field public static java.lang.String ACTION_ENTER_CAR_MODE;
     field public static java.lang.String ACTION_ENTER_DESK_MODE;
@@ -7441,12 +7444,16 @@
     method public static boolean compareMimeTypes(java.lang.String, java.lang.String);
     method public int describeContents();
     method public java.lang.String[] filterMimeTypes(java.lang.String);
+    method public android.os.PersistableBundle getExtras();
     method public java.lang.CharSequence getLabel();
     method public java.lang.String getMimeType(int);
     method public int getMimeTypeCount();
     method public boolean hasMimeType(java.lang.String);
+    method public void setExtras(android.os.PersistableBundle);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
+    field public static final java.lang.String EXTRA_TARGET_COMPONENT_NAME = "android.content.extra.TARGET_COMPONENT_NAME";
+    field public static final java.lang.String EXTRA_USER_SERIAL_NUMBER = "android.content.extra.USER_SERIAL_NUMBER";
     field public static final java.lang.String MIMETYPE_TEXT_HTML = "text/html";
     field public static final java.lang.String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
     field public static final java.lang.String MIMETYPE_TEXT_PLAIN = "text/plain";
@@ -7809,6 +7816,7 @@
     method public abstract java.lang.String getPackageResourcePath();
     method public abstract android.content.res.Resources getResources();
     method public abstract android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public final java.lang.String getString(int);
     method public final java.lang.String getString(int, java.lang.Object...);
     method public abstract java.lang.Object getSystemService(java.lang.String);
@@ -7907,6 +7915,7 @@
     field public static final int MODE_APPEND = 32768; // 0x8000
     field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
     field public static final deprecated int MODE_MULTI_PROCESS = 4; // 0x4
+    field public static final int MODE_NO_LOCALIZED_COLLATORS = 16; // 0x10
     field public static final int MODE_PRIVATE = 0; // 0x0
     field public static final deprecated int MODE_WORLD_READABLE = 1; // 0x1
     field public static final deprecated int MODE_WORLD_WRITEABLE = 2; // 0x2
@@ -7991,6 +8000,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -8278,6 +8288,7 @@
     field public static final java.lang.String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT";
     field public static final java.lang.String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE";
     field public static final java.lang.String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
+    field public static final java.lang.String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
     field public static final java.lang.String ACTION_MAIN = "android.intent.action.MAIN";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_ADDED = "android.intent.action.MANAGED_PROFILE_ADDED";
     field public static final java.lang.String ACTION_MANAGED_PROFILE_REMOVED = "android.intent.action.MANAGED_PROFILE_REMOVED";
@@ -8344,6 +8355,7 @@
     field public static final java.lang.String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND";
     field public static final java.lang.String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE";
     field public static final java.lang.String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
+    field public static final java.lang.String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
     field public static final java.lang.String ACTION_VIEW = "android.intent.action.VIEW";
     field public static final java.lang.String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
     field public static final deprecated java.lang.String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
@@ -13880,7 +13892,7 @@
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
     field public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
-    field public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_DYNAMIC_BLACK_LEVEL;
+    field public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
     field public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
@@ -28057,6 +28069,7 @@
     method public boolean isUserAGoat();
     method public boolean isUserRunning(android.os.UserHandle);
     method public boolean isUserRunningOrStopping(android.os.UserHandle);
+    method public boolean isUserRunningUnlocked(android.os.UserHandle);
     method public deprecated boolean setRestrictionsChallenge(java.lang.String);
     method public deprecated void setUserRestriction(java.lang.String, boolean);
     method public deprecated void setUserRestrictions(android.os.Bundle);
@@ -28742,7 +28755,9 @@
     method public java.lang.String getLabel();
     method public android.print.PageRange[] getPages();
     method public android.print.PrinterId getPrinterId();
+    method public float getProgress();
     method public int getState();
+    method public java.lang.CharSequence getStatus();
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.print.PrintJobInfo> CREATOR;
     field public static final int STATE_BLOCKED = 4; // 0x4
@@ -28861,6 +28876,8 @@
     method public boolean isFailed();
     method public boolean isQueued();
     method public boolean isStarted();
+    method public void setProgress(float);
+    method public void setStatus(java.lang.CharSequence);
     method public boolean setTag(java.lang.String);
     method public boolean start();
   }
@@ -29620,6 +29637,7 @@
     ctor public ContactsContract.CommonDataKinds.Callable();
     field public static final android.net.Uri CONTENT_FILTER_URI;
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -29766,6 +29784,7 @@
     field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
     field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
     field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
     field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
@@ -30424,6 +30443,7 @@
     field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type";
     field public static final java.lang.String COLUMN_SIZE = "_size";
     field public static final java.lang.String COLUMN_SUMMARY = "summary";
+    field public static final int FLAG_ARCHIVE = 2048; // 0x800
     field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10
     field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20
     field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8
@@ -31403,7 +31423,10 @@
   public static final class Telephony.Sms.Intents {
     method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent);
     field public static final java.lang.String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
+    field public static final java.lang.String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
+    field public static final java.lang.String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
     field public static final java.lang.String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
+    field public static final java.lang.String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP";
     field public static final java.lang.String EXTRA_PACKAGE_NAME = "package";
     field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5
     field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2
@@ -33134,6 +33157,35 @@
     field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
   }
 
+  public abstract class NotificationAssistantService extends android.service.notification.NotificationListenerService {
+    ctor public NotificationAssistantService();
+    method public final void adjustImportance(java.lang.String, android.service.notification.NotificationAssistantService.Adjustment);
+    method public final void clearAnnotation(java.lang.String);
+    method public void onNotificationActionClick(java.lang.String, long, int);
+    method public void onNotificationClick(java.lang.String, long);
+    method public abstract android.service.notification.NotificationAssistantService.Adjustment onNotificationEnqueued(android.service.notification.StatusBarNotification, int, boolean);
+    method public void onNotificationRemoved(java.lang.String, long, int);
+    method public void onNotificationVisibilityChanged(java.lang.String, long, boolean);
+    method public final void setAnnotation(java.lang.String, android.app.Notification);
+    field public static final int REASON_APP_CANCEL = 8; // 0x8
+    field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9
+    field public static final int REASON_DELEGATE_CANCEL = 2; // 0x2
+    field public static final int REASON_DELEGATE_CANCEL_ALL = 3; // 0x3
+    field public static final int REASON_DELEGATE_CLICK = 1; // 0x1
+    field public static final int REASON_DELEGATE_ERROR = 4; // 0x4
+    field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd
+    field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc
+    field public static final int REASON_LISTENER_CANCEL = 10; // 0xa
+    field public static final int REASON_LISTENER_CANCEL_ALL = 11; // 0xb
+    field public static final int REASON_PACKAGE_BANNED = 7; // 0x7
+    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
+    field public static final int REASON_USER_STOPPED = 6; // 0x6
+  }
+
+  public class NotificationAssistantService.Adjustment {
+    ctor public NotificationAssistantService.Adjustment(int, java.lang.CharSequence, android.net.Uri);
+  }
+
   public abstract class NotificationListenerService extends android.app.Service {
     ctor public NotificationListenerService();
     method public final void cancelAllNotifications();
@@ -33170,11 +33222,19 @@
 
   public static class NotificationListenerService.Ranking {
     ctor public NotificationListenerService.Ranking();
+    method public int getImportance();
+    method public java.lang.CharSequence getImportanceExplanation();
     method public java.lang.String getKey();
     method public int getRank();
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
+    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
+    field public static final int IMPORTANCE_HIGH = 1; // 0x1
+    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
+    field public static final int IMPORTANCE_MAX = 2; // 0x2
+    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
   public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
@@ -33231,6 +33291,7 @@
     method public void onStopListening();
     method public void onTileAdded();
     method public void onTileRemoved();
+    method public final void showDialog(android.app.Dialog);
     field public static final java.lang.String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
   }
 
@@ -36197,6 +36258,7 @@
     method public java.lang.String getPackageResourcePath();
     method public android.content.res.Resources getResources();
     method public android.content.SharedPreferences getSharedPreferences(java.lang.String, int);
+    method public android.content.SharedPreferences getSharedPreferences(java.io.File, int);
     method public java.lang.Object getSystemService(java.lang.String);
     method public java.lang.String getSystemServiceName(java.lang.Class<?>);
     method public android.content.res.Resources.Theme getTheme();
@@ -38594,10 +38656,11 @@
     field public static final int RTL = 1; // 0x1
   }
 
-  public final class LocaleList {
+  public final class LocaleList implements android.os.Parcelable {
     ctor public LocaleList();
     ctor public LocaleList(java.util.Locale);
     ctor public LocaleList(java.util.Locale[]);
+    method public int describeContents();
     method public static android.util.LocaleList forLanguageTags(java.lang.String);
     method public java.util.Locale get(int);
     method public java.util.Locale getBestMatch(java.lang.String[]);
@@ -38607,6 +38670,8 @@
     method public boolean isEmpty();
     method public int size();
     method public java.lang.String toLanguageTags();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR;
   }
 
   public final class Log {
@@ -42890,6 +42955,7 @@
     field public int initialSelStart;
     field public int inputType;
     field public java.lang.CharSequence label;
+    field public android.util.LocaleList locales;
     field public java.lang.String packageName;
     field public java.lang.String privateImeOptions;
   }
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index daf01ec..2ad63b5 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -154,7 +154,7 @@
                 "       am switch-user <USER_ID>\n" +
                 "       am start-user <USER_ID>\n" +
                 "       am unlock-user <USER_ID> [TOKEN_HEX]\n" +
-                "       am stop-user [-w] <USER_ID>\n" +
+                "       am stop-user [-w] [-f] <USER_ID>\n" +
                 "       am stack start <DISPLAY_ID> <INTENT>\n" +
                 "       am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" +
                 "       am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" +
@@ -290,6 +290,7 @@
                 "am stop-user: stop execution of USER_ID, not allowing it to run any\n" +
                 "  code until a later explicit start or switch to it.\n" +
                 "  -w: wait for stop-user to complete.\n" +
+                "  -f: force stop even if there are related users that cannot be stopped.\n" +
                 "\n" +
                 "am stack start: start a new activity on <DISPLAY_ID> using <INTENT>.\n" +
                 "\n" +
@@ -1131,10 +1132,13 @@
 
     private void runStopUser() throws Exception {
         boolean wait = false;
-        String opt = null;
+        boolean force = false;
+        String opt;
         while ((opt = nextOption()) != null) {
             if ("-w".equals(opt)) {
                 wait = true;
+            } else if ("-f".equals(opt)) {
+                force = true;
             } else {
                 System.err.println("Error: unknown option: " + opt);
                 return;
@@ -1143,7 +1147,7 @@
         int user = Integer.parseInt(nextArgRequired());
         StopUserCallback callback = wait ? new StopUserCallback() : null;
 
-        int res = mAm.stopUser(user, callback);
+        int res = mAm.stopUser(user, force, callback);
         if (res != ActivityManager.USER_OP_SUCCESS) {
             String txt = "";
             switch (res) {
@@ -1153,6 +1157,13 @@
                 case ActivityManager.USER_OP_UNKNOWN_USER:
                     txt = " (Unknown user " + user + ")";
                     break;
+                case ActivityManager.USER_OP_ERROR_IS_SYSTEM:
+                    txt = " (System user cannot be stopped)";
+                    break;
+                case ActivityManager.USER_OP_ERROR_RELATED_USERS_CANNOT_STOP:
+                    txt = " (Can't stop user " + user
+                            + " - one of its related users can't be stopped)";
+                    break;
             }
             System.err.println("Switch failed: " + res + txt);
         } else if (callback != null) {
diff --git a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
index 726167e..e63a1f5 100644
--- a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
+++ b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
@@ -76,7 +76,12 @@
                         // --user specified more than once; invalid
                         break;
                     }
-                    mUser = Integer.parseInt(nextArg());
+                    arg = nextArg();
+                    if ("current".equals(arg) || "cur".equals(arg)) {
+                        mUser = UserHandle.USER_CURRENT;
+                    } else {
+                        mUser = Integer.parseInt(arg);
+                    }
                 } else if (mVerb == CommandVerb.UNSPECIFIED) {
                     if ("get".equalsIgnoreCase(arg)) {
                         mVerb = CommandVerb.GET;
@@ -129,12 +134,14 @@
         }
 
         if (valid) {
-            if (mUser < 0) {
-                mUser = UserHandle.USER_SYSTEM;
-            }
-
             try {
                 IActivityManager activityManager = ActivityManagerNative.getDefault();
+                if (mUser == UserHandle.USER_CURRENT) {
+                    mUser = activityManager.getCurrentUser().id;
+                }
+                if (mUser < 0) {
+                    mUser = UserHandle.USER_SYSTEM;
+                }
                 IContentProvider provider = null;
                 IBinder token = new Binder();
                 try {
@@ -286,13 +293,13 @@
     }
 
     private static void printUsage() {
-        System.err.println("usage:  settings [--user NUM] get namespace key");
-        System.err.println("        settings [--user NUM] put namespace key value");
-        System.err.println("        settings [--user NUM] delete namespace key");
-        System.err.println("        settings [--user NUM] list namespace");
+        System.err.println("usage:  settings [--user <USER_ID> | current] get namespace key");
+        System.err.println("        settings [--user <USER_ID> | current] put namespace key value");
+        System.err.println("        settings [--user <USER_ID> | current] delete namespace key");
+        System.err.println("        settings [--user <USER_ID> | current] list namespace");
         System.err.println("\n'namespace' is one of {system, secure, global}, case-insensitive");
-        System.err.println("If '--user NUM' is not given, the operations are performed on the "
-                + "system user.");
+        System.err.println("If '--user <USER_ID> | current' is not given, the operations are "
+                + "performed on the system user.");
     }
 
     public static String resolveCallingPackage() {
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index 273483a..468c145 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -178,15 +178,8 @@
  * </p>
  * <h3>Notification strategy</h3>
  * <p>
- * For each feedback type only one accessibility service is notified. Services are notified
- * in the order of registration. Hence, if two services are registered for the same
- * feedback type in the same package the first one wins. It is possible however, to
- * register a service as the default one for a given feedback type. In such a case this
- * service is invoked if no other service was interested in the event. In other words, default
- * services do not compete with other services and are notified last regardless of the
- * registration order. This enables "generic" accessibility services that work reasonably
- * well with most applications to coexist with "polished" ones that are targeted for
- * specific applications.
+ * All accessibility services are notified of all events they have requested, regardless of their
+ * feedback type.
  * </p>
  * <p class="note">
  * <strong>Note:</strong> The event notification timeout is useful to avoid propagating
diff --git a/core/java/android/annotation/BinderThread.java b/core/java/android/annotation/BinderThread.java
index c69ba10..6f85e04 100644
--- a/core/java/android/annotation/BinderThread.java
+++ b/core/java/android/annotation/BinderThread.java
@@ -29,10 +29,10 @@
  * on the binder thread.
  * <p>
  * Example:
- * <pre>{@code
- *  (&#64;BinderThread
+ * <pre><code>
+ *  &#64;BinderThread
  *  public BeamShareData createBeamShareData() { ... }
- * }</pre>
+ * </code></pre>
  *
  * {@hide}
  */
diff --git a/core/java/android/annotation/CallSuper.java b/core/java/android/annotation/CallSuper.java
index 82e2723..b10a28a 100644
--- a/core/java/android/annotation/CallSuper.java
+++ b/core/java/android/annotation/CallSuper.java
@@ -25,10 +25,10 @@
  * Denotes that any overriding methods should invoke this method as well.
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;CallSuper
  *  public abstract void onFocusLost();
- * }</pre>
+ * </code></pre>
  *
  * @hide
  */
diff --git a/core/java/android/annotation/CheckResult.java b/core/java/android/annotation/CheckResult.java
index 787514e..97d031a 100644
--- a/core/java/android/annotation/CheckResult.java
+++ b/core/java/android/annotation/CheckResult.java
@@ -29,7 +29,7 @@
  * <p>
  * Example:
  * <pre>{@code
- *  public &#64;CheckResult String trim(String s) { return s.trim(); }
+ *  public @CheckResult String trim(String s) { return s.trim(); }
  *  ...
  *  s.trim(); // this is probably an error
  *  s = s.trim(); // ok
diff --git a/core/java/android/annotation/ColorInt.java b/core/java/android/annotation/ColorInt.java
index 69d196c..4671b1b 100644
--- a/core/java/android/annotation/ColorInt.java
+++ b/core/java/android/annotation/ColorInt.java
@@ -31,7 +31,7 @@
  * <p>
  * Example:
  * <pre>{@code
- *  public abstract void setTextColor(&#64;ColorInt int color);
+ *  public abstract void setTextColor(@ColorInt int color);
  * }</pre>
  *
  * @hide
diff --git a/core/java/android/annotation/FloatRange.java b/core/java/android/annotation/FloatRange.java
index 3a7c150..05b51680 100644
--- a/core/java/android/annotation/FloatRange.java
+++ b/core/java/android/annotation/FloatRange.java
@@ -28,12 +28,12 @@
  * Denotes that the annotated element should be a float or double in the given range
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;FloatRange(from=0.0,to=1.0)
  *  public float getAlpha() {
  *      ...
  *  }
- * }</pre>
+ * </code></pre>
  *
  * @hide
  */
diff --git a/core/java/android/annotation/IntDef.java b/core/java/android/annotation/IntDef.java
index 3cae9c5..a18bfa5 100644
--- a/core/java/android/annotation/IntDef.java
+++ b/core/java/android/annotation/IntDef.java
@@ -27,25 +27,24 @@
  * named constants. If the {@link #flag()} attribute is set to true,
  * multiple constants can be combined.
  * <p>
- * Example:
- * <pre>{@code
- *  &#64;Retention(CLASS)
- *  &#64;IntDef(&#123;NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS&#125;)
- *  public &#64;interface NavigationMode &#123;&#125;
+ * <pre><code>
+ *  &#64;Retention(SOURCE)
+ *  &#64;IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
+ *  public @interface NavigationMode {}
  *  public static final int NAVIGATION_MODE_STANDARD = 0;
  *  public static final int NAVIGATION_MODE_LIST = 1;
  *  public static final int NAVIGATION_MODE_TABS = 2;
  *  ...
- *  public abstract void setNavigationMode(&#64;NavigationMode int mode);
+ *  public abstract void setNavigationMode(@NavigationMode int mode);
  *  &#64;NavigationMode
  *  public abstract int getNavigationMode();
- * }</pre>
+ * </code></pre>
  * For a flag, set the flag attribute:
- * <pre>{@code
+ * <pre><code>
  *  &#64;IntDef(
  *      flag = true
- *      value = &#123;NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS&#125;)
- * }</pre>
+ *      value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
+ * </code></pre>
  *
  * @hide
  */
diff --git a/core/java/android/annotation/IntRange.java b/core/java/android/annotation/IntRange.java
index b489c01..c043e2d 100644
--- a/core/java/android/annotation/IntRange.java
+++ b/core/java/android/annotation/IntRange.java
@@ -29,12 +29,12 @@
  * Denotes that the annotated element should be an int or long in the given range
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;IntRange(from=0,to=255)
  *  public int getAlpha() {
  *      ...
  *  }
- * }</pre>
+ * </code></pre>
  *
  * @hide
  */
diff --git a/core/java/android/annotation/MainThread.java b/core/java/android/annotation/MainThread.java
index 18a4283..52f8dfb 100644
--- a/core/java/android/annotation/MainThread.java
+++ b/core/java/android/annotation/MainThread.java
@@ -29,10 +29,10 @@
  * on the main thread.
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;MainThread
  *  public void deliverResult(D data) { ... }
- * }</pre>
+ * </code></pre>
  *
  * {@hide}
  */
diff --git a/core/java/android/annotation/RequiresPermission.java b/core/java/android/annotation/RequiresPermission.java
index 113c055..59d419f 100644
--- a/core/java/android/annotation/RequiresPermission.java
+++ b/core/java/android/annotation/RequiresPermission.java
@@ -32,26 +32,26 @@
  * <p/>
  * Example of requiring a single permission:
  * <pre>{@code
- *   &#64;RequiresPermission(Manifest.permission.SET_WALLPAPER)
+ *   {@literal @}RequiresPermission(Manifest.permission.SET_WALLPAPER)
  *   public abstract void setWallpaper(Bitmap bitmap) throws IOException;
  *
- *   &#64;RequiresPermission(ACCESS_COARSE_LOCATION)
+ *   {@literal @}RequiresPermission(ACCESS_COARSE_LOCATION)
  *   public abstract Location getLastKnownLocation(String provider);
  * }</pre>
  * Example of requiring at least one permission from a set:
  * <pre>{@code
- *   &#64;RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
+ *   {@literal @}RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
  *   public abstract Location getLastKnownLocation(String provider);
  * }</pre>
  * Example of requiring multiple permissions:
  * <pre>{@code
- *   &#64;RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
+ *   {@literal @}RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
  *   public abstract Location getLastKnownLocation(String provider);
  * }</pre>
  * Example of requiring separate read and write permissions for a content provider:
  * <pre>{@code
- *   &#64;RequiresPermission.Read(&#64;RequiresPermission(READ_HISTORY_BOOKMARKS))
- *   &#64;RequiresPermission.Write(&#64;RequiresPermission(WRITE_HISTORY_BOOKMARKS))
+ *   {@literal @}RequiresPermission.Read(@RequiresPermission(READ_HISTORY_BOOKMARKS))
+ *   {@literal @}RequiresPermission.Write(@RequiresPermission(WRITE_HISTORY_BOOKMARKS))
  *   public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
  * }</pre>
  * <p>
@@ -59,7 +59,7 @@
  * a permission which depends on the value of the parameter. For example, consider
  * {@link android.app.Activity#startActivity(Intent)}:
  * <pre>{@code
- *   public void startActivity(&#64;RequiresPermission Intent intent) { ... }
+ *   public void startActivity(@RequiresPermission Intent intent) { ... }
  * }</pre>
  * Notice how there are no actual permission names listed in the annotation. The actual
  * permissions required will depend on the particular intent passed in. For example,
@@ -71,7 +71,7 @@
  * and the actual permission requirement for this particular intent is described on
  * the Intent name itself:
  * <pre>{@code
- *   &#64;RequiresPermission(Manifest.permission.CALL_PHONE)
+ *   {@literal @}RequiresPermission(Manifest.permission.CALL_PHONE)
  *   public static final String ACTION_CALL = "android.intent.action.CALL";
  * }</pre>
  *
@@ -115,7 +115,7 @@
      * When specified on a parameter, the annotation indicates that the method requires
      * a permission which depends on the value of the parameter (and typically
      * the corresponding field passed in will be one of a set of constants which have
-     * been annotated with a {@code &#64;RequiresPermission} annotation.)
+     * been annotated with a <code>@RequiresPermission</code> annotation.)
      */
     @Target({FIELD, METHOD, PARAMETER})
     @interface Read {
@@ -128,7 +128,7 @@
      * When specified on a parameter, the annotation indicates that the method requires
      * a permission which depends on the value of the parameter (and typically
      * the corresponding field passed in will be one of a set of constants which have
-     * been annotated with a {@code &#64;RequiresPermission} annotation.)
+     * been annotated with a <code>@RequiresPermission</code> annotation.)
      */
     @Target({FIELD, METHOD, PARAMETER})
     @interface Write {
diff --git a/core/java/android/annotation/Size.java b/core/java/android/annotation/Size.java
index 389b819..7c3e70f 100644
--- a/core/java/android/annotation/Size.java
+++ b/core/java/android/annotation/Size.java
@@ -31,7 +31,7 @@
  * <p>
  * Example:
  * <pre>{@code
- *  public void getLocationInWindow(&#64;Size(2) int[] location) {
+ *  public void getLocationInWindow(@Size(2) int[] location) {
  *      ...
  *  }
  * }</pre>
diff --git a/core/java/android/annotation/StringDef.java b/core/java/android/annotation/StringDef.java
index 5f7f380..8c8d5d8 100644
--- a/core/java/android/annotation/StringDef.java
+++ b/core/java/android/annotation/StringDef.java
@@ -26,20 +26,20 @@
  * type and that its value should be one of the explicitly named constants.
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;Retention(SOURCE)
- *  &#64;StringDef(&#123;
+ *  &#64;StringDef({
  *     POWER_SERVICE,
  *     WINDOW_SERVICE,
  *     LAYOUT_INFLATER_SERVICE
- *  &#125;)
- *  public &#64;interface ServiceName &#123;&#125;
+ *  })
+ *  public @interface ServiceName {}
  *  public static final String POWER_SERVICE = "power";
  *  public static final String WINDOW_SERVICE = "window";
  *  public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater";
  *  ...
- *  public abstract Object getSystemService(&#64;ServiceName String name);
- * }</pre>
+ *  public abstract Object getSystemService(@ServiceName String name);
+ * </code></pre>
  *
  * @hide
  */
diff --git a/core/java/android/annotation/UiThread.java b/core/java/android/annotation/UiThread.java
index b814600..53121e7 100644
--- a/core/java/android/annotation/UiThread.java
+++ b/core/java/android/annotation/UiThread.java
@@ -29,10 +29,10 @@
  * on the UI thread.
  * <p>
  * Example:
- * <pre>{@code
+ * <pre><code>
  *  &#64;UiThread
- *  public abstract void setText(&#64;NonNull String text) { ... }
- * }</pre>
+ *  public abstract void setText(@NonNull String text) { ... }
+ * </code></pre>
  *
  * {@hide}
  */
diff --git a/core/java/android/annotation/WorkerThread.java b/core/java/android/annotation/WorkerThread.java
index dd12e05..0d2c43e 100644
--- a/core/java/android/annotation/WorkerThread.java
+++ b/core/java/android/annotation/WorkerThread.java
@@ -29,10 +29,10 @@
  * on a worker thread.
  * <p>
  * Example:
- * <pre>{@code
- *  (&#64;WorkerThread
+ * <pre><code>
+ *  &#64;WorkerThread
  *  protected abstract FilterResults performFiltering(CharSequence constraint);
- * }</pre>
+ * </code></pre>
  *
  * {@hide}
  */
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index f7aee75..798deb1 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -81,9 +81,9 @@
 
     /**
      * <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
-     * &lt;meta-data>}</a> name for a 'home' Activity that declares a package that is to be
+     * <meta-data>}</a> name for a 'home' Activity that declares a package that is to be
      * uninstalled in lieu of the declaring one.  The package named here must be
-     * signed with the same certificate as the one declaring the {@code &lt;meta-data>}.
+     * signed with the same certificate as the one declaring the {@code <meta-data>}.
      */
     public static final String META_HOME_ALTERNATE = "android.app.home.alternate";
 
@@ -265,6 +265,12 @@
     /** @hide User operation call: given user id is the current user, can't be stopped. */
     public static final int USER_OP_IS_CURRENT = -2;
 
+    /** @hide User operation call: system user can't be stopped. */
+    public static final int USER_OP_ERROR_IS_SYSTEM = -3;
+
+    /** @hide User operation call: one of related users cannot be stopped. */
+    public static final int USER_OP_ERROR_RELATED_USERS_CANNOT_STOP = -4;
+
     /** @hide Process does not exist. */
     public static final int PROCESS_STATE_NONEXISTENT = -1;
 
@@ -537,6 +543,11 @@
             return stackId == FREEFORM_WORKSPACE_STACK_ID
                     || stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
         }
+
+        /** Returns true if the windows in the stack can receive input keys. */
+        public static boolean canReceiveKeys(int stackId) {
+            return stackId != PINNED_STACK_ID;
+        }
     }
 
     /**
@@ -3084,7 +3095,9 @@
     /** {@hide} */
     public static final int FLAG_OR_STOPPED = 1 << 0;
     /** {@hide} */
-    public static final int FLAG_WITH_AMNESIA = 1 << 1;
+    public static final int FLAG_AND_LOCKED = 1 << 1;
+    /** {@hide} */
+    public static final int FLAG_AND_UNLOCKED = 1 << 2;
 
     /**
      * Return whether the given user is actively running.  This means that
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 19d9fc2..c05d5e8 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1981,9 +1981,10 @@
         case STOP_USER_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             int userid = data.readInt();
+            boolean force = data.readInt() != 0;
             IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
                     data.readStrongBinder());
-            int result = stopUser(userid, callback);
+            int result = stopUser(userid, force, callback);
             reply.writeNoException();
             reply.writeInt(result);
             return true;
@@ -5287,11 +5288,13 @@
         return result;
     }
 
-    public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
+    public int stopUser(int userid, boolean force, IStopUserCallback callback)
+            throws RemoteException {
         Parcel data = Parcel.obtain();
         Parcel reply = Parcel.obtain();
         data.writeInterfaceToken(IActivityManager.descriptor);
         data.writeInt(userid);
+        data.writeInt(force ? 1 : 0);
         data.writeStrongInterface(callback);
         mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
         reply.readException();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 802880d..c264368 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -92,7 +92,7 @@
 import android.util.SparseIntArray;
 import android.util.SuperNotCalledException;
 import android.view.Display;
-import android.view.HardwareRenderer;
+import android.view.ThreadedRenderer;
 import android.view.View;
 import android.view.ViewDebug;
 import android.view.ViewManager;
@@ -4612,7 +4612,7 @@
             // If there are several packages in this application we won't
             // initialize the graphics disk caches
             if (packages != null && packages.length == 1) {
-                HardwareRenderer.setupDiskCache(cacheDir);
+                ThreadedRenderer.setupDiskCache(cacheDir);
                 RenderScriptCacheDir.setupDiskCache(cacheDir);
             }
         } catch (RemoteException e) {
@@ -4659,7 +4659,7 @@
             // use hardware accelerated drawing, since this can add too much
             // overhead to the process.
             if (!ActivityManager.isHighEndGfx()) {
-                HardwareRenderer.disable(false);
+                ThreadedRenderer.disable(false);
             }
         }
 
@@ -4841,7 +4841,7 @@
         if (ii != null) {
             final ApplicationInfo instrApp = new ApplicationInfo();
             ii.copyTo(instrApp);
-
+            instrApp.initForUser(UserHandle.myUserId());
             final LoadedApk pi = getPackageInfo(instrApp, data.compatInfo,
                     appContext.getClassLoader(), false, true, false);
             final ContextImpl instrContext = ContextImpl.createAppContext(this, pi);
@@ -5529,9 +5529,9 @@
         // accelerated drawing, since this can add too much overhead to the
         // process.
         if (!ActivityManager.isHighEndGfx()) {
-            HardwareRenderer.disable(true);
+            ThreadedRenderer.disable(true);
         } else {
-            HardwareRenderer.enableForegroundTrimming();
+            ThreadedRenderer.enableForegroundTrimming();
         }
         ActivityThread thread = new ActivityThread();
         thread.attach(true);
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java
index bf2e13a..b569416 100644
--- a/core/java/android/app/AlarmManager.java
+++ b/core/java/android/app/AlarmManager.java
@@ -25,7 +25,6 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.RemoteException;
-import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.WorkSource;
 import android.text.TextUtils;
@@ -869,13 +868,19 @@
      * {@link Intent#filterEquals}), will be canceled.
      *
      * @param operation IntentSender which matches a previously added
-     * IntentSender.
+     * IntentSender. This parameter must not be {@code null}.
      *
      * @see #set
      */
     public void cancel(PendingIntent operation) {
         if (operation == null) {
-            throw new NullPointerException("operation");
+            final String msg = "cancel() called with a null PendingIntent";
+            if (mTargetSdkVersion >= Build.VERSION_CODES.N) {
+                throw new NullPointerException(msg);
+            } else {
+                Log.e(TAG, msg);
+                return;
+            }
         }
 
         try {
@@ -891,7 +896,7 @@
      */
     public void cancel(OnAlarmListener listener) {
         if (listener == null) {
-            throw new NullPointerException("listener");
+            throw new NullPointerException("cancel() called with a null OnAlarmListener");
         }
 
         ListenerWrapper wrapper = null;
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index bc7c3d0..23c4198 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -129,7 +129,7 @@
     /**
      * Map from package name, to preference name, to cached preferences.
      */
-    private static ArrayMap<String, ArrayMap<String, SharedPreferencesImpl>> sSharedPrefs;
+    private static ArrayMap<String, ArrayMap<File, SharedPreferencesImpl>> sSharedPrefs;
 
     final ActivityThread mMainThread;
     final LoadedApk mPackageInfo;
@@ -327,34 +327,39 @@
 
     @Override
     public SharedPreferences getSharedPreferences(String name, int mode) {
+        // At least one application in the world actually passes in a null
+        // name.  This happened to work because when we generated the file name
+        // we would stringify it to "null.xml".  Nice.
+        if (mPackageInfo.getApplicationInfo().targetSdkVersion <
+                Build.VERSION_CODES.KITKAT) {
+            if (name == null) {
+                name = "null";
+            }
+        }
+
+        final File file = getSharedPrefsFile(name);
+        return getSharedPreferences(file, mode);
+    }
+
+    @Override
+    public SharedPreferences getSharedPreferences(File file, int mode) {
         SharedPreferencesImpl sp;
         synchronized (ContextImpl.class) {
             if (sSharedPrefs == null) {
-                sSharedPrefs = new ArrayMap<String, ArrayMap<String, SharedPreferencesImpl>>();
+                sSharedPrefs = new ArrayMap<String, ArrayMap<File, SharedPreferencesImpl>>();
             }
 
             final String packageName = getPackageName();
-            ArrayMap<String, SharedPreferencesImpl> packagePrefs = sSharedPrefs.get(packageName);
+            ArrayMap<File, SharedPreferencesImpl> packagePrefs = sSharedPrefs.get(packageName);
             if (packagePrefs == null) {
-                packagePrefs = new ArrayMap<String, SharedPreferencesImpl>();
+                packagePrefs = new ArrayMap<File, SharedPreferencesImpl>();
                 sSharedPrefs.put(packageName, packagePrefs);
             }
 
-            // At least one application in the world actually passes in a null
-            // name.  This happened to work because when we generated the file name
-            // we would stringify it to "null.xml".  Nice.
-            if (mPackageInfo.getApplicationInfo().targetSdkVersion <
-                    Build.VERSION_CODES.KITKAT) {
-                if (name == null) {
-                    name = "null";
-                }
-            }
-
-            sp = packagePrefs.get(name);
+            sp = packagePrefs.get(file);
             if (sp == null) {
-                File prefsFile = getSharedPrefsFile(name);
-                sp = new SharedPreferencesImpl(prefsFile, mode);
-                packagePrefs.put(name, sp);
+                sp = new SharedPreferencesImpl(file, mode);
+                packagePrefs.put(file, sp);
                 return sp;
             }
         }
@@ -584,6 +589,9 @@
         if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
             flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
         }
+        if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
+            flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
+        }
         SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
         setFilePermissionsFromMode(f.getPath(), mode, 0);
         return db;
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 09c6c0b..38c7957 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -391,7 +391,7 @@
     public boolean switchUser(int userid) throws RemoteException;
     public boolean startUserInBackground(int userid) throws RemoteException;
     public boolean unlockUser(int userid, byte[] token) throws RemoteException;
-    public int stopUser(int userid, IStopUserCallback callback) throws RemoteException;
+    public int stopUser(int userid, boolean force, IStopUserCallback callback) throws RemoteException;
     public UserInfo getCurrentUser() throws RemoteException;
     public boolean isUserRunning(int userid, int flags) throws RemoteException;
     public int[] getRunningUserIds() throws RemoteException;
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index c1d5b19..c504ce3 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -93,6 +93,7 @@
     AutomaticZenRule addAutomaticZenRule(in AutomaticZenRule automaticZenRule);
     boolean updateAutomaticZenRule(in AutomaticZenRule automaticZenRule);
     boolean removeAutomaticZenRule(String id);
+    boolean removeAutomaticZenRules(String packageName);
 
     byte[] getBackupPayload(int user);
     void applyRestore(in byte[] payload, int user);
diff --git a/core/java/android/app/IUiModeManager.aidl b/core/java/android/app/IUiModeManager.aidl
index 7e9873e..cae54b6 100644
--- a/core/java/android/app/IUiModeManager.aidl
+++ b/core/java/android/app/IUiModeManager.aidl
@@ -51,4 +51,14 @@
      * 2 for night, and 3 for automatic mode switching.
      */
     int getNightMode();
+
+    /**
+     * Tells if UI mode is locked or not.
+     */
+    boolean isUiModeLocked();
+
+    /**
+     * Tells if Night mode is locked or not.
+     */
+    boolean isNightModeLocked();
 }
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java
index 2c12317..23e4d97 100644
--- a/core/java/android/app/KeyguardManager.java
+++ b/core/java/android/app/KeyguardManager.java
@@ -248,8 +248,9 @@
      * @hide
      */
     public boolean isDeviceLocked(int userId) {
+        ITrustManager trustManager = getTrustManager();
         try {
-            return mTrustManager.isDeviceLocked(userId);
+            return trustManager.isDeviceLocked(userId);
         } catch (RemoteException e) {
             return false;
         }
@@ -273,13 +274,22 @@
      * @hide
      */
     public boolean isDeviceSecure(int userId) {
+        ITrustManager trustManager = getTrustManager();
         try {
-            return mTrustManager.isDeviceSecure(userId);
+            return trustManager.isDeviceSecure(userId);
         } catch (RemoteException e) {
             return false;
         }
     }
 
+    private synchronized ITrustManager getTrustManager() {
+        if (mTrustManager == null) {
+            mTrustManager = ITrustManager.Stub.asInterface(
+                    ServiceManager.getService(Context.TRUST_SERVICE));
+        }
+        return mTrustManager;
+    }
+
     /**
      * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
      * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 74634a9..6c0c3e8 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.ColorStateList;
 import android.graphics.Bitmap;
@@ -45,7 +46,6 @@
 import android.os.UserHandle;
 import android.text.TextUtils;
 import android.util.Log;
-import android.util.MathUtils;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.View;
@@ -58,7 +58,6 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.reflect.Constructor;
-import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -2969,7 +2968,6 @@
             Bitmap profileBadge = getProfileBadge();
 
             contentView.setViewVisibility(R.id.profile_badge_large_template, View.GONE);
-            contentView.setViewVisibility(R.id.profile_badge_line2, View.GONE);
             contentView.setViewVisibility(R.id.profile_badge_line3, View.GONE);
 
             if (profileBadge != null) {
@@ -2986,38 +2984,35 @@
             return false;
         }
 
-        private void shrinkLine3Text(RemoteViews contentView) {
-            float subTextSize = mContext.getResources().getDimensionPixelSize(
-                    R.dimen.notification_subtext_size);
-            contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
-        }
-
-        private void unshrinkLine3Text(RemoteViews contentView) {
-            float regularTextSize = mContext.getResources().getDimensionPixelSize(
-                    com.android.internal.R.dimen.notification_text_size);
-            contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, regularTextSize);
-        }
-
         private void resetStandardTemplate(RemoteViews contentView) {
-            removeLargeIconBackground(contentView);
-            contentView.setViewPadding(R.id.icon, 0, 0, 0, 0);
-            contentView.setImageViewResource(R.id.icon, 0);
-            contentView.setInt(R.id.icon, "setBackgroundResource", 0);
+            resetNotificationHeader(contentView);
+            resetContentMargins(contentView);
             contentView.setViewVisibility(R.id.right_icon, View.GONE);
-            contentView.setInt(R.id.right_icon, "setBackgroundResource", 0);
-            contentView.setImageViewResource(R.id.right_icon, 0);
-            contentView.setImageViewResource(R.id.icon, 0);
             contentView.setTextViewText(R.id.title, null);
             contentView.setTextViewText(R.id.text, null);
-            unshrinkLine3Text(contentView);
-            contentView.setTextViewText(R.id.text2, null);
-            contentView.setViewVisibility(R.id.text2, View.GONE);
-            contentView.setViewVisibility(R.id.info, View.GONE);
-            contentView.setViewVisibility(R.id.time, View.GONE);
             contentView.setViewVisibility(R.id.line3, View.GONE);
-            contentView.setViewVisibility(R.id.overflow_divider, View.GONE);
+            contentView.setViewVisibility(R.id.text_line_1, View.GONE);
             contentView.setViewVisibility(R.id.progress, View.GONE);
+        }
+
+        /**
+         * Resets the notification header to its original state
+         */
+        private void resetNotificationHeader(RemoteViews contentView) {
+            contentView.setImageViewResource(R.id.icon, 0);
+            contentView.setTextViewText(R.id.app_name_text, null);
             contentView.setViewVisibility(R.id.chronometer, View.GONE);
+            contentView.setViewVisibility(R.id.header_sub_text, View.GONE);
+            contentView.setViewVisibility(R.id.header_content_info, View.GONE);
+            contentView.setViewVisibility(R.id.number_of_children, View.GONE);
+            contentView.setViewVisibility(R.id.sub_text_divider, View.GONE);
+            contentView.setViewVisibility(R.id.content_info_divider, View.GONE);
+            contentView.setViewVisibility(R.id.time_divider, View.GONE);
+        }
+
+        private void resetContentMargins(RemoteViews contentView) {
+            contentView.setViewLayoutMarginEnd(R.id.line1, 0);
+            contentView.setViewLayoutMarginEnd(R.id.line3, 0);
         }
 
         private RemoteViews applyStandardTemplate(int resId) {
@@ -3033,95 +3028,118 @@
             resetStandardTemplate(contentView);
 
             boolean showLine3 = false;
-            boolean showLine2 = false;
-            boolean contentTextInLine2 = false;
             final Bundle ex = mN.extras;
 
-            if (mN.mLargeIcon != null) {
-                contentView.setImageViewIcon(R.id.icon, mN.mLargeIcon);
-                processLargeLegacyIcon(mN.mLargeIcon, contentView);
-                contentView.setImageViewIcon(R.id.right_icon, mN.mSmallIcon);
-                contentView.setViewVisibility(R.id.right_icon, View.VISIBLE);
-                processSmallRightIcon(mN.mSmallIcon, contentView);
-            } else { // small icon at left
-                contentView.setImageViewIcon(R.id.icon, mN.mSmallIcon);
-                contentView.setViewVisibility(R.id.icon, View.VISIBLE);
-                processSmallIconAsLarge(mN.mSmallIcon, contentView);
-            }
+            bindNotificationHeader(contentView);
+            bindLargeIcon(contentView);
             if (ex.getCharSequence(EXTRA_TITLE) != null) {
                 contentView.setTextViewText(R.id.title,
                         processLegacyText(ex.getCharSequence(EXTRA_TITLE)));
             }
+            boolean showProgress = handleProgressBar(hasProgress, contentView, ex);
             if (ex.getCharSequence(EXTRA_TEXT) != null) {
-                contentView.setTextViewText(R.id.text,
+                contentView.setTextViewText(showProgress ? R.id.text_line_1 : R.id.text,
                         processLegacyText(ex.getCharSequence(EXTRA_TEXT)));
+                if (showProgress) {
+                    contentView.setViewVisibility(R.id.text_line_1, View.VISIBLE);
+                }
+                showLine3 = !showProgress;
+            }
+            // We want to add badge to first line of text.
+            if (addProfileBadge(contentView, R.id.profile_badge_line3)) {
                 showLine3 = true;
             }
-            if (ex.getCharSequence(EXTRA_INFO_TEXT) != null) {
-                contentView.setTextViewText(R.id.info,
-                        processLegacyText(ex.getCharSequence(EXTRA_INFO_TEXT)));
-                contentView.setViewVisibility(R.id.info, View.VISIBLE);
-                showLine3 = true;
+            // Note getStandardView may hide line 3 again.
+            contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
+
+            return contentView;
+        }
+
+        private boolean handleProgressBar(boolean hasProgress, RemoteViews contentView, Bundle ex) {
+            final int max = ex.getInt(EXTRA_PROGRESS_MAX, 0);
+            final int progress = ex.getInt(EXTRA_PROGRESS, 0);
+            final boolean ind = ex.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
+            if (hasProgress && (max != 0 || ind)) {
+                contentView.setViewVisibility(com.android.internal.R.id.progress, View.VISIBLE);
+                contentView.setProgressBar(
+                        R.id.progress, max, progress, ind);
+                contentView.setProgressBackgroundTintList(
+                        R.id.progress, ColorStateList.valueOf(mContext.getColor(
+                                R.color.notification_progress_background_color)));
+                if (mN.color != COLOR_DEFAULT) {
+                    ColorStateList colorStateList = ColorStateList.valueOf(mN.color);
+                    contentView.setProgressTintList(R.id.progress, colorStateList);
+                    contentView.setProgressIndeterminateTintList(R.id.progress, colorStateList);
+                }
+                return true;
+            } else {
+                contentView.setViewVisibility(R.id.progress, View.GONE);
+                return false;
+            }
+        }
+
+        private void bindLargeIcon(RemoteViews contentView) {
+            if (mN.mLargeIcon != null) {
+                contentView.setViewVisibility(R.id.right_icon, View.VISIBLE);
+                contentView.setImageViewIcon(R.id.right_icon, mN.mLargeIcon);
+                processLargeLegacyIcon(mN.mLargeIcon, contentView);
+                int endMargin = mContext.getResources().getDimensionPixelSize(
+                        R.dimen.notification_content_picture_margin);
+                contentView.setViewLayoutMarginEnd(R.id.line1, endMargin);
+                contentView.setViewLayoutMarginEnd(R.id.line3, endMargin);
+                contentView.setViewLayoutMarginEnd(R.id.progress, endMargin);
+            }
+        }
+
+        private void bindNotificationHeader(RemoteViews contentView) {
+            bindSmallIcon(contentView);
+            bindChildCountColor(contentView);
+            bindHeaderAppName(contentView);
+            bindHeaderSubText(contentView);
+            bindContentInfo(contentView);
+            bindHeaderChronometerAndTime(contentView);
+            bindExpandButton(contentView);
+        }
+
+        private void bindChildCountColor(RemoteViews contentView) {
+            contentView.setTextColor(R.id.number_of_children, resolveColor());
+        }
+
+        private void bindContentInfo(RemoteViews contentView) {
+            boolean visible = false;
+            if (mN.extras.getCharSequence(EXTRA_INFO_TEXT) != null) {
+                contentView.setTextViewText(R.id.header_content_info,
+                        processLegacyText(mN.extras.getCharSequence(EXTRA_INFO_TEXT)));
+                contentView.setViewVisibility(R.id.header_content_info, View.VISIBLE);
+                visible = true;
             } else if (mN.number > 0) {
                 final int tooBig = mContext.getResources().getInteger(
                         R.integer.status_bar_notification_info_maxnum);
                 if (mN.number > tooBig) {
-                    contentView.setTextViewText(R.id.info, processLegacyText(
+                    contentView.setTextViewText(R.id.header_content_info, processLegacyText(
                             mContext.getResources().getString(
                                     R.string.status_bar_notification_info_overflow)));
                 } else {
-                    NumberFormat f = NumberFormat.getIntegerInstance();
-                    contentView.setTextViewText(R.id.info, processLegacyText(f.format(mN.number)));
+                    contentView.setTextViewText(R.id.header_content_info,
+                            processLegacyText(String.valueOf(mN.number)));
                 }
-                contentView.setViewVisibility(R.id.info, View.VISIBLE);
-                showLine3 = true;
-            } else {
-                contentView.setViewVisibility(R.id.info, View.GONE);
+                contentView.setViewVisibility(R.id.header_content_info, View.VISIBLE);
+                visible = true;
             }
-
-            // Need to show three lines?
-            if (ex.getCharSequence(EXTRA_SUB_TEXT) != null) {
-                contentView.setTextViewText(R.id.text,
-                        processLegacyText(ex.getCharSequence(EXTRA_SUB_TEXT)));
-                if (ex.getCharSequence(EXTRA_TEXT) != null) {
-                    contentView.setTextViewText(R.id.text2,
-                            processLegacyText(ex.getCharSequence(EXTRA_TEXT)));
-                    contentView.setViewVisibility(R.id.text2, View.VISIBLE);
-                    showLine2 = true;
-                    contentTextInLine2 = true;
-                } else {
-                    contentView.setViewVisibility(R.id.text2, View.GONE);
-                }
-            } else {
-                contentView.setViewVisibility(R.id.text2, View.GONE);
-                final int max = ex.getInt(EXTRA_PROGRESS_MAX, 0);
-                final int progress = ex.getInt(EXTRA_PROGRESS, 0);
-                final boolean ind = ex.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
-                if (hasProgress && (max != 0 || ind)) {
-                    contentView.setViewVisibility(R.id.progress, View.VISIBLE);
-                    contentView.setProgressBar(
-                            R.id.progress, max, progress, ind);
-                    contentView.setProgressBackgroundTintList(
-                            R.id.progress, ColorStateList.valueOf(mContext.getColor(
-                                    R.color.notification_progress_background_color)));
-                    if (mN.color != COLOR_DEFAULT) {
-                        ColorStateList colorStateList = ColorStateList.valueOf(mN.color);
-                        contentView.setProgressTintList(R.id.progress, colorStateList);
-                        contentView.setProgressIndeterminateTintList(R.id.progress, colorStateList);
-                    }
-                    showLine2 = true;
-                } else {
-                    contentView.setViewVisibility(R.id.progress, View.GONE);
-                }
+            if (visible) {
+                contentView.setViewVisibility(R.id.content_info_divider, View.VISIBLE);
             }
-            if (showLine2) {
+        }
 
-                // need to shrink all the type to make sure everything fits
-                shrinkLine3Text(contentView);
-            }
+        private void bindExpandButton(RemoteViews contentView) {
+            contentView.setDrawableParameters(R.id.expand_button, false, -1, resolveColor(),
+                    PorterDuff.Mode.SRC_ATOP, -1);
+        }
 
+        private void bindHeaderChronometerAndTime(RemoteViews contentView) {
             if (showsTimeOrChronometer()) {
-                if (ex.getBoolean(EXTRA_SHOW_CHRONOMETER)) {
+                contentView.setViewVisibility(R.id.time_divider, View.VISIBLE);
+                if (mN.extras.getBoolean(EXTRA_SHOW_CHRONOMETER)) {
                     contentView.setViewVisibility(R.id.chronometer, View.VISIBLE);
                     contentView.setLong(R.id.chronometer, "setBase",
                             mN.when + (SystemClock.elapsedRealtime() - System.currentTimeMillis()));
@@ -3131,26 +3149,42 @@
                     contentView.setLong(R.id.time, "setTime", mN.when);
                 }
             }
+        }
 
-            // Adjust padding depending on line count and font size.
-            contentView.setViewPadding(R.id.line1, 0,
-                    calculateTopPadding(mContext, hasThreeLines(),
-                            mContext.getResources().getConfiguration().fontScale),
-                    0, 0);
-
-            // We want to add badge to first line of text.
-            boolean addedBadge = addProfileBadge(contentView,
-                    contentTextInLine2 ? R.id.profile_badge_line2 : R.id.profile_badge_line3);
-            // If we added the badge to line 3 then we should show line 3.
-            if (addedBadge && !contentTextInLine2) {
-                showLine3 = true;
+        private void bindHeaderSubText(RemoteViews contentView) {
+            CharSequence subText = mN.extras.getCharSequence(EXTRA_SUB_TEXT);
+            if (subText == null && mStyle != null && mStyle.mSummaryTextSet
+                    && mStyle.hasSummaryInHeader()) {
+                subText = mStyle.mSummaryText;
             }
+            if (subText != null) {
+                // TODO: Remove the span entirely to only have the string with propper formating.
+                contentView.setTextViewText(R.id.header_sub_text, processLegacyText(subText));
+                contentView.setViewVisibility(R.id.header_sub_text, View.VISIBLE);
+                contentView.setViewVisibility(R.id.sub_text_divider, View.VISIBLE);
+            }
+        }
 
-            // Note getStandardView may hide line 3 again.
-            contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
-            contentView.setViewVisibility(R.id.overflow_divider,
-                    showLine3 ? View.VISIBLE : View.GONE);
-            return contentView;
+        private void bindHeaderAppName(RemoteViews contentView) {
+            PackageManager packageManager = mContext.getPackageManager();
+            ApplicationInfo info = null;
+            try {
+                info = packageManager.getApplicationInfo(mContext.getApplicationInfo().packageName,
+                        0);
+            } catch (final NameNotFoundException e) {
+                return;
+            }
+            CharSequence appName = info != null ? packageManager.getApplicationLabel(info)
+                    : null;
+            if (TextUtils.isEmpty(appName)) {
+                return;
+            }
+            contentView.setTextViewText(R.id.app_name_text, appName);
+        }
+
+        private void bindSmallIcon(RemoteViews contentView) {
+            contentView.setImageViewIcon(R.id.icon, mN.mSmallIcon);
+            processSmallIconColor(mN.mSmallIcon, contentView);
         }
 
         /**
@@ -3161,49 +3195,6 @@
             return mN.when != 0 && mN.extras.getBoolean(EXTRA_SHOW_WHEN);
         }
 
-        /**
-         * Logic to find out whether the notification is going to have three lines in the contracted
-         * layout. This is used to adjust the top padding.
-         *
-         * @return true if the notification is going to have three lines; false if the notification
-         *         is going to have one or two lines
-         */
-        private boolean hasThreeLines() {
-            final CharSequence subText = mN.extras.getCharSequence(EXTRA_SUB_TEXT);
-            final CharSequence text = mN.extras.getCharSequence(EXTRA_TEXT);
-            boolean contentTextInLine2 = subText != null && text != null;
-            boolean hasProgress = mStyle == null || mStyle.hasProgress();
-            // If we have content text in line 2, badge goes into line 2, or line 3 otherwise
-            boolean badgeInLine3 = getProfileBadgeDrawable() != null && !contentTextInLine2;
-            boolean hasLine3 = text != null || mN.extras.getCharSequence(EXTRA_INFO_TEXT) != null
-                    || mN.number > 0 || badgeInLine3;
-            final Bundle ex = mN.extras;
-            final int max = ex.getInt(EXTRA_PROGRESS_MAX, 0);
-            final boolean ind = ex.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
-            boolean hasLine2 = (subText != null && text != null) ||
-                    (hasProgress && subText == null && (max != 0 || ind));
-            return hasLine2 && hasLine3;
-        }
-
-        /**
-         * @hide
-         */
-        public static int calculateTopPadding(Context ctx, boolean hasThreeLines,
-                float fontScale) {
-            int padding = ctx.getResources().getDimensionPixelSize(hasThreeLines
-                    ? R.dimen.notification_top_pad_narrow
-                    : R.dimen.notification_top_pad);
-            int largePadding = ctx.getResources().getDimensionPixelSize(hasThreeLines
-                    ? R.dimen.notification_top_pad_large_text_narrow
-                    : R.dimen.notification_top_pad_large_text);
-            float largeFactor = (MathUtils.constrain(fontScale, 1.0f, LARGE_TEXT_SCALE) - 1f)
-                    / (LARGE_TEXT_SCALE - 1f);
-
-            // Linearly interpolate the padding between large and normal with the font scale ranging
-            // from 1f to LARGE_TEXT_SCALE
-            return Math.round((1 - largeFactor) * padding + largeFactor * largePadding);
-        }
-
         private void resetStandardTemplateWithActions(RemoteViews big) {
             big.setViewVisibility(R.id.actions, View.GONE);
             big.setViewVisibility(R.id.action_divider, View.GONE);
@@ -3250,18 +3241,46 @@
          * Construct a RemoteViews for the final big notification layout.
          */
         public RemoteViews makeBigContentView() {
+            RemoteViews result = null;
             if (mN.bigContentView != null) {
                 return mN.bigContentView;
             } else if (mStyle != null) {
-                final RemoteViews styleView = mStyle.makeBigContentView();
-                if (styleView != null) {
-                    return styleView;
-                }
+                result = mStyle.makeBigContentView();
             } else if (mActions.size() == 0) {
                 return null;
             }
+            if (result == null) {
+                result = applyStandardTemplateWithActions(getBigBaseLayoutResource());
+            } else {
+                hideLine1Text(result);
+            }
+            adaptNotificationHeaderForBigContentView(result);
+            return result;
+        }
 
-            return applyStandardTemplateWithActions(getBigBaseLayoutResource());
+        /**
+         * Construct a RemoteViews for the final notification header only
+         *
+         * @hide
+         */
+        public RemoteViews makeNotificationHeader() {
+            RemoteViews header = new BuilderRemoteViews(mContext.getApplicationInfo(),
+                    R.layout.notification_template_header);
+            resetNotificationHeader(header);
+            bindNotificationHeader(header);
+            return header;
+        }
+
+        private void hideLine1Text(RemoteViews result) {
+            result.setViewVisibility(R.id.text_line_1, View.GONE);
+        }
+
+        private void adaptNotificationHeaderForBigContentView(RemoteViews result) {
+            // We have to set the collapse button instead
+            result.setImageViewResource(R.id.expand_button, R.drawable.ic_arrow_up_14dp);
+            // Apply the color again
+            result.setDrawableParameters(R.id.expand_button, false, -1, resolveColor(),
+                    PorterDuff.Mode.SRC_ATOP, -1);
         }
 
         /**
@@ -3330,84 +3349,27 @@
         }
 
         /**
-         * Apply any necessary background to smallIcons being used in the largeIcon spot.
+         * Apply any necessariy colors to the small icon
          */
-        private void processSmallIconAsLarge(Icon largeIcon, RemoteViews contentView) {
-            if (!isLegacy()) {
-                contentView.setDrawableParameters(R.id.icon, false, -1,
-                        0xFFFFFFFF,
+        private void processSmallIconColor(Icon smallIcon, RemoteViews contentView) {
+            if (!isLegacy() || getColorUtil().isGrayscaleIcon(mContext, smallIcon)) {
+                contentView.setDrawableParameters(R.id.icon, false, -1, resolveColor(),
                         PorterDuff.Mode.SRC_ATOP, -1);
-                applyLargeIconBackground(contentView);
-            } else {
-                if (getColorUtil().isGrayscaleIcon(mContext, largeIcon)) {
-                    applyLargeIconBackground(contentView);
-                }
             }
         }
 
         /**
-         * Apply any necessary background to a largeIcon if it's a fake smallIcon (that is,
+         * Make the largeIcon dark if it's a fake smallIcon (that is,
          * if it's grayscale).
          */
         // TODO: also check bounds, transparency, that sort of thing.
         private void processLargeLegacyIcon(Icon largeIcon, RemoteViews contentView) {
             if (largeIcon != null && isLegacy()
                     && getColorUtil().isGrayscaleIcon(mContext, largeIcon)) {
-                applyLargeIconBackground(contentView);
-            } else {
-                removeLargeIconBackground(contentView);
-            }
-        }
-
-        /**
-         * Add a colored circle behind the largeIcon slot.
-         */
-        private void applyLargeIconBackground(RemoteViews contentView) {
-            contentView.setInt(R.id.icon, "setBackgroundResource",
-                    R.drawable.notification_icon_legacy_bg);
-
-            contentView.setDrawableParameters(
-                    R.id.icon,
-                    true,
-                    -1,
-                    resolveColor(),
-                    PorterDuff.Mode.SRC_ATOP,
-                    -1);
-
-            int padding = mContext.getResources().getDimensionPixelSize(
-                    R.dimen.notification_large_icon_circle_padding);
-            contentView.setViewPadding(R.id.icon, padding, padding, padding, padding);
-        }
-
-        private void removeLargeIconBackground(RemoteViews contentView) {
-            contentView.setInt(R.id.icon, "setBackgroundResource", 0);
-        }
-
-        /**
-         * Recolor small icons when used in the R.id.right_icon slot.
-         */
-        private void processSmallRightIcon(Icon smallIcon, RemoteViews contentView) {
-            if (!isLegacy()) {
-                contentView.setDrawableParameters(R.id.right_icon, false, -1,
-                        0xFFFFFFFF,
+                // resolve color will fall back to the default when legacy
+                contentView.setDrawableParameters(R.id.icon, false, -1, resolveColor(),
                         PorterDuff.Mode.SRC_ATOP, -1);
             }
-            final boolean gray = isLegacy()
-                    && smallIcon.getType() == Icon.TYPE_RESOURCE
-                    && getColorUtil().isGrayscaleIcon(mContext, smallIcon.getResId());
-            if (!isLegacy() || gray) {
-                contentView.setInt(R.id.right_icon,
-                        "setBackgroundResource",
-                        R.drawable.notification_icon_legacy_bg);
-
-                contentView.setDrawableParameters(
-                        R.id.right_icon,
-                        true,
-                        -1,
-                        resolveColor(),
-                        PorterDuff.Mode.SRC_ATOP,
-                        -1);
-            }
         }
 
         private void sanitizeColor() {
@@ -3416,9 +3378,9 @@
             }
         }
 
-        private int resolveColor() {
+        int resolveColor() {
             if (mN.color == COLOR_DEFAULT) {
-                return mContext.getColor(R.color.notification_icon_bg_color);
+                return mContext.getColor(R.color.notification_icon_default_color);
             }
             return mN.color;
         }
@@ -3622,20 +3584,9 @@
                 contentView.setViewVisibility(R.id.line1, View.VISIBLE);
             }
 
-            // The last line defaults to the subtext, but can be replaced by mSummaryText
-            final CharSequence overflowText =
-                    mSummaryTextSet ? mSummaryText
-                                    : mBuilder.getAllExtras().getCharSequence(EXTRA_SUB_TEXT);
-            if (overflowText != null) {
-                contentView.setTextViewText(R.id.text, mBuilder.processLegacyText(overflowText));
-                contentView.setViewVisibility(R.id.overflow_divider, View.VISIBLE);
-                contentView.setViewVisibility(R.id.line3, View.VISIBLE);
-            } else {
-                // Clear text in case we use the line to show the profile badge.
-                contentView.setTextViewText(R.id.text, "");
-                contentView.setViewVisibility(R.id.overflow_divider, View.GONE);
-                contentView.setViewVisibility(R.id.line3, View.GONE);
-            }
+            // Clear text in case we use the line to show the profile badge.
+            contentView.setTextViewText(com.android.internal.R.id.text, "");
+            contentView.setViewVisibility(com.android.internal.R.id.line3, View.GONE);
 
             return contentView;
         }
@@ -3666,19 +3617,6 @@
         }
 
         /**
-         * Changes the padding of the first line such that the big and small content view have the
-         * same top padding.
-         *
-         * @hide
-         */
-        protected void applyTopPadding(RemoteViews contentView) {
-            int topPadding = Builder.calculateTopPadding(mBuilder.mContext,
-                    mBuilder.hasThreeLines(),
-                    mBuilder.mContext.getResources().getConfiguration().fontScale);
-            contentView.setViewPadding(R.id.line1, 0, topPadding, 0, 0);
-        }
-
-        /**
          * Apply any style-specific extras to this notification before shipping it out.
          * @hide
          */
@@ -3739,6 +3677,14 @@
         protected boolean hasProgress() {
             return true;
         }
+
+        /**
+         * @hide
+         * @return Whether we should put the summary be put into the notification header
+         */
+        public boolean hasSummaryInHeader() {
+            return true;
+        }
     }
 
     /**
@@ -3846,6 +3792,16 @@
             }
 
             RemoteViews contentView = getStandardView(mBuilder.getBigPictureLayoutResource());
+            if (mSummaryTextSet) {
+                contentView.setTextViewText(R.id.text, mBuilder.processLegacyText(mSummaryText));
+                contentView.setViewVisibility(R.id.line3, View.VISIBLE);
+            }
+            int imageMinHeight = mBuilder.mContext.getResources().getDimensionPixelSize(
+                    R.dimen.notification_big_picture_content_min_height_with_picture);
+            // We need to make space for the right image, so we're enforcing a minheight if there
+            // is a picture.
+            int minHeight = (mBuilder.mN.mLargeIcon == null) ? 0 : imageMinHeight;
+            contentView.setInt(R.id.notification_main_column, "setMinimumHeight", minHeight);
 
             if (mBigLargeIconSet) {
                 mBuilder.mN.mLargeIcon = oldLargeIcon;
@@ -3853,12 +3809,7 @@
 
             contentView.setImageViewBitmap(R.id.big_picture, mPicture);
 
-            applyTopPadding(contentView);
-
-            boolean twoTextLines = mBuilder.getAllExtras().getCharSequence(EXTRA_SUB_TEXT) != null
-                    && mBuilder.getAllExtras().getCharSequence(EXTRA_TEXT) != null;
-            mBuilder.addProfileBadge(contentView,
-                    twoTextLines ? R.id.profile_badge_line2 : R.id.profile_badge_line3);
+            mBuilder.addProfileBadge(contentView, R.id.profile_badge_line3);
             return contentView;
         }
 
@@ -3887,6 +3838,14 @@
             }
             mPicture = extras.getParcelable(EXTRA_PICTURE);
         }
+
+        /**
+         * @hide
+         */
+        @Override
+        public boolean hasSummaryInHeader() {
+            return false;
+        }
     }
 
     /**
@@ -3983,14 +3942,11 @@
             contentView.setTextViewText(R.id.big_text, mBuilder.processLegacyText(mBigText));
             contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
             contentView.setInt(R.id.big_text, "setMaxLines", calculateMaxLines());
-            contentView.setViewVisibility(R.id.text2, View.GONE);
-
-            applyTopPadding(contentView);
-
-            mBuilder.shrinkLine3Text(contentView);
 
             mBuilder.addProfileBadge(contentView, R.id.profile_badge_large_template);
 
+            contentView.setBoolean(R.id.big_text, "setHasImage", mBuilder.mN.mLargeIcon != null);
+
             return contentView;
         }
 
@@ -4005,11 +3961,6 @@
             if (hasSummary) {
                 lineCount -= LINES_CONSUMED_BY_SUMMARY;
             }
-
-            // If we have less top padding at the top, we can fit less lines.
-            if (!mBuilder.hasThreeLines()) {
-                lineCount--;
-            }
             return lineCount;
         }
     }
@@ -4105,8 +4056,6 @@
 
             mBuilder.getAllExtras().putCharSequence(EXTRA_TEXT, oldBuilderContentText);
 
-            contentView.setViewVisibility(R.id.text2, View.GONE);
-
             int[] rowIds = {R.id.inbox_text0, R.id.inbox_text1, R.id.inbox_text2, R.id.inbox_text3,
                     R.id.inbox_text4, R.id.inbox_text5, R.id.inbox_text6};
 
@@ -4120,6 +4069,9 @@
             final float subTextSize = mBuilder.mContext.getResources().getDimensionPixelSize(
                     R.dimen.notification_subtext_size);
             int i=0;
+            final float density = mBuilder.mContext.getResources().getDisplayMetrics().density;
+            int topPadding = (int) (5 * density);
+            int bottomPadding = (int) (13 * density);
             while (i < mTexts.size() && i < rowIds.length) {
                 CharSequence str = mTexts.get(i);
                 if (str != null && !str.equals("")) {
@@ -4129,24 +4081,29 @@
                         contentView.setTextViewTextSize(rowIds[i], TypedValue.COMPLEX_UNIT_PX,
                                 subTextSize);
                     }
+                    contentView.setViewPadding(rowIds[i], 0, topPadding, 0,
+                            i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0);
                 }
                 i++;
             }
-
-            contentView.setViewVisibility(R.id.inbox_end_pad,
-                    mTexts.size() > 0 ? View.VISIBLE : View.GONE);
-
-            contentView.setViewVisibility(R.id.inbox_more,
-                    mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
-
-            applyTopPadding(contentView);
-
-            mBuilder.shrinkLine3Text(contentView);
-
             mBuilder.addProfileBadge(contentView, R.id.profile_badge_large_template);
 
+            handleInboxImageMargin(contentView, rowIds[0]);
+
             return contentView;
         }
+
+        private void handleInboxImageMargin(RemoteViews contentView, int id) {
+            final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0);
+            final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
+            boolean hasProgress = max != 0 || ind;
+            int endMargin = 0;
+            if (mTexts.size() > 0 && mBuilder.mN.mLargeIcon != null && !hasProgress) {
+                endMargin = mBuilder.mContext.getResources().getDimensionPixelSize(
+                        R.dimen.notification_content_picture_margin);
+            }
+            contentView.setViewLayoutMarginEnd(id, endMargin);
+        }
     }
 
     /**
@@ -4278,14 +4235,13 @@
             }
         }
 
-        private RemoteViews generateMediaActionButton(Action action) {
+        private RemoteViews generateMediaActionButton(Action action, int color) {
             final boolean tombstone = (action.actionIntent == null);
             RemoteViews button = new BuilderRemoteViews(mBuilder.mContext.getApplicationInfo(),
                     R.layout.notification_material_media_action);
             button.setImageViewIcon(R.id.action0, action.getIcon());
-            button.setDrawableParameters(R.id.action0, false, -1,
-                    0xFFFFFFFF,
-                    PorterDuff.Mode.SRC_ATOP, -1);
+            button.setDrawableParameters(R.id.action0, false, -1, color, PorterDuff.Mode.SRC_ATOP,
+                    -1);
             if (!tombstone) {
                 button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
             }
@@ -4311,67 +4267,40 @@
                     }
 
                     final Action action = mBuilder.mActions.get(mActionsToShowInCompact[i]);
-                    final RemoteViews button = generateMediaActionButton(action);
+                    final RemoteViews button = generateMediaActionButton(action,
+                            mBuilder.resolveColor());
                     view.addView(com.android.internal.R.id.media_actions, button);
                 }
             }
-            styleText(view);
-            hideRightIcon(view);
+            handleImage(view  /* addPaddingToMainColumn */);
             return view;
         }
 
         private RemoteViews makeMediaBigContentView() {
             final int actionCount = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
-            RemoteViews big = mBuilder.applyStandardTemplate(getBigLayoutResource(actionCount),
-                    false /* hasProgress */);
+            RemoteViews big = mBuilder.applyStandardTemplate(
+                    R.layout.notification_template_material_big_media,
+                    false);
 
             if (actionCount > 0) {
                 big.removeAllViews(com.android.internal.R.id.media_actions);
                 for (int i = 0; i < actionCount; i++) {
-                    final RemoteViews button = generateMediaActionButton(mBuilder.mActions.get(i));
+                    final RemoteViews button = generateMediaActionButton(mBuilder.mActions.get(i),
+                            mBuilder.resolveColor());
                     big.addView(com.android.internal.R.id.media_actions, button);
                 }
             }
-            styleText(big);
-            hideRightIcon(big);
-            applyTopPadding(big);
-            big.setViewVisibility(android.R.id.progress, View.GONE);
+            handleImage(big);
             return big;
         }
 
-        private int getBigLayoutResource(int actionCount) {
-            if (actionCount <= 3) {
-                return R.layout.notification_template_material_big_media_narrow;
-            } else {
-                return R.layout.notification_template_material_big_media;
+        private void handleImage(RemoteViews contentView) {
+            if (mBuilder.mN.mLargeIcon != null) {
+                contentView.setViewLayoutMarginEnd(R.id.line1, 0);
+                contentView.setViewLayoutMarginEnd(R.id.line3, 0);
             }
         }
 
-        private void hideRightIcon(RemoteViews contentView) {
-            contentView.setViewVisibility(R.id.right_icon, View.GONE);
-        }
-
-        /**
-         * Applies the special text colors for media notifications to all text views.
-         */
-        private void styleText(RemoteViews contentView) {
-            int primaryColor = mBuilder.mContext.getColor(
-                    R.color.notification_media_primary_color);
-            int secondaryColor = mBuilder.mContext.getColor(
-                    R.color.notification_media_secondary_color);
-            contentView.setTextColor(R.id.title, primaryColor);
-            if (mBuilder.showsTimeOrChronometer()) {
-                if (mBuilder.getAllExtras().getBoolean(EXTRA_SHOW_CHRONOMETER)) {
-                    contentView.setTextColor(R.id.chronometer, secondaryColor);
-                } else {
-                    contentView.setTextColor(R.id.time, secondaryColor);
-                }
-            }
-            contentView.setTextColor(R.id.text2, secondaryColor);
-            contentView.setTextColor(R.id.text, secondaryColor);
-            contentView.setTextColor(R.id.info, secondaryColor);
-        }
-
         /**
          * @hide
          */
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 3eb3e0f..89610e9 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -470,6 +470,20 @@
     }
 
     /**
+     * Deletes all automatic zen rules owned by the given package.
+     *
+     * @hide
+     */
+    public boolean removeAutomaticZenRules(String packageName) {
+        INotificationManager service = getService();
+        try {
+            return service.removeAutomaticZenRules(packageName);
+        } catch (RemoteException e) {
+        }
+        return false;
+    }
+
+    /**
      * Checks the ability to read/modify notification policy for the calling package.
      *
      * <p>
diff --git a/core/java/android/app/UiModeManager.java b/core/java/android/app/UiModeManager.java
index 0f6ce12..4416415 100644
--- a/core/java/android/app/UiModeManager.java
+++ b/core/java/android/app/UiModeManager.java
@@ -233,4 +233,35 @@
         }
         return -1;
     }
+
+    /**
+     * @return If UI mode is locked or not. When UI mode is locked, calls to change UI mode
+     *         like {@link #enableCarMode(int)} will silently fail.
+     */
+    public boolean isUiModeLocked() {
+        if (mService != null) {
+            try {
+                return mService.isUiModeLocked();
+            } catch (RemoteException e) {
+                Log.e(TAG, "isUiModeLocked: RemoteException", e);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @return If Night mode is locked or not. When Night mode is locked, changing Night mode
+     *         is only allowed to privileged system components and normal application's call
+     *         to change Night mode using {@link #setNightMode(int)} will silently fail.
+     */
+    public boolean isNightModeLocked() {
+        if (mService != null) {
+            try {
+                return mService.isNightModeLocked();
+            } catch (RemoteException e) {
+                Log.e(TAG, "isNightModeLocked: RemoteException", e);
+            }
+        }
+        return true;
+    }
 }
diff --git a/core/java/android/app/assist/AssistContent.java b/core/java/android/app/assist/AssistContent.java
index 39902d7..1c9f573 100644
--- a/core/java/android/app/assist/AssistContent.java
+++ b/core/java/android/app/assist/AssistContent.java
@@ -35,7 +35,9 @@
      */
     public void setDefaultIntent(Intent intent) {
         mIntent = intent;
-        setWebUri(null);
+        mIsAppProvidedIntent = false;
+        mIsAppProvidedWebUri = false;
+        mUri = null;
         if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
             Uri uri = intent.getData();
             if (uri != null) {
@@ -161,6 +163,7 @@
         }
         mIsAppProvidedIntent = in.readInt() == 1;
         mExtras = in.readBundle();
+        mIsAppProvidedWebUri = in.readInt() == 1;
     }
 
     void writeToParcelInternal(Parcel dest, int flags) {
@@ -190,6 +193,7 @@
         }
         dest.writeInt(mIsAppProvidedIntent ? 1 : 0);
         dest.writeBundle(mExtras);
+        dest.writeInt(mIsAppProvidedWebUri ? 1 : 0);
     }
 
     @Override
diff --git a/core/java/android/app/trust/ITrustManager.aidl b/core/java/android/app/trust/ITrustManager.aidl
index 2dea545..a3fe6ab 100644
--- a/core/java/android/app/trust/ITrustManager.aidl
+++ b/core/java/android/app/trust/ITrustManager.aidl
@@ -29,6 +29,7 @@
     void registerTrustListener(in ITrustListener trustListener);
     void unregisterTrustListener(in ITrustListener trustListener);
     void reportKeyguardShowingChanged();
+    void setDeviceLockedForUser(int userId, boolean locked);
     boolean isDeviceLocked(int userId);
     boolean isDeviceSecure(int userId);
 }
diff --git a/core/java/android/app/trust/TrustManager.java b/core/java/android/app/trust/TrustManager.java
index aff69f0..ee591d3 100644
--- a/core/java/android/app/trust/TrustManager.java
+++ b/core/java/android/app/trust/TrustManager.java
@@ -51,6 +51,21 @@
     }
 
     /**
+     * Changes the lock status for the given user. This is only applicable to Managed Profiles,
+     * other users should be handled by Keyguard.
+     *
+     * @param userId The id for the user to be locked/unlocked.
+     * @param locked The value for that user's locked state.
+     */
+    public void setDeviceLockedForUser(int userId, boolean locked) {
+        try {
+            mService.setDeviceLockedForUser(userId, locked);
+        } catch (RemoteException e) {
+            onError(e);
+        }
+    }
+
+    /**
      * Reports that user {@param userId} has tried to unlock the device.
      *
      * @param successful if true, the unlock attempt was successful.
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 2d825fa..3e8a51e 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -74,6 +74,8 @@
  * {@link #listenUsingRfcommWithServiceRecord(String,UUID)}; or start a scan for
  * Bluetooth LE devices with {@link #startLeScan(LeScanCallback callback)}.
  *
+ * <p>This class is thread safe.
+ *
  * <p class="note"><strong>Note:</strong>
  * Most methods require the {@link android.Manifest.permission#BLUETOOTH}
  * permission and some also require the
@@ -82,7 +84,7 @@
  * <div class="special reference">
  * <h3>Developer Guides</h3>
  * <p>For more information about using Bluetooth, read the
- * <a href="{@docRoot}guide/topics/wireless/bluetooth.html">Bluetooth</a> developer guide.</p>
+ * <a href="{@docRoot}guide/topics/wireless/bluetooth.html">Bluetooth</a> developer guide.
  * </div>
  *
  * {@see BluetoothDevice}
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index d27dfa0..cd5c205 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -25,6 +25,7 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.ParcelUuid;
+import android.os.Process;
 import android.os.RemoteException;
 import android.util.Log;
 
@@ -823,6 +824,9 @@
             return false;
         }
         try {
+            Log.i(TAG, "createBond() for device " + getAddress() +
+                    " called by pid: " + Process.myPid() +
+                    " tid: " + Process.myTid());
             return sService.createBond(this, TRANSPORT_AUTO);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return false;
@@ -854,6 +858,9 @@
             throw new IllegalArgumentException(transport + " is not a valid Bluetooth transport");
         }
         try {
+            Log.i(TAG, "createBond() for device " + getAddress() +
+                    " called by pid: " + Process.myPid() +
+                    " tid: " + Process.myTid());
             return sService.createBond(this, transport);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return false;
@@ -922,6 +929,9 @@
             return false;
         }
         try {
+            Log.i(TAG, "cancelBondProcess() for device " + getAddress() +
+                    " called by pid: " + Process.myPid() +
+                    " tid: " + Process.myTid());
             return sService.cancelBondProcess(this);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return false;
@@ -943,6 +953,9 @@
             return false;
         }
         try {
+            Log.i(TAG, "removeBond() for device " + getAddress() +
+                    " called by pid: " + Process.myPid() +
+                    " tid: " + Process.myTid());
             return sService.removeBond(this);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return false;
diff --git a/core/java/android/content/ClipDescription.java b/core/java/android/content/ClipDescription.java
index e988516..1b024e2 100644
--- a/core/java/android/content/ClipDescription.java
+++ b/core/java/android/content/ClipDescription.java
@@ -18,6 +18,7 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.os.PersistableBundle;
 import android.text.TextUtils;
 
 import java.util.ArrayList;
@@ -59,8 +60,35 @@
      */
     public static final String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
 
+    /**
+     * The name of the extra used to define a component name when copying/dragging
+     * an app icon from Launcher.
+     * <p>
+     * Type: String
+     * </p>
+     * <p>
+     * Use {@link ComponentName#unflattenFromString(String)}
+     * and {@link ComponentName#flattenToString()} to convert the extra value
+     * to/from {@link ComponentName}.
+     * </p>
+     */
+    public static final String EXTRA_TARGET_COMPONENT_NAME =
+            "android.content.extra.TARGET_COMPONENT_NAME";
+
+    /**
+     * The name of the extra used to define a user serial number when copying/dragging
+     * an app icon from Launcher.
+     * <p>
+     * Type: long
+     * </p>
+     */
+    public static final String EXTRA_USER_SERIAL_NUMBER =
+            "android.content.extra.USER_SERIAL_NUMBER";
+
+
     final CharSequence mLabel;
     final String[] mMimeTypes;
+    private PersistableBundle mExtras;
 
     /**
      * Create a new clip.
@@ -173,6 +201,27 @@
         return mMimeTypes[index];
     }
 
+    /**
+     * Retrieve extended data from the clip description.
+     *
+     * @return the bundle containing extended data previously set with
+     * {@link #setExtras(PersistableBundle)}, or null if no extras have been set.
+     *
+     * @see #setExtras(PersistableBundle)
+     */
+    public PersistableBundle getExtras() {
+        return mExtras;
+    }
+
+    /**
+     * Add extended data to the clip description.
+     *
+     * @see #getExtras()
+     */
+    public void setExtras(PersistableBundle extras) {
+        mExtras = new PersistableBundle(extras);
+    }
+
     /** @hide */
     public void validate() {
         if (mMimeTypes == null) {
@@ -211,6 +260,13 @@
             b.append(mLabel);
             b.append('"');
         }
+        if (mExtras != null) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append(mExtras.toString());
+        }
         return !first;
     }
 
@@ -236,11 +292,13 @@
     public void writeToParcel(Parcel dest, int flags) {
         TextUtils.writeToParcel(mLabel, dest, flags);
         dest.writeStringArray(mMimeTypes);
+        dest.writePersistableBundle(mExtras);
     }
 
     ClipDescription(Parcel in) {
         mLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
         mMimeTypes = in.createStringArray();
+        mExtras = in.readPersistableBundle();
     }
 
     public static final Parcelable.Creator<ClipDescription> CREATOR =
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 853bc6c..9d0ebc2 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -986,6 +986,7 @@
                         stableProvider = acquireProvider(uri);
                     }
                     releaseUnstableProvider(unstableProvider);
+                    unstableProvider = null;
                     ParcelFileDescriptor pfd = new ParcelFileDescriptorInner(
                             fd.getParcelFileDescriptor(), stableProvider);
 
@@ -1130,6 +1131,7 @@
                 stableProvider = acquireProvider(uri);
             }
             releaseUnstableProvider(unstableProvider);
+            unstableProvider = null;
             ParcelFileDescriptor pfd = new ParcelFileDescriptorInner(
                     fd.getParcelFileDescriptor(), stableProvider);
 
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index a0102b6..6cc5497 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -159,6 +159,16 @@
      */
     public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 0x0008;
 
+    /**
+     * Database open flag: when set, the database is opened without support for
+     * localized collators.
+     *
+     * @see #openOrCreateDatabase(String, int, CursorFactory)
+     * @see #openOrCreateDatabase(String, int, CursorFactory, DatabaseErrorHandler)
+     * @see SQLiteDatabase#NO_LOCALIZED_COLLATORS
+     */
+    public static final int MODE_NO_LOCALIZED_COLLATORS = 0x0010;
+
     /** @hide */
     @IntDef(flag = true,
             value = {
@@ -625,8 +635,30 @@
      * @see #MODE_WORLD_READABLE
      * @see #MODE_WORLD_WRITEABLE
      */
-    public abstract SharedPreferences getSharedPreferences(String name,
-            int mode);
+    public abstract SharedPreferences getSharedPreferences(String name, int mode);
+
+    /**
+     * Retrieve and hold the contents of the preferences file, returning
+     * a SharedPreferences through which you can retrieve and modify its
+     * values.  Only one instance of the SharedPreferences object is returned
+     * to any callers for the same name, meaning they will see each other's
+     * edits as soon as they are made.
+     *
+     * @param file Desired preferences file. If a preferences file by this name
+     * does not exist, it will be created when you retrieve an
+     * editor (SharedPreferences.edit()) and then commit changes (Editor.commit()).
+     * @param mode Operating mode.  Use 0 or {@link #MODE_PRIVATE} for the
+     * default operation, {@link #MODE_WORLD_READABLE}
+     * and {@link #MODE_WORLD_WRITEABLE} to control permissions.
+     *
+     * @return The single {@link SharedPreferences} instance that can be used
+     *         to retrieve and modify the preference values.
+     *
+     * @see #MODE_PRIVATE
+     * @see #MODE_WORLD_READABLE
+     * @see #MODE_WORLD_WRITEABLE
+     */
+    public abstract SharedPreferences getSharedPreferences(File file, int mode);
 
     /**
      * Open a private file associated with this Context's application package
@@ -1249,6 +1281,7 @@
      *     default operation, {@link #MODE_WORLD_READABLE}
      *     and {@link #MODE_WORLD_WRITEABLE} to control permissions.
      *     Use {@link #MODE_ENABLE_WRITE_AHEAD_LOGGING} to enable write-ahead logging by default.
+     *     Use {@link #MODE_NO_LOCALIZED_COLLATORS} to disable localized collators.
      * @param factory An optional factory class that is called to instantiate a
      *     cursor when query is called.
      *
@@ -1259,6 +1292,7 @@
      * @see #MODE_WORLD_READABLE
      * @see #MODE_WORLD_WRITEABLE
      * @see #MODE_ENABLE_WRITE_AHEAD_LOGGING
+     * @see #MODE_NO_LOCALIZED_COLLATORS
      * @see #deleteDatabase
      */
     public abstract SQLiteDatabase openOrCreateDatabase(String name,
@@ -1276,6 +1310,7 @@
      *     default operation, {@link #MODE_WORLD_READABLE}
      *     and {@link #MODE_WORLD_WRITEABLE} to control permissions.
      *     Use {@link #MODE_ENABLE_WRITE_AHEAD_LOGGING} to enable write-ahead logging by default.
+     *     Use {@link #MODE_NO_LOCALIZED_COLLATORS} to disable localized collators.
      * @param factory An optional factory class that is called to instantiate a
      *     cursor when query is called.
      * @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database
@@ -1287,6 +1322,7 @@
      * @see #MODE_WORLD_READABLE
      * @see #MODE_WORLD_WRITEABLE
      * @see #MODE_ENABLE_WRITE_AHEAD_LOGGING
+     * @see #MODE_NO_LOCALIZED_COLLATORS
      * @see #deleteDatabase
      */
     public abstract SQLiteDatabase openOrCreateDatabase(String name,
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index bec1b37..a345aae 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -172,6 +172,11 @@
     }
 
     @Override
+    public SharedPreferences getSharedPreferences(File file, int mode) {
+        return mBase.getSharedPreferences(file, mode);
+    }
+
+    @Override
     public FileInputStream openFileInput(String name)
         throws FileNotFoundException {
         return mBase.openFileInput(name);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 4a7cbc7..b65d825 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1609,6 +1609,53 @@
             "android.intent.action.MANAGE_PERMISSIONS";
 
     /**
+     * Activity action: Launch UI to review permissions for an app.
+     * The system uses this intent if permission review for apps not
+     * supporting the new runtime permissions model is enabled. In
+     * this mode a permission review is required before any of the
+     * app components can run.
+     * <p>
+     * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose
+     * permissions will be reviewed (mandatory).
+     * </p>
+     * <p>
+     * Input: {@link #EXTRA_INTENT} specifies a pending intent to
+     * be fired after the permission review (optional).
+     * </p>
+     * <p>
+     * Input: {@link #EXTRA_REMOTE_CALLBACK} specifies a callback to
+     * be invoked after the permission review (optional).
+     * </p>
+     * <p>
+     * Input: {@link #EXTRA_RESULT_NEEDED} specifies whether the intent
+     * passed via {@link #EXTRA_INTENT} needs a result (optional).
+     * </p>
+     * <p>
+     * Output: Nothing.
+     * </p>
+     *
+     * @see #EXTRA_PACKAGE_NAME
+     * @see #EXTRA_INTENT
+     * @see #EXTRA_REMOTE_CALLBACK
+     * @see #EXTRA_RESULT_NEEDED
+     *
+     * @hide
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_REVIEW_PERMISSIONS =
+            "android.intent.action.REVIEW_PERMISSIONS";
+
+    /**
+     * Intent extra: A callback for reporting remote result as a bundle.
+     * <p>
+     * Type: IRemoteCallback
+     * </p>
+     *
+     * @hide
+     */
+    public static final String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK";
+
+    /**
      * Intent extra: An app package name.
      * <p>
      * Type: String
@@ -1620,6 +1667,16 @@
     public static final String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME";
 
     /**
+     * Intent extra: An extra for specifying whether a result is needed.
+     * <p>
+     * Type: boolean
+     * </p>
+     *
+     * @hide
+     */
+    public static final String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED";
+
+    /**
      * Broadcast action that requests current permission granted information.  It will respond
      * to the request by sending a broadcast with action defined by
      * {@link #EXTRA_GET_PERMISSIONS_RESPONSE_INTENT}. The response will contain
@@ -1869,6 +1926,24 @@
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED";
+
+    /**
+     * Broadcast Action: This is broadcast once, after the system has finished
+     * booting and the user is in a "locked" state. A user is locked when their
+     * credential-encrypted private app data storage is unavailable. Once the
+     * user has entered their credentials (such as a lock pattern or PIN) for
+     * the first time, the {@link #ACTION_BOOT_COMPLETED} broadcast will be
+     * sent.
+     * <p>
+     * You must hold the
+     * {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission in
+     * order to receive this broadcast.
+     * <p class="note">
+     * This is a protected intent that can only be sent by the system.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
+
     /**
      * Broadcast Action: This is broadcast once, after the system has finished
      * booting.  It can be used to perform application-specific initialization,
@@ -1881,6 +1956,7 @@
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
+
     /**
      * Broadcast Action: This is broadcast when a user action should request a
      * temporary system dialog to dismiss.  Some examples of temporary system
@@ -2877,6 +2953,14 @@
             "android.intent.action.USER_SWITCHED";
 
     /**
+     * Broadcast Action: Sent when the credential-encrypted private storage has
+     * become unlocked for the target user. This is only sent to registered
+     * receivers, not manifest receivers.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
+
+    /**
      * Broadcast sent to the system when a user's information changes. Carries an extra
      * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed.
      * This is only sent to registered receivers, not manifest receivers. It is sent to all users.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 1996e0f..65e5945 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -487,6 +487,13 @@
     public static final int PRIVATE_FLAG_AUTOPLAY = 1 << 7;
 
     /**
+     * When set, at least one component inside this application is encryption aware.
+     *
+     * @hide
+     */
+    public static final int PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE = 1 << 8;
+
+    /**
      * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
      * {@hide}
      */
@@ -1054,6 +1061,11 @@
         return (privateFlags & ApplicationInfo.PRIVATE_FLAG_ENCRYPTION_AWARE) != 0;
     }
 
+    /** @hide */
+    public boolean isPartiallyEncryptionAware() {
+        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE) != 0;
+    }
+
     /**
      * @hide
      */
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 6fe1efd..b9a42eb 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -59,7 +59,7 @@
  *  {@hide}
  */
 interface IPackageManager {
-    boolean isPackageFrozen(String packageName);
+    void checkPackageStartable(String packageName, int userId);
     boolean isPackageAvailable(String packageName, int userId);
     PackageInfo getPackageInfo(String packageName, int flags, int userId);
     int getPackageUid(String packageName, int userId);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 0c28008..abd4c28 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -259,6 +259,14 @@
      */
     public static final int SKIP_CURRENT_PROFILE = 0x00000002;
 
+    /**
+     * Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
+     * activities in the other profiles can respond to the intent only if no activity with
+     * non-negative priority in current profile can respond to the intent.
+     * @hide
+     */
+    public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004;
+
     /** @hide */
     @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED})
     @Retention(RetentionPolicy.SOURCE)
@@ -2018,7 +2026,6 @@
      */
     public static final int FLAG_PERMISSION_SYSTEM_FIXED =  1 << 4;
 
-
     /**
      * Permission flag: The permission is granted by default because it
      * enables app functionality that is expected to work out-of-the-box
@@ -2030,6 +2037,14 @@
     public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT =  1 << 5;
 
     /**
+     * Permission flag: The permission has to be reviewed before any of
+     * the app components can run.
+     *
+     * @hide
+     */
+    public static final int FLAG_PERMISSION_REVIEW_REQUIRED =  1 << 6;
+
+    /**
      * Mask for all permission flags.
      *
      * @hide
@@ -4629,7 +4644,8 @@
      * @param filter The {@link IntentFilter} the intent has to match
      * @param sourceUserId The source user id.
      * @param targetUserId The target user id.
-     * @param flags The only possible value is {@link SKIP_CURRENT_PROFILE}
+     * @param flags The possible values are {@link SKIP_CURRENT_PROFILE} and
+     *        {@link ONLY_IF_NO_MATCH_FOUND}.
      * @hide
      */
     public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId,
@@ -4808,6 +4824,7 @@
             case FLAG_PERMISSION_USER_SET: return "USER_SET";
             case FLAG_PERMISSION_REVOKE_ON_UPGRADE: return "REVOKE_ON_UPGRADE";
             case FLAG_PERMISSION_USER_FIXED: return "USER_FIXED";
+            case FLAG_PERMISSION_REVIEW_REQUIRED: return "REVIEW_REQUIRED";
             default: return Integer.toString(flag);
         }
     }
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 905ac5e..8bf20bf 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -122,4 +122,13 @@
      * @param packageList List of package names to keep cached.
      */
     public abstract void setKeepUninstalledPackages(List<String> packageList);
+
+    /**
+     * Gets whether some of the permissions used by this package require a user
+     * review before any of the app components can run.
+     * @param packageName The package name for which to check.
+     * @param userId The user under which to check.
+     * @return True a permissions review is required.
+     */
+    public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
 }
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 838da37..fd1e57b 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -84,9 +84,10 @@
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
-import java.util.jar.StrictJarFile;
 import java.util.zip.ZipEntry;
 
+import android.util.jar.StrictJarFile;
+
 /**
  * Parser for package files (APKs) on disk. This supports apps packaged either
  * as a single "monolithic" APK, or apps packaged as a "cluster" of multiple
@@ -1067,19 +1068,20 @@
         pkg.mSignatures = null;
         pkg.mSigningKeys = null;
 
-        collectCertificates(pkg, new File(pkg.baseCodePath), parseFlags);
+        collectCertificates(pkg, new File(pkg.baseCodePath), pkg.applicationInfo.flags, parseFlags);
 
         if (!ArrayUtils.isEmpty(pkg.splitCodePaths)) {
-            for (String splitCodePath : pkg.splitCodePaths) {
-                collectCertificates(pkg, new File(splitCodePath), parseFlags);
+            for (int i = 0; i < pkg.splitCodePaths.length; i++) {
+                collectCertificates(pkg, new File(pkg.splitCodePaths[i]), pkg.splitFlags[i],
+                        parseFlags);
             }
         }
     }
 
-    private static void collectCertificates(Package pkg, File apkFile, int parseFlags)
+    private static void collectCertificates(Package pkg, File apkFile, int apkFlags, int parseFlags)
             throws PackageParserException {
-        final boolean requireCode = ((parseFlags & PARSE_ENFORCE_CODE) != 0)
-                && ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_HAS_CODE) != 0);
+        final boolean hasCode = (apkFlags & ApplicationInfo.FLAG_HAS_CODE) != 0;
+        final boolean requireCode = ((parseFlags & PARSE_ENFORCE_CODE) != 0) && hasCode;
         final String apkPath = apkFile.getAbsolutePath();
         final boolean skipVerification = Build.IS_DEBUGGABLE
                 && ((parseFlags & PARSE_SKIP_VERIFICATION) != 0);
@@ -1216,7 +1218,8 @@
                 // TODO: factor signature related items out of Package object
                 final Package tempPkg = new Package(null);
                 // TODO: fix b/25118622; pass in '0' for parse flags
-                collectCertificates(tempPkg, apkFile, flags & PARSE_SKIP_VERIFICATION);
+                collectCertificates(tempPkg, apkFile, 0 /*apkFlags*/,
+                        flags & PARSE_SKIP_VERIFICATION);
                 signatures = tempPkg.mSignatures;
             } else {
                 signatures = null;
@@ -3262,6 +3265,11 @@
                     owner.applicationInfo.isEncryptionAware());
         }
 
+        if (a.info.encryptionAware) {
+            owner.applicationInfo.privateFlags |=
+                    ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE;
+        }
+
         sa.recycle();
 
         if (receiver && (owner.applicationInfo.privateFlags
@@ -3663,6 +3671,10 @@
         p.info.encryptionAware = sa.getBoolean(
                 R.styleable.AndroidManifestProvider_encryptionAware,
                 owner.applicationInfo.isEncryptionAware());
+        if (p.info.encryptionAware) {
+            owner.applicationInfo.privateFlags |=
+                    ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE;
+        }
 
         sa.recycle();
 
@@ -3947,6 +3959,10 @@
         s.info.encryptionAware = sa.getBoolean(
                 R.styleable.AndroidManifestService_encryptionAware,
                 owner.applicationInfo.isEncryptionAware());
+        if (s.info.encryptionAware) {
+            owner.applicationInfo.privateFlags |=
+                    ApplicationInfo.PRIVATE_FLAG_PARTIALLY_ENCRYPTION_AWARE;
+        }
 
         sa.recycle();
 
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 73bb426..8a87bff 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -2891,8 +2891,7 @@
          * <var>y</var> for the Y plane and row <var>c</var> for the U and V
          * planes:
          *
-         * {@code
-         * <pre>
+         * <pre>{@code
          * yStride   = (int) ceil(width / 16.0) * 16;
          * uvStride  = (int) ceil( (yStride / 2) / 16.0) * 16;
          * ySize     = yStride * height;
@@ -2900,8 +2899,9 @@
          * yRowIndex = yStride * y;
          * uRowIndex = ySize + uvSize + uvStride * c;
          * vRowIndex = ySize + uvStride * c;
-         * size      = ySize + uvSize * 2;</pre>
+         * size      = ySize + uvSize * 2;
          * }
+         *</pre>
          *
          * @param pixel_format the desired preview picture format, defined by
          *   one of the {@link android.graphics.ImageFormat} constants.  (E.g.,
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 5f27bca..3c2d503 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -3329,8 +3329,8 @@
      * @see CaptureRequest#SENSOR_SENSITIVITY
      */
     @PublicKey
-    public static final Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_DYNAMIC_BLACK_LEVEL =
-            new Key<android.hardware.camera2.params.BlackLevelPattern>("android.sensor.dynamicBlackLevel", android.hardware.camera2.params.BlackLevelPattern.class);
+    public static final Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL =
+            new Key<float[]>("android.sensor.dynamicBlackLevel", float[].class);
 
     /**
      * <p>Maximum raw value output by sensor for this frame.</p>
diff --git a/core/java/android/hardware/input/InputManagerInternal.java b/core/java/android/hardware/input/InputManagerInternal.java
index 6a392dd..014e73f 100644
--- a/core/java/android/hardware/input/InputManagerInternal.java
+++ b/core/java/android/hardware/input/InputManagerInternal.java
@@ -16,8 +16,11 @@
 
 package android.hardware.input;
 
+import android.annotation.Nullable;
 import android.hardware.display.DisplayViewport;
 import android.view.InputEvent;
+import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodSubtype;
 
 /**
  * Input manager local system service interface.
@@ -39,4 +42,14 @@
      * watching for wake events.
      */
     public abstract void setInteractive(boolean interactive);
+
+    /**
+     * Notifies that InputMethodManagerService switched the current input method subtype.
+     *
+     * @param userId user id that indicates who is using the specified input method and subtype.
+     * @param inputMethodInfo {@code null} when no input method is selected.
+     * @param subtype {@code null} when {@code inputMethodInfo} does has no subtype.
+     */
+    public abstract void onInputMethodSubtypeChanged(int userId,
+            @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype);
 }
diff --git a/core/java/android/hardware/package.html b/core/java/android/hardware/package.html
index 5b04da1..ee54476 100644
--- a/core/java/android/hardware/package.html
+++ b/core/java/android/hardware/package.html
@@ -4,6 +4,6 @@
 not all Android-powered devices support all hardware features, so you should declare hardware
 that your application requires using the <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> manifest element.</p>
+<uses-feature>}</a> manifest element.</p>
 </BODY>
 </HTML>
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 02c5bbd..515e9a2 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -1028,13 +1028,25 @@
      * Guess what the network request was trying to say so that the resulting
      * network is accessible via the legacy (deprecated) API such as
      * requestRouteToHost.
-     * This means we should try to be fairly preceise about transport and
+     *
+     * This means we should try to be fairly precise about transport and
      * capability but ignore things such as networkSpecifier.
      * If the request has more than one transport or capability it doesn't
      * match the old legacy requests (they selected only single transport/capability)
      * so this function cannot map the request to a single legacy type and
      * the resulting network will not be available to the legacy APIs.
      *
+     * This code is only called from the requestNetwork API (L and above).
+     *
+     * Setting a legacy type causes CONNECTIVITY_ACTION broadcasts, which are expensive
+     * because they wake up lots of apps - see http://b/23350688 . So we currently only
+     * do this for SUPL requests, which are the only ones that we know need it. If
+     * omitting these broadcasts causes unacceptable app breakage, then for backwards
+     * compatibility we can send them:
+     *
+     * if (targetSdkVersion < Build.VERSION_CODES.M) &&        // legacy API unsupported >= M
+     *     targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP))  // requestNetwork not present < L
+     *
      * TODO - This should be removed when the legacy APIs are removed.
      */
     private int inferLegacyTypeForNetworkCapabilities(NetworkCapabilities netCap) {
@@ -1046,6 +1058,14 @@
             return TYPE_NONE;
         }
 
+        // Do this only for SUPL, until GpsLocationProvider is fixed. http://b/25876485 .
+        if (!netCap.hasCapability(NetworkCapabilities.NET_CAPABILITY_SUPL)) {
+            // NOTE: if this causes app breakage, we should not just comment out this early return;
+            // instead, we should make this early return conditional on the requesting app's target
+            // SDK version, as described in the comment above.
+            return TYPE_NONE;
+        }
+
         String type = null;
         int result = TYPE_NONE;
 
@@ -1062,7 +1082,7 @@
             type = "enableDUN";
             result = TYPE_MOBILE_DUN;
         } else if (netCap.hasCapability(NetworkCapabilities.NET_CAPABILITY_SUPL)) {
-           type = "enableSUPL";
+            type = "enableSUPL";
             result = TYPE_MOBILE_SUPL;
         // back out this hack for mms as they no longer need this and it's causing
         // device slowdowns - b/23350688 (note, supl still needs this)
diff --git a/core/java/android/net/LocalSocket.java b/core/java/android/net/LocalSocket.java
index a374a86..e14facb1 100644
--- a/core/java/android/net/LocalSocket.java
+++ b/core/java/android/net/LocalSocket.java
@@ -25,7 +25,8 @@
 
 /**
  * Creates a (non-server) socket in the UNIX-domain namespace. The interface
- * here is not entirely unlike that of java.net.Socket
+ * here is not entirely unlike that of java.net.Socket. This class and the streams
+ * returned from it may be used from multiple threads.
  */
 public class LocalSocket implements Closeable {
 
diff --git a/core/java/android/net/PskKeyManager.java b/core/java/android/net/PskKeyManager.java
index f82e635..667abb4 100644
--- a/core/java/android/net/PskKeyManager.java
+++ b/core/java/android/net/PskKeyManager.java
@@ -97,7 +97,7 @@
  *
  * SSLContext sslContext = SSLContext.getInstance("TLS");
  * sslContext.init(
- *         new KeyManager[] &#123;pskKeyManager&#125;,
+ *         new KeyManager[] { pskKeyManager },
  *         new TrustManager[0], // No TrustManagers needed for TLS-PSK
  *         null // Use the default source of entropy
  *         );
diff --git a/core/java/android/net/http/HttpResponseCache.java b/core/java/android/net/http/HttpResponseCache.java
index 188287f..729aff0 100644
--- a/core/java/android/net/http/HttpResponseCache.java
+++ b/core/java/android/net/http/HttpResponseCache.java
@@ -36,7 +36,8 @@
  * saving time and bandwidth. This class supports {@link
  * java.net.HttpURLConnection} and {@link javax.net.ssl.HttpsURLConnection};
  * there is no platform-provided cache for {@code DefaultHttpClient} or
- * {@code AndroidHttpClient}.
+ * {@code AndroidHttpClient}. Installation and instances are thread
+ * safe.
  *
  * <h3>Installing an HTTP response cache</h3>
  * Enable caching of all of your application's HTTP requests by installing the
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index b492deb..ff6eb40 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -914,7 +914,7 @@
      *
      * <p>If you want to prevent the Android OS from sending default NDEF
      * messages completely (for all activities), you can include a
-     * {@code &lt;meta-data>} element inside the {@code &lt;application>}
+     * {@code <meta-data>} element inside the {@code <application>}
      * element of your AndroidManifest.xml file, like this:
      * <pre>
      * &lt;application ...>
@@ -1022,7 +1022,7 @@
      *
      * <p>If you want to prevent the Android OS from sending default NDEF
      * messages completely (for all activities), you can include a
-     * {@code &lt;meta-data>} element inside the {@code &lt;application>}
+     * {@code <meta-data>} element inside the {@code <application>}
      * element of your AndroidManifest.xml file, like this:
      * <pre>
      * &lt;application ...>
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index 521df28..63f39c5 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -181,9 +181,12 @@
     private static final String LOG_TAG = "AsyncTask";
 
     private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
-    private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
+    // We want at least 2 threads and at most 4 threads in the core pool,
+    // preferring to have 1 less than the CPU count to avoid saturating
+    // the CPU with background work
+    private static final int CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4));
     private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1;
-    private static final int KEEP_ALIVE = 1;
+    private static final int KEEP_ALIVE_SECONDS = 30;
 
     private static final ThreadFactory sThreadFactory = new ThreadFactory() {
         private final AtomicInteger mCount = new AtomicInteger(1);
@@ -199,9 +202,15 @@
     /**
      * An {@link Executor} that can be used to execute tasks in parallel.
      */
-    public static final Executor THREAD_POOL_EXECUTOR
-            = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE,
-                    TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory);
+    public static final Executor THREAD_POOL_EXECUTOR;
+
+    static {
+        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
+                CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
+                sPoolWorkQueue, sThreadFactory);
+        threadPoolExecutor.allowCoreThreadTimeOut(true);
+        THREAD_POOL_EXECUTOR = threadPoolExecutor;
+    }
 
     /**
      * An {@link Executor} that executes tasks one at a time in serial
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 1aa5c66..bce38f4 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -169,7 +169,7 @@
     /**
      * Current version of checkin data format.
      */
-    static final String CHECKIN_VERSION = "16";
+    static final String CHECKIN_VERSION = "17";
 
     /**
      * Old version, we hit 9 and ran out of room, need to remove.
@@ -407,17 +407,23 @@
         public abstract Timer getCameraTurnedOnTimer();
         public abstract Timer getForegroundActivityTimer();
 
-        // Time this uid has any processes in foreground state.
-        public static final int PROCESS_STATE_FOREGROUND = 0;
-        // Time this uid has any process in active state (not cached).
-        public static final int PROCESS_STATE_ACTIVE = 1;
+        // Time this uid has any processes in the top state.
+        public static final int PROCESS_STATE_TOP = 0;
+        // Time this uid has any process with a started out bound foreground service.
+        public static final int PROCESS_STATE_FOREGROUND_SERVICE = 1;
+        // Time this uid has any process that is top while the device is sleeping.
+        public static final int PROCESS_STATE_TOP_SLEEPING = 2;
+        // Time this uid has any process in an active foreground state.
+        public static final int PROCESS_STATE_FOREGROUND = 3;
+        // Time this uid has any process in an active background state.
+        public static final int PROCESS_STATE_BACKGROUND = 4;
         // Time this uid has any processes running at all.
-        public static final int PROCESS_STATE_RUNNING = 2;
+        public static final int PROCESS_STATE_CACHED = 5;
         // Total number of process states we track.
-        public static final int NUM_PROCESS_STATE = 3;
+        public static final int NUM_PROCESS_STATE = 6;
 
         static final String[] PROCESS_STATE_NAMES = {
-            "Foreground", "Active", "Running"
+            "Top", "Fg Service", "Top Sleeping", "Foreground", "Background", "Cached"
         };
 
         public abstract long getProcessStateTime(int state, long elapsedRealtimeUs, int which);
@@ -2954,8 +2960,9 @@
             final Object[] stateTimes = new Object[Uid.NUM_PROCESS_STATE];
             long totalStateTime = 0;
             for (int ips=0; ips<Uid.NUM_PROCESS_STATE; ips++) {
-                totalStateTime += u.getProcessStateTime(ips, rawRealtime, which);
-                stateTimes[ips] = (totalStateTime + 500) / 1000;
+                final long time = u.getProcessStateTime(ips, rawRealtime, which);
+                totalStateTime += time;
+                stateTimes[ips] = (time + 500) / 1000;
             }
             if (totalStateTime > 0) {
                 dumpLine(pw, uid, category, STATE_TIME_DATA, stateTimes);
@@ -4122,11 +4129,18 @@
                     sb.append("    ");
                     sb.append(Uid.PROCESS_STATE_NAMES[ips]);
                     sb.append(" for: ");
-                    formatTimeMs(sb, (totalStateTime + 500) / 1000);
+                    formatTimeMs(sb, (time + 500) / 1000);
                     pw.println(sb.toString());
                     uidActivity = true;
                 }
             }
+            if (totalStateTime > 0) {
+                sb.setLength(0);
+                sb.append(prefix);
+                sb.append("    Total running: ");
+                formatTimeMs(sb, (totalStateTime + 500) / 1000);
+                pw.println(sb.toString());
+            }
 
             final long userCpuTimeUs = u.getUserCpuTimeUs(which);
             final long systemCpuTimeUs = u.getSystemCpuTimeUs(which);
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index f7c8662..de8b690 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -788,6 +788,18 @@
             SystemProperties.getInt("ro.debuggable", 0) == 1;
 
     /**
+     * Specifies whether the permissions needed by a legacy app should be
+     * reviewed before any of its components can run. A legacy app is one
+     * with targetSdkVersion < 23, i.e apps using the old permission model.
+     * If review is not required, permissions are reviewed before the app
+     * is installed.
+     *
+     * @hide
+     */
+    public static final boolean PERMISSIONS_REVIEW_REQUIRED =
+            SystemProperties.getInt("ro.permission_review_required", 0) == 1;
+
+    /**
      * Returns the version string for the radio firmware.  May return
      * null (if, for instance, the radio is not currently on).
      */
diff --git a/core/java/android/os/IProcessInfoService.aidl b/core/java/android/os/IProcessInfoService.aidl
index c98daa2..62237f5 100644
--- a/core/java/android/os/IProcessInfoService.aidl
+++ b/core/java/android/os/IProcessInfoService.aidl
@@ -25,5 +25,12 @@
      * to indicate that no process with the given PID exists.
      */
     void getProcessStatesFromPids(in int[] pids, out int[] states);
+
+    /**
+     * For each PID in the given input array, write the current process state and OOM score
+     * for that process into the output arrays, or ActivityManager.PROCESS_STATE_NONEXISTENT
+     * in the states array to indicate that no process with the given PID exists.
+     */
+    void getProcessStatesAndOomScoresFromPids(in int[] pids, out int[] states, out int[] scores);
 }
 
diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java
index 13b5de9..c10abec 100644
--- a/core/java/android/os/Parcelable.java
+++ b/core/java/android/os/Parcelable.java
@@ -73,19 +73,31 @@
      */
     public static final int PARCELABLE_ELIDE_DUPLICATES = 0x0002;
 
-    /**
+    /*
      * Bit masks for use with {@link #describeContents}: each bit represents a
      * kind of object considered to have potential special significance when
      * marshalled.
      */
+
+    /**
+     * Descriptor bit used with {@link #describeContents()}: indicates that
+     * the Parcelable object's flattened representation includes a file descriptor.
+     *
+     * @see #describeContents()
+     */
     public static final int CONTENTS_FILE_DESCRIPTOR = 0x0001;
     
     /**
-     * Describe the kinds of special objects contained in this Parcelable's
-     * marshalled representation.
+     * Describe the kinds of special objects contained in this Parcelable
+     * instance's marshaled representation. For example, if the object will
+     * include a file descriptor in the output of {@link #writeToParcel(Parcel, int)},
+     * the return value of this method must include the
+     * {@link #CONTENTS_FILE_DESCRIPTOR} bit.
      *  
-     * @return a bitmask indicating the set of special object types marshalled
-     * by the Parcelable.
+     * @return a bitmask indicating the set of special object types marshaled
+     * by this Parcelable object instance.
+     *
+     * @see #CONTENTS_FILE_DESCRIPTOR
      */
     public int describeContents();
     
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 1cffa83..a0a0060 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -96,7 +96,7 @@
  * </table>
  * <p>
  * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK}
- * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
+ * permission in an {@code <uses-permission>} element of the application's manifest.
  * </p>
  */
 public final class PowerManager {
@@ -1033,7 +1033,7 @@
      * to have the device stay on.
      * <p>
      * Any application using a WakeLock must request the {@code android.permission.WAKE_LOCK}
-     * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
+     * permission in an {@code <uses-permission>} element of the application's manifest.
      * Obtain a wake lock by calling {@link PowerManager#newWakeLock(int, String)}.
      * </p><p>
      * Call {@link #acquire()} to acquire the wake lock and force the device to stay
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
index ca95bdf..89e30a9 100644
--- a/core/java/android/os/RemoteCallback.java
+++ b/core/java/android/os/RemoteCallback.java
@@ -16,88 +16,84 @@
 
 package android.os;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+
 /**
- * TODO: Make this a public API?  Let's see how it goes with a few use
- * cases first.
  * @hide
  */
-public abstract class RemoteCallback implements Parcelable {
-    final Handler mHandler;
-    final IRemoteCallback mTarget;
-    
-    class DeliverResult implements Runnable {
-        final Bundle mResult;
-        
-        DeliverResult(Bundle result) {
-            mResult = result;
-        }
-        
-        public void run() {
-            onResult(mResult);
-        }
+public final class RemoteCallback implements Parcelable {
+
+    public interface OnResultListener {
+        public void onResult(Bundle result);
     }
-    
-    class LocalCallback extends IRemoteCallback.Stub {
-        public void sendResult(Bundle bundle) {
-            mHandler.post(new DeliverResult(bundle));
-        }
+
+    private final OnResultListener mListener;
+    private final Handler mHandler;
+    private final IRemoteCallback mCallback;
+
+    public RemoteCallback(OnResultListener listener) {
+        this(listener, null);
     }
-    
-    static class RemoteCallbackProxy extends RemoteCallback {
-        RemoteCallbackProxy(IRemoteCallback target) {
-            super(target);
+
+    public RemoteCallback(@NonNull OnResultListener listener, @Nullable Handler handler) {
+        if (listener == null) {
+            throw new NullPointerException("listener cannot be null");
         }
-        
-        protected void onResult(Bundle bundle) {
-        }
-    }
-    
-    public RemoteCallback(Handler handler) {
+        mListener = listener;
         mHandler = handler;
-        mTarget = new LocalCallback();
+        mCallback = new IRemoteCallback.Stub() {
+            @Override
+            public void sendResult(Bundle data) {
+                RemoteCallback.this.sendResult(data);
+            }
+        };
     }
-    
-     RemoteCallback(IRemoteCallback target) {
+
+    RemoteCallback(Parcel parcel) {
+        mListener = null;
         mHandler = null;
-        mTarget = target;
+        mCallback = IRemoteCallback.Stub.asInterface(
+                parcel.readStrongBinder());
     }
-    
-    public void sendResult(Bundle bundle) throws RemoteException {
-        mTarget.sendResult(bundle);
-    }
-    
-    protected abstract void onResult(Bundle bundle);
-    
-    public boolean equals(Object otherObj) {
-        if (otherObj == null) {
-            return false;
+
+    public void sendResult(@Nullable final Bundle result) {
+        // Do local dispatch
+        if (mListener != null) {
+            if (mHandler != null) {
+                mHandler.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        mListener.onResult(result);
+                    }
+                });
+            } else {
+                mListener.onResult(result);
+            }
+        // Do remote dispatch
+        } else {
+            try {
+                mCallback.sendResult(result);
+            } catch (RemoteException e) {
+                /* ignore */
+            }
         }
-        try {
-            return mTarget.asBinder().equals(((RemoteCallback)otherObj)
-                    .mTarget.asBinder());
-        } catch (ClassCastException e) {
-        }
-        return false;
     }
-    
-    public int hashCode() {
-        return mTarget.asBinder().hashCode();
-    }
-    
+
+    @Override
     public int describeContents() {
         return 0;
     }
 
-    public void writeToParcel(Parcel out, int flags) {
-        out.writeStrongBinder(mTarget.asBinder());
+    @Override
+    public void writeToParcel(Parcel parcel, int flags) {
+        parcel.writeStrongBinder(mCallback.asBinder());
     }
 
     public static final Parcelable.Creator<RemoteCallback> CREATOR
             = new Parcelable.Creator<RemoteCallback>() {
-        public RemoteCallback createFromParcel(Parcel in) {
-            IBinder target = in.readStrongBinder();
-            return target != null ? new RemoteCallbackProxy(
-                    IRemoteCallback.Stub.asInterface(target)) : null;
+        public RemoteCallback createFromParcel(Parcel parcel) {
+            return new RemoteCallback(parcel);
         }
 
         public RemoteCallback[] newArray(int size) {
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 8b2c74f..f1672df 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1931,9 +1931,9 @@
                 // so we'll report it and bail on all of the current strict mode violations
                 // we currently are maintaining for this thread.
                 // First, drain the remaining violations from the parcel.
-                while (i < numViolations) {
+                i++;  // Skip the current entry.
+                for (; i < numViolations; i++) {
                     info = new ViolationInfo(p, !currentlyGathering);
-                    i++;
                 }
                 // Next clear out all gathered violations.
                 clearGatheredViolations();
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 0a149bb..79390d4 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -487,6 +487,19 @@
     public static final String DISALLOW_RECORD_AUDIO = "no_record_audio";
 
     /**
+     * Specifies if a user is not allowed to run in the background and should be stopped during
+     * user switch. The default value is <code>false</code>.
+     *
+     * <p>This restriction can be set by device owners and profile owners.
+     *
+     * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+     * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+     * @see #getUserRestrictions()
+     * @hide
+     */
+    public static final String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
+
+    /**
      * Specifies if a user is not allowed to use the camera.
      *
      * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
@@ -742,6 +755,23 @@
     }
 
     /**
+     * Return whether the given user is running in an "unlocked" state. A user
+     * is unlocked only after they've entered their credentials (such as a lock
+     * pattern or PIN), and credential-encrypted private app data storage is
+     * available.
+     *
+     * @param user to retrieve the unlocked state for.
+     */
+    public boolean isUserRunningUnlocked(UserHandle user) {
+        try {
+            return ActivityManagerNative.getDefault().isUserRunning(
+                    user.getIdentifier(), ActivityManager.FLAG_AND_UNLOCKED);
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
+    /**
      * Returns the UserInfo object describing a specific user.
      * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
      * @param userHandle the user handle of the user whose information is being requested.
@@ -929,9 +959,6 @@
             if (guest != null) {
                 Settings.Secure.putStringForUser(context.getContentResolver(),
                         Settings.Secure.SKIP_FIRST_USE_HINTS, "1", guest.id);
-
-                mService.setUserRestriction(DISALLOW_SMS, true, guest.id);
-                mService.setUserRestriction(DISALLOW_INSTALL_UNKNOWN_SOURCES, true, guest.id);
             }
         } catch (RemoteException re) {
             Log.w(TAG, "Could not create a user", re);
diff --git a/core/java/android/print/IPrintSpooler.aidl b/core/java/android/print/IPrintSpooler.aidl
index db2bf1a..b7cfbea 100644
--- a/core/java/android/print/IPrintSpooler.aidl
+++ b/core/java/android/print/IPrintSpooler.aidl
@@ -41,6 +41,23 @@
     void createPrintJob(in PrintJobInfo printJob);
     void setPrintJobState(in PrintJobId printJobId, int status, String stateReason,
             IPrintSpoolerCallbacks callback, int sequence);
+
+    /**
+     * Set the progress of this print job
+     *
+     * @param printJobId The print job to update
+     * @param progress The new progress
+     */
+    void setProgress(in PrintJobId printJobId, in float progress);
+
+    /**
+     * Set the status of this print job
+     *
+     * @param printJobId The print job to update
+     * @param status The new status, can be null
+     */
+    void setStatus(in PrintJobId printJobId, in CharSequence status);
+
     void setPrintJobTag(in PrintJobId printJobId, String tag, IPrintSpoolerCallbacks callback,
             int sequence);
     void writePrintJobData(in ParcelFileDescriptor fd, in PrintJobId printJobId);
diff --git a/core/java/android/print/PrintJobInfo.java b/core/java/android/print/PrintJobInfo.java
index 63f94fe..7148c87 100644
--- a/core/java/android/print/PrintJobInfo.java
+++ b/core/java/android/print/PrintJobInfo.java
@@ -16,10 +16,15 @@
 
 package android.print;
 
+import android.annotation.FloatRange;
+import android.annotation.Nullable;
+import android.annotation.TestApi;
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import com.android.internal.util.Preconditions;
+
 import java.util.Arrays;
 
 /**
@@ -149,9 +154,6 @@
     /** How many copies to print. */
     private int mCopies;
 
-    /** Reason for the print job being in its current state. */
-    private String mStateReason;
-
     /** The pages to print */
     private PageRange[] mPageRanges;
 
@@ -161,6 +163,12 @@
     /** Information about the printed document. */
     private PrintDocumentInfo mDocumentInfo;
 
+    /** The progress made on printing this job or -1 if not set. */
+    private float mProgress;
+
+    /** A short string describing the status of this job. */
+    private CharSequence mStatus;
+
     /** Advanced printer specific options. */
     private Bundle mAdvancedOptions;
 
@@ -169,7 +177,7 @@
 
     /** @hide*/
     public PrintJobInfo() {
-        /* do nothing */
+        mProgress = -1;
     }
 
     /** @hide */
@@ -183,10 +191,11 @@
         mTag = other.mTag;
         mCreationTime = other.mCreationTime;
         mCopies = other.mCopies;
-        mStateReason = other.mStateReason;
         mPageRanges = other.mPageRanges;
         mAttributes = other.mAttributes;
         mDocumentInfo = other.mDocumentInfo;
+        mProgress = other.mProgress;
+        mStatus = other.mStatus;
         mCanceling = other.mCanceling;
         mAdvancedOptions = other.mAdvancedOptions;
     }
@@ -201,7 +210,6 @@
         mTag = parcel.readString();
         mCreationTime = parcel.readLong();
         mCopies = parcel.readInt();
-        mStateReason = parcel.readString();
         Parcelable[] parcelables = parcel.readParcelableArray(null);
         if (parcelables != null) {
             mPageRanges = new PageRange[parcelables.length];
@@ -211,6 +219,8 @@
         }
         mAttributes = (PrintAttributes) parcel.readParcelable(null);
         mDocumentInfo = (PrintDocumentInfo) parcel.readParcelable(null);
+        mProgress = parcel.readFloat();
+        mStatus = parcel.readCharSequence();
         mCanceling = (parcel.readInt() == 1);
         mAdvancedOptions = parcel.readBundle();
     }
@@ -227,7 +237,7 @@
     /**
      * Sets the unique print job id.
      *
-     * @param The job id.
+     * @param id The job id.
      *
      * @hide
      */
@@ -265,7 +275,7 @@
     }
 
     /**
-     * Sets the unique target pritner id.
+     * Sets the unique target printer id.
      *
      * @param printerId The target printer id.
      *
@@ -326,6 +336,30 @@
     }
 
     /**
+     * Sets the progress of the print job.
+     *
+     * @param progress the progress of the job
+     *
+     * @hide
+     */
+    public void setProgress(@FloatRange(from=0.0, to=1.0) float progress) {
+        Preconditions.checkArgumentInRange(progress, 0, 1, "progress");
+
+        mProgress = progress;
+    }
+
+    /**
+     * Sets the status of the print job.
+     *
+     * @param status the status of the job, can be null
+     *
+     * @hide
+     */
+    public void setStatus(@Nullable CharSequence status) {
+        mStatus = status;
+    }
+
+    /**
      * Sets the owning application id.
      *
      * @return The owning app id.
@@ -416,30 +450,6 @@
     }
 
     /**
-     * Gets the reason for the print job being in the current state.
-     *
-     * @return The reason, or null if there is no reason or the
-     * reason is unknown.
-     *
-     * @hide
-     */
-    public String getStateReason() {
-        return mStateReason;
-    }
-
-    /**
-     * Sets the reason for the print job being in the current state.
-     *
-     * @param stateReason The reason, or null if there is no reason
-     * or the reason is unknown.
-     *
-     * @hide
-     */
-    public void setStateReason(String stateReason) {
-        mStateReason = stateReason;
-    }
-
-    /**
      * Gets the included pages.
      *
      * @return The included pages or <code>null</code> if not set.
@@ -604,10 +614,11 @@
         parcel.writeString(mTag);
         parcel.writeLong(mCreationTime);
         parcel.writeInt(mCopies);
-        parcel.writeString(mStateReason);
         parcel.writeParcelableArray(mPageRanges, flags);
         parcel.writeParcelable(mAttributes, flags);
         parcel.writeParcelable(mDocumentInfo, 0);
+        parcel.writeFloat(mProgress);
+        parcel.writeCharSequence(mStatus);
         parcel.writeInt(mCanceling ? 1 : 0);
         parcel.writeBundle(mAdvancedOptions);
     }
@@ -631,6 +642,9 @@
         builder.append(", pages: " + (mPageRanges != null
                 ? Arrays.toString(mPageRanges) : null));
         builder.append(", hasAdvancedOptions: " + (mAdvancedOptions != null));
+        builder.append(", progress: " + mProgress);
+        builder.append(", status: " + (mStatus != null
+                ? mStatus.toString() : null));
         builder.append("}");
         return builder.toString();
     }
@@ -666,6 +680,28 @@
     }
 
     /**
+     * Get the progress that has been made printing this job.
+     *
+     * @return the print progress or -1 if not set
+     * @hide
+     */
+    @TestApi
+    public float getProgress() {
+        return mProgress;
+    }
+
+    /**
+     * Get the status of this job.
+     *
+     * @return the status of this job or null if not set
+     * @hide
+     */
+    @TestApi
+    public @Nullable CharSequence getStatus() {
+        return mStatus;
+    }
+
+    /**
      * Builder for creating a {@link PrintJobInfo}.
      */
     public static final class Builder {
@@ -711,6 +747,28 @@
         }
 
         /**
+         * Sets the progress of the print job.
+         *
+         * @param progress the progress of the job
+         * @hide
+         */
+        public void setProgress(@FloatRange(from=0.0, to=1.0) float progress) {
+            Preconditions.checkArgumentInRange(progress, 0, 1, "progress");
+
+            mPrototype.mProgress = progress;
+        }
+
+        /**
+         * Sets the status of the print job.
+         *
+         * @param status the status of the job, can be null
+         * @hide
+         */
+        public void setStatus(@Nullable CharSequence status) {
+            mPrototype.mStatus = status;
+        }
+
+        /**
          * Puts an advanced (printer specific) option.
          *
          * @param key The option key.
diff --git a/core/java/android/printservice/IPrintServiceClient.aidl b/core/java/android/printservice/IPrintServiceClient.aidl
index c2dfc30..b4baa48 100644
--- a/core/java/android/printservice/IPrintServiceClient.aidl
+++ b/core/java/android/printservice/IPrintServiceClient.aidl
@@ -35,6 +35,22 @@
     boolean setPrintJobTag(in PrintJobId printJobId, String tag);
     oneway void writePrintJobData(in ParcelFileDescriptor fd, in PrintJobId printJobId);
 
+    /**
+     * Set the progress of this print job
+     *
+     * @param printJobId The print job to update
+     * @param progress The new progress
+     */
+    void setProgress(in PrintJobId printJobId, in float progress);
+
+    /**
+     * Set the status of this print job
+     *
+     * @param printJobId The print job to update
+     * @param status The new status, can be null
+     */
+    void setStatus(in PrintJobId printJobId, in CharSequence status);
+
     void onPrintersAdded(in ParceledListSlice printers);
     void onPrintersRemoved(in ParceledListSlice printerIds);
 }
diff --git a/core/java/android/printservice/PrintJob.java b/core/java/android/printservice/PrintJob.java
index 6fa0bdd..86fc292 100644
--- a/core/java/android/printservice/PrintJob.java
+++ b/core/java/android/printservice/PrintJob.java
@@ -16,6 +16,10 @@
 
 package android.printservice;
 
+import android.annotation.FloatRange;
+import android.annotation.MainThread;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.os.RemoteException;
 import android.print.PrintJobId;
 import android.print.PrintJobInfo;
@@ -41,7 +45,7 @@
 
     private PrintJobInfo mCachedInfo;
 
-    PrintJob(PrintJobInfo jobInfo, IPrintServiceClient client) {
+    PrintJob(@NonNull PrintJobInfo jobInfo, @NonNull IPrintServiceClient client) {
         mCachedInfo = jobInfo;
         mPrintServiceClient = client;
         mDocument = new PrintDocument(mCachedInfo.getId(), client,
@@ -53,6 +57,7 @@
      *
      * @return The id.
      */
+    @MainThread
     public PrintJobId getId() {
         PrintService.throwIfNotCalledOnMainThread();
         return mCachedInfo.getId();
@@ -68,7 +73,8 @@
      *
      * @return The print job info.
      */
-    public PrintJobInfo getInfo() {
+    @MainThread
+    public @NonNull PrintJobInfo getInfo() {
         PrintService.throwIfNotCalledOnMainThread();
         if (isInImmutableState()) {
             return mCachedInfo;
@@ -90,7 +96,8 @@
      *
      * @return The document.
      */
-    public PrintDocument getDocument() {
+    @MainThread
+    public @NonNull PrintDocument getDocument() {
         PrintService.throwIfNotCalledOnMainThread();
         return mDocument;
     }
@@ -104,6 +111,7 @@
      * @see #start()
      * @see #cancel()
      */
+    @MainThread
     public boolean isQueued() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_QUEUED;
@@ -117,8 +125,9 @@
      *
      * @see #complete()
      * @see #cancel()
-     * @see #fail(CharSequence)
+     * @see #fail(String)
      */
+    @MainThread
     public boolean isStarted() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_STARTED;
@@ -132,8 +141,9 @@
      *
      * @see #start()
      * @see #cancel()
-     * @see #fail(CharSequence)
+     * @see #fail(String)
      */
+    @MainThread
     public boolean isBlocked() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_BLOCKED;
@@ -147,6 +157,7 @@
      *
      * @see #complete()
      */
+    @MainThread
     public boolean isCompleted() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_COMPLETED;
@@ -158,8 +169,9 @@
      *
      * @return Whether the print job is failed.
      *
-     * @see #fail(CharSequence)
+     * @see #fail(String)
      */
+    @MainThread
     public boolean isFailed() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_FAILED;
@@ -173,6 +185,7 @@
      *
      * @see #cancel()
      */
+    @MainThread
     public boolean isCancelled() {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getState() == PrintJobInfo.STATE_CANCELED;
@@ -182,12 +195,16 @@
      * Starts the print job. You should call this method if {@link
      * #isQueued()} or {@link #isBlocked()} returns true and you started
      * resumed printing.
+     * <p>
+     * This resets the print status to null. Set the new status by using {@link #setStatus}.
+     * </p>
      *
      * @return Whether the job was started.
      *
      * @see #isQueued()
      * @see #isBlocked()
      */
+    @MainThread
     public boolean start() {
         PrintService.throwIfNotCalledOnMainThread();
         final int state = getInfo().getState();
@@ -205,18 +222,20 @@
      * paper to continue printing. To resume the print job call {@link
      * #start()}.
      *
+     * @param reason The human readable, short, and translated reason why the print job is blocked.
      * @return Whether the job was blocked.
      *
      * @see #isStarted()
      * @see #isBlocked()
      */
-    public boolean block(String reason) {
+    @MainThread
+    public boolean block(@Nullable String reason) {
         PrintService.throwIfNotCalledOnMainThread();
         PrintJobInfo info = getInfo();
         final int state = info.getState();
         if (state == PrintJobInfo.STATE_STARTED
                 || (state == PrintJobInfo.STATE_BLOCKED
-                        && !TextUtils.equals(info.getStateReason(), reason))) {
+                        && !TextUtils.equals(info.getStatus(), reason))) {
             return setState(PrintJobInfo.STATE_BLOCKED, reason);
         }
         return false;
@@ -230,6 +249,7 @@
      *
      * @see #isStarted()
      */
+    @MainThread
     public boolean complete() {
         PrintService.throwIfNotCalledOnMainThread();
         if (isStarted()) {
@@ -251,7 +271,8 @@
      * @see #isStarted()
      * @see #isBlocked()
      */
-    public boolean fail(String error) {
+    @MainThread
+    public boolean fail(@Nullable String error) {
         PrintService.throwIfNotCalledOnMainThread();
         if (!isInImmutableState()) {
             return setState(PrintJobInfo.STATE_FAILED, error);
@@ -271,6 +292,7 @@
      * @see #isQueued()
      * @see #isBlocked()
      */
+    @MainThread
     public boolean cancel() {
         PrintService.throwIfNotCalledOnMainThread();
         if (!isInImmutableState()) {
@@ -280,6 +302,39 @@
     }
 
     /**
+     * Sets the progress of this print job as a fraction of 1.
+     *
+     * @param progress The new progress
+     */
+    @MainThread
+    public void setProgress(@FloatRange(from=0.0, to=1.0) float progress) {
+        PrintService.throwIfNotCalledOnMainThread();
+
+        try {
+            mPrintServiceClient.setProgress(mCachedInfo.getId(), progress);
+        } catch (RemoteException re) {
+            Log.e(LOG_TAG, "Error setting progress for job: " + mCachedInfo.getId(), re);
+        }
+    }
+
+    /**
+     * Sets the status of this print job. This should be a human readable, short, and translated
+     * description of the current state of the print job.
+     *
+     * @param status The new status. If null the status will be empty.
+     */
+    @MainThread
+    public void setStatus(@Nullable CharSequence status) {
+        PrintService.throwIfNotCalledOnMainThread();
+
+        try {
+            mPrintServiceClient.setStatus(mCachedInfo.getId(), status);
+        } catch (RemoteException re) {
+            Log.e(LOG_TAG, "Error setting status for job: " + mCachedInfo.getId(), re);
+        }
+    }
+
+    /**
      * Sets a tag that is valid in the context of a {@link PrintService}
      * and is not interpreted by the system. For example, a print service
      * may set as a tag the key of the print job returned by a remote
@@ -288,6 +343,7 @@
      * @param tag The tag.
      * @return True if the tag was set, false otherwise.
      */
+    @MainThread
     public boolean setTag(String tag) {
         PrintService.throwIfNotCalledOnMainThread();
         if (isInImmutableState()) {
@@ -319,6 +375,7 @@
      * @param key The option key.
      * @return The option value.
      */
+    @MainThread
     public String getAdvancedStringOption(String key) {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getAdvancedStringOption(key);
@@ -331,6 +388,7 @@
      * @param key The option key.
      * @return Whether the option is present.
      */
+    @MainThread
     public boolean hasAdvancedOption(String key) {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().hasAdvancedOption(key);
@@ -342,6 +400,7 @@
      * @param key The option key.
      * @return The option value.
      */
+    @MainThread
     public int getAdvancedIntOption(String key) {
         PrintService.throwIfNotCalledOnMainThread();
         return getInfo().getAdvancedIntOption(key);
@@ -374,14 +433,14 @@
                 || state == PrintJobInfo.STATE_FAILED;
     }
 
-    private boolean setState(int state, String error) {
+    private boolean setState(int state, @Nullable String error) {
         try {
             if (mPrintServiceClient.setPrintJobState(mCachedInfo.getId(), state, error)) {
                 // Best effort - update the state of the cached info since
                 // we may not be able to re-fetch it later if the job gets
                 // removed from the spooler as a result of the state change.
                 mCachedInfo.setState(state);
-                mCachedInfo.setStateReason(error);
+                mCachedInfo.setStatus(error);
                 return true;
             }
         } catch (RemoteException re) {
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index af23312..89c0c85 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -5922,6 +5922,14 @@
                     "filter");
 
             /**
+             * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same
+             * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
+             * parameters, otherwise it will throw UnsupportedOperationException.
+             */
+            public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath(
+                    CONTENT_URI, "filter_enterprise");
+
+            /**
              * A boolean query parameter that can be used with {@link #CONTENT_FILTER_URI}.
              * If "1" or "true", display names are searched.  If "0" or "false", display names
              * are not searched.  Default is "1".
@@ -7402,6 +7410,14 @@
              */
             public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
                     "filter");
+
+            /**
+             * Similar to {@link Phone#ENTERPRISE_CONTENT_FILTER_URI}, but allows users to filter
+             * callable data. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
+             * parameters, otherwise it will throw UnsupportedOperationException.
+             */
+            public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath(
+                    CONTENT_URI, "filter_enterprise");
         }
 
         /**
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 8ae899f..77a4485 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -67,7 +67,7 @@
  * @see DocumentsProvider
  */
 public final class DocumentsContract {
-    private static final String TAG = "Documents";
+    private static final String TAG = "DocumentsContract";
 
     // content://com.example/root/
     // content://com.example/root/sdcard/
@@ -234,6 +234,7 @@
          * @see #FLAG_DIR_PREFERS_GRID
          * @see #FLAG_DIR_PREFERS_LAST_MODIFIED
          * @see #FLAG_VIRTUAL_DOCUMENT
+         * @see #FLAG_ARCHIVE
          */
         public static final String COLUMN_FLAGS = "flags";
 
@@ -368,6 +369,18 @@
         public static final int FLAG_VIRTUAL_DOCUMENT = 1 << 10;
 
         /**
+         * Flag indicating that a document is an archive, and it's contents can be
+         * obtained via {@link DocumentsProvider#queryChildDocuments}.
+         * <p>
+         * The <em>provider</em> support library offers utility classes to add common
+         * archive support.
+         *
+         * @see #COLUMN_FLAGS
+         * @see DocumentsProvider#queryChildDocuments(String, String[], String)
+         */
+        public static final int FLAG_ARCHIVE = 1 << 11;
+
+        /**
          * Flag indicating that document titles should be hidden when viewing
          * this directory in a larger format grid. For example, a directory
          * containing only images may want the image thumbnails to speak for
@@ -591,6 +604,12 @@
      */
     public static final String EXTRA_ERROR = "error";
 
+    /**
+     * Optional result (I'm thinking boolean) answer to a question.
+     * {@hide}
+     */
+    public static final String EXTRA_RESULT = "result";
+
     /** {@hide} */
     public static final String METHOD_CREATE_DOCUMENT = "android:createDocument";
     /** {@hide} */
@@ -601,6 +620,8 @@
     public static final String METHOD_COPY_DOCUMENT = "android:copyDocument";
     /** {@hide} */
     public static final String METHOD_MOVE_DOCUMENT = "android:moveDocument";
+    /** {@hide} */
+    public static final String METHOD_IS_CHILD_DOCUMENT = "android:isChildDocument";
 
     /** {@hide} */
     public static final String EXTRA_URI = "uri";
@@ -1025,6 +1046,24 @@
         return out.getParcelable(DocumentsContract.EXTRA_URI);
     }
 
+    /** {@hide} */
+    public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri,
+            Uri childDocumentUri) throws RemoteException {
+
+        final Bundle in = new Bundle();
+        in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri);
+        in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri);
+
+        final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in);
+        if (out == null) {
+            throw new RemoteException("Failed to get a reponse from isChildDocument query.");
+        }
+        if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) {
+            throw new RemoteException("Response did not include result field..");
+        }
+        return out.getBoolean(DocumentsContract.EXTRA_RESULT);
+    }
+
     /**
      * Change the display name of an existing document.
      * <p>
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index f01073b..e25ba35 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -16,11 +16,12 @@
 
 package android.provider;
 
+import static android.provider.DocumentsContract.METHOD_COPY_DOCUMENT;
 import static android.provider.DocumentsContract.METHOD_CREATE_DOCUMENT;
 import static android.provider.DocumentsContract.METHOD_DELETE_DOCUMENT;
-import static android.provider.DocumentsContract.METHOD_RENAME_DOCUMENT;
-import static android.provider.DocumentsContract.METHOD_COPY_DOCUMENT;
+import static android.provider.DocumentsContract.METHOD_IS_CHILD_DOCUMENT;
 import static android.provider.DocumentsContract.METHOD_MOVE_DOCUMENT;
+import static android.provider.DocumentsContract.METHOD_RENAME_DOCUMENT;
 import static android.provider.DocumentsContract.buildDocumentUri;
 import static android.provider.DocumentsContract.buildDocumentUriMaybeUsingTree;
 import static android.provider.DocumentsContract.buildTreeDocumentUri;
@@ -688,6 +689,16 @@
             return super.call(method, arg, extras);
         }
 
+        try {
+            return callUnchecked(method, arg, extras);
+        } catch (FileNotFoundException e) {
+            throw new IllegalStateException("Failed call " + method, e);
+        }
+    }
+
+    private Bundle callUnchecked(String method, String arg, Bundle extras)
+            throws FileNotFoundException {
+
         final Context context = getContext();
         final Uri documentUri = extras.getParcelable(DocumentsContract.EXTRA_URI);
         final String authority = documentUri.getAuthority();
@@ -697,109 +708,120 @@
             throw new SecurityException(
                     "Requested authority " + authority + " doesn't match provider " + mAuthority);
         }
-        enforceTree(documentUri);
 
         final Bundle out = new Bundle();
-        try {
-            if (METHOD_CREATE_DOCUMENT.equals(method)) {
-                enforceWritePermissionInner(documentUri, getCallingPackage(), null);
 
-                final String mimeType = extras.getString(Document.COLUMN_MIME_TYPE);
-                final String displayName = extras.getString(Document.COLUMN_DISPLAY_NAME);
-                final String newDocumentId = createDocument(documentId, mimeType, displayName);
+        // If the URI is a tree URI performs some validation.
+        enforceTree(documentUri);
 
-                // No need to issue new grants here, since caller either has
-                // manage permission or a prefix grant. We might generate a
-                // tree style URI if that's how they called us.
+        if (METHOD_IS_CHILD_DOCUMENT.equals(method)) {
+            enforceReadPermissionInner(documentUri, getCallingPackage(), null);
+
+            final Uri childUri = extras.getParcelable(DocumentsContract.EXTRA_TARGET_URI);
+            final String childAuthority = childUri.getAuthority();
+            final String childId = DocumentsContract.getDocumentId(childUri);
+
+            out.putBoolean(
+                    DocumentsContract.EXTRA_RESULT,
+                    mAuthority.equals(childAuthority)
+                            && isChildDocument(documentId, childId));
+
+        } else if (METHOD_CREATE_DOCUMENT.equals(method)) {
+            enforceWritePermissionInner(documentUri, getCallingPackage(), null);
+
+            final String mimeType = extras.getString(Document.COLUMN_MIME_TYPE);
+            final String displayName = extras.getString(Document.COLUMN_DISPLAY_NAME);
+            final String newDocumentId = createDocument(documentId, mimeType, displayName);
+
+            // No need to issue new grants here, since caller either has
+            // manage permission or a prefix grant. We might generate a
+            // tree style URI if that's how they called us.
+            final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
+                    newDocumentId);
+            out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
+
+        } else if (METHOD_RENAME_DOCUMENT.equals(method)) {
+            enforceWritePermissionInner(documentUri, getCallingPackage(), null);
+
+            final String displayName = extras.getString(Document.COLUMN_DISPLAY_NAME);
+            final String newDocumentId = renameDocument(documentId, displayName);
+
+            if (newDocumentId != null) {
                 final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
                         newDocumentId);
+
+                // If caller came in with a narrow grant, issue them a
+                // narrow grant for the newly renamed document.
+                if (!isTreeUri(newDocumentUri)) {
+                    final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
+                            documentUri);
+                    context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
+                }
+
                 out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
 
-            } else if (METHOD_RENAME_DOCUMENT.equals(method)) {
-                enforceWritePermissionInner(documentUri, getCallingPackage(), null);
-
-                final String displayName = extras.getString(Document.COLUMN_DISPLAY_NAME);
-                final String newDocumentId = renameDocument(documentId, displayName);
-
-                if (newDocumentId != null) {
-                    final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
-                            newDocumentId);
-
-                    // If caller came in with a narrow grant, issue them a
-                    // narrow grant for the newly renamed document.
-                    if (!isTreeUri(newDocumentUri)) {
-                        final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
-                                documentUri);
-                        context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
-                    }
-
-                    out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
-
-                    // Original document no longer exists, clean up any grants
-                    revokeDocumentPermission(documentId);
-                }
-
-            } else if (METHOD_DELETE_DOCUMENT.equals(method)) {
-                enforceWritePermissionInner(documentUri, getCallingPackage(), null);
-                deleteDocument(documentId);
-
-                // Document no longer exists, clean up any grants
-                revokeDocumentPermission(documentId);
-
-            } else if (METHOD_COPY_DOCUMENT.equals(method)) {
-                final Uri targetUri = extras.getParcelable(DocumentsContract.EXTRA_TARGET_URI);
-                final String targetId = DocumentsContract.getDocumentId(targetUri);
-
-                enforceReadPermissionInner(documentUri, getCallingPackage(), null);
-                enforceWritePermissionInner(targetUri, getCallingPackage(), null);
-
-                final String newDocumentId = copyDocument(documentId, targetId);
-
-                if (newDocumentId != null) {
-                    final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
-                            newDocumentId);
-
-                    if (!isTreeUri(newDocumentUri)) {
-                        final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
-                                documentUri);
-                        context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
-                    }
-
-                    out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
-                }
-
-            } else if (METHOD_MOVE_DOCUMENT.equals(method)) {
-                final Uri targetUri = extras.getParcelable(DocumentsContract.EXTRA_TARGET_URI);
-                final String targetId = DocumentsContract.getDocumentId(targetUri);
-
-                enforceReadPermissionInner(documentUri, getCallingPackage(), null);
-                enforceWritePermissionInner(targetUri, getCallingPackage(), null);
-
-                final String displayName = extras.getString(Document.COLUMN_DISPLAY_NAME);
-                final String newDocumentId = moveDocument(documentId, targetId);
-
-                if (newDocumentId != null) {
-                    final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
-                            newDocumentId);
-
-                    if (!isTreeUri(newDocumentUri)) {
-                        final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
-                                documentUri);
-                        context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
-                    }
-
-                    out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
-                }
-
                 // Original document no longer exists, clean up any grants
                 revokeDocumentPermission(documentId);
-
-            } else {
-                throw new UnsupportedOperationException("Method not supported " + method);
             }
-        } catch (FileNotFoundException e) {
-            throw new IllegalStateException("Failed call " + method, e);
+
+        } else if (METHOD_DELETE_DOCUMENT.equals(method)) {
+            enforceWritePermissionInner(documentUri, getCallingPackage(), null);
+            deleteDocument(documentId);
+
+            // Document no longer exists, clean up any grants
+            revokeDocumentPermission(documentId);
+
+        } else if (METHOD_COPY_DOCUMENT.equals(method)) {
+            final Uri targetUri = extras.getParcelable(DocumentsContract.EXTRA_TARGET_URI);
+            final String targetId = DocumentsContract.getDocumentId(targetUri);
+
+            enforceReadPermissionInner(documentUri, getCallingPackage(), null);
+            enforceWritePermissionInner(targetUri, getCallingPackage(), null);
+
+            final String newDocumentId = copyDocument(documentId, targetId);
+
+            if (newDocumentId != null) {
+                final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
+                        newDocumentId);
+
+                if (!isTreeUri(newDocumentUri)) {
+                    final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
+                            documentUri);
+                    context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
+                }
+
+                out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
+            }
+
+        } else if (METHOD_MOVE_DOCUMENT.equals(method)) {
+            final Uri targetUri = extras.getParcelable(DocumentsContract.EXTRA_TARGET_URI);
+            final String targetId = DocumentsContract.getDocumentId(targetUri);
+
+            enforceReadPermissionInner(documentUri, getCallingPackage(), null);
+            enforceWritePermissionInner(targetUri, getCallingPackage(), null);
+
+            final String newDocumentId = moveDocument(documentId, targetId);
+
+            if (newDocumentId != null) {
+                final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
+                        newDocumentId);
+
+                if (!isTreeUri(newDocumentUri)) {
+                    final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
+                            documentUri);
+                    context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
+                }
+
+                out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
+            }
+
+            // Original document no longer exists, clean up any grants
+            revokeDocumentPermission(documentId);
+
+        } else {
+            throw new UnsupportedOperationException("Method not supported " + method);
         }
+
         return out;
     }
 
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f560f8a..fa1bf76 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4420,8 +4420,19 @@
          * to receive changes in this value.
          */
         public static final String LOCATION_MODE = "location_mode";
+        /**
+         * Stores the previous location mode when {@link #LOCATION_MODE} is set to
+         * {@link #LOCATION_MODE_OFF}
+         * @hide
+         */
+        public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
 
         /**
+         * Sets all location providers to the previous states before location was turned off.
+         * @hide
+         */
+        public static final int LOCATION_MODE_PREVIOUS = -1;
+        /**
          * Location access disabled.
          */
         public static final int LOCATION_MODE_OFF = 0;
@@ -4920,6 +4931,15 @@
                 "accessibility_autoclick_delay";
 
         /**
+         * Whether or not larger size icons are used for the pointer of mouse/trackpad for
+         * accessibility.
+         * (0 = false, 1 = true)
+         * @hide
+         */
+        public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
+                "accessibility_large_pointer_icon";
+
+        /**
          * The timeout for considering a press to be a long press in milliseconds.
          * @hide
          */
@@ -5795,6 +5815,7 @@
             CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
             CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
             CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
+            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
             CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
             CLONE_TO_MANAGED_PROFILE.add(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
             CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
@@ -5882,6 +5903,28 @@
         }
 
         /**
+         * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
+         */
+        private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
+            final int mode = getLocationModeForUser(cr, userId);
+            return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
+        }
+
+        /**
+         * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
+         */
+        private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
+            int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
+                    LOCATION_MODE_HIGH_ACCURACY, userId);
+            // Make sure that the previous mode is never "off". Otherwise the user won't be able to
+            // turn on location any longer.
+            if (mode == LOCATION_MODE_OFF) {
+                mode = LOCATION_MODE_HIGH_ACCURACY;
+            }
+            return setLocationModeForUser(cr, mode, userId);
+        }
+
+        /**
          * Thread-safe method for setting the location mode to one of
          * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
          * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
@@ -5899,7 +5942,11 @@
                 boolean gps = false;
                 boolean network = false;
                 switch (mode) {
+                    case LOCATION_MODE_PREVIOUS:
+                        // Retrieve the actual mode and set to that mode.
+                        return restoreLocationModeForUser(cr, userId);
                     case LOCATION_MODE_OFF:
+                        saveLocationModeForUser(cr, userId);
                         break;
                     case LOCATION_MODE_SENSORS_ONLY:
                         gps = true;
diff --git a/core/java/android/security/net/config/ApplicationConfig.java b/core/java/android/security/net/config/ApplicationConfig.java
index 48359d47..b627641 100644
--- a/core/java/android/security/net/config/ApplicationConfig.java
+++ b/core/java/android/security/net/config/ApplicationConfig.java
@@ -144,18 +144,4 @@
             return sInstance;
         }
     }
-
-    /** @hide */
-    public static ApplicationConfig getPlatformDefault() {
-        return new ApplicationConfig(new ConfigSource() {
-            @Override
-            public NetworkSecurityConfig getDefaultConfig() {
-                return NetworkSecurityConfig.DEFAULT;
-            }
-            @Override
-            public Set<Pair<Domain, NetworkSecurityConfig>> getPerDomainConfigs() {
-                return null;
-            }
-        });
-    }
 }
diff --git a/core/java/android/security/net/config/CertificateSource.java b/core/java/android/security/net/config/CertificateSource.java
index 386354d..2b7829e 100644
--- a/core/java/android/security/net/config/CertificateSource.java
+++ b/core/java/android/security/net/config/CertificateSource.java
@@ -22,4 +22,5 @@
 /** @hide */
 public interface CertificateSource {
     Set<X509Certificate> getCertificates();
+    X509Certificate findBySubjectAndPublicKey(X509Certificate cert);
 }
diff --git a/core/java/android/security/net/config/CertificatesEntryRef.java b/core/java/android/security/net/config/CertificatesEntryRef.java
index 2ba38c21..1d15e19 100644
--- a/core/java/android/security/net/config/CertificatesEntryRef.java
+++ b/core/java/android/security/net/config/CertificatesEntryRef.java
@@ -30,6 +30,10 @@
         mOverridesPins = overridesPins;
     }
 
+    boolean overridesPins() {
+        return mOverridesPins;
+    }
+
     public Set<TrustAnchor> getTrustAnchors() {
         // TODO: cache this [but handle mutable sources]
         Set<TrustAnchor> anchors = new ArraySet<TrustAnchor>();
@@ -38,4 +42,13 @@
         }
         return anchors;
     }
+
+    public TrustAnchor findBySubjectAndPublicKey(X509Certificate cert) {
+        X509Certificate foundCert = mSource.findBySubjectAndPublicKey(cert);
+        if (foundCert == null) {
+            return null;
+        }
+
+        return new TrustAnchor(foundCert, mOverridesPins);
+    }
 }
diff --git a/core/java/android/security/net/config/DirectoryCertificateSource.java b/core/java/android/security/net/config/DirectoryCertificateSource.java
new file mode 100644
index 0000000..a261e06
--- /dev/null
+++ b/core/java/android/security/net/config/DirectoryCertificateSource.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2015 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.security.net.config;
+
+import android.os.Environment;
+import android.os.UserHandle;
+import android.util.ArraySet;
+import android.util.Pair;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Set;
+import libcore.io.IoUtils;
+
+import com.android.org.conscrypt.Hex;
+import com.android.org.conscrypt.NativeCrypto;
+
+import javax.security.auth.x500.X500Principal;
+
+/**
+ * {@link CertificateSource} based on a directory where certificates are stored as individual files
+ * named after a hash of their SubjectName for more efficient lookups.
+ * @hide
+ */
+abstract class DirectoryCertificateSource implements CertificateSource {
+    private final File mDir;
+    private final Object mLock = new Object();
+    private final CertificateFactory mCertFactory;
+
+    private Set<X509Certificate> mCertificates;
+
+    protected DirectoryCertificateSource(File caDir) {
+        mDir = caDir;
+        try {
+            mCertFactory = CertificateFactory.getInstance("X.509");
+        } catch (CertificateException e) {
+            throw new RuntimeException("Failed to obtain X.509 CertificateFactory", e);
+        }
+    }
+
+    protected abstract boolean isCertMarkedAsRemoved(String caFile);
+
+    @Override
+    public Set<X509Certificate> getCertificates() {
+        // TODO: loading all of these is wasteful, we should instead use a keystore style API.
+        synchronized (mLock) {
+            if (mCertificates != null) {
+                return mCertificates;
+            }
+
+            Set<X509Certificate> certs = new ArraySet<X509Certificate>();
+            if (mDir.isDirectory()) {
+                for (String caFile : mDir.list()) {
+                    if (isCertMarkedAsRemoved(caFile)) {
+                        continue;
+                    }
+                    X509Certificate cert = readCertificate(caFile);
+                    if (cert != null) {
+                        certs.add(cert);
+                    }
+                }
+            }
+            mCertificates = certs;
+            return mCertificates;
+        }
+    }
+
+    @Override
+    public X509Certificate findBySubjectAndPublicKey(final X509Certificate cert) {
+        return findCert(cert.getSubjectX500Principal(), new CertSelector() {
+            @Override
+            public boolean match(X509Certificate ca) {
+                return ca.getPublicKey().equals(cert.getPublicKey());
+            }
+        });
+    }
+
+    private static interface CertSelector {
+        boolean match(X509Certificate cert);
+    }
+
+    private X509Certificate findCert(X500Principal subj, CertSelector selector) {
+        String hash = getHash(subj);
+        for (int index = 0; index >= 0; index++) {
+            String fileName = hash + "." + index;
+            if (!new File(mDir, fileName).exists()) {
+                break;
+            }
+            if (isCertMarkedAsRemoved(fileName)) {
+                continue;
+            }
+            X509Certificate cert = readCertificate(fileName);
+            if (!subj.equals(cert.getSubjectX500Principal())) {
+                continue;
+            }
+            if (selector.match(cert)) {
+                return cert;
+            }
+        }
+        return null;
+    }
+
+    private String getHash(X500Principal name) {
+        int hash = NativeCrypto.X509_NAME_hash_old(name);
+        return Hex.intToHexString(hash, 8);
+    }
+
+    private X509Certificate readCertificate(String file) {
+        InputStream is = null;
+        try {
+            is = new BufferedInputStream(new FileInputStream(new File(mDir, file)));
+            return (X509Certificate) mCertFactory.generateCertificate(is);
+        } catch (CertificateException | IOException e) {
+            return null;
+        } finally {
+            IoUtils.closeQuietly(is);
+        }
+    }
+}
diff --git a/core/java/android/security/net/config/KeyStoreCertificateSource.java b/core/java/android/security/net/config/KeyStoreCertificateSource.java
index 1973ef1..7a01a64 100644
--- a/core/java/android/security/net/config/KeyStoreCertificateSource.java
+++ b/core/java/android/security/net/config/KeyStoreCertificateSource.java
@@ -24,6 +24,8 @@
 import java.util.Enumeration;
 import java.util.Set;
 
+import com.android.org.conscrypt.TrustedCertificateIndex;
+
 /**
  * {@link CertificateSource} which provides certificates from trusted certificate entries of a
  * {@link KeyStore}.
@@ -31,6 +33,7 @@
 class KeyStoreCertificateSource implements CertificateSource {
     private final Object mLock = new Object();
     private final KeyStore mKeyStore;
+    private TrustedCertificateIndex mIndex;
     private Set<X509Certificate> mCertificates;
 
     public KeyStoreCertificateSource(KeyStore ks) {
@@ -39,27 +42,42 @@
 
     @Override
     public Set<X509Certificate> getCertificates() {
+        ensureInitialized();
+        return mCertificates;
+    }
+
+    private void ensureInitialized() {
         synchronized (mLock) {
             if (mCertificates != null) {
-                return mCertificates;
+                return;
             }
+
             try {
+                TrustedCertificateIndex localIndex = new TrustedCertificateIndex();
                 Set<X509Certificate> certificates = new ArraySet<>(mKeyStore.size());
                 for (Enumeration<String> en = mKeyStore.aliases(); en.hasMoreElements();) {
                     String alias = en.nextElement();
-                    if (!mKeyStore.isCertificateEntry(alias)) {
-                        continue;
-                    }
                     X509Certificate cert = (X509Certificate) mKeyStore.getCertificate(alias);
                     if (cert != null) {
                         certificates.add(cert);
+                        localIndex.index(cert);
                     }
                 }
+                mIndex = localIndex;
                 mCertificates = certificates;
-                return mCertificates;
             } catch (KeyStoreException e) {
                 throw new RuntimeException("Failed to load certificates from KeyStore", e);
             }
         }
     }
+
+    @Override
+    public X509Certificate findBySubjectAndPublicKey(X509Certificate cert) {
+        ensureInitialized();
+        java.security.cert.TrustAnchor anchor = mIndex.findBySubjectAndPublicKey(cert);
+        if (anchor == null) {
+            return null;
+        }
+        return anchor.getTrustedCert();
+    }
 }
diff --git a/core/java/android/security/net/config/ManifestConfigSource.java b/core/java/android/security/net/config/ManifestConfigSource.java
new file mode 100644
index 0000000..bf1fb8a
--- /dev/null
+++ b/core/java/android/security/net/config/ManifestConfigSource.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2015 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.security.net.config;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.util.Log;
+import android.util.Pair;
+import java.util.Set;
+
+/** @hide */
+public class ManifestConfigSource implements ConfigSource {
+    public static final String META_DATA_NETWORK_SECURITY_CONFIG =
+            "android.security.net.config";
+    private static final boolean DBG = true;
+    private static final String LOG_TAG = "NetworkSecurityConfig";
+
+    private final Object mLock = new Object();
+    private final Context mContext;
+
+    private ConfigSource mConfigSource;
+
+    public ManifestConfigSource(Context context) {
+        mContext = context;
+    }
+
+    @Override
+    public Set<Pair<Domain, NetworkSecurityConfig>> getPerDomainConfigs() {
+        return getConfigSource().getPerDomainConfigs();
+    }
+
+    @Override
+    public NetworkSecurityConfig getDefaultConfig() {
+        return getConfigSource().getDefaultConfig();
+    }
+
+    private ConfigSource getConfigSource() {
+        synchronized (mLock) {
+            if (mConfigSource != null) {
+                return mConfigSource;
+            }
+            ApplicationInfo info;
+            try {
+                info = mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(),
+                        PackageManager.GET_META_DATA);
+            } catch (PackageManager.NameNotFoundException e) {
+                throw new RuntimeException("Failed to look up ApplicationInfo", e);
+            }
+            int configResourceId = 0;
+            if (info != null && info.metaData != null) {
+                configResourceId = info.metaData.getInt(META_DATA_NETWORK_SECURITY_CONFIG);
+            }
+
+            ConfigSource source;
+            if (configResourceId != 0) {
+                boolean debugBuild = (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
+                if (DBG) {
+                    Log.d(LOG_TAG, "Using Network Security Config from resource "
+                            + mContext.getResources().getResourceEntryName(configResourceId)
+                            + " debugBuild: " + debugBuild);
+                }
+                source = new XmlConfigSource(mContext, configResourceId, debugBuild);
+            } else {
+                if (DBG) {
+                    Log.d(LOG_TAG, "No Network Security Config specified, using platform default");
+                }
+                source = new DefaultConfigSource();
+            }
+            mConfigSource = source;
+            return mConfigSource;
+        }
+    }
+
+    private static final class DefaultConfigSource implements ConfigSource {
+        @Override
+        public NetworkSecurityConfig getDefaultConfig() {
+            return NetworkSecurityConfig.DEFAULT;
+        }
+
+        @Override
+        public Set<Pair<Domain, NetworkSecurityConfig>> getPerDomainConfigs() {
+            return null;
+        }
+    }
+}
diff --git a/core/java/android/security/net/config/NetworkSecurityConfig.java b/core/java/android/security/net/config/NetworkSecurityConfig.java
index 9eab80c..2ab07b5 100644
--- a/core/java/android/security/net/config/NetworkSecurityConfig.java
+++ b/core/java/android/security/net/config/NetworkSecurityConfig.java
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -53,6 +54,19 @@
         mHstsEnforced = hstsEnforced;
         mPins = pins;
         mCertificatesEntryRefs = certificatesEntryRefs;
+        // Sort the certificates entry refs so that all entries that override pins come before
+        // non-override pin entries. This allows us to handle the case where a certificate is in
+        // multiple entry refs by returning the certificate from the first entry ref.
+        Collections.sort(mCertificatesEntryRefs, new Comparator<CertificatesEntryRef>() {
+            @Override
+            public int compare(CertificatesEntryRef lhs, CertificatesEntryRef rhs) {
+                if (lhs.overridesPins()) {
+                    return rhs.overridesPins() ? 0 : -1;
+                } else {
+                    return rhs.overridesPins() ? 1 : 0;
+                }
+            }
+        });
     }
 
     public Set<TrustAnchor> getTrustAnchors() {
@@ -63,14 +77,15 @@
             // Merge trust anchors based on the X509Certificate.
             // If we see the same certificate in two TrustAnchors, one with overridesPins and one
             // without, the one with overridesPins wins.
+            // Because mCertificatesEntryRefs is sorted with all overridesPins anchors coming first
+            // this can be simplified to just using the first occurrence of a certificate.
             Map<X509Certificate, TrustAnchor> anchorMap = new ArrayMap<>();
             for (CertificatesEntryRef ref : mCertificatesEntryRefs) {
                 Set<TrustAnchor> anchors = ref.getTrustAnchors();
                 for (TrustAnchor anchor : anchors) {
-                    if (anchor.overridesPins) {
-                        anchorMap.put(anchor.certificate, anchor);
-                    } else if (!anchorMap.containsKey(anchor.certificate)) {
-                        anchorMap.put(anchor.certificate, anchor);
+                    X509Certificate cert = anchor.certificate;
+                    if (!anchorMap.containsKey(cert)) {
+                        anchorMap.put(cert, anchor);
                     }
                 }
             }
@@ -108,6 +123,17 @@
         }
     }
 
+    /** @hide */
+    public TrustAnchor findTrustAnchorBySubjectAndPublicKey(X509Certificate cert) {
+        for (CertificatesEntryRef ref : mCertificatesEntryRefs) {
+            TrustAnchor anchor = ref.findBySubjectAndPublicKey(cert);
+            if (anchor != null) {
+                return anchor;
+            }
+        }
+        return null;
+    }
+
     /**
      * Return a {@link Builder} for the default {@code NetworkSecurityConfig}.
      *
diff --git a/core/java/android/security/net/config/NetworkSecurityConfigProvider.java b/core/java/android/security/net/config/NetworkSecurityConfigProvider.java
index ac762ef..5ebc7ac 100644
--- a/core/java/android/security/net/config/NetworkSecurityConfigProvider.java
+++ b/core/java/android/security/net/config/NetworkSecurityConfigProvider.java
@@ -17,20 +17,13 @@
 package android.security.net.config;
 
 import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.util.Log;
 import java.security.Security;
 import java.security.Provider;
 
 /** @hide */
 public final class NetworkSecurityConfigProvider extends Provider {
-    private static final String LOG_TAG = "NetworkSecurityConfig";
     private static final String PREFIX =
             NetworkSecurityConfigProvider.class.getPackage().getName() + ".";
-    public static final String META_DATA_NETWORK_SECURITY_CONFIG =
-            "android.security.net.config";
-    private static final boolean DBG = true;
 
     public NetworkSecurityConfigProvider() {
         // TODO: More clever name than this
@@ -40,36 +33,7 @@
     }
 
     public static void install(Context context) {
-        ApplicationInfo info = null;
-        // TODO: This lookup shouldn't be done in the app startup path, it should be done lazily.
-        try {
-            info = context.getPackageManager().getApplicationInfo(context.getPackageName(),
-                    PackageManager.GET_META_DATA);
-        } catch (PackageManager.NameNotFoundException e) {
-            throw new RuntimeException("Failed to look up ApplicationInfo", e);
-        }
-        int configResourceId = 0;
-        if (info != null && info.metaData != null) {
-            configResourceId = info.metaData.getInt(META_DATA_NETWORK_SECURITY_CONFIG);
-        }
-
-        ApplicationConfig config;
-        if (configResourceId != 0) {
-            boolean debugBuild = (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
-            if (DBG) {
-                Log.d(LOG_TAG, "Using Network Security Config from resource "
-                        + context.getResources().getResourceEntryName(configResourceId)
-                        + " debugBuild: " + debugBuild);
-            }
-            ConfigSource source = new XmlConfigSource(context, configResourceId, debugBuild);
-            config = new ApplicationConfig(source);
-        } else {
-            if (DBG) {
-                Log.d(LOG_TAG, "No Network Security Config specified, using platform default");
-            }
-            config = ApplicationConfig.getPlatformDefault();
-        }
-
+        ApplicationConfig config = new ApplicationConfig(new ManifestConfigSource(context));
         ApplicationConfig.setDefaultInstance(config);
         int pos = Security.insertProviderAt(new NetworkSecurityConfigProvider(), 1);
         if (pos != 1) {
diff --git a/core/java/android/security/net/config/NetworkSecurityTrustManager.java b/core/java/android/security/net/config/NetworkSecurityTrustManager.java
index 2b860fa..6013c1e 100644
--- a/core/java/android/security/net/config/NetworkSecurityTrustManager.java
+++ b/core/java/android/security/net/config/NetworkSecurityTrustManager.java
@@ -133,14 +133,8 @@
             return false;
         }
         X509Certificate anchorCert = chain.get(chain.size() - 1);
-        TrustAnchor chainAnchor = null;
-        // TODO: faster lookup
-        for (TrustAnchor anchor : mNetworkSecurityConfig.getTrustAnchors()) {
-            if (anchor.certificate.equals(anchorCert)) {
-                chainAnchor = anchor;
-                break;
-            }
-        }
+        TrustAnchor chainAnchor =
+                mNetworkSecurityConfig.findTrustAnchorBySubjectAndPublicKey(anchorCert);
         if (chainAnchor == null) {
             throw new CertificateException("Trusted chain does not end in a TrustAnchor");
         }
diff --git a/core/java/android/security/net/config/ResourceCertificateSource.java b/core/java/android/security/net/config/ResourceCertificateSource.java
index 06dd9d4..b007f8f 100644
--- a/core/java/android/security/net/config/ResourceCertificateSource.java
+++ b/core/java/android/security/net/config/ResourceCertificateSource.java
@@ -27,26 +27,29 @@
 import java.util.Collection;
 import java.util.Set;
 
+import com.android.org.conscrypt.TrustedCertificateIndex;
+
 /**
  * {@link CertificateSource} based on certificates contained in an application resource file.
  * @hide
  */
 public class ResourceCertificateSource implements CertificateSource {
-    private Set<X509Certificate> mCertificates;
-    private final int  mResourceId;
-    private Context mContext;
     private final Object mLock = new Object();
+    private final int  mResourceId;
+
+    private Set<X509Certificate> mCertificates;
+    private Context mContext;
+    private TrustedCertificateIndex mIndex;
 
     public ResourceCertificateSource(int resourceId, Context context) {
         mResourceId = resourceId;
         mContext = context.getApplicationContext();
     }
 
-    @Override
-    public Set<X509Certificate> getCertificates() {
+    private void ensureInitialized() {
         synchronized (mLock) {
             if (mCertificates != null) {
-                return mCertificates;
+                return;
             }
             Set<X509Certificate> certificates = new ArraySet<X509Certificate>();
             Collection<? extends Certificate> certs;
@@ -61,12 +64,30 @@
             } finally {
                 IoUtils.closeQuietly(in);
             }
+            TrustedCertificateIndex indexLocal = new TrustedCertificateIndex();
             for (Certificate cert : certs) {
-                    certificates.add((X509Certificate) cert);
+                certificates.add((X509Certificate) cert);
+                indexLocal.index((X509Certificate) cert);
             }
             mCertificates = certificates;
+            mIndex = indexLocal;
             mContext = null;
-            return mCertificates;
         }
     }
+
+    @Override
+    public Set<X509Certificate> getCertificates() {
+        ensureInitialized();
+        return mCertificates;
+    }
+
+    @Override
+    public X509Certificate findBySubjectAndPublicKey(X509Certificate cert) {
+        ensureInitialized();
+        java.security.cert.TrustAnchor anchor = mIndex.findBySubjectAndPublicKey(cert);
+        if (anchor == null) {
+            return null;
+        }
+        return anchor.getTrustedCert();
+    }
 }
diff --git a/core/java/android/security/net/config/SystemCertificateSource.java b/core/java/android/security/net/config/SystemCertificateSource.java
index 7649a97..abef7b4 100644
--- a/core/java/android/security/net/config/SystemCertificateSource.java
+++ b/core/java/android/security/net/config/SystemCertificateSource.java
@@ -18,29 +18,20 @@
 
 import android.os.Environment;
 import android.os.UserHandle;
-import android.util.ArraySet;
-import java.io.BufferedInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.Set;
-import libcore.io.IoUtils;
 
 /**
  * {@link CertificateSource} based on the system trusted CA store.
  * @hide
  */
-public class SystemCertificateSource implements CertificateSource {
+public final class SystemCertificateSource extends DirectoryCertificateSource {
     private static final SystemCertificateSource INSTANCE = new SystemCertificateSource();
-    private Set<X509Certificate> mSystemCerts = null;
-    private final Object mLock = new Object();
+    private final File mUserRemovedCaDir;
 
     private SystemCertificateSource() {
+        super(new File(System.getenv("ANDROID_ROOT") + "/etc/security/cacerts"));
+        File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId());
+        mUserRemovedCaDir = new File(configDir, "cacerts-removed");
     }
 
     public static SystemCertificateSource getInstance() {
@@ -48,54 +39,7 @@
     }
 
     @Override
-    public Set<X509Certificate> getCertificates() {
-        // TODO: loading all of these is wasteful, we should instead use a keystore style API.
-        synchronized (mLock) {
-            if (mSystemCerts != null) {
-                return mSystemCerts;
-            }
-            CertificateFactory certFactory;
-            try {
-                certFactory = CertificateFactory.getInstance("X.509");
-            } catch (CertificateException e) {
-                throw new RuntimeException("Failed to obtain X.509 CertificateFactory", e);
-            }
-
-            final String ANDROID_ROOT = System.getenv("ANDROID_ROOT");
-            final File systemCaDir = new File(ANDROID_ROOT + "/etc/security/cacerts");
-            final File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId());
-            final File userRemovedCaDir = new File(configDir, "cacerts-removed");
-            // Sanity check
-            if (!systemCaDir.isDirectory()) {
-                throw new AssertionError(systemCaDir + " is not a directory");
-            }
-
-            Set<X509Certificate> systemCerts = new ArraySet<X509Certificate>();
-            for (String caFile : systemCaDir.list()) {
-                // Skip any CAs in the user's deleted directory.
-                if (new File(userRemovedCaDir, caFile).exists()) {
-                    continue;
-                }
-                InputStream is = null;
-                try {
-                    is = new BufferedInputStream(
-                            new FileInputStream(new File(systemCaDir, caFile)));
-                    systemCerts.add((X509Certificate) certFactory.generateCertificate(is));
-                } catch (CertificateException | IOException e) {
-                    // Don't rethrow to be consistent with conscrypt's cert loading code.
-                    continue;
-                } finally {
-                    IoUtils.closeQuietly(is);
-                }
-            }
-            mSystemCerts = systemCerts;
-            return mSystemCerts;
-        }
-    }
-
-    public void onCertificateStorageChange() {
-        synchronized (mLock) {
-            mSystemCerts = null;
-        }
+    protected boolean isCertMarkedAsRemoved(String caFile) {
+        return new File(mUserRemovedCaDir, caFile).exists();
     }
 }
diff --git a/core/java/android/security/net/config/UserCertificateSource.java b/core/java/android/security/net/config/UserCertificateSource.java
index e9d5aa1..1a7d924 100644
--- a/core/java/android/security/net/config/UserCertificateSource.java
+++ b/core/java/android/security/net/config/UserCertificateSource.java
@@ -18,29 +18,18 @@
 
 import android.os.Environment;
 import android.os.UserHandle;
-import android.util.ArraySet;
-import java.io.BufferedInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.Set;
-import libcore.io.IoUtils;
 
 /**
  * {@link CertificateSource} based on the user-installed trusted CA store.
  * @hide
  */
-public class UserCertificateSource implements CertificateSource {
+public final class UserCertificateSource extends DirectoryCertificateSource {
     private static final UserCertificateSource INSTANCE = new UserCertificateSource();
-    private Set<X509Certificate> mUserCerts = null;
-    private final Object mLock = new Object();
 
     private UserCertificateSource() {
+        super(new File(
+                Environment.getUserConfigDirectory(UserHandle.myUserId()), "cacerts-added"));
     }
 
     public static UserCertificateSource getInstance() {
@@ -48,45 +37,7 @@
     }
 
     @Override
-    public Set<X509Certificate> getCertificates() {
-        // TODO: loading all of these is wasteful, we should instead use a keystore style API.
-        synchronized (mLock) {
-            if (mUserCerts != null) {
-                return mUserCerts;
-            }
-            CertificateFactory certFactory;
-            try {
-                certFactory = CertificateFactory.getInstance("X.509");
-            } catch (CertificateException e) {
-                throw new RuntimeException("Failed to obtain X.509 CertificateFactory", e);
-            }
-            final File configDir = Environment.getUserConfigDirectory(UserHandle.myUserId());
-            final File userCaDir = new File(configDir, "cacerts-added");
-            Set<X509Certificate> userCerts = new ArraySet<X509Certificate>();
-            // If the user hasn't added any certificates the directory may not exist.
-            if (userCaDir.isDirectory()) {
-                for (String caFile : userCaDir.list()) {
-                    InputStream is = null;
-                    try {
-                        is = new BufferedInputStream(
-                                new FileInputStream(new File(userCaDir, caFile)));
-                        userCerts.add((X509Certificate) certFactory.generateCertificate(is));
-                    } catch (CertificateException | IOException e) {
-                        // Don't rethrow to be consistent with conscrypt's cert loading code.
-                        continue;
-                    } finally {
-                        IoUtils.closeQuietly(is);
-                    }
-                }
-            }
-            mUserCerts = userCerts;
-            return mUserCerts;
-        }
-    }
-
-    public void onCertificateStorageChange() {
-        synchronized (mLock) {
-            mUserCerts = null;
-        }
+    protected boolean isCertMarkedAsRemoved(String caFile) {
+        return false;
     }
 }
diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java
index 0171869..bb46e83 100644
--- a/core/java/android/service/dreams/DreamService.java
+++ b/core/java/android/service/dreams/DreamService.java
@@ -98,7 +98,7 @@
  * &lt;/service>
  * </pre>
  *
- * <p>If specified with the {@code &lt;meta-data&gt;} element,
+ * <p>If specified with the {@code <meta-data>} element,
  * additional information for the dream is defined using the
  * {@link android.R.styleable#Dream &lt;dream&gt;} element in a separate XML file.
  * Currently, the only addtional
diff --git a/core/java/android/service/notification/NotificationAssistantService.java b/core/java/android/service/notification/NotificationAssistantService.java
new file mode 100644
index 0000000..5d1317c
--- /dev/null
+++ b/core/java/android/service/notification/NotificationAssistantService.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2015 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.service.notification;
+
+import android.app.Notification;
+import android.net.Uri;
+
+/**
+ * A service that helps the user manage notifications by modifying the
+ * relative importance of notifications.
+ * <p>To extend this class, you must declare the service in your manifest file with
+ * the {@link android.Manifest.permission#BIND_NOTIFICATION_ASSISTANT_SERVICE} permission
+ * and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p>
+ * <pre>
+ * &lt;service android:name=".NotificationAssistant"
+ *          android:label="&#64;string/service_name"
+ *          android:permission="android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE">
+ *     &lt;intent-filter>
+ *         &lt;action android:name="android.service.notification.NotificationAssistantService" />
+ *     &lt;/intent-filter>
+ * &lt;/service></pre>
+ */
+public abstract class NotificationAssistantService extends NotificationListenerService {
+    /** Notification was canceled by the status bar reporting a click. */
+    public static final int REASON_DELEGATE_CLICK = 1;
+
+    /** Notification was canceled by the status bar reporting a user dismissal. */
+    public static final int REASON_DELEGATE_CANCEL = 2;
+
+    /** Notification was canceled by the status bar reporting a user dismiss all. */
+    public static final int REASON_DELEGATE_CANCEL_ALL = 3;
+
+    /** Notification was canceled by the status bar reporting an inflation error. */
+    public static final int REASON_DELEGATE_ERROR = 4;
+
+    /** Notification was canceled by the package manager modifying the package. */
+    public static final int REASON_PACKAGE_CHANGED = 5;
+
+    /** Notification was canceled by the owning user context being stopped. */
+    public static final int REASON_USER_STOPPED = 6;
+
+    /** Notification was canceled by the user banning the package. */
+    public static final int REASON_PACKAGE_BANNED = 7;
+
+    /** Notification was canceled by the app canceling this specific notification. */
+    public static final int REASON_APP_CANCEL = 8;
+
+    /** Notification was canceled by the app cancelling all its notifications. */
+    public static final int REASON_APP_CANCEL_ALL = 9;
+
+    /** Notification was canceled by a listener reporting a user dismissal. */
+    public static final int REASON_LISTENER_CANCEL = 10;
+
+    /** Notification was canceled by a listener reporting a user dismiss all. */
+    public static final int REASON_LISTENER_CANCEL_ALL = 11;
+
+    /** Notification was canceled because it was a member of a canceled group. */
+    public static final int REASON_GROUP_SUMMARY_CANCELED = 12;
+
+    /** Notification was canceled because it was an invisible member of a group. */
+    public static final int REASON_GROUP_OPTIMIZATION = 13;
+
+    public class Adjustment {
+        int mImportance;
+        CharSequence mExplanation;
+        Uri mReference;
+
+        /**
+         * Create a notification importance adjustment.
+         *
+         * @param importance The final importance of the notification.
+         * @param explanation A human-readable justification for the adjustment.
+         * @param reference A reference to an external object that augments the
+         *                  explanation, such as a
+         *                  {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI},
+         *                  or null.
+         */
+        public Adjustment(int importance, CharSequence explanation, Uri reference) {
+            mImportance = importance;
+            mExplanation = explanation;
+            mReference = reference;
+        }
+    }
+
+    /**
+     * A notification was posted by an app. Called before alert.
+     *
+     * @param sbn the new notification
+     * @param importance the initial importance of the notification.
+     * @param user true if the initial importance reflects an explicit user preference.
+     * @return an adjustment or null to take no action, within 100ms.
+     */
+    abstract public Adjustment onNotificationEnqueued(StatusBarNotification sbn,
+          int importance, boolean user);
+
+    /**
+     * The visibility of a notification has changed.
+     *
+     * @param key the notification key
+     * @param time milliseconds since midnight, January 1, 1970 UTC.
+     * @param visible true if the notification became visible, false if hidden.
+     */
+    public void onNotificationVisibilityChanged(String key, long time, boolean visible)
+    {
+        // Do nothing, Override this to collect visibility statistics.
+    }
+
+    /**
+     * The user clicked on a notification.
+     *
+     * @param key the notification key
+     * @param time milliseconds since midnight, January 1, 1970 UTC.
+     */
+    public void onNotificationClick(String key, long time)
+    {
+        // Do nothing, Override this to collect click statistics
+    }
+
+    /**
+     * The user clicked on a notification action.
+     *
+     * @param key the notification key
+     * @param time milliseconds since midnight, January 1, 1970 UTC.
+     * @param actionIndex the index of the action button that was pressed.
+     */
+    public void onNotificationActionClick(String key, long time, int actionIndex)
+    {
+        // Do nothing, Override this to collect action button click statistics
+    }
+
+    /**
+     * A notification was removed.
+
+     * @param key the notification key
+     * @param time milliseconds since midnight, January 1, 1970 UTC.
+     * @param reason see {@link #REASON_LISTENER_CANCEL}, etc.
+     */
+    public void onNotificationRemoved(String key, long time, int reason) {
+        // Do nothing, Override this to collect dismissal statistics
+    }
+
+    /**
+     * Change the importance of an existing notification.  N.B. this won’t cause
+     * an existing notification to alert, but might allow a future update to
+     * this notification to alert.
+     *
+     * @param key the notification key
+     * @param adjustment the new importance with an explanation
+     */
+    public final void adjustImportance(String key, Adjustment adjustment)
+    {
+        // TODO: pack up the adjustment and send it to the NotificationManager.
+    }
+
+    /**
+     * Add an annotation to a an existing notification. The delete intent will
+     * be fired when the host notification is deleted, or when this annotation
+     * is removed or replaced.
+     *
+     * @param key the notification key
+     * @param annotation the new annotation object
+     */
+    public final void setAnnotation(String key, Notification annotation)
+    {
+        // TODO: pack up the annotation and send it to the NotificationManager.
+    }
+
+    /**
+     * Remove the annotation from a notification.
+     *
+     * @param key the notification key
+     */
+    public final void clearAnnotation(String key)
+    {
+        // TODO: ask the NotificationManager to clear the annotation.
+    }
+}
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index ee97e8e..d741f1a 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -822,6 +822,41 @@
          * @hide */
         public static final int VISIBILITY_NO_OVERRIDE = -1000;
 
+        /**
+         * Value signifying thatn the has not expressed an importance.
+         *
+         * This value is for persisting preferences, and should never ve associated with
+         * an actual notification.
+         */
+        public static final int IMPORTANCE_UNSPECIFIED = -1000;
+
+        /**
+         * A notification with no importance: shows nowhere, is blocked.
+         */
+        public static final int IMPORTANCE_NONE = -2;
+
+        /**
+         * Low notification importance: only shows in the shade, below the fold.
+         */
+        public static final int IMPORTANCE_LOW = -1;
+
+        /**
+         * Default notification importance: shows everywhere, but is not intrusive.
+         */
+        public static final int IMPORTANCE_DEFAULT = 0;
+
+        /**
+         * Higher notification importance: shows everywhere, makes noise,
+         * but does not visually intrude.
+         */
+        public static final int IMPORTANCE_HIGH = 1;
+
+        /**
+         * Highest notification importance: shows everywhere, makes noise,
+         * and also visually intrudes.
+         */
+        public static final int IMPORTANCE_MAX = 2;
+
         private String mKey;
         private int mRank = -1;
         private boolean mIsAmbient;
@@ -875,7 +910,6 @@
             return mSuppressedVisualEffects;
         }
 
-
         /**
          * Returns whether the notification matches the user's interruption
          * filter.
@@ -887,6 +921,27 @@
             return mMatchesInterruptionFilter;
         }
 
+        /**
+         * Returns the importance of the notification, which dictates its
+         * modes of presentation, see: {@link #IMPORTANCE_DEFAULT}, etc.
+         *
+         * @return the rank of the notification
+         */
+        public int getImportance() {
+            return IMPORTANCE_DEFAULT;  // TODO implement;
+        }
+
+        /**
+         * If the importance has been overriden by user preference, or by a
+         * {@link NotificationAssistantService}, then this will be non-null,
+         * and should be displayed to the user.
+         *
+         * @return the explanation for the importance, or null if it is the natural importance
+         */
+        public CharSequence getImportanceExplanation() {
+            return null;  // TODO implement
+        }
+
         private void populate(String key, int rank, boolean isAmbient,
                 boolean matchesInterruptionFilter, int visibilityOverride,
                 int suppressedVisualEffects) {
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index b3399d0..541623d 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -1110,7 +1110,7 @@
             if (!Objects.equals(id, to.id)) {
                 d.addLine(item, "id", id, to.id);
             }
-            if (creationTime == to.creationTime) {
+            if (creationTime != to.creationTime) {
                 d.addLine(item, "creationTime", creationTime, to.creationTime);
             }
         }
diff --git a/core/java/android/service/quicksettings/IQSService.aidl b/core/java/android/service/quicksettings/IQSService.aidl
index 087eb61..7e70501 100644
--- a/core/java/android/service/quicksettings/IQSService.aidl
+++ b/core/java/android/service/quicksettings/IQSService.aidl
@@ -23,4 +23,5 @@
  */
 interface IQSService {
     void updateQsTile(in Tile tile);
+    void onShowDialog(in Tile tile);
 }
diff --git a/core/java/android/service/quicksettings/IQSTileService.aidl b/core/java/android/service/quicksettings/IQSTileService.aidl
index 6b46bee5..63a4c5e 100644
--- a/core/java/android/service/quicksettings/IQSTileService.aidl
+++ b/core/java/android/service/quicksettings/IQSTileService.aidl
@@ -27,5 +27,5 @@
     void onTileRemoved();
     void onStartListening();
     void onStopListening();
-    void onClick();
+    void onClick(IBinder wtoken);
 }
diff --git a/core/java/android/service/quicksettings/Tile.java b/core/java/android/service/quicksettings/Tile.java
index c8ae171..a53fc59 100644
--- a/core/java/android/service/quicksettings/Tile.java
+++ b/core/java/android/service/quicksettings/Tile.java
@@ -137,6 +137,18 @@
         }
     }
 
+    /**
+     * @hide
+     * Notifies the IQSService that this tile is showing a dialog.
+     */
+    void onShowDialog() {
+        try {
+            mService.onShowDialog(this);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Couldn't onShowDialog");
+        }
+    }
+
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeStrongInterface(mService);
diff --git a/core/java/android/service/quicksettings/TileService.java b/core/java/android/service/quicksettings/TileService.java
index eba4c6f..fd2d5b0 100644
--- a/core/java/android/service/quicksettings/TileService.java
+++ b/core/java/android/service/quicksettings/TileService.java
@@ -15,6 +15,7 @@
  */
 package android.service.quicksettings;
 
+import android.app.Dialog;
 import android.app.Service;
 import android.content.Intent;
 import android.os.Handler;
@@ -22,6 +23,7 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
+import android.view.WindowManager;
 
 /**
  * A QSTileService provides the user a tile that can be added to Quick Settings.
@@ -55,7 +57,7 @@
  *     android:icon="@drawable/my_default_icon_label"
  *     android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
  *     <intent-filter>
- *         <action android:name="android.intent.action.QS_TILE" />
+ *         <action android:name="android.service.quicksettings.action.QS_TILE" />
  *     </intent-filter>
  * </service>}
  * </pre>
@@ -73,6 +75,7 @@
 
     private boolean mListening = false;
     private Tile mTile;
+    private IBinder mToken;
 
     /**
      * Called when the user adds this tile to Quick Settings.
@@ -116,6 +119,20 @@
     }
 
     /**
+     * Used to show a dialog.
+     *
+     * This will collapse the Quick Settings panel and show the dialog.
+     *
+     * @param dialog Dialog to show.
+     */
+    public final void showDialog(Dialog dialog) {
+        dialog.getWindow().getAttributes().token = mToken;
+        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_QS_DIALOG);
+        dialog.show();
+        getQsTile().onShowDialog();
+    }
+
+    /**
      * Gets the {@link Tile} for this service.
      * <p/>
      * This tile may be used to get or set the current state for this
@@ -155,8 +172,8 @@
             }
 
             @Override
-            public void onClick() throws RemoteException {
-                mHandler.sendEmptyMessage(H.MSG_TILE_CLICKED);
+            public void onClick(IBinder wtoken) throws RemoteException {
+                mHandler.obtainMessage(H.MSG_TILE_CLICKED, wtoken).sendToTarget();
             }
         };
     }
@@ -185,19 +202,20 @@
                 case MSG_TILE_REMOVED:
                     TileService.this.onTileAdded();
                     break;
-                case MSG_START_LISTENING:
+                case MSG_STOP_LISTENING:
                     if (mListening) {
                         mListening = false;
                         TileService.this.onStopListening();
                     }
                     break;
-                case MSG_STOP_LISTENING:
+                case MSG_START_LISTENING:
                     if (!mListening) {
                         mListening = true;
                         TileService.this.onStartListening();
                     }
                     break;
                 case MSG_TILE_CLICKED:
+                    mToken = (IBinder) msg.obj;
                     TileService.this.onClick();
                     break;
             }
diff --git a/core/java/android/service/textservice/package.html b/core/java/android/service/textservice/package.html
index 0b5113b..4124922 100644
--- a/core/java/android/service/textservice/package.html
+++ b/core/java/android/service/textservice/package.html
@@ -12,9 +12,9 @@
 
 <p>Applications with a spell checker service must declare the {@link
 android.Manifest.permission#BIND_TEXT_SERVICE} permission as required by the service. The service
-must also declare an intent filter with {@code &lt;action
+must also declare an intent filter with {@code <action
 android:name="android.service.textservice.SpellCheckerService" />} as the intent’s action and should
-include a {@code &lt;meta-data&gt;} element that declares configuration information for the spell
+include a {@code <meta-data>} element that declares configuration information for the spell
 checker. For example:</p>
 
 <pre>
diff --git a/core/java/android/speech/RecognitionListener.java b/core/java/android/speech/RecognitionListener.java
index bdb3ba9..1ffdf08 100644
--- a/core/java/android/speech/RecognitionListener.java
+++ b/core/java/android/speech/RecognitionListener.java
@@ -69,7 +69,7 @@
      * Called when recognition results are ready.
      * 
      * @param results the recognition results. To retrieve the results in {@code
-     *        ArrayList&lt;String&gt;} format use {@link Bundle#getStringArrayList(String)} with
+     *        ArrayList<String>} format use {@link Bundle#getStringArrayList(String)} with
      *        {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter. A float array of
      *        confidence values might also be given in {@link SpeechRecognizer#CONFIDENCE_SCORES}.
      */
diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java
index 3e74d22..674f809 100644
--- a/core/java/android/speech/RecognitionService.java
+++ b/core/java/android/speech/RecognitionService.java
@@ -303,7 +303,7 @@
          * The service should call this method when recognition results are ready.
          * 
          * @param results the recognition results. To retrieve the results in {@code
-         *        ArrayList&lt;String&gt;} format use {@link Bundle#getStringArrayList(String)} with
+         *        ArrayList<String>} format use {@link Bundle#getStringArrayList(String)} with
          *        {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter
          */
         public void results(Bundle results) throws RemoteException {
diff --git a/core/java/android/speech/tts/FileSynthesisCallback.java b/core/java/android/speech/tts/FileSynthesisCallback.java
index 2b882d3..c7a4ccc 100644
--- a/core/java/android/speech/tts/FileSynthesisCallback.java
+++ b/core/java/android/speech/tts/FileSynthesisCallback.java
@@ -15,6 +15,7 @@
  */
 package android.speech.tts;
 
+import android.annotation.NonNull;
 import android.media.AudioFormat;
 import android.speech.tts.TextToSpeechService.UtteranceProgressDispatcher;
 import android.util.Log;
@@ -46,7 +47,6 @@
     private FileChannel mFileChannel;
 
     private final UtteranceProgressDispatcher mDispatcher;
-    private final Object mCallerIdentity;
 
     private boolean mStarted = false;
     private boolean mDone = false;
@@ -54,12 +54,11 @@
     /** Status code of synthesis */
     protected int mStatusCode;
 
-    FileSynthesisCallback(FileChannel fileChannel, UtteranceProgressDispatcher dispatcher,
-            Object callerIdentity, boolean clientIsUsingV2) {
+    FileSynthesisCallback(@NonNull FileChannel fileChannel,
+            @NonNull UtteranceProgressDispatcher dispatcher, boolean clientIsUsingV2) {
         super(clientIsUsingV2);
         mFileChannel = fileChannel;
         mDispatcher = dispatcher;
-        mCallerIdentity = callerIdentity;
         mStatusCode = TextToSpeech.SUCCESS;
     }
 
@@ -75,9 +74,7 @@
 
             mStatusCode = TextToSpeech.STOPPED;
             cleanUp();
-            if (mDispatcher != null) {
-                mDispatcher.dispatchOnStop();
-            }
+            mDispatcher.dispatchOnStop();
         }
     }
 
@@ -134,9 +131,7 @@
             mAudioFormat = audioFormat;
             mChannelCount = channelCount;
 
-            if (mDispatcher != null) {
-                mDispatcher.dispatchOnStart();
-            }
+            mDispatcher.dispatchOnStart();
             fileChannel = mFileChannel;
         }
 
@@ -214,8 +209,7 @@
                 if (DBG) Log.d(TAG, "Request has been aborted.");
                 return errorCodeOnStop();
             }
-            if (mDispatcher != null && mStatusCode != TextToSpeech.SUCCESS &&
-                    mStatusCode != TextToSpeech.STOPPED) {
+            if (mStatusCode != TextToSpeech.SUCCESS && mStatusCode != TextToSpeech.STOPPED) {
                 mDispatcher.dispatchOnError(mStatusCode);
                 return TextToSpeech.ERROR;
             }
@@ -239,9 +233,7 @@
 
             synchronized (mStateLock) {
                 closeFile();
-                if (mDispatcher != null) {
-                    mDispatcher.dispatchOnSuccess();
-                }
+                mDispatcher.dispatchOnSuccess();
                 return TextToSpeech.SUCCESS;
             }
         } catch (IOException ex) {
diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java
index c3aed75..8c355d8 100644
--- a/core/java/android/speech/tts/TextToSpeechService.java
+++ b/core/java/android/speech/tts/TextToSpeechService.java
@@ -1032,8 +1032,7 @@
 
         @Override
         protected AbstractSynthesisCallback createSynthesisCallback() {
-            return new FileSynthesisCallback(mFileOutputStream.getChannel(),
-                    this, getCallerIdentity(), false);
+            return new FileSynthesisCallback(mFileOutputStream.getChannel(), this, false);
         }
 
         @Override
diff --git a/core/java/android/text/Hyphenator.java b/core/java/android/text/Hyphenator.java
index f2b6041..5d9d929 100644
--- a/core/java/android/text/Hyphenator.java
+++ b/core/java/android/text/Hyphenator.java
@@ -166,7 +166,7 @@
         sMap.put(null, null);
 
         // TODO: replace this with a discovery-based method that looks into /system/usr/hyphen-data
-        String[] availableLanguages = {"en-US", "eu", "hu", "hy", "nb", "nn", "und-Ethi"};
+        String[] availableLanguages = {"en-US", "es", "eu", "hu", "hy", "nb", "nn", "und-Ethi"};
         for (int i = 0; i < availableLanguages.length; i++) {
             String languageTag = availableLanguages[i];
             Hyphenator h = loadHyphenator(languageTag);
diff --git a/core/java/android/text/format/Time.java b/core/java/android/text/format/Time.java
index d567d90..66e2ec3 100644
--- a/core/java/android/text/format/Time.java
+++ b/core/java/android/text/format/Time.java
@@ -842,7 +842,7 @@
      * the given time.
      *
      * <p>
-     * Equivalent to {@code Time.compare(this, that) &lt; 0}. See
+     * Equivalent to {@code Time.compare(this, that) < 0}. See
      * {@link #compare(Time, Time)} for details.
      *
      * @param that a given Time object to compare against
@@ -858,7 +858,7 @@
      * the given time.
      *
      * <p>
-     * Equivalent to {@code Time.compare(this, that) &gt; 0}. See
+     * Equivalent to {@code Time.compare(this, that) > 0}. See
      * {@link #compare(Time, Time)} for details.
      *
      * @param that a given Time object to compare against
diff --git a/core/java/android/transition/ArcMotion.java b/core/java/android/transition/ArcMotion.java
index 70dfe7f..fa4c8d2 100644
--- a/core/java/android/transition/ArcMotion.java
+++ b/core/java/android/transition/ArcMotion.java
@@ -36,13 +36,12 @@
  * arc between two points.
  * </p>
  * <p>This may be used in XML as an element inside a transition.</p>
- * <pre>
- * {@code
- * &lt;changeBounds>
- *   &lt;arcMotion android:minimumHorizontalAngle="15"
+ * <pre>{@code
+ * <changeBounds>
+ *   <arcMotion android:minimumHorizontalAngle="15"
  *              android:minimumVerticalAngle="0"
  *              android:maximumAngle="90"/>
- * &lt;/changeBounds>}
+ * </changeBounds>}
  * </pre>
  */
 public class ArcMotion extends PathMotion {
diff --git a/core/java/android/transition/PathMotion.java b/core/java/android/transition/PathMotion.java
index 651223d..01102a4 100644
--- a/core/java/android/transition/PathMotion.java
+++ b/core/java/android/transition/PathMotion.java
@@ -31,9 +31,9 @@
  * <p>This may be used in XML as an element inside a transition.</p>
  * <pre>
  * {@code
- * &lt;changeBounds>
- *     &lt;pathMotion class="my.app.transition.MyPathMotion"/>
- * &lt;/changeBounds>
+ * <changeBounds>
+ *     <pathMotion class="my.app.transition.MyPathMotion"/>
+ * </changeBounds>
  * }
  * </pre>
  */
diff --git a/core/java/android/transition/PatternPathMotion.java b/core/java/android/transition/PatternPathMotion.java
index 773c387..f23863f 100644
--- a/core/java/android/transition/PatternPathMotion.java
+++ b/core/java/android/transition/PatternPathMotion.java
@@ -30,11 +30,10 @@
  * The starting point of the Path will be moved to the origin and the end point will be scaled
  * and rotated so that it matches with the target end point.
  * <p>This may be used in XML as an element inside a transition.</p>
- * <pre>
- * {@code
- * &lt;changeBounds>
- *     &lt;patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
- * &lt;/changeBounds>}
+ * <pre>{@code
+ * <changeBounds>
+ *     <patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
+ * </changeBounds>}
  * </pre>
  */
 public class PatternPathMotion extends PathMotion {
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index e958058..48614c0 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -2052,18 +2052,18 @@
      *     attributed with the fully-described class name. For example:</p>
      * <pre>
      * {@code
-     * &lt;changeBounds>
-     *     &lt;pathMotion class="my.app.transition.MyPathMotion"/>
-     * &lt;/changeBounds>
+     * <changeBounds>
+     *     <pathMotion class="my.app.transition.MyPathMotion"/>
+     * </changeBounds>
      * }
      * </pre>
      * <p>or</p>
      * <pre>
      * {@code
-     * &lt;changeBounds>
-     *   &lt;arcMotion android:minimumHorizontalAngle="15"
+     * <changeBounds>
+     *   <arcMotion android:minimumHorizontalAngle="15"
      *     android:minimumVerticalAngle="0" android:maximumAngle="90"/>
-     * &lt;/changeBounds>
+     * </changeBounds>
      * }
      * </pre>
      *
@@ -2090,20 +2090,18 @@
      *     the built-in tags <code>arcMotion</code> or <code>patternPathMotion</code> or it can
      *     be a custom PathMotion using <code>pathMotion</code> with the <code>class</code>
      *     attributed with the fully-described class name. For example:</p>
-     * <pre>
-     * {@code
-     * &lt;changeBounds>
-     *     &lt;pathMotion class="my.app.transition.MyPathMotion"/>
-     * &lt;/changeBounds>}
+     * <pre>{@code
+     * <changeBounds>
+     *     <pathMotion class="my.app.transition.MyPathMotion"/>
+     * </changeBounds>}
      * </pre>
      * <p>or</p>
-     * <pre>
-     * {@code
-     * &lt;changeBounds>
-     *   &lt;arcMotion android:minimumHorizontalAngle="15"
+     * <pre>{@code
+     * <changeBounds>
+     *   <arcMotion android:minimumHorizontalAngle="15"
      *              android:minimumVerticalAngle="0"
      *              android:maximumAngle="90"/>
-     * &lt;/changeBounds>}
+     * </changeBounds>}
      * </pre>
      *
      * @return The algorithm object used to interpolate along two dimensions.
diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java
index 558b8f5..6bda83d2 100644
--- a/core/java/android/util/EventLog.java
+++ b/core/java/android/util/EventLog.java
@@ -52,7 +52,7 @@
     private static HashMap<String, Integer> sTagCodes = null;
     private static HashMap<Integer, String> sTagNames = null;
 
-    /** A previously logged event read from the logs. */
+    /** A previously logged event read from the logs. Instances are thread safe. */
     public static final class Event {
         private final ByteBuffer mBuffer;
 
diff --git a/core/java/android/util/LocaleList.aidl b/core/java/android/util/LocaleList.aidl
new file mode 100644
index 0000000..f5de354
--- /dev/null
+++ b/core/java/android/util/LocaleList.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2015 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.util;
+
+parcelable LocaleList;
diff --git a/core/java/android/util/LocaleList.java b/core/java/android/util/LocaleList.java
index c1d23bb..b2ee045 100644
--- a/core/java/android/util/LocaleList.java
+++ b/core/java/android/util/LocaleList.java
@@ -19,6 +19,8 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.Size;
+import android.os.Parcel;
+import android.os.Parcelable;
 
 import com.android.internal.annotations.GuardedBy;
 
@@ -35,11 +37,12 @@
  * LocaleList is an immutable list of Locales, typically used to keep an
  * ordered user preferences for locales.
  */
-public final class LocaleList {
+public final class LocaleList implements Parcelable {
     private final Locale[] mList;
     // This is a comma-separated list of the locales in the LocaleList created at construction time,
     // basically the result of running each locale's toLanguageTag() method and concatenating them
     // with commas in between.
+    @NonNull
     private final String mStringRepresentation;
 
     private static final Locale[] sEmptyList = new Locale[0];
@@ -101,6 +104,16 @@
         return sb.toString();
     }
 
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int parcelableFlags) {
+        dest.writeString(mStringRepresentation);
+    }
+
     @NonNull
     public String toLanguageTags() {
         return mStringRepresentation;
@@ -163,10 +176,25 @@
         }
     }
 
+    public static final Parcelable.Creator<LocaleList> CREATOR
+            = new Parcelable.Creator<LocaleList>() {
+        @Override
+        public LocaleList createFromParcel(Parcel source) {
+            return LocaleList.forLanguageTags(source.readString());
+        }
+
+        @Override
+        public LocaleList[] newArray(int size) {
+            return new LocaleList[size];
+        }
+    };
+
+    @NonNull
     public static LocaleList getEmptyLocaleList() {
         return sEmptyLocaleList;
     }
 
+    @NonNull
     public static LocaleList forLanguageTags(@Nullable String list) {
         if (list == null || list.equals("")) {
             return getEmptyLocaleList();
diff --git a/core/java/android/util/jar/StrictJarFile.java b/core/java/android/util/jar/StrictJarFile.java
new file mode 100644
index 0000000..fd57806
--- /dev/null
+++ b/core/java/android/util/jar/StrictJarFile.java
@@ -0,0 +1,427 @@
+/*
+ * Copyright (C) 2013 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.util.jar;
+
+import dalvik.system.CloseGuard;
+import java.io.ByteArrayInputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+import java.security.cert.Certificate;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import libcore.io.IoUtils;
+import libcore.io.Streams;
+
+/**
+ * A subset of the JarFile API implemented as a thin wrapper over
+ * system/core/libziparchive.
+ *
+ * @hide for internal use only. Not API compatible (or as forgiving) as
+ *        {@link java.util.jar.JarFile}
+ */
+public final class StrictJarFile {
+
+    private final long nativeHandle;
+
+    // NOTE: It's possible to share a file descriptor with the native
+    // code, at the cost of some additional complexity.
+    private final RandomAccessFile raf;
+
+    private final StrictJarManifest manifest;
+    private final StrictJarVerifier verifier;
+
+    private final boolean isSigned;
+
+    private final CloseGuard guard = CloseGuard.get();
+    private boolean closed;
+
+    public StrictJarFile(String fileName) throws IOException, SecurityException {
+        this.nativeHandle = nativeOpenJarFile(fileName);
+        this.raf = new RandomAccessFile(fileName, "r");
+
+        try {
+            // Read the MANIFEST and signature files up front and try to
+            // parse them. We never want to accept a JAR File with broken signatures
+            // or manifests, so it's best to throw as early as possible.
+            HashMap<String, byte[]> metaEntries = getMetaEntries();
+            this.manifest = new StrictJarManifest(metaEntries.get(JarFile.MANIFEST_NAME), true);
+            this.verifier = new StrictJarVerifier(fileName, manifest, metaEntries);
+            Set<String> files = manifest.getEntries().keySet();
+            for (String file : files) {
+                if (findEntry(file) == null) {
+                    throw new SecurityException(fileName + ": File " + file + " in manifest does not exist");
+                }
+            }
+
+            isSigned = verifier.readCertificates() && verifier.isSignedJar();
+        } catch (IOException | SecurityException e) {
+            nativeClose(this.nativeHandle);
+            IoUtils.closeQuietly(this.raf);
+            throw e;
+        }
+
+        guard.open("close");
+    }
+
+    public StrictJarManifest getManifest() {
+        return manifest;
+    }
+
+    public Iterator<ZipEntry> iterator() throws IOException {
+        return new EntryIterator(nativeHandle, "");
+    }
+
+    public ZipEntry findEntry(String name) {
+        return nativeFindEntry(nativeHandle, name);
+    }
+
+    /**
+     * Return all certificate chains for a given {@link ZipEntry} belonging to this jar.
+     * This method MUST be called only after fully exhausting the InputStream belonging
+     * to this entry.
+     *
+     * Returns {@code null} if this jar file isn't signed or if this method is
+     * called before the stream is processed.
+     */
+    public Certificate[][] getCertificateChains(ZipEntry ze) {
+        if (isSigned) {
+            return verifier.getCertificateChains(ze.getName());
+        }
+
+        return null;
+    }
+
+    /**
+     * Return all certificates for a given {@link ZipEntry} belonging to this jar.
+     * This method MUST be called only after fully exhausting the InputStream belonging
+     * to this entry.
+     *
+     * Returns {@code null} if this jar file isn't signed or if this method is
+     * called before the stream is processed.
+     *
+     * @deprecated Switch callers to use getCertificateChains instead
+     */
+    @Deprecated
+    public Certificate[] getCertificates(ZipEntry ze) {
+        if (isSigned) {
+            Certificate[][] certChains = verifier.getCertificateChains(ze.getName());
+
+            // Measure number of certs.
+            int count = 0;
+            for (Certificate[] chain : certChains) {
+                count += chain.length;
+            }
+
+            // Create new array and copy all the certs into it.
+            Certificate[] certs = new Certificate[count];
+            int i = 0;
+            for (Certificate[] chain : certChains) {
+                System.arraycopy(chain, 0, certs, i, chain.length);
+                i += chain.length;
+            }
+
+            return certs;
+        }
+
+        return null;
+    }
+
+    public InputStream getInputStream(ZipEntry ze) {
+        final InputStream is = getZipInputStream(ze);
+
+        if (isSigned) {
+            StrictJarVerifier.VerifierEntry entry = verifier.initEntry(ze.getName());
+            if (entry == null) {
+                return is;
+            }
+
+            return new JarFileInputStream(is, ze.getSize(), entry);
+        }
+
+        return is;
+    }
+
+    public void close() throws IOException {
+        if (!closed) {
+            guard.close();
+
+            nativeClose(nativeHandle);
+            IoUtils.closeQuietly(raf);
+            closed = true;
+        }
+    }
+
+    private InputStream getZipInputStream(ZipEntry ze) {
+        if (ze.getMethod() == ZipEntry.STORED) {
+            return new RAFStream(raf, ze.getDataOffset(),
+                    ze.getDataOffset() + ze.getSize());
+        } else {
+            final RAFStream wrapped = new RAFStream(
+                    raf, ze.getDataOffset(), ze.getDataOffset() + ze.getCompressedSize());
+
+            int bufSize = Math.max(1024, (int) Math.min(ze.getSize(), 65535L));
+            return new ZipInflaterInputStream(wrapped, new Inflater(true), bufSize, ze);
+        }
+    }
+
+    static final class EntryIterator implements Iterator<ZipEntry> {
+        private final long iterationHandle;
+        private ZipEntry nextEntry;
+
+        EntryIterator(long nativeHandle, String prefix) throws IOException {
+            iterationHandle = nativeStartIteration(nativeHandle, prefix);
+        }
+
+        public ZipEntry next() {
+            if (nextEntry != null) {
+                final ZipEntry ze = nextEntry;
+                nextEntry = null;
+                return ze;
+            }
+
+            return nativeNextEntry(iterationHandle);
+        }
+
+        public boolean hasNext() {
+            if (nextEntry != null) {
+                return true;
+            }
+
+            final ZipEntry ze = nativeNextEntry(iterationHandle);
+            if (ze == null) {
+                return false;
+            }
+
+            nextEntry = ze;
+            return true;
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private HashMap<String, byte[]> getMetaEntries() throws IOException {
+        HashMap<String, byte[]> metaEntries = new HashMap<String, byte[]>();
+
+        Iterator<ZipEntry> entryIterator = new EntryIterator(nativeHandle, "META-INF/");
+        while (entryIterator.hasNext()) {
+            final ZipEntry entry = entryIterator.next();
+            metaEntries.put(entry.getName(), Streams.readFully(getInputStream(entry)));
+        }
+
+        return metaEntries;
+    }
+
+    static final class JarFileInputStream extends FilterInputStream {
+        private final StrictJarVerifier.VerifierEntry entry;
+
+        private long count;
+        private boolean done = false;
+
+        JarFileInputStream(InputStream is, long size, StrictJarVerifier.VerifierEntry e) {
+            super(is);
+            entry = e;
+
+            count = size;
+        }
+
+        @Override
+        public int read() throws IOException {
+            if (done) {
+                return -1;
+            }
+            if (count > 0) {
+                int r = super.read();
+                if (r != -1) {
+                    entry.write(r);
+                    count--;
+                } else {
+                    count = 0;
+                }
+                if (count == 0) {
+                    done = true;
+                    entry.verify();
+                }
+                return r;
+            } else {
+                done = true;
+                entry.verify();
+                return -1;
+            }
+        }
+
+        @Override
+        public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            if (done) {
+                return -1;
+            }
+            if (count > 0) {
+                int r = super.read(buffer, byteOffset, byteCount);
+                if (r != -1) {
+                    int size = r;
+                    if (count < size) {
+                        size = (int) count;
+                    }
+                    entry.write(buffer, byteOffset, size);
+                    count -= size;
+                } else {
+                    count = 0;
+                }
+                if (count == 0) {
+                    done = true;
+                    entry.verify();
+                }
+                return r;
+            } else {
+                done = true;
+                entry.verify();
+                return -1;
+            }
+        }
+
+        @Override
+        public int available() throws IOException {
+            if (done) {
+                return 0;
+            }
+            return super.available();
+        }
+
+        @Override
+        public long skip(long byteCount) throws IOException {
+            return Streams.skipByReading(this, byteCount);
+        }
+    }
+
+    /** @hide */
+    public static class ZipInflaterInputStream extends InflaterInputStream {
+        private final ZipEntry entry;
+        private long bytesRead = 0;
+
+        public ZipInflaterInputStream(InputStream is, Inflater inf, int bsize, ZipEntry entry) {
+            super(is, inf, bsize);
+            this.entry = entry;
+        }
+
+        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            final int i;
+            try {
+                i = super.read(buffer, byteOffset, byteCount);
+            } catch (IOException e) {
+                throw new IOException("Error reading data for " + entry.getName() + " near offset "
+                        + bytesRead, e);
+            }
+            if (i == -1) {
+                if (entry.getSize() != bytesRead) {
+                    throw new IOException("Size mismatch on inflated file: " + bytesRead + " vs "
+                            + entry.getSize());
+                }
+            } else {
+                bytesRead += i;
+            }
+            return i;
+        }
+
+        @Override public int available() throws IOException {
+            if (closed) {
+                // Our superclass will throw an exception, but there's a jtreg test that
+                // explicitly checks that the InputStream returned from ZipFile.getInputStream
+                // returns 0 even when closed.
+                return 0;
+            }
+            return super.available() == 0 ? 0 : (int) (entry.getSize() - bytesRead);
+        }
+    }
+
+    /**
+     * Wrap a stream around a RandomAccessFile.  The RandomAccessFile is shared
+     * among all streams returned by getInputStream(), so we have to synchronize
+     * access to it.  (We can optimize this by adding buffering here to reduce
+     * collisions.)
+     *
+     * <p>We could support mark/reset, but we don't currently need them.
+     *
+     * @hide
+     */
+    public static class RAFStream extends InputStream {
+        private final RandomAccessFile sharedRaf;
+        private long endOffset;
+        private long offset;
+
+
+        public RAFStream(RandomAccessFile raf, long initialOffset, long endOffset) {
+            sharedRaf = raf;
+            offset = initialOffset;
+            this.endOffset = endOffset;
+        }
+
+        public RAFStream(RandomAccessFile raf, long initialOffset) throws IOException {
+            this(raf, initialOffset, raf.length());
+        }
+
+        @Override public int available() throws IOException {
+            return (offset < endOffset ? 1 : 0);
+        }
+
+        @Override public int read() throws IOException {
+            return Streams.readSingleByte(this);
+        }
+
+        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            synchronized (sharedRaf) {
+                final long length = endOffset - offset;
+                if (byteCount > length) {
+                    byteCount = (int) length;
+                }
+                sharedRaf.seek(offset);
+                int count = sharedRaf.read(buffer, byteOffset, byteCount);
+                if (count > 0) {
+                    offset += count;
+                    return count;
+                } else {
+                    return -1;
+                }
+            }
+        }
+
+        @Override public long skip(long byteCount) throws IOException {
+            if (byteCount > endOffset - offset) {
+                byteCount = endOffset - offset;
+            }
+            offset += byteCount;
+            return byteCount;
+        }
+    }
+
+
+    private static native long nativeOpenJarFile(String fileName) throws IOException;
+    private static native long nativeStartIteration(long nativeHandle, String prefix);
+    private static native ZipEntry nativeNextEntry(long iterationHandle);
+    private static native ZipEntry nativeFindEntry(long nativeHandle, String entryName);
+    private static native void nativeClose(long nativeHandle);
+}
diff --git a/core/java/android/util/jar/StrictJarManifest.java b/core/java/android/util/jar/StrictJarManifest.java
new file mode 100644
index 0000000..dbb466c
--- /dev/null
+++ b/core/java/android/util/jar/StrictJarManifest.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.util.jar;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.Attributes;
+import libcore.io.Streams;
+
+/**
+ * The {@code StrictJarManifest} class is used to obtain attribute information for a
+ * {@code StrictJarFile} and its entries.
+ *
+ * @hide
+ */
+public class StrictJarManifest implements Cloneable {
+    static final int LINE_LENGTH_LIMIT = 72;
+
+    private static final byte[] LINE_SEPARATOR = new byte[] { '\r', '\n' };
+
+    private static final byte[] VALUE_SEPARATOR = new byte[] { ':', ' ' };
+
+    private final Attributes mainAttributes;
+    private final HashMap<String, Attributes> entries;
+
+    static final class Chunk {
+        final int start;
+        final int end;
+
+        Chunk(int start, int end) {
+            this.start = start;
+            this.end = end;
+        }
+    }
+
+    private HashMap<String, Chunk> chunks;
+
+    /**
+     * The end of the main attributes section in the manifest is needed in
+     * verification.
+     */
+    private int mainEnd;
+
+    /**
+     * Creates a new {@code StrictJarManifest} instance.
+     */
+    public StrictJarManifest() {
+        entries = new HashMap<String, Attributes>();
+        mainAttributes = new Attributes();
+    }
+
+    /**
+     * Creates a new {@code StrictJarManifest} instance using the attributes obtained
+     * from the input stream.
+     *
+     * @param is
+     *            {@code InputStream} to parse for attributes.
+     * @throws IOException
+     *             if an IO error occurs while creating this {@code StrictJarManifest}
+     */
+    public StrictJarManifest(InputStream is) throws IOException {
+        this();
+        read(Streams.readFully(is));
+    }
+
+    /**
+     * Creates a new {@code StrictJarManifest} instance. The new instance will have the
+     * same attributes as those found in the parameter {@code StrictJarManifest}.
+     *
+     * @param man
+     *            {@code StrictJarManifest} instance to obtain attributes from.
+     */
+    @SuppressWarnings("unchecked")
+    public StrictJarManifest(StrictJarManifest man) {
+        mainAttributes = (Attributes) man.mainAttributes.clone();
+        entries = (HashMap<String, Attributes>) ((HashMap<String, Attributes>) man
+                .getEntries()).clone();
+    }
+
+    StrictJarManifest(byte[] manifestBytes, boolean readChunks) throws IOException {
+        this();
+        if (readChunks) {
+            chunks = new HashMap<String, Chunk>();
+        }
+        read(manifestBytes);
+    }
+
+    /**
+     * Resets the both the main attributes as well as the entry attributes
+     * associated with this {@code StrictJarManifest}.
+     */
+    public void clear() {
+        entries.clear();
+        mainAttributes.clear();
+    }
+
+    /**
+     * Returns the {@code Attributes} associated with the parameter entry
+     * {@code name}.
+     *
+     * @param name
+     *            the name of the entry to obtain {@code Attributes} from.
+     * @return the Attributes for the entry or {@code null} if the entry does
+     *         not exist.
+     */
+    public Attributes getAttributes(String name) {
+        return getEntries().get(name);
+    }
+
+    /**
+     * Returns a map containing the {@code Attributes} for each entry in the
+     * {@code StrictJarManifest}.
+     *
+     * @return the map of entry attributes.
+     */
+    public Map<String, Attributes> getEntries() {
+        return entries;
+    }
+
+    /**
+     * Returns the main {@code Attributes} of the {@code JarFile}.
+     *
+     * @return main {@code Attributes} associated with the source {@code
+     *         JarFile}.
+     */
+    public Attributes getMainAttributes() {
+        return mainAttributes;
+    }
+
+    /**
+     * Creates a copy of this {@code StrictJarManifest}. The returned {@code StrictJarManifest}
+     * will equal the {@code StrictJarManifest} from which it was cloned.
+     *
+     * @return a copy of this instance.
+     */
+    @Override
+    public Object clone() {
+        return new StrictJarManifest(this);
+    }
+
+    /**
+     * Writes this {@code StrictJarManifest}'s name/attributes pairs to the given {@code OutputStream}.
+     * The {@code MANIFEST_VERSION} or {@code SIGNATURE_VERSION} attribute must be set before
+     * calling this method, or no attributes will be written.
+     *
+     * @throws IOException
+     *             If an error occurs writing the {@code StrictJarManifest}.
+     */
+    public void write(OutputStream os) throws IOException {
+        write(this, os);
+    }
+
+    /**
+     * Merges name/attribute pairs read from the input stream {@code is} into this manifest.
+     *
+     * @param is
+     *            The {@code InputStream} to read from.
+     * @throws IOException
+     *             If an error occurs reading the manifest.
+     */
+    public void read(InputStream is) throws IOException {
+        read(Streams.readFullyNoClose(is));
+    }
+
+    private void read(byte[] buf) throws IOException {
+        if (buf.length == 0) {
+            return;
+        }
+
+        StrictJarManifestReader im = new StrictJarManifestReader(buf, mainAttributes);
+        mainEnd = im.getEndOfMainSection();
+        im.readEntries(entries, chunks);
+    }
+
+    /**
+     * Returns the hash code for this instance.
+     *
+     * @return this {@code StrictJarManifest}'s hashCode.
+     */
+    @Override
+    public int hashCode() {
+        return mainAttributes.hashCode() ^ getEntries().hashCode();
+    }
+
+    /**
+     * Determines if the receiver is equal to the parameter object. Two {@code
+     * StrictJarManifest}s are equal if they have identical main attributes as well as
+     * identical entry attributes.
+     *
+     * @param o
+     *            the object to compare against.
+     * @return {@code true} if the manifests are equal, {@code false} otherwise
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (o == null) {
+            return false;
+        }
+        if (o.getClass() != this.getClass()) {
+            return false;
+        }
+        if (!mainAttributes.equals(((StrictJarManifest) o).mainAttributes)) {
+            return false;
+        }
+        return getEntries().equals(((StrictJarManifest) o).getEntries());
+    }
+
+    Chunk getChunk(String name) {
+        return chunks.get(name);
+    }
+
+    void removeChunks() {
+        chunks = null;
+    }
+
+    int getMainAttributesEnd() {
+        return mainEnd;
+    }
+
+    /**
+     * Writes out the attribute information of the specified manifest to the
+     * specified {@code OutputStream}
+     *
+     * @param manifest
+     *            the manifest to write out.
+     * @param out
+     *            The {@code OutputStream} to write to.
+     * @throws IOException
+     *             If an error occurs writing the {@code StrictJarManifest}.
+     */
+    static void write(StrictJarManifest manifest, OutputStream out) throws IOException {
+        CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
+        ByteBuffer buffer = ByteBuffer.allocate(LINE_LENGTH_LIMIT);
+
+        Attributes.Name versionName = Attributes.Name.MANIFEST_VERSION;
+        String version = manifest.mainAttributes.getValue(versionName);
+        if (version == null) {
+            versionName = Attributes.Name.SIGNATURE_VERSION;
+            version = manifest.mainAttributes.getValue(versionName);
+        }
+        if (version != null) {
+            writeEntry(out, versionName, version, encoder, buffer);
+            Iterator<?> entries = manifest.mainAttributes.keySet().iterator();
+            while (entries.hasNext()) {
+                Attributes.Name name = (Attributes.Name) entries.next();
+                if (!name.equals(versionName)) {
+                    writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
+                }
+            }
+        }
+        out.write(LINE_SEPARATOR);
+        Iterator<String> i = manifest.getEntries().keySet().iterator();
+        while (i.hasNext()) {
+            String key = i.next();
+            writeEntry(out, Attributes.Name.NAME, key, encoder, buffer);
+            Attributes attributes = manifest.entries.get(key);
+            Iterator<?> entries = attributes.keySet().iterator();
+            while (entries.hasNext()) {
+                Attributes.Name name = (Attributes.Name) entries.next();
+                writeEntry(out, name, attributes.getValue(name), encoder, buffer);
+            }
+            out.write(LINE_SEPARATOR);
+        }
+    }
+
+    private static void writeEntry(OutputStream os, Attributes.Name name,
+            String value, CharsetEncoder encoder, ByteBuffer bBuf) throws IOException {
+        String nameString = name.toString();
+        os.write(nameString.getBytes(StandardCharsets.US_ASCII));
+        os.write(VALUE_SEPARATOR);
+
+        encoder.reset();
+        bBuf.clear().limit(LINE_LENGTH_LIMIT - nameString.length() - 2);
+
+        CharBuffer cBuf = CharBuffer.wrap(value);
+
+        while (true) {
+            CoderResult r = encoder.encode(cBuf, bBuf, true);
+            if (CoderResult.UNDERFLOW == r) {
+                r = encoder.flush(bBuf);
+            }
+            os.write(bBuf.array(), bBuf.arrayOffset(), bBuf.position());
+            os.write(LINE_SEPARATOR);
+            if (CoderResult.UNDERFLOW == r) {
+                break;
+            }
+            os.write(' ');
+            bBuf.clear().limit(LINE_LENGTH_LIMIT - 1);
+        }
+    }
+}
diff --git a/core/java/android/util/jar/StrictJarManifestReader.java b/core/java/android/util/jar/StrictJarManifestReader.java
new file mode 100644
index 0000000..9881bb0
--- /dev/null
+++ b/core/java/android/util/jar/StrictJarManifestReader.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.util.jar;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.jar.Attributes;
+
+/**
+ * Reads a JAR file manifest. The specification is here:
+ * http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html
+ */
+class StrictJarManifestReader {
+    // There are relatively few unique attribute names,
+    // but a manifest might have thousands of entries.
+    private final HashMap<String, Attributes.Name> attributeNameCache = new HashMap<String, Attributes.Name>();
+
+    private final ByteArrayOutputStream valueBuffer = new ByteArrayOutputStream(80);
+
+    private final byte[] buf;
+
+    private final int endOfMainSection;
+
+    private int pos;
+
+    private Attributes.Name name;
+
+    private String value;
+
+    private int consecutiveLineBreaks = 0;
+
+    public StrictJarManifestReader(byte[] buf, Attributes main) throws IOException {
+        this.buf = buf;
+        while (readHeader()) {
+            main.put(name, value);
+        }
+        this.endOfMainSection = pos;
+    }
+
+    public void readEntries(Map<String, Attributes> entries, Map<String, StrictJarManifest.Chunk> chunks) throws IOException {
+        int mark = pos;
+        while (readHeader()) {
+            if (!Attributes.Name.NAME.equals(name)) {
+                throw new IOException("Entry is not named");
+            }
+            String entryNameValue = value;
+
+            Attributes entry = entries.get(entryNameValue);
+            if (entry == null) {
+                entry = new Attributes(12);
+            }
+
+            while (readHeader()) {
+                entry.put(name, value);
+            }
+
+            if (chunks != null) {
+                if (chunks.get(entryNameValue) != null) {
+                    // TODO A bug: there might be several verification chunks for
+                    // the same name. I believe they should be used to update
+                    // signature in order of appearance; there are two ways to fix
+                    // this: either use a list of chunks, or decide on used
+                    // signature algorithm in advance and reread the chunks while
+                    // updating the signature; for now a defensive error is thrown
+                    throw new IOException("A jar verifier does not support more than one entry with the same name");
+                }
+                chunks.put(entryNameValue, new StrictJarManifest.Chunk(mark, pos));
+                mark = pos;
+            }
+
+            entries.put(entryNameValue, entry);
+        }
+    }
+
+    public int getEndOfMainSection() {
+        return endOfMainSection;
+    }
+
+    /**
+     * Read a single line from the manifest buffer.
+     */
+    private boolean readHeader() throws IOException {
+        if (consecutiveLineBreaks > 1) {
+            // break a section on an empty line
+            consecutiveLineBreaks = 0;
+            return false;
+        }
+        readName();
+        consecutiveLineBreaks = 0;
+        readValue();
+        // if the last line break is missed, the line
+        // is ignored by the reference implementation
+        return consecutiveLineBreaks > 0;
+    }
+
+    private void readName() throws IOException {
+        int mark = pos;
+
+        while (pos < buf.length) {
+            if (buf[pos++] != ':') {
+                continue;
+            }
+
+            String nameString = new String(buf, mark, pos - mark - 1, StandardCharsets.US_ASCII);
+
+            if (buf[pos++] != ' ') {
+                throw new IOException(String.format("Invalid value for attribute '%s'", nameString));
+            }
+
+            try {
+                name = attributeNameCache.get(nameString);
+                if (name == null) {
+                    name = new Attributes.Name(nameString);
+                    attributeNameCache.put(nameString, name);
+                }
+            } catch (IllegalArgumentException e) {
+                // new Attributes.Name() throws IllegalArgumentException but we declare IOException
+                throw new IOException(e.getMessage());
+            }
+            return;
+        }
+    }
+
+    private void readValue() throws IOException {
+        boolean lastCr = false;
+        int mark = pos;
+        int last = pos;
+        valueBuffer.reset();
+        while (pos < buf.length) {
+            byte next = buf[pos++];
+            switch (next) {
+            case 0:
+                throw new IOException("NUL character in a manifest");
+            case '\n':
+                if (lastCr) {
+                    lastCr = false;
+                } else {
+                    consecutiveLineBreaks++;
+                }
+                continue;
+            case '\r':
+                lastCr = true;
+                consecutiveLineBreaks++;
+                continue;
+            case ' ':
+                if (consecutiveLineBreaks == 1) {
+                    valueBuffer.write(buf, mark, last - mark);
+                    mark = pos;
+                    consecutiveLineBreaks = 0;
+                    continue;
+                }
+            }
+
+            if (consecutiveLineBreaks >= 1) {
+                pos--;
+                break;
+            }
+            last = pos;
+        }
+
+        valueBuffer.write(buf, mark, last - mark);
+        // A bit frustrating that that Charset.forName will be called
+        // again.
+        value = valueBuffer.toString(StandardCharsets.UTF_8.name());
+    }
+}
diff --git a/core/java/android/util/jar/StrictJarVerifier.java b/core/java/android/util/jar/StrictJarVerifier.java
new file mode 100644
index 0000000..ca2aec1
--- /dev/null
+++ b/core/java/android/util/jar/StrictJarVerifier.java
@@ -0,0 +1,456 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.util.jar;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import libcore.io.Base64;
+import sun.security.jca.Providers;
+import sun.security.pkcs.PKCS7;
+
+/**
+ * Non-public class used by {@link JarFile} and {@link JarInputStream} to manage
+ * the verification of signed JARs. {@code JarFile} and {@code JarInputStream}
+ * objects are expected to have a {@code JarVerifier} instance member which
+ * can be used to carry out the tasks associated with verifying a signed JAR.
+ * These tasks would typically include:
+ * <ul>
+ * <li>verification of all signed signature files
+ * <li>confirmation that all signed data was signed only by the party or parties
+ * specified in the signature block data
+ * <li>verification that the contents of all signature files (i.e. {@code .SF}
+ * files) agree with the JAR entries information found in the JAR manifest.
+ * </ul>
+ */
+class StrictJarVerifier {
+    /**
+     * List of accepted digest algorithms. This list is in order from most
+     * preferred to least preferred.
+     */
+    private static final String[] DIGEST_ALGORITHMS = new String[] {
+        "SHA-512",
+        "SHA-384",
+        "SHA-256",
+        "SHA1",
+    };
+
+    private final String jarName;
+    private final StrictJarManifest manifest;
+    private final HashMap<String, byte[]> metaEntries;
+    private final int mainAttributesEnd;
+
+    private final Hashtable<String, HashMap<String, Attributes>> signatures =
+            new Hashtable<String, HashMap<String, Attributes>>(5);
+
+    private final Hashtable<String, Certificate[]> certificates =
+            new Hashtable<String, Certificate[]>(5);
+
+    private final Hashtable<String, Certificate[][]> verifiedEntries =
+            new Hashtable<String, Certificate[][]>();
+
+    /**
+     * Stores and a hash and a message digest and verifies that massage digest
+     * matches the hash.
+     */
+    static class VerifierEntry extends OutputStream {
+
+        private final String name;
+
+        private final MessageDigest digest;
+
+        private final byte[] hash;
+
+        private final Certificate[][] certChains;
+
+        private final Hashtable<String, Certificate[][]> verifiedEntries;
+
+        VerifierEntry(String name, MessageDigest digest, byte[] hash,
+                Certificate[][] certChains, Hashtable<String, Certificate[][]> verifedEntries) {
+            this.name = name;
+            this.digest = digest;
+            this.hash = hash;
+            this.certChains = certChains;
+            this.verifiedEntries = verifedEntries;
+        }
+
+        /**
+         * Updates a digest with one byte.
+         */
+        @Override
+        public void write(int value) {
+            digest.update((byte) value);
+        }
+
+        /**
+         * Updates a digest with byte array.
+         */
+        @Override
+        public void write(byte[] buf, int off, int nbytes) {
+            digest.update(buf, off, nbytes);
+        }
+
+        /**
+         * Verifies that the digests stored in the manifest match the decrypted
+         * digests from the .SF file. This indicates the validity of the
+         * signing, not the integrity of the file, as its digest must be
+         * calculated and verified when its contents are read.
+         *
+         * @throws SecurityException
+         *             if the digest value stored in the manifest does <i>not</i>
+         *             agree with the decrypted digest as recovered from the
+         *             <code>.SF</code> file.
+         */
+        void verify() {
+            byte[] d = digest.digest();
+            if (!MessageDigest.isEqual(d, Base64.decode(hash))) {
+                throw invalidDigest(JarFile.MANIFEST_NAME, name, name);
+            }
+            verifiedEntries.put(name, certChains);
+        }
+    }
+
+    private static SecurityException invalidDigest(String signatureFile, String name,
+            String jarName) {
+        throw new SecurityException(signatureFile + " has invalid digest for " + name +
+                " in " + jarName);
+    }
+
+    private static SecurityException failedVerification(String jarName, String signatureFile) {
+        throw new SecurityException(jarName + " failed verification of " + signatureFile);
+    }
+
+    private static SecurityException failedVerification(String jarName, String signatureFile,
+                                                      Throwable e) {
+        throw new SecurityException(jarName + " failed verification of " + signatureFile, e);
+    }
+
+
+    /**
+     * Constructs and returns a new instance of {@code JarVerifier}.
+     *
+     * @param name
+     *            the name of the JAR file being verified.
+     */
+    StrictJarVerifier(String name, StrictJarManifest manifest,
+        HashMap<String, byte[]> metaEntries) {
+        jarName = name;
+        this.manifest = manifest;
+        this.metaEntries = metaEntries;
+        this.mainAttributesEnd = manifest.getMainAttributesEnd();
+    }
+
+    /**
+     * Invoked for each new JAR entry read operation from the input
+     * stream. This method constructs and returns a new {@link VerifierEntry}
+     * which contains the certificates used to sign the entry and its hash value
+     * as specified in the JAR MANIFEST format.
+     *
+     * @param name
+     *            the name of an entry in a JAR file which is <b>not</b> in the
+     *            {@code META-INF} directory.
+     * @return a new instance of {@link VerifierEntry} which can be used by
+     *         callers as an {@link OutputStream}.
+     */
+    VerifierEntry initEntry(String name) {
+        // If no manifest is present by the time an entry is found,
+        // verification cannot occur. If no signature files have
+        // been found, do not verify.
+        if (manifest == null || signatures.isEmpty()) {
+            return null;
+        }
+
+        Attributes attributes = manifest.getAttributes(name);
+        // entry has no digest
+        if (attributes == null) {
+            return null;
+        }
+
+        ArrayList<Certificate[]> certChains = new ArrayList<Certificate[]>();
+        Iterator<Map.Entry<String, HashMap<String, Attributes>>> it = signatures.entrySet().iterator();
+        while (it.hasNext()) {
+            Map.Entry<String, HashMap<String, Attributes>> entry = it.next();
+            HashMap<String, Attributes> hm = entry.getValue();
+            if (hm.get(name) != null) {
+                // Found an entry for entry name in .SF file
+                String signatureFile = entry.getKey();
+                Certificate[] certChain = certificates.get(signatureFile);
+                if (certChain != null) {
+                    certChains.add(certChain);
+                }
+            }
+        }
+
+        // entry is not signed
+        if (certChains.isEmpty()) {
+            return null;
+        }
+        Certificate[][] certChainsArray = certChains.toArray(new Certificate[certChains.size()][]);
+
+        for (int i = 0; i < DIGEST_ALGORITHMS.length; i++) {
+            final String algorithm = DIGEST_ALGORITHMS[i];
+            final String hash = attributes.getValue(algorithm + "-Digest");
+            if (hash == null) {
+                continue;
+            }
+            byte[] hashBytes = hash.getBytes(StandardCharsets.ISO_8859_1);
+
+            try {
+                return new VerifierEntry(name, MessageDigest.getInstance(algorithm), hashBytes,
+                        certChainsArray, verifiedEntries);
+            } catch (NoSuchAlgorithmException ignored) {
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Add a new meta entry to the internal collection of data held on each JAR
+     * entry in the {@code META-INF} directory including the manifest
+     * file itself. Files associated with the signing of a JAR would also be
+     * added to this collection.
+     *
+     * @param name
+     *            the name of the file located in the {@code META-INF}
+     *            directory.
+     * @param buf
+     *            the file bytes for the file called {@code name}.
+     * @see #removeMetaEntries()
+     */
+    void addMetaEntry(String name, byte[] buf) {
+        metaEntries.put(name.toUpperCase(Locale.US), buf);
+    }
+
+    /**
+     * If the associated JAR file is signed, check on the validity of all of the
+     * known signatures.
+     *
+     * @return {@code true} if the associated JAR is signed and an internal
+     *         check verifies the validity of the signature(s). {@code false} if
+     *         the associated JAR file has no entries at all in its {@code
+     *         META-INF} directory. This situation is indicative of an invalid
+     *         JAR file.
+     *         <p>
+     *         Will also return {@code true} if the JAR file is <i>not</i>
+     *         signed.
+     * @throws SecurityException
+     *             if the JAR file is signed and it is determined that a
+     *             signature block file contains an invalid signature for the
+     *             corresponding signature file.
+     */
+    synchronized boolean readCertificates() {
+        if (metaEntries.isEmpty()) {
+            return false;
+        }
+
+        Iterator<String> it = metaEntries.keySet().iterator();
+        while (it.hasNext()) {
+            String key = it.next();
+            if (key.endsWith(".DSA") || key.endsWith(".RSA") || key.endsWith(".EC")) {
+                verifyCertificate(key);
+                it.remove();
+            }
+        }
+        return true;
+    }
+
+   /**
+     * Verifies that the signature computed from {@code sfBytes} matches
+     * that specified in {@code blockBytes} (which is a PKCS7 block). Returns
+     * certificates listed in the PKCS7 block. Throws a {@code GeneralSecurityException}
+     * if something goes wrong during verification.
+     */
+    static Certificate[] verifyBytes(byte[] blockBytes, byte[] sfBytes)
+        throws GeneralSecurityException {
+
+        Object obj = null;
+        try {
+
+            obj = Providers.startJarVerification();
+            PKCS7 block = new PKCS7(blockBytes);
+            if (block.verify(sfBytes) == null) {
+                throw new GeneralSecurityException("Failed to verify signature");
+            }
+            X509Certificate[] blockCerts = block.getCertificates();
+            Certificate[] signerCertChain = null;
+            if (blockCerts != null) {
+                signerCertChain = new Certificate[blockCerts.length];
+                for (int i = 0; i < blockCerts.length; ++i) {
+                    signerCertChain[i] = blockCerts[i];
+                }
+            }
+            return signerCertChain;
+        } catch (IOException e) {
+            throw new GeneralSecurityException("IO exception verifying jar cert", e);
+        } finally {
+            Providers.stopJarVerification(obj);
+        }
+    }
+
+    /**
+     * @param certFile
+     */
+    private void verifyCertificate(String certFile) {
+        // Found Digital Sig, .SF should already have been read
+        String signatureFile = certFile.substring(0, certFile.lastIndexOf('.')) + ".SF";
+        byte[] sfBytes = metaEntries.get(signatureFile);
+        if (sfBytes == null) {
+            return;
+        }
+
+        byte[] manifestBytes = metaEntries.get(JarFile.MANIFEST_NAME);
+        // Manifest entry is required for any verifications.
+        if (manifestBytes == null) {
+            return;
+        }
+
+        byte[] sBlockBytes = metaEntries.get(certFile);
+        try {
+            Certificate[] signerCertChain = verifyBytes(sBlockBytes, sfBytes);
+            if (signerCertChain != null) {
+                certificates.put(signatureFile, signerCertChain);
+            }
+        } catch (GeneralSecurityException e) {
+          throw failedVerification(jarName, signatureFile, e);
+        }
+
+        // Verify manifest hash in .sf file
+        Attributes attributes = new Attributes();
+        HashMap<String, Attributes> entries = new HashMap<String, Attributes>();
+        try {
+            StrictJarManifestReader im = new StrictJarManifestReader(sfBytes, attributes);
+            im.readEntries(entries, null);
+        } catch (IOException e) {
+            return;
+        }
+
+        // Do we actually have any signatures to look at?
+        if (attributes.get(Attributes.Name.SIGNATURE_VERSION) == null) {
+            return;
+        }
+
+        boolean createdBySigntool = false;
+        String createdBy = attributes.getValue("Created-By");
+        if (createdBy != null) {
+            createdBySigntool = createdBy.indexOf("signtool") != -1;
+        }
+
+        // Use .SF to verify the mainAttributes of the manifest
+        // If there is no -Digest-Manifest-Main-Attributes entry in .SF
+        // file, such as those created before java 1.5, then we ignore
+        // such verification.
+        if (mainAttributesEnd > 0 && !createdBySigntool) {
+            String digestAttribute = "-Digest-Manifest-Main-Attributes";
+            if (!verify(attributes, digestAttribute, manifestBytes, 0, mainAttributesEnd, false, true)) {
+                throw failedVerification(jarName, signatureFile);
+            }
+        }
+
+        // Use .SF to verify the whole manifest.
+        String digestAttribute = createdBySigntool ? "-Digest" : "-Digest-Manifest";
+        if (!verify(attributes, digestAttribute, manifestBytes, 0, manifestBytes.length, false, false)) {
+            Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
+            while (it.hasNext()) {
+                Map.Entry<String, Attributes> entry = it.next();
+                StrictJarManifest.Chunk chunk = manifest.getChunk(entry.getKey());
+                if (chunk == null) {
+                    return;
+                }
+                if (!verify(entry.getValue(), "-Digest", manifestBytes,
+                        chunk.start, chunk.end, createdBySigntool, false)) {
+                    throw invalidDigest(signatureFile, entry.getKey(), jarName);
+                }
+            }
+        }
+        metaEntries.put(signatureFile, null);
+        signatures.put(signatureFile, entries);
+    }
+
+    /**
+     * Returns a <code>boolean</code> indication of whether or not the
+     * associated jar file is signed.
+     *
+     * @return {@code true} if the JAR is signed, {@code false}
+     *         otherwise.
+     */
+    boolean isSignedJar() {
+        return certificates.size() > 0;
+    }
+
+    private boolean verify(Attributes attributes, String entry, byte[] data,
+            int start, int end, boolean ignoreSecondEndline, boolean ignorable) {
+        for (int i = 0; i < DIGEST_ALGORITHMS.length; i++) {
+            String algorithm = DIGEST_ALGORITHMS[i];
+            String hash = attributes.getValue(algorithm + entry);
+            if (hash == null) {
+                continue;
+            }
+
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance(algorithm);
+            } catch (NoSuchAlgorithmException e) {
+                continue;
+            }
+            if (ignoreSecondEndline && data[end - 1] == '\n' && data[end - 2] == '\n') {
+                md.update(data, start, end - 1 - start);
+            } else {
+                md.update(data, start, end - start);
+            }
+            byte[] b = md.digest();
+            byte[] hashBytes = hash.getBytes(StandardCharsets.ISO_8859_1);
+            return MessageDigest.isEqual(b, Base64.decode(hashBytes));
+        }
+        return ignorable;
+    }
+
+    /**
+     * Returns all of the {@link java.security.cert.Certificate} chains that
+     * were used to verify the signature on the JAR entry called
+     * {@code name}. Callers must not modify the returned arrays.
+     *
+     * @param name
+     *            the name of a JAR entry.
+     * @return an array of {@link java.security.cert.Certificate} chains.
+     */
+    Certificate[][] getCertificateChains(String name) {
+        return verifiedEntries.get(name);
+    }
+
+    /**
+     * Remove all entries from the internal collection of data held about each
+     * JAR entry in the {@code META-INF} directory.
+     */
+    void removeMetaEntries() {
+        metaEntries.clear();
+    }
+}
diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/HardwareLayer.java
index 692ca7b..a12434c 100644
--- a/core/java/android/view/HardwareLayer.java
+++ b/core/java/android/view/HardwareLayer.java
@@ -33,10 +33,10 @@
  * @hide
  */
 final class HardwareLayer {
-    private HardwareRenderer mRenderer;
+    private ThreadedRenderer mRenderer;
     private VirtualRefBasePtr mFinalizer;
 
-    private HardwareLayer(HardwareRenderer renderer, long deferredUpdater) {
+    private HardwareLayer(ThreadedRenderer renderer, long deferredUpdater) {
         if (renderer == null || deferredUpdater == 0) {
             throw new IllegalArgumentException("Either hardware renderer: " + renderer
                     + " or deferredUpdater: " + deferredUpdater + " is invalid");
@@ -140,7 +140,7 @@
         mRenderer.pushLayerUpdate(this);
     }
 
-    static HardwareLayer adoptTextureLayer(HardwareRenderer renderer, long layer) {
+    static HardwareLayer adoptTextureLayer(ThreadedRenderer renderer, long layer) {
         return new HardwareLayer(renderer, layer);
     }
 
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
deleted file mode 100644
index 5e58250..0000000
--- a/core/java/android/view/HardwareRenderer.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Copyright (C) 2013 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.view;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Rect;
-import android.view.Surface.OutOfResourcesException;
-
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-/**
- * Interface for rendering a view hierarchy using hardware acceleration.
- *
- * @hide
- */
-public abstract class HardwareRenderer {
-    static final String LOG_TAG = "HardwareRenderer";
-
-    /**
-     * Name of the file that holds the shaders cache.
-     */
-    private static final String CACHE_PATH_SHADERS = "com.android.opengl.shaders_cache";
-
-    /**
-     * System property used to enable or disable dirty regions invalidation.
-     * This property is only queried if {@link #RENDER_DIRTY_REGIONS} is true.
-     * The default value of this property is assumed to be true.
-     *
-     * Possible values:
-     * "true", to enable partial invalidates
-     * "false", to disable partial invalidates
-     */
-    static final String RENDER_DIRTY_REGIONS_PROPERTY = "debug.hwui.render_dirty_regions";
-
-    /**
-     * System property used to enable or disable hardware rendering profiling.
-     * The default value of this property is assumed to be false.
-     *
-     * When profiling is enabled, the adb shell dumpsys gfxinfo command will
-     * output extra information about the time taken to execute by the last
-     * frames.
-     *
-     * Possible values:
-     * "true", to enable profiling
-     * "visual_bars", to enable profiling and visualize the results on screen
-     * "false", to disable profiling
-     *
-     * @see #PROFILE_PROPERTY_VISUALIZE_BARS
-     *
-     * @hide
-     */
-    public static final String PROFILE_PROPERTY = "debug.hwui.profile";
-
-    /**
-     * Value for {@link #PROFILE_PROPERTY}. When the property is set to this
-     * value, profiling data will be visualized on screen as a bar chart.
-     *
-     * @hide
-     */
-    public static final String PROFILE_PROPERTY_VISUALIZE_BARS = "visual_bars";
-
-    /**
-     * System property used to specify the number of frames to be used
-     * when doing hardware rendering profiling.
-     * The default value of this property is #PROFILE_MAX_FRAMES.
-     *
-     * When profiling is enabled, the adb shell dumpsys gfxinfo command will
-     * output extra information about the time taken to execute by the last
-     * frames.
-     *
-     * Possible values:
-     * "60", to set the limit of frames to 60
-     */
-    static final String PROFILE_MAXFRAMES_PROPERTY = "debug.hwui.profile.maxframes";
-
-    /**
-     * System property used to debug EGL configuration choice.
-     *
-     * Possible values:
-     * "choice", print the chosen configuration only
-     * "all", print all possible configurations
-     */
-    static final String PRINT_CONFIG_PROPERTY = "debug.hwui.print_config";
-
-    /**
-     * Turn on to draw dirty regions every other frame.
-     *
-     * Possible values:
-     * "true", to enable dirty regions debugging
-     * "false", to disable dirty regions debugging
-     *
-     * @hide
-     */
-    public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions";
-
-    /**
-     * Turn on to flash hardware layers when they update.
-     *
-     * Possible values:
-     * "true", to enable hardware layers updates debugging
-     * "false", to disable hardware layers updates debugging
-     *
-     * @hide
-     */
-    public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY =
-            "debug.hwui.show_layers_updates";
-
-    /**
-     * Controls overdraw debugging.
-     *
-     * Possible values:
-     * "false", to disable overdraw debugging
-     * "show", to show overdraw areas on screen
-     * "count", to display an overdraw counter
-     *
-     * @hide
-     */
-    public static final String DEBUG_OVERDRAW_PROPERTY = "debug.hwui.overdraw";
-
-    /**
-     * Value for {@link #DEBUG_OVERDRAW_PROPERTY}. When the property is set to this
-     * value, overdraw will be shown on screen by coloring pixels.
-     *
-     * @hide
-     */
-    public static final String OVERDRAW_PROPERTY_SHOW = "show";
-
-    /**
-     * Turn on to debug non-rectangular clip operations.
-     *
-     * Possible values:
-     * "hide", to disable this debug mode
-     * "highlight", highlight drawing commands tested against a non-rectangular clip
-     * "stencil", renders the clip region on screen when set
-     *
-     * @hide
-     */
-    public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY =
-            "debug.hwui.show_non_rect_clip";
-
-    /**
-     * A process can set this flag to false to prevent the use of hardware
-     * rendering.
-     *
-     * @hide
-     */
-    public static boolean sRendererDisabled = false;
-
-    /**
-     * Further hardware renderer disabling for the system process.
-     *
-     * @hide
-     */
-    public static boolean sSystemRendererDisabled = false;
-
-    private boolean mEnabled;
-    private boolean mRequested = true;
-
-    /**
-     * Invoke this method to disable hardware rendering in the current process.
-     *
-     * @hide
-     */
-    public static void disable(boolean system) {
-        sRendererDisabled = true;
-        if (system) {
-            sSystemRendererDisabled = true;
-        }
-    }
-
-    public static boolean sTrimForeground = false;
-
-    /**
-     * Controls whether or not the hardware renderer should aggressively
-     * trim memory. Note that this must not be set for any process that
-     * uses WebView! This should be only used by system_process or similar
-     * that do not go into the background.
-     */
-    public static void enableForegroundTrimming() {
-        sTrimForeground = true;
-    }
-
-    /**
-     * Indicates whether hardware acceleration is available under any form for
-     * the view hierarchy.
-     *
-     * @return True if the view hierarchy can potentially be hardware accelerated,
-     *         false otherwise
-     */
-    public static boolean isAvailable() {
-        return DisplayListCanvas.isAvailable();
-    }
-
-    /**
-     * Destroys the hardware rendering context.
-     */
-    abstract void destroy();
-
-    /**
-     * Initializes the hardware renderer for the specified surface.
-     *
-     * @param surface The surface to hardware accelerate
-     *
-     * @return True if the initialization was successful, false otherwise.
-     */
-    abstract boolean initialize(Surface surface) throws OutOfResourcesException;
-
-    /**
-     * Updates the hardware renderer for the specified surface.
-     *
-     * @param surface The surface to hardware accelerate
-     */
-    abstract void updateSurface(Surface surface) throws OutOfResourcesException;
-
-    /**
-     * Stops any rendering into the surface. Use this if it is unclear whether
-     * or not the surface used by the HardwareRenderer will be changing. It
-     * Suspends any rendering into the surface, but will not do any destruction
-     */
-    abstract boolean pauseSurface(Surface surface);
-
-    /**
-     * Destroys all hardware rendering resources associated with the specified
-     * view hierarchy.
-     *
-     * @param view The root of the view hierarchy
-     */
-    abstract void destroyHardwareResources(View view);
-
-    /**
-     * This method should be invoked whenever the current hardware renderer
-     * context should be reset.
-     *
-     * @param surface The surface to hardware accelerate
-     */
-    abstract void invalidate(Surface surface);
-
-    /**
-     * Detaches the layer's surface texture from the GL context and releases
-     * the texture id
-     */
-    abstract void detachSurfaceTexture(long hardwareLayer);
-
-    /**
-     * Gets the current width of the surface. This is the width that the surface
-     * was last set to in a call to {@link #setup(int, int, View.AttachInfo, Rect)}.
-     *
-     * @return the current width of the surface
-     */
-    abstract int getWidth();
-
-    /**
-     * Gets the current height of the surface. This is the height that the surface
-     * was last set to in a call to {@link #setup(int, int, View.AttachInfo, Rect)}.
-     *
-     * @return the current width of the surface
-     */
-    abstract int getHeight();
-
-    /**
-     * Outputs extra debugging information in the specified file descriptor.
-     */
-    abstract void dumpGfxInfo(PrintWriter pw, FileDescriptor fd, String[] args);
-
-    /**
-     * Loads system properties used by the renderer. This method is invoked
-     * whenever system properties are modified. Implementations can use this
-     * to trigger live updates of the renderer based on properties.
-     *
-     * @return True if a property has changed.
-     */
-    abstract boolean loadSystemProperties();
-
-    /**
-     * Sets the directory to use as a persistent storage for hardware rendering
-     * resources.
-     *
-     * @param cacheDir A directory the current process can write to
-     *
-     * @hide
-     */
-    public static void setupDiskCache(File cacheDir) {
-        ThreadedRenderer.setupShadersDiskCache(new File(cacheDir, CACHE_PATH_SHADERS).getAbsolutePath());
-    }
-
-    /**
-     * Indicates that the specified hardware layer needs to be updated
-     * as soon as possible.
-     *
-     * @param layer The hardware layer that needs an update
-     */
-    abstract void pushLayerUpdate(HardwareLayer layer);
-
-    /**
-     * Tells the HardwareRenderer that the layer is destroyed. The renderer
-     * should remove the layer from any update queues.
-     */
-    abstract void onLayerDestroyed(HardwareLayer layer);
-
-    /**
-     * Interface used to receive callbacks whenever a view is drawn by
-     * a hardware renderer instance.
-     */
-    interface HardwareDrawCallbacks {
-        /**
-         * Invoked before a view is drawn by a hardware renderer.
-         * This method can be used to apply transformations to the
-         * canvas but no drawing command should be issued.
-         *
-         * @param canvas The Canvas used to render the view.
-         */
-        void onHardwarePreDraw(DisplayListCanvas canvas);
-
-        /**
-         * Invoked after a view is drawn by a hardware renderer.
-         * It is safe to invoke drawing commands from this method.
-         *
-         * @param canvas The Canvas used to render the view.
-         */
-        void onHardwarePostDraw(DisplayListCanvas canvas);
-    }
-
-    /**
-     *  Indicates that the content drawn by HardwareDrawCallbacks needs to
-     *  be updated, which will be done by the next call to draw()
-     */
-    abstract void invalidateRoot();
-
-    /**
-     * Draws the specified view.
-     *
-     * @param view The view to draw.
-     * @param attachInfo AttachInfo tied to the specified view.
-     * @param callbacks Callbacks invoked when drawing happens.
-     */
-    abstract void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks);
-
-    /**
-     * Creates a new hardware layer. A hardware layer built by calling this
-     * method will be treated as a texture layer, instead of as a render target.
-     *
-     * @return A hardware layer
-     */
-    abstract HardwareLayer createTextureLayer();
-
-    abstract void buildLayer(RenderNode node);
-
-    abstract boolean copyLayerInto(HardwareLayer layer, Bitmap bitmap);
-
-    /**
-     * Initializes the hardware renderer for the specified surface and setup the
-     * renderer for drawing, if needed. This is invoked when the ViewAncestor has
-     * potentially lost the hardware renderer. The hardware renderer should be
-     * reinitialized and setup when the render {@link #isRequested()} and
-     * {@link #isEnabled()}.
-     *
-     * @param width The width of the drawing surface.
-     * @param height The height of the drawing surface.
-     * @param attachInfo Information about the window.
-     * @param surface The surface to hardware accelerate
-     * @param surfaceInsets The drawing surface insets to apply
-     *
-     * @return true if the surface was initialized, false otherwise. Returning
-     *         false might mean that the surface was already initialized.
-     */
-    boolean initializeIfNeeded(int width, int height, View.AttachInfo attachInfo,
-            Surface surface, Rect surfaceInsets) throws OutOfResourcesException {
-        if (isRequested()) {
-            // We lost the gl context, so recreate it.
-            if (!isEnabled()) {
-                if (initialize(surface)) {
-                    setup(width, height, attachInfo, surfaceInsets);
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Sets up the renderer for drawing.
-     *
-     * @param width The width of the drawing surface.
-     * @param height The height of the drawing surface.
-     * @param attachInfo Information about the window.
-     * @param surfaceInsets The drawing surface insets to apply
-     */
-    abstract void setup(int width, int height, View.AttachInfo attachInfo, Rect surfaceInsets);
-
-    /**
-     * Updates the light position based on the position of the window.
-     *
-     * @param attachInfo Information about the window.
-     */
-    abstract void setLightCenter(View.AttachInfo attachInfo);
-
-    /**
-     * Optional, sets the name of the renderer. Useful for debugging purposes.
-     *
-     * @param name The name of this renderer, can be null
-     */
-    abstract void setName(String name);
-
-    /**
-     * Change the HardwareRenderer's opacity
-     */
-    abstract void setOpaque(boolean opaque);
-
-    /**
-     * Creates a hardware renderer using OpenGL.
-     *
-     * @param translucent True if the surface is translucent, false otherwise
-     *
-     * @return A hardware renderer backed by OpenGL.
-     */
-    static HardwareRenderer create(Context context, boolean translucent) {
-        HardwareRenderer renderer = null;
-        if (DisplayListCanvas.isAvailable()) {
-            renderer = new ThreadedRenderer(context, translucent);
-        }
-        return renderer;
-    }
-
-    /**
-     * Invoke this method when the system is running out of memory. This
-     * method will attempt to recover as much memory as possible, based on
-     * the specified hint.
-     *
-     * @param level Hint about the amount of memory that should be trimmed,
-     *              see {@link android.content.ComponentCallbacks}
-     */
-    static void trimMemory(int level) {
-        ThreadedRenderer.trimMemory(level);
-    }
-
-    /**
-     * Indicates whether hardware acceleration is currently enabled.
-     *
-     * @return True if hardware acceleration is in use, false otherwise.
-     */
-    boolean isEnabled() {
-        return mEnabled;
-    }
-
-    /**
-     * Indicates whether hardware acceleration is currently enabled.
-     *
-     * @param enabled True if the hardware renderer is in use, false otherwise.
-     */
-    void setEnabled(boolean enabled) {
-        mEnabled = enabled;
-    }
-
-    /**
-     * Indicates whether hardware acceleration is currently request but not
-     * necessarily enabled yet.
-     *
-     * @return True if requested, false otherwise.
-     */
-    boolean isRequested() {
-        return mRequested;
-    }
-
-    /**
-     * Indicates whether hardware acceleration is currently requested but not
-     * necessarily enabled yet.
-     *
-     * @return True to request hardware acceleration, false otherwise.
-     */
-    void setRequested(boolean requested) {
-        mRequested = requested;
-    }
-
-    /**
-     * Blocks until all previously queued work has completed.
-     */
-    abstract void fence();
-
-    /**
-     * Prevents any further drawing until draw() is called. This is a signal
-     * that the contents of the RenderNode tree are no longer safe to play back.
-     * In practice this usually means that there are Functor pointers in the
-     * display list that are no longer valid.
-     */
-    abstract void stopDrawing();
-
-    /**
-     * Called by {@link ViewRootImpl} when a new performTraverals is scheduled.
-     */
-    abstract void notifyFramePending();
-
-    abstract void registerAnimatingRenderNode(RenderNode animator);
-}
diff --git a/core/java/android/view/IDockDividerVisibilityListener.aidl b/core/java/android/view/IDockDividerVisibilityListener.aidl
new file mode 100644
index 0000000..a7d5cda
--- /dev/null
+++ b/core/java/android/view/IDockDividerVisibilityListener.aidl
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2015, 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.view;
+
+/**
+  * Listener for showing/hiding of the dock divider. Will fire when an app is shown in side by side
+  * mode and a divider should be shown.
+  *
+  * @hide
+  */
+oneway interface IDockDividerVisibilityListener {
+    void onDockDividerVisibilityChanged(boolean visible);
+}
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 64a046e..7a379d50 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -29,6 +29,7 @@
 import android.os.IRemoteCallback;
 import android.view.IApplicationToken;
 import android.view.IAppTransitionAnimationSpecsFuture;
+import android.view.IDockDividerVisibilityListener;
 import android.view.IOnKeyguardExitResult;
 import android.view.IRotationWatcher;
 import android.view.IWindowSession;
@@ -109,11 +110,14 @@
      *
      * @param token The token we are adding to the input task Id.
      * @param taskId The Id of the task we are adding the token to.
+     * @param stackId Stack Id to create a new Task with the input task Id on
+     *                if the task doesn't exist yet.
      * @param taskBounds Bounds to use when creating a new Task with the input task Id if
      *                   the task doesn't exist yet.
      * @param config Configuration that is being used with this task.
      */
-    void setAppTask(IBinder token, int taskId, in Rect taskBounds, in Configuration config);
+    void setAppTask(
+            IBinder token, int taskId, int stackId, in Rect taskBounds, in Configuration config);
     void setAppOrientation(IApplicationToken token, int requestedOrientation);
     int getAppOrientation(IApplicationToken token);
     void setFocusedApp(IBinder token, boolean moveFocusNow);
@@ -290,10 +294,10 @@
     /**
      * Create a screenshot of the applications currently displayed.
      *
-     * @param frameScale the scale to apply to the frame, only used when width = -1 and 
+     * @param frameScale the scale to apply to the frame, only used when width = -1 and
      *                   height = -1
      */
-    Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight, 
+    Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight,
             float frameScale);
 
     /**
@@ -348,4 +352,9 @@
      * stack size.
      */
     void setDockedStackResizing(boolean resizing);
+
+    /**
+     * Registers a listener that will be called when the dock divider changes its visibility.
+     */
+    void registerDockDividerVisibilityListener(IDockDividerVisibilityListener listener);
 }
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java
new file mode 100644
index 0000000..82f6c7f
--- /dev/null
+++ b/core/java/android/view/NotificationHeaderView.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2015 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.view;
+
+import android.annotation.Nullable;
+import android.app.Notification;
+import android.content.Context;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+import android.widget.RemoteViews;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * A header of a notification view
+ *
+ * @hide
+ */
+@RemoteViews.RemoteView
+public class NotificationHeaderView extends LinearLayout {
+    private final int mHeaderMinWidth;
+    private View mAppName;
+    private View mSubTextView;
+    private OnClickListener mExpandClickListener;
+    private HeaderTouchListener mTouchListener = new HeaderTouchListener();
+    private View mExpandButton;
+    private View mIcon;
+    private TextView mChildCount;
+
+    public NotificationHeaderView(Context context) {
+        this(context, null);
+    }
+
+    public NotificationHeaderView(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public NotificationHeaderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public NotificationHeaderView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        mHeaderMinWidth = getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.notification_header_shrink_min_width);
+    }
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        mAppName = findViewById(com.android.internal.R.id.app_name_text);
+        mSubTextView = findViewById(com.android.internal.R.id.header_sub_text);
+        mExpandButton = findViewById(com.android.internal.R.id.expand_button);
+        mIcon = findViewById(com.android.internal.R.id.icon);
+        mChildCount = (TextView) findViewById(com.android.internal.R.id.number_of_children);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        final int givenWidth = MeasureSpec.getSize(widthMeasureSpec);
+        final int givenHeight = MeasureSpec.getSize(heightMeasureSpec);
+        int wrapContentWidthSpec = MeasureSpec.makeMeasureSpec(givenWidth,
+                MeasureSpec.AT_MOST);
+        int wrapContentHeightSpec = MeasureSpec.makeMeasureSpec(givenHeight,
+                MeasureSpec.AT_MOST);
+        int totalWidth = getPaddingStart() + getPaddingEnd();
+        for (int i = 0; i < getChildCount(); i++) {
+            final View child = getChildAt(i);
+            if (child.getVisibility() == GONE) {
+                // We'll give it the rest of the space in the end
+                continue;
+            }
+            final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
+            int childWidthSpec = getChildMeasureSpec(wrapContentWidthSpec,
+                    lp.leftMargin + lp.rightMargin, lp.width);
+            int childHeightSpec = getChildMeasureSpec(wrapContentHeightSpec,
+                    lp.topMargin + lp.bottomMargin, lp.height);
+            child.measure(childWidthSpec, childHeightSpec);
+            totalWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth();
+        }
+        if (totalWidth > givenWidth) {
+            int overFlow = totalWidth - givenWidth;
+            // We are overflowing, lets shrink
+            final int appWidth = mAppName.getMeasuredWidth();
+            if (appWidth > mHeaderMinWidth) {
+                int newSize = appWidth - Math.min(appWidth - mHeaderMinWidth, overFlow);
+                int childWidthSpec = MeasureSpec.makeMeasureSpec(newSize, MeasureSpec.AT_MOST);
+                mAppName.measure(childWidthSpec, wrapContentHeightSpec);
+                overFlow -= appWidth - newSize;
+            }
+            if (overFlow > 0 && mSubTextView.getVisibility() != GONE) {
+                // we're still too big
+                final int subTextWidth = mSubTextView.getMeasuredWidth();
+                int newSize = Math.max(0, subTextWidth - overFlow);
+                int childWidthSpec = MeasureSpec.makeMeasureSpec(newSize, MeasureSpec.AT_MOST);
+                mSubTextView.measure(childWidthSpec, wrapContentHeightSpec);
+            }
+            totalWidth = givenWidth;
+        }
+        setMeasuredDimension(totalWidth, givenHeight);
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        super.onLayout(changed, l, t, r, b);
+        updateTouchListener();
+    }
+
+    private void updateTouchListener() {
+        if (mExpandClickListener != null) {
+            mTouchListener.bindTouchRects();
+        }
+    }
+
+    @Override
+    public void setOnClickListener(@Nullable OnClickListener l) {
+        mExpandClickListener = l;
+        setOnTouchListener(mExpandClickListener != null ? mTouchListener : null);
+        updateTouchListener();
+    }
+
+    public void setChildCount(int childCount) {
+        if (childCount > 0) {
+            mChildCount.setText(getContext().getString(
+                    com.android.internal.R.string.notification_children_count_bracketed,
+                    childCount));
+            mChildCount.setVisibility(VISIBLE);
+        } else {
+            mChildCount.setVisibility(GONE);
+        }
+    }
+
+    public class HeaderTouchListener implements View.OnTouchListener {
+
+        private final ArrayList<Rect> mTouchRects = new ArrayList<>();
+        private int mTouchSlop;
+        private boolean mTrackGesture;
+        private float mDownX;
+        private float mDownY;
+
+        public HeaderTouchListener() {
+        }
+
+        public void bindTouchRects() {
+            mTouchRects.clear();
+            addRectAroundViewView(mIcon);
+            addRectAroundViewView(mExpandButton);
+            addInBetweenRect();
+            mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
+        }
+
+        private void addInBetweenRect() {
+            final Rect r = new Rect();
+            r.top = 0;
+            r.bottom = (int) (32 * getResources().getDisplayMetrics().density);
+            Rect leftRect = mTouchRects.get(0);
+            r.left = leftRect.right;
+            Rect rightRect = mTouchRects.get(1);
+            r.right = rightRect.left;
+            mTouchRects.add(r);
+        }
+
+        private void addRectAroundViewView(View view) {
+            final Rect r = getRectAroundView(view);
+            mTouchRects.add(r);
+        }
+
+        private Rect getRectAroundView(View view) {
+            float size = 48 * getResources().getDisplayMetrics().density;
+            final Rect r = new Rect();
+            if (view.getVisibility() == GONE) {
+                view = getFirstChildNotGone();
+                r.left = (int) (view.getLeft() - size / 2.0f);
+            } else {
+                r.left = (int) ((view.getLeft() + view.getRight()) / 2.0f - size / 2.0f);
+            }
+            r.top = (int) ((view.getTop() + view.getBottom()) / 2.0f - size / 2.0f);
+            r.bottom = (int) (r.top + size);
+            r.right = (int) (r.left + size);
+            return r;
+        }
+
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            float x = event.getX();
+            float y = event.getY();
+            switch (event.getActionMasked() & MotionEvent.ACTION_MASK) {
+                case MotionEvent.ACTION_DOWN:
+                    mTrackGesture = false;
+                    if (isInside(x, y)) {
+                        mTrackGesture = true;
+                        return true;
+                    }
+                    break;
+                case MotionEvent.ACTION_MOVE:
+                    if (mTrackGesture) {
+                        if (Math.abs(mDownX - x) > mTouchSlop
+                                || Math.abs(mDownY - y) > mTouchSlop) {
+                            mTrackGesture = false;
+                        }
+                    }
+                    break;
+                case MotionEvent.ACTION_UP:
+                    if (mTrackGesture) {
+                        mExpandClickListener.onClick(NotificationHeaderView.this);
+                    }
+                    break;
+            }
+            return mTrackGesture;
+        }
+
+        private boolean isInside(float x, float y) {
+            for (int i = 0; i < mTouchRects.size(); i++) {
+                Rect r = mTouchRects.get(i);
+                if (r.contains((int) x, (int) y)) {
+                    mDownX = x;
+                    mDownY = y;
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    private View getFirstChildNotGone() {
+        for (int i = 0; i < getChildCount(); i++) {
+            final View child = getChildAt(i);
+            if (child.getVisibility() != GONE) {
+                return child;
+            }
+        }
+        return this;
+    }
+}
diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java
index b61706e..d2a7d4a 100644
--- a/core/java/android/view/PointerIcon.java
+++ b/core/java/android/view/PointerIcon.java
@@ -16,6 +16,8 @@
 
 package android.view;
 
+import android.os.UserHandle;
+import android.provider.Settings;
 import com.android.internal.util.XmlUtils;
 
 import android.annotation.XmlRes;
@@ -199,9 +201,14 @@
             styleIndex = getSystemIconStyleIndex(STYLE_DEFAULT);
         }
 
+        int accessibilityConfig = Settings.Secure.getIntForUser(
+                    context.getContentResolver(), Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON,
+                    0, UserHandle.USER_CURRENT);
+        int defStyle = (accessibilityConfig == 1) ?
+                com.android.internal.R.style.LargePointer : com.android.internal.R.style.Pointer;
         TypedArray a = context.obtainStyledAttributes(null,
                 com.android.internal.R.styleable.Pointer,
-                com.android.internal.R.attr.pointerStyle, 0);
+                0, defStyle);
         int resourceId = a.getResourceId(styleIndex, -1);
         a.recycle();
 
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 304e9c0..f2a4d7b 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -35,6 +35,7 @@
 
 import com.android.internal.R;
 
+import java.io.File;
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.lang.annotation.Retention;
@@ -59,8 +60,230 @@
  *
  * @hide
  */
-public class ThreadedRenderer extends HardwareRenderer {
-    private static final String LOGTAG = "ThreadedRenderer";
+public final class ThreadedRenderer {
+    private static final String LOG_TAG = "ThreadedRenderer";
+
+    /**
+     * Name of the file that holds the shaders cache.
+     */
+    private static final String CACHE_PATH_SHADERS = "com.android.opengl.shaders_cache";
+
+    /**
+     * System property used to enable or disable dirty regions invalidation.
+     * This property is only queried if {@link #RENDER_DIRTY_REGIONS} is true.
+     * The default value of this property is assumed to be true.
+     *
+     * Possible values:
+     * "true", to enable partial invalidates
+     * "false", to disable partial invalidates
+     */
+    static final String RENDER_DIRTY_REGIONS_PROPERTY = "debug.hwui.render_dirty_regions";
+
+    /**
+     * System property used to enable or disable hardware rendering profiling.
+     * The default value of this property is assumed to be false.
+     *
+     * When profiling is enabled, the adb shell dumpsys gfxinfo command will
+     * output extra information about the time taken to execute by the last
+     * frames.
+     *
+     * Possible values:
+     * "true", to enable profiling
+     * "visual_bars", to enable profiling and visualize the results on screen
+     * "false", to disable profiling
+     *
+     * @see #PROFILE_PROPERTY_VISUALIZE_BARS
+     *
+     * @hide
+     */
+    public static final String PROFILE_PROPERTY = "debug.hwui.profile";
+
+    /**
+     * Value for {@link #PROFILE_PROPERTY}. When the property is set to this
+     * value, profiling data will be visualized on screen as a bar chart.
+     *
+     * @hide
+     */
+    public static final String PROFILE_PROPERTY_VISUALIZE_BARS = "visual_bars";
+
+    /**
+     * System property used to specify the number of frames to be used
+     * when doing hardware rendering profiling.
+     * The default value of this property is #PROFILE_MAX_FRAMES.
+     *
+     * When profiling is enabled, the adb shell dumpsys gfxinfo command will
+     * output extra information about the time taken to execute by the last
+     * frames.
+     *
+     * Possible values:
+     * "60", to set the limit of frames to 60
+     */
+    static final String PROFILE_MAXFRAMES_PROPERTY = "debug.hwui.profile.maxframes";
+
+    /**
+     * System property used to debug EGL configuration choice.
+     *
+     * Possible values:
+     * "choice", print the chosen configuration only
+     * "all", print all possible configurations
+     */
+    static final String PRINT_CONFIG_PROPERTY = "debug.hwui.print_config";
+
+    /**
+     * Turn on to draw dirty regions every other frame.
+     *
+     * Possible values:
+     * "true", to enable dirty regions debugging
+     * "false", to disable dirty regions debugging
+     *
+     * @hide
+     */
+    public static final String DEBUG_DIRTY_REGIONS_PROPERTY = "debug.hwui.show_dirty_regions";
+
+    /**
+     * Turn on to flash hardware layers when they update.
+     *
+     * Possible values:
+     * "true", to enable hardware layers updates debugging
+     * "false", to disable hardware layers updates debugging
+     *
+     * @hide
+     */
+    public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY =
+            "debug.hwui.show_layers_updates";
+
+    /**
+     * Controls overdraw debugging.
+     *
+     * Possible values:
+     * "false", to disable overdraw debugging
+     * "show", to show overdraw areas on screen
+     * "count", to display an overdraw counter
+     *
+     * @hide
+     */
+    public static final String DEBUG_OVERDRAW_PROPERTY = "debug.hwui.overdraw";
+
+    /**
+     * Value for {@link #DEBUG_OVERDRAW_PROPERTY}. When the property is set to this
+     * value, overdraw will be shown on screen by coloring pixels.
+     *
+     * @hide
+     */
+    public static final String OVERDRAW_PROPERTY_SHOW = "show";
+
+    /**
+     * Turn on to debug non-rectangular clip operations.
+     *
+     * Possible values:
+     * "hide", to disable this debug mode
+     * "highlight", highlight drawing commands tested against a non-rectangular clip
+     * "stencil", renders the clip region on screen when set
+     *
+     * @hide
+     */
+    public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY =
+            "debug.hwui.show_non_rect_clip";
+
+    /**
+     * A process can set this flag to false to prevent the use of hardware
+     * rendering.
+     *
+     * @hide
+     */
+    public static boolean sRendererDisabled = false;
+
+    /**
+     * Further hardware renderer disabling for the system process.
+     *
+     * @hide
+     */
+    public static boolean sSystemRendererDisabled = false;
+
+    /**
+     * Invoke this method to disable hardware rendering in the current process.
+     *
+     * @hide
+     */
+    public static void disable(boolean system) {
+        sRendererDisabled = true;
+        if (system) {
+            sSystemRendererDisabled = true;
+        }
+    }
+
+    public static boolean sTrimForeground = false;
+
+    /**
+     * Controls whether or not the hardware renderer should aggressively
+     * trim memory. Note that this must not be set for any process that
+     * uses WebView! This should be only used by system_process or similar
+     * that do not go into the background.
+     */
+    public static void enableForegroundTrimming() {
+        sTrimForeground = true;
+    }
+
+    /**
+     * Indicates whether hardware acceleration is available under any form for
+     * the view hierarchy.
+     *
+     * @return True if the view hierarchy can potentially be hardware accelerated,
+     *         false otherwise
+     */
+    public static boolean isAvailable() {
+        return DisplayListCanvas.isAvailable();
+    }
+
+    /**
+     * Sets the directory to use as a persistent storage for hardware rendering
+     * resources.
+     *
+     * @param cacheDir A directory the current process can write to
+     *
+     * @hide
+     */
+    public static void setupDiskCache(File cacheDir) {
+        ThreadedRenderer.setupShadersDiskCache(new File(cacheDir, CACHE_PATH_SHADERS).getAbsolutePath());
+    }
+
+    /**
+     * Creates a hardware renderer using OpenGL.
+     *
+     * @param translucent True if the surface is translucent, false otherwise
+     *
+     * @return A hardware renderer backed by OpenGL.
+     */
+    public static ThreadedRenderer create(Context context, boolean translucent) {
+        ThreadedRenderer renderer = null;
+        if (DisplayListCanvas.isAvailable()) {
+            renderer = new ThreadedRenderer(context, translucent);
+        }
+        return renderer;
+    }
+
+    /**
+     * Invoke this method when the system is running out of memory. This
+     * method will attempt to recover as much memory as possible, based on
+     * the specified hint.
+     *
+     * @param level Hint about the amount of memory that should be trimmed,
+     *              see {@link android.content.ComponentCallbacks}
+     */
+    public static void trimMemory(int level) {
+        nTrimMemory(level);
+    }
+
+    public static void overrideProperty(@NonNull String name, @NonNull String value) {
+        if (name == null || value == null) {
+            throw new IllegalArgumentException("name and value must be non-null");
+        }
+        nOverrideProperty(name, value);
+    }
+
+    public static void dumpProfileData(byte[] data, FileDescriptor fd) {
+        nDumpProfileData(data, fd);
+    }
 
     // Keep in sync with DrawFrameTask.h SYNC_* flags
     // Nothing interesting to report
@@ -113,6 +336,9 @@
     private final Rect mCurrentContentBounds = new Rect();
     private final Rect mStagedContentBounds = new Rect();
 
+    private boolean mEnabled;
+    private boolean mRequested = true;
+
     ThreadedRenderer(Context context, boolean translucent) {
         final TypedArray a = context.obtainStyledAttributes(null, R.styleable.Lighting, 0, 0);
         mLightY = a.getDimension(R.styleable.Lighting_lightY, 0);
@@ -133,13 +359,53 @@
         loadSystemProperties();
     }
 
-    @Override
+    /**
+     * Destroys the hardware rendering context.
+     */
     void destroy() {
         mInitialized = false;
         updateEnabledState(null);
         nDestroy(mNativeProxy);
     }
 
+    /**
+     * Indicates whether hardware acceleration is currently enabled.
+     *
+     * @return True if hardware acceleration is in use, false otherwise.
+     */
+    boolean isEnabled() {
+        return mEnabled;
+    }
+
+    /**
+     * Indicates whether hardware acceleration is currently enabled.
+     *
+     * @param enabled True if the hardware renderer is in use, false otherwise.
+     */
+    void setEnabled(boolean enabled) {
+        mEnabled = enabled;
+    }
+
+    /**
+     * Indicates whether hardware acceleration is currently request but not
+     * necessarily enabled yet.
+     *
+     * @return True if requested, false otherwise.
+     */
+    boolean isRequested() {
+        return mRequested;
+    }
+
+    /**
+     * Indicates whether hardware acceleration is currently requested but not
+     * necessarily enabled yet.
+     *
+     * @return True to request hardware acceleration, false otherwise.
+     */
+    void setRequested(boolean requested) {
+        mRequested = requested;
+    }
+
     private void updateEnabledState(Surface surface) {
         if (surface == null || !surface.isValid()) {
             setEnabled(false);
@@ -148,7 +414,13 @@
         }
     }
 
-    @Override
+    /**
+     * Initializes the hardware renderer for the specified surface.
+     *
+     * @param surface The surface to hardware accelerate
+     *
+     * @return True if the initialization was successful, false otherwise.
+     */
     boolean initialize(Surface surface) throws OutOfResourcesException {
         mInitialized = true;
         updateEnabledState(surface);
@@ -156,18 +428,61 @@
         return status;
     }
 
-    @Override
+    /**
+     * Initializes the hardware renderer for the specified surface and setup the
+     * renderer for drawing, if needed. This is invoked when the ViewAncestor has
+     * potentially lost the hardware renderer. The hardware renderer should be
+     * reinitialized and setup when the render {@link #isRequested()} and
+     * {@link #isEnabled()}.
+     *
+     * @param width The width of the drawing surface.
+     * @param height The height of the drawing surface.
+     * @param attachInfo Information about the window.
+     * @param surface The surface to hardware accelerate
+     * @param surfaceInsets The drawing surface insets to apply
+     *
+     * @return true if the surface was initialized, false otherwise. Returning
+     *         false might mean that the surface was already initialized.
+     */
+    boolean initializeIfNeeded(int width, int height, View.AttachInfo attachInfo,
+            Surface surface, Rect surfaceInsets) throws OutOfResourcesException {
+        if (isRequested()) {
+            // We lost the gl context, so recreate it.
+            if (!isEnabled()) {
+                if (initialize(surface)) {
+                    setup(width, height, attachInfo, surfaceInsets);
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Updates the hardware renderer for the specified surface.
+     *
+     * @param surface The surface to hardware accelerate
+     */
     void updateSurface(Surface surface) throws OutOfResourcesException {
         updateEnabledState(surface);
         nUpdateSurface(mNativeProxy, surface);
     }
 
-    @Override
+    /**
+     * Stops any rendering into the surface. Use this if it is unclear whether
+     * or not the surface used by the HardwareRenderer will be changing. It
+     * Suspends any rendering into the surface, but will not do any destruction
+     */
     boolean pauseSurface(Surface surface) {
         return nPauseSurface(mNativeProxy, surface);
     }
 
-    @Override
+    /**
+     * Destroys all hardware rendering resources associated with the specified
+     * view hierarchy.
+     *
+     * @param view The root of the view hierarchy
+     */
     void destroyHardwareResources(View view) {
         destroyResources(view);
         nDestroyHardwareResources(mNativeProxy);
@@ -186,17 +501,32 @@
         }
     }
 
-    @Override
+    /**
+     * This method should be invoked whenever the current hardware renderer
+     * context should be reset.
+     *
+     * @param surface The surface to hardware accelerate
+     */
     void invalidate(Surface surface) {
         updateSurface(surface);
     }
 
-    @Override
+    /**
+     * Detaches the layer's surface texture from the GL context and releases
+     * the texture id
+     */
     void detachSurfaceTexture(long hardwareLayer) {
         nDetachSurfaceTexture(mNativeProxy, hardwareLayer);
     }
 
-    @Override
+    /**
+     * Sets up the renderer for drawing.
+     *
+     * @param width The width of the drawing surface.
+     * @param height The height of the drawing surface.
+     * @param attachInfo Information about the window.
+     * @param surfaceInsets The drawing surface insets to apply
+     */
     void setup(int width, int height, AttachInfo attachInfo, Rect surfaceInsets) {
         mWidth = width;
         mHeight = height;
@@ -226,7 +556,11 @@
         setLightCenter(attachInfo);
     }
 
-    @Override
+    /**
+     * Updates the light position based on the position of the window.
+     *
+     * @param attachInfo Information about the window.
+     */
     void setLightCenter(AttachInfo attachInfo) {
         // Adjust light position for window offsets.
         final Point displaySize = attachInfo.mPoint;
@@ -237,22 +571,36 @@
         nSetLightCenter(mNativeProxy, lightX, lightY, mLightZ);
     }
 
-    @Override
+    /**
+     * Change the HardwareRenderer's opacity
+     */
     void setOpaque(boolean opaque) {
         nSetOpaque(mNativeProxy, opaque && !mHasInsets);
     }
 
-    @Override
+    /**
+     * Gets the current width of the surface. This is the width that the surface
+     * was last set to in a call to {@link #setup(int, int, View.AttachInfo, Rect)}.
+     *
+     * @return the current width of the surface
+     */
     int getWidth() {
         return mWidth;
     }
 
-    @Override
+    /**
+     * Gets the current height of the surface. This is the height that the surface
+     * was last set to in a call to {@link #setup(int, int, View.AttachInfo, Rect)}.
+     *
+     * @return the current width of the surface
+     */
     int getHeight() {
         return mHeight;
     }
 
-    @Override
+    /**
+     * Outputs extra debugging information in the specified file descriptor.
+     */
     void dumpGfxInfo(PrintWriter pw, FileDescriptor fd, String[] args) {
         pw.flush();
         int flags = 0;
@@ -269,7 +617,13 @@
         nDumpProfileInfo(mNativeProxy, fd, flags);
     }
 
-    @Override
+    /**
+     * Loads system properties used by the renderer. This method is invoked
+     * whenever system properties are modified. Implementations can use this
+     * to trigger live updates of the renderer based on properties.
+     *
+     * @return True if a property has changed.
+     */
     boolean loadSystemProperties() {
         boolean changed = nLoadSystemProperties(mNativeProxy);
         if (changed) {
@@ -353,12 +707,44 @@
         mStagedContentBounds.set(left, top, right, bottom);
     }
 
-    @Override
+    /**
+     * Interface used to receive callbacks whenever a view is drawn by
+     * a hardware renderer instance.
+     */
+    interface HardwareDrawCallbacks {
+        /**
+         * Invoked before a view is drawn by a hardware renderer.
+         * This method can be used to apply transformations to the
+         * canvas but no drawing command should be issued.
+         *
+         * @param canvas The Canvas used to render the view.
+         */
+        void onHardwarePreDraw(DisplayListCanvas canvas);
+
+        /**
+         * Invoked after a view is drawn by a hardware renderer.
+         * It is safe to invoke drawing commands from this method.
+         *
+         * @param canvas The Canvas used to render the view.
+         */
+        void onHardwarePostDraw(DisplayListCanvas canvas);
+    }
+
+    /**
+     *  Indicates that the content drawn by HardwareDrawCallbacks needs to
+     *  be updated, which will be done by the next call to draw()
+     */
     void invalidateRoot() {
         mRootNodeNeedsUpdate = true;
     }
 
-    @Override
+    /**
+     * Draws the specified view.
+     *
+     * @param view The view to draw.
+     * @param attachInfo AttachInfo tied to the specified view.
+     * @param callbacks Callbacks invoked when drawing happens.
+     */
     void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks) {
         attachInfo.mIgnoreDirtyState = true;
 
@@ -409,54 +795,80 @@
         nInvokeFunctor(functor, waitForCompletion);
     }
 
-    @Override
+    /**
+     * Creates a new hardware layer. A hardware layer built by calling this
+     * method will be treated as a texture layer, instead of as a render target.
+     *
+     * @return A hardware layer
+     */
     HardwareLayer createTextureLayer() {
         long layer = nCreateTextureLayer(mNativeProxy);
         return HardwareLayer.adoptTextureLayer(this, layer);
     }
 
-    @Override
+
     void buildLayer(RenderNode node) {
         nBuildLayer(mNativeProxy, node.getNativeDisplayList());
     }
 
-    @Override
+
     boolean copyLayerInto(final HardwareLayer layer, final Bitmap bitmap) {
         return nCopyLayerInto(mNativeProxy,
                 layer.getDeferredLayerUpdater(), bitmap);
     }
 
-    @Override
+    /**
+     * Indicates that the specified hardware layer needs to be updated
+     * as soon as possible.
+     *
+     * @param layer The hardware layer that needs an update
+     */
     void pushLayerUpdate(HardwareLayer layer) {
         nPushLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
     }
 
-    @Override
+    /**
+     * Tells the HardwareRenderer that the layer is destroyed. The renderer
+     * should remove the layer from any update queues.
+     */
     void onLayerDestroyed(HardwareLayer layer) {
         nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
     }
 
-    @Override
+    /**
+     * Optional, sets the name of the renderer. Useful for debugging purposes.
+     *
+     * @param name The name of this renderer, can be null
+     */
     void setName(String name) {
         nSetName(mNativeProxy, name);
     }
 
-    @Override
+    /**
+     * Blocks until all previously queued work has completed.
+     */
     void fence() {
         nFence(mNativeProxy);
     }
 
-    @Override
+    /**
+     * Prevents any further drawing until draw() is called. This is a signal
+     * that the contents of the RenderNode tree are no longer safe to play back.
+     * In practice this usually means that there are Functor pointers in the
+     * display list that are no longer valid.
+     */
     void stopDrawing() {
         nStopDrawing(mNativeProxy);
     }
 
-    @Override
+    /**
+     * Called by {@link ViewRootImpl} when a new performTraverals is scheduled.
+     */
     public void notifyFramePending() {
         nNotifyFramePending(mNativeProxy);
     }
 
-    @Override
+
     void registerAnimatingRenderNode(RenderNode animator) {
         nRegisterAnimatingRenderNode(mRootNode.mNativeRenderNode, animator.mNativeRenderNode);
     }
@@ -475,21 +887,6 @@
         }
     }
 
-    static void trimMemory(int level) {
-        nTrimMemory(level);
-    }
-
-    public static void overrideProperty(@NonNull String name, @NonNull String value) {
-        if (name == null || value == null) {
-            throw new IllegalArgumentException("name and value must be non-null");
-        }
-        nOverrideProperty(name, value);
-    }
-
-    public static void dumpProfileData(byte[] data, FileDescriptor fd) {
-        nDumpProfileData(data, fd);
-    }
-
     private static class ProcessInitializer {
         static ProcessInitializer sInstance = new ProcessInitializer();
         private static IBinder sProcToken;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index ab1943c..fc347ea 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -580,7 +580,7 @@
  * <p>
  * Tags may be specified with character sequence values in layout XML as either
  * a single tag using the {@link android.R.styleable#View_tag android:tag}
- * attribute or multiple tags using the {@code &lt;tag&gt;} child element:
+ * attribute or multiple tags using the {@code <tag>} child element:
  * <pre>
  *     &ltView ...
  *           android:tag="@string/mytag_value" /&gt;
@@ -3057,14 +3057,29 @@
     /**
      * @hide
      *
-     * Makes system ui transparent.
+     * Makes navigation bar transparent (but not the status bar).
      */
-    public static final int SYSTEM_UI_TRANSPARENT = 0x00008000;
+    public static final int NAVIGATION_BAR_TRANSPARENT = 0x00008000;
+
+    /**
+     * @hide
+     *
+     * Makes status bar transparent (but not the navigation bar).
+     */
+    public static final int STATUS_BAR_TRANSPARENT = 0x0000008;
+
+    /**
+     * @hide
+     *
+     * Makes both status bar and navigation bar transparent.
+     */
+    public static final int SYSTEM_UI_TRANSPARENT = NAVIGATION_BAR_TRANSPARENT
+            | STATUS_BAR_TRANSPARENT;
 
     /**
      * @hide
      */
-    public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x00003FFF;
+    public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x00003FF7;
 
     /**
      * These are the system UI flags that can be cleared by events outside
@@ -5505,20 +5520,26 @@
     }
 
     /**
-     * Bring up the context menu for this view.
+     * Shows the context menu for this view.
      *
-     * @return Whether a context menu was displayed.
+     * @return {@code true} if the context menu was shown, {@code false}
+     *         otherwise
+     * @see #showContextMenu(float, float)
      */
     public boolean showContextMenu() {
         return getParent().showContextMenuForChild(this);
     }
 
     /**
-     * Bring up the context menu for this view, referring to the item under the specified point.
+     * Shows the context menu for this view anchored to the specified
+     * view-relative coordinate.
      *
-     * @param x The referenced x coordinate.
-     * @param y The referenced y coordinate.
-     * @return Whether a context menu was displayed.
+     * @param x the X coordinate in pixels relative to the view to which the
+     *          menu should be anchored
+     * @param y the Y coordinate in pixels relative to the view to which the
+     *          menu should be anchored
+     * @return {@code true} if the context menu was shown, {@code false}
+     *         otherwise
      */
     public boolean showContextMenu(float x, float y) {
         return getParent().showContextMenuForChild(this, x, y);
@@ -13270,7 +13291,7 @@
     /**
      * @hide
      */
-    public HardwareRenderer getHardwareRenderer() {
+    public ThreadedRenderer getHardwareRenderer() {
         return mAttachInfo != null ? mAttachInfo.mHardwareRenderer : null;
     }
 
@@ -17436,7 +17457,7 @@
         if (hasWindowFocus()) viewStateIndex |= StateSet.VIEW_STATE_WINDOW_FOCUSED;
         if ((privateFlags & PFLAG_ACTIVATED) != 0) viewStateIndex |= StateSet.VIEW_STATE_ACTIVATED;
         if (mAttachInfo != null && mAttachInfo.mHardwareAccelerationRequested &&
-                HardwareRenderer.isAvailable()) {
+                ThreadedRenderer.isAvailable()) {
             // This is set if HW acceleration is requested, even if the current
             // process doesn't allow it.  This is just to allow app preview
             // windows to better match their app.
@@ -19429,6 +19450,7 @@
      *
      * @attr ref android.R.styleable#View_minHeight
      */
+    @RemotableViewMethod
     public void setMinimumHeight(int minHeight) {
         mMinHeight = minHeight;
         requestLayout();
@@ -22053,7 +22075,7 @@
 
         boolean mHardwareAccelerated;
         boolean mHardwareAccelerationRequested;
-        HardwareRenderer mHardwareRenderer;
+        ThreadedRenderer mHardwareRenderer;
         List<RenderNode> mPendingAnimatingRenderNodes;
 
         /**
@@ -22369,7 +22391,13 @@
          * Used to track views that need (at least) a partial relayout at their current size
          * during the next traversal.
          */
-        final List<View> mPartialLayoutViews = new ArrayList<View>();
+        List<View> mPartialLayoutViews = new ArrayList<>();
+
+        /**
+         * Swapped with mPartialLayoutViews during layout to avoid concurrent
+         * modification. Lazily assigned during ViewRootImpl layout.
+         */
+        List<View> mEmptyPartialLayoutViews;
 
         /**
          * Used to track the identity of the current drag operation.
diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java
index 6ae448a..f2ab35e 100644
--- a/core/java/android/view/ViewParent.java
+++ b/core/java/android/view/ViewParent.java
@@ -174,26 +174,38 @@
     public void focusableViewAvailable(View v);
 
     /**
-     * Bring up a context menu for the specified view or its ancestors.
-     *
-     * <p>In most cases, a subclass does not need to override this.  However, if
+     * Shows the context menu for the specified view or its ancestors.
+     * <p>
+     * In most cases, a subclass does not need to override this. However, if
      * the subclass is added directly to the window manager (for example,
      * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
-     * then it should override this and show the context menu.</p>
-     * 
-     * @param originalView The source view where the context menu was first invoked
-     * @return true if a context menu was displayed
+     * then it should override this and show the context menu.
+     *
+     * @param originalView the source view where the context menu was first
+     *                     invoked
+     * @return {@code true} if the context menu was shown, {@code false}
+     *         otherwise
+     * @see #showContextMenuForChild(View, float, float)
      */
     public boolean showContextMenuForChild(View originalView);
 
     /**
-     * Bring up a context menu for the specified view at the given x/y offset from
-     * the top left corner.
+     * Shows the context menu for the specified view or its ancestors anchored
+     * to the specified view-relative coordinate.
+     * <p>
+     * In most cases, a subclass does not need to override this. However, if
+     * the subclass is added directly to the window manager (for example,
+     * {@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
+     * then it should override this and show the context menu.
      *
-     * @param originalView
-     * @param x The x offset at which to open the menu
-     * @param y The y offset at which to open the menu
-     * @return true if a context menu was displayed
+     * @param originalView the source view where the context menu was first
+     *                     invoked
+     * @param x the X coordinate in pixels relative to the original view to
+     *          which the menu should be anchored
+     * @param y the Y coordinate in pixels relative to the original view to
+     *          which the menu should be anchored
+     * @return {@code true} if the context menu was shown, {@code false}
+     *         otherwise
      */
     public boolean showContextMenuForChild(View originalView, float x, float y);
 
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b503e12..b7bb9a3 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -102,7 +102,7 @@
  */
 @SuppressWarnings({"EmptyCatchBlock", "PointlessBooleanExpression"})
 public final class ViewRootImpl implements ViewParent,
-        View.AttachInfo.Callbacks, HardwareRenderer.HardwareDrawCallbacks {
+        View.AttachInfo.Callbacks, ThreadedRenderer.HardwareDrawCallbacks {
     private static final String TAG = "ViewRootImpl";
     private static final boolean DBG = false;
     private static final boolean LOCAL_LOGV = false;
@@ -761,7 +761,7 @@
                 (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
 
         if (hardwareAccelerated) {
-            if (!HardwareRenderer.isAvailable()) {
+            if (!ThreadedRenderer.isAvailable()) {
                 return;
             }
 
@@ -784,8 +784,8 @@
                 // shows for launching applications, so they will look more like
                 // the app being launched.
                 mAttachInfo.mHardwareAccelerationRequested = true;
-            } else if (!HardwareRenderer.sRendererDisabled
-                    || (HardwareRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
+            } else if (!ThreadedRenderer.sRendererDisabled
+                    || (ThreadedRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
                 if (mAttachInfo.mHardwareRenderer != null) {
                     mAttachInfo.mHardwareRenderer.destroy();
                 }
@@ -794,7 +794,7 @@
                 final boolean hasSurfaceInsets = insets.left != 0 || insets.right != 0
                         || insets.top != 0 || insets.bottom != 0;
                 final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets;
-                mAttachInfo.mHardwareRenderer = HardwareRenderer.create(mContext, translucent);
+                mAttachInfo.mHardwareRenderer = ThreadedRenderer.create(mContext, translucent);
                 if (mAttachInfo.mHardwareRenderer != null) {
                     mAttachInfo.mHardwareRenderer.setName(attrs.getTitle().toString());
                     mAttachInfo.mHardwareAccelerated =
@@ -1865,7 +1865,7 @@
                 }
             }
 
-            final HardwareRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
+            final ThreadedRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
             if (hardwareRenderer != null && hardwareRenderer.isEnabled()) {
                 if (hwInitialized
                         || mWidth != hardwareRenderer.getWidth()
@@ -1974,6 +1974,15 @@
         final List<View> partialLayoutViews = mAttachInfo.mPartialLayoutViews;
         final boolean didPartialLayout;
         if (!partialLayoutViews.isEmpty()) {
+            // Measurement or layout of views may result in changes to the list
+            // of partial-layout views. Swap in an "empty" list to prevent
+            // concurrent modification of the list being traversed.
+            if (mAttachInfo.mEmptyPartialLayoutViews == null) {
+                mAttachInfo.mPartialLayoutViews = new ArrayList<>();
+            } else {
+                mAttachInfo.mPartialLayoutViews = mAttachInfo.mEmptyPartialLayoutViews;
+            }
+
             final int count = partialLayoutViews.size();
             mInLayout = true;
             for (int i = 0; i < count; i++) {
@@ -1992,9 +2001,12 @@
                 }
             }
             mInLayout = false;
-            partialLayoutViews.clear();
             didPartialLayout = true;
             triggerGlobalLayoutListener = true;
+
+            // The traversal list becomes the new empty list.
+            partialLayoutViews.clear();
+            mAttachInfo.mEmptyPartialLayoutViews = partialLayoutViews;
         } else {
             didPartialLayout = false;
         }
@@ -5721,7 +5733,7 @@
     }
 
     private void destroyHardwareRenderer() {
-        HardwareRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
+        ThreadedRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
 
         if (hardwareRenderer != null) {
             if (mView != null) {
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 1521f2e..d6bc27c 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -238,6 +238,7 @@
             @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
             @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
             @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"),
+            @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"),
         })
         public int type;
 
@@ -584,6 +585,13 @@
         public static final int TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34;
 
         /**
+         * Window type: like {@link #TYPE_APPLICATION_ATTACHED_DIALOG}, but used
+         * by Quick Settings Tiles.
+         * @hide
+         */
+        public static final int TYPE_QS_DIALOG = FIRST_SYSTEM_WINDOW+35;
+
+        /**
          * End of types of system windows.
          */
         public static final int LAST_SYSTEM_WINDOW      = 2999;
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index c08e1b5..8c68e92 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -425,7 +425,7 @@
                 mDyingViews.remove(view);
             }
         }
-        if (HardwareRenderer.sTrimForeground && HardwareRenderer.isAvailable()) {
+        if (ThreadedRenderer.sTrimForeground && ThreadedRenderer.isAvailable()) {
             doTrimForeground();
         }
     }
@@ -452,7 +452,7 @@
     }
 
     public void trimMemory(int level) {
-        if (HardwareRenderer.isAvailable()) {
+        if (ThreadedRenderer.isAvailable()) {
             if (shouldDestroyEglContext(level)) {
                 // Destroy all hardware surfaces and resources associated to
                 // known windows
@@ -465,16 +465,16 @@
                 level = ComponentCallbacks2.TRIM_MEMORY_COMPLETE;
             }
 
-            HardwareRenderer.trimMemory(level);
+            ThreadedRenderer.trimMemory(level);
 
-            if (HardwareRenderer.sTrimForeground) {
+            if (ThreadedRenderer.sTrimForeground) {
                 doTrimForeground();
             }
         }
     }
 
     public static void trimForeground() {
-        if (HardwareRenderer.sTrimForeground && HardwareRenderer.isAvailable()) {
+        if (ThreadedRenderer.sTrimForeground && ThreadedRenderer.isAvailable()) {
             WindowManagerGlobal wm = WindowManagerGlobal.getInstance();
             wm.doTrimForeground();
         }
@@ -494,7 +494,7 @@
             }
         }
         if (!hasVisibleWindows) {
-            HardwareRenderer.trimMemory(
+            ThreadedRenderer.trimMemory(
                     ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
         }
     }
@@ -513,7 +513,7 @@
                     String name = getWindowName(root);
                     pw.printf("\n\t%s (visibility=%d)", name, root.getHostVisibility());
 
-                    HardwareRenderer renderer =
+                    ThreadedRenderer renderer =
                             root.getView().mAttachInfo.mHardwareRenderer;
                     if (renderer != null) {
                         renderer.dumpGfxInfo(pw, fd, args);
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index 6130fd5..3ff9522 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -21,6 +21,7 @@
 import android.os.Parcelable;
 import android.text.InputType;
 import android.text.TextUtils;
+import android.util.LocaleList;
 import android.util.Printer;
 
 /**
@@ -340,6 +341,22 @@
     public Bundle extras;
 
     /**
+     * Additional context information that tells what languages are expected by the user.
+     *
+     * <p><strong>IME authors:</strong> Possible use cases for IME developers would be:</p>
+     * <ul>
+     *     <li>Automatically switching keyboard layout.</li>
+     *     <li>Changing language model for better typing experience.</li>
+     * </ul>
+     *
+     * <p><strong>Editor authors:</strong> Providing this context information can help IMEs to
+     * improve text input experience.  For example, chat applications can remember what language is
+     * used in the last conversation for each chat session, and put the last used language at the
+     * top of {@link #locales}.</p>
+     */
+    public LocaleList locales = LocaleList.getEmptyLocaleList();
+
+    /**
      * Ensure that the data in this EditorInfo is compatible with an application
      * that was developed against the given target API version.  This can
      * impact the following input types:
@@ -393,6 +410,7 @@
                 + " fieldId=" + fieldId
                 + " fieldName=" + fieldName);
         pw.println(prefix + "extras=" + extras);
+        pw.println(prefix + "locales=" + locales);
     }
 
     /**
@@ -416,6 +434,7 @@
         dest.writeInt(fieldId);
         dest.writeString(fieldName);
         dest.writeBundle(extras);
+        locales.writeToParcel(dest, flags);
     }
 
     /**
@@ -439,6 +458,7 @@
                     res.fieldId = source.readInt();
                     res.fieldName = source.readString();
                     res.extras = source.readBundle();
+                    res.locales = LocaleList.CREATOR.createFromParcel(source);
                     return res;
                 }
 
diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java
index 4ac547a..4fc6665 100644
--- a/core/java/android/view/inputmethod/InputMethodInfo.java
+++ b/core/java/android/view/inputmethod/InputMethodInfo.java
@@ -48,7 +48,7 @@
 /**
  * This class is used to specify meta information of an input method.
  *
- * <p>It should be defined in an XML resource file with an {@code &lt;input-method>} element.
+ * <p>It should be defined in an XML resource file with an {@code <input-method>} element.
  * For more information, see the guide to
  * <a href="{@docRoot}guide/topics/text/creating-input-method.html">
  * Creating an Input Method</a>.</p>
diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java
index 4ee155c..fbaf51c 100644
--- a/core/java/android/view/inputmethod/InputMethodSubtype.java
+++ b/core/java/android/view/inputmethod/InputMethodSubtype.java
@@ -41,7 +41,7 @@
  * the specified subtype of the designated IME directly.
  *
  * <p>It should be defined in an XML resource file of the input method with the
- * <code>&lt;subtype&gt;</code> element, which resides within an {@code &lt;input-method>} element.
+ * <code>&lt;subtype&gt;</code> element, which resides within an {@code <input-method>} element.
  * For more information, see the guide to
  * <a href="{@docRoot}guide/topics/text/creating-input-method.html">
  * Creating an Input Method</a>.</p>
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 358f939..7443bce 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -93,7 +93,7 @@
  * </pre>
  * <p>See {@link android.content.Intent} for more information.</p>
  *
- * <p>To provide a WebView in your own Activity, include a {@code &lt;WebView&gt;} in your layout,
+ * <p>To provide a WebView in your own Activity, include a {@code <WebView>} in your layout,
  * or set the entire Activity window as a WebView during {@link
  * android.app.Activity#onCreate(Bundle) onCreate()}:</p>
  * <pre class="prettyprint">
diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java
index 41f1ce7..0032f17 100644
--- a/core/java/android/widget/ActionMenuPresenter.java
+++ b/core/java/android/widget/ActionMenuPresenter.java
@@ -933,7 +933,7 @@
             super(context, menu, anchorView, overflowOnly,
                     com.android.internal.R.attr.actionOverflowMenuStyle);
             setGravity(Gravity.END);
-            setCallback(mPopupPresenterCallback);
+            setPresenterCallback(mPopupPresenterCallback);
         }
 
         @Override
@@ -956,7 +956,7 @@
                 setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
             }
 
-            setCallback(mPopupPresenterCallback);
+            setPresenterCallback(mPopupPresenterCallback);
         }
 
         @Override
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index c3d0993..5146bc6 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -17,6 +17,7 @@
 package android.widget;
 
 import android.R;
+import android.annotation.IntDef;
 import android.annotation.Nullable;
 import android.app.PendingIntent;
 import android.app.PendingIntent.CanceledException;
@@ -106,6 +107,8 @@
 import com.android.internal.util.Preconditions;
 import com.android.internal.widget.EditableInputConnection;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.text.BreakIterator;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -4087,7 +4090,17 @@
         }
     }
 
-    private class SelectionStartHandleView extends HandleView {
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef({HANDLE_TYPE_SELECTION_START, HANDLE_TYPE_SELECTION_END})
+    public @interface HandleType {}
+    public static final int HANDLE_TYPE_SELECTION_START = 0;
+    public static final int HANDLE_TYPE_SELECTION_END = 1;
+
+    private class SelectionHandleView extends HandleView {
+        // Indicates the handle type, selection start (HANDLE_TYPE_SELECTION_START) or selection
+        // end (HANDLE_TYPE_SELECTION_END).
+        @HandleType
+        private final int mHandleType;
         // Indicates whether the cursor is making adjustments within a word.
         private boolean mInWord = false;
         // Difference between touch position and word boundary position.
@@ -4102,16 +4115,21 @@
         // Used to save text view location.
         private final int[] mTextViewLocation = new int[2];
 
-        public SelectionStartHandleView(Drawable drawableLtr, Drawable drawableRtl) {
-            super(drawableLtr, drawableRtl, com.android.internal.R.id.selection_start_handle);
-            ViewConfiguration viewConfiguration = ViewConfiguration.get(
-                    mTextView.getContext());
+        public SelectionHandleView(Drawable drawableLtr, Drawable drawableRtl, int id,
+                @HandleType int handleType) {
+            super(drawableLtr, drawableRtl, id);
+            mHandleType = handleType;
+            ViewConfiguration viewConfiguration = ViewConfiguration.get(mTextView.getContext());
             mTextViewEdgeSlop = viewConfiguration.getScaledTouchSlop() * 4;
         }
 
+        private boolean isStartHandle() {
+            return mHandleType == HANDLE_TYPE_SELECTION_START;
+        }
+
         @Override
         protected int getHotspotX(Drawable drawable, boolean isRtlRun) {
-            if (isRtlRun) {
+            if (isRtlRun == isStartHandle()) {
                 return drawable.getIntrinsicWidth() / 4;
             } else {
                 return (drawable.getIntrinsicWidth() * 3) / 4;
@@ -4120,18 +4138,23 @@
 
         @Override
         protected int getHorizontalGravity(boolean isRtlRun) {
-            return isRtlRun ? Gravity.LEFT : Gravity.RIGHT;
+            return (isRtlRun == isStartHandle()) ? Gravity.LEFT : Gravity.RIGHT;
         }
 
         @Override
         public int getCurrentCursorOffset() {
-            return mTextView.getSelectionStart();
+            return isStartHandle() ? mTextView.getSelectionStart() : mTextView.getSelectionEnd();
         }
 
         @Override
-        public void updateSelection(int offset) {
-            Selection.setSelection((Spannable) mTextView.getText(), offset,
-                    mTextView.getSelectionEnd());
+        protected void updateSelection(int offset) {
+            if (isStartHandle()) {
+                Selection.setSelection((Spannable) mTextView.getText(), offset,
+                        mTextView.getSelectionEnd());
+            } else {
+                Selection.setSelection((Spannable) mTextView.getText(),
+                        mTextView.getSelectionStart(), offset);
+            }
             updateDrawable();
             if (mTextActionMode != null) {
                 mTextActionMode.invalidate();
@@ -4153,35 +4176,36 @@
             }
 
             boolean positionCursor = false;
-            final int selectionEnd = mTextView.getSelectionEnd();
+            final int anotherHandleOffset =
+                    isStartHandle() ? mTextView.getSelectionEnd() : mTextView.getSelectionStart();
             int currLine = getCurrentLineAdjustedForSlop(layout, mPreviousLineTouched, y);
             int initialOffset = mTextView.getOffsetAtCoordinate(currLine, x);
 
-            if (initialOffset >= selectionEnd) {
-                // Handles have crossed, bound it to the last selected line and
+            if (isStartHandle() && initialOffset >= anotherHandleOffset
+                    || !isStartHandle() && initialOffset <= anotherHandleOffset) {
+                // Handles have crossed, bound it to the first selected line and
                 // adjust by word / char as normal.
-                currLine = layout.getLineForOffset(selectionEnd);
+                currLine = layout.getLineForOffset(anotherHandleOffset);
                 initialOffset = mTextView.getOffsetAtCoordinate(currLine, x);
             }
 
             int offset = initialOffset;
-            int end = getWordEnd(offset);
-            int start = getWordStart(offset);
+            final int wordEnd = getWordEnd(offset);
+            final int wordStart = getWordStart(offset);
 
             if (mPrevX == UNSET_X_VALUE) {
                 mPrevX = x;
             }
 
-            final int selectionStart = mTextView.getSelectionStart();
-            final boolean selectionStartRtl = layout.isRtlCharAt(selectionStart);
+            final int currentOffset = getCurrentCursorOffset();
+            final boolean rtlAtCurrentOffset = layout.isRtlCharAt(currentOffset);
             final boolean atRtl = layout.isRtlCharAt(offset);
             final boolean isLvlBoundary = layout.isLevelBoundary(offset);
-            boolean isExpanding;
 
             // We can't determine if the user is expanding or shrinking the selection if they're
             // on a bi-di boundary, so until they've moved past the boundary we'll just place
             // the cursor at the current position.
-            if (isLvlBoundary || (selectionStartRtl && !atRtl) || (!selectionStartRtl && atRtl)) {
+            if (isLvlBoundary || (rtlAtCurrentOffset && !atRtl) || (!rtlAtCurrentOffset && atRtl)) {
                 // We're on a boundary or this is the first direction change -- just update
                 // to the current position.
                 mLanguageDirectionChanged = true;
@@ -4195,24 +4219,30 @@
                 mTouchWordDelta = 0.0f;
                 mLanguageDirectionChanged = false;
                 return;
+            }
+
+            boolean isExpanding;
+            final float xDiff = x - mPrevX;
+            if (atRtl == isStartHandle()) {
+                isExpanding = xDiff > 0 || currLine > mPreviousLineTouched;
             } else {
-                final float xDiff = x - mPrevX;
-                if (atRtl) {
-                    isExpanding = xDiff > 0 || currLine > mPreviousLineTouched;
-                } else {
-                    isExpanding = xDiff < 0 || currLine < mPreviousLineTouched;
-                }
+                isExpanding = xDiff < 0 || currLine < mPreviousLineTouched;
             }
 
             if (mTextView.getHorizontallyScrolling()) {
                 if (positionNearEdgeOfScrollingView(x, atRtl)
-                        && (mTextView.getScrollX() != 0)
-                        && ((isExpanding && offset < selectionStart) || !isExpanding)) {
-                    // If we're expanding ensure that the offset is smaller than the
-                    // selection start, if the handle snapped to the word, the finger position
+                        && ((isStartHandle() && mTextView.getScrollX() != 0)
+                                || (!isStartHandle()
+                                        && mTextView.canScrollHorizontally(atRtl ? -1 : 1)))
+                        && ((isExpanding && ((isStartHandle() && offset < currentOffset)
+                                || (!isStartHandle() && offset > currentOffset)))
+                                        || !isExpanding)) {
+                    // If we're expanding ensure that the offset is actually expanding compared to
+                    // the current offset, if the handle snapped to the word, the finger position
                     // may be out of sync and we don't want the selection to jump back.
                     mTouchWordDelta = 0.0f;
-                    final int nextOffset = atRtl ? layout.getOffsetToRightOf(mPreviousOffset)
+                    final int nextOffset = (atRtl == isStartHandle())
+                            ? layout.getOffsetToRightOf(mPreviousOffset)
                             : layout.getOffsetToLeftOf(mPreviousOffset);
                     positionAndAdjustForCrossingHandles(nextOffset);
                     return;
@@ -4221,24 +4251,36 @@
 
             if (isExpanding) {
                 // User is increasing the selection.
-                if (!mInWord || currLine < mPrevLine) {
+                final boolean snapToWord = !mInWord
+                        || (isStartHandle() ? currLine < mPrevLine : currLine > mPrevLine);
+                if (snapToWord) {
                     // Sometimes words can be broken across lines (Chinese, hyphenation).
-                    // We still snap to the start of the word but we only use the letters on the
+                    // We still snap to the word boundary but we only use the letters on the
                     // current line to determine if the user is far enough into the word to snap.
-                    int wordStartOnCurrLine = start;
-                    if (layout != null && layout.getLineForOffset(start) != currLine) {
-                        wordStartOnCurrLine = layout.getLineStart(currLine);
+                    int wordBoundary = isStartHandle() ? wordStart : wordEnd;
+                    if (layout != null && layout.getLineForOffset(wordBoundary) != currLine) {
+                        wordBoundary = isStartHandle() ?
+                                layout.getLineStart(currLine) : layout.getLineEnd(currLine);
                     }
-                    int offsetThresholdToSnap = end - ((end - wordStartOnCurrLine) / 2);
-                    if (offset <= offsetThresholdToSnap || currLine < mPrevLine) {
-                        // User is far enough into the word or on a different
-                        // line so we expand by word.
-                        offset = start;
+                    final int offsetThresholdToSnap = isStartHandle()
+                            ? wordEnd - ((wordEnd - wordBoundary) / 2)
+                            : wordStart + ((wordBoundary - wordStart) / 2);
+                    if (isStartHandle()
+                            && (offset <= offsetThresholdToSnap || currLine < mPrevLine)) {
+                        // User is far enough into the word or on a different line so we expand by
+                        // word.
+                        offset = wordStart;
+                    } else if (!isStartHandle()
+                            && (offset >= offsetThresholdToSnap || currLine > mPrevLine)) {
+                        // User is far enough into the word or on a different line so we expand by
+                        // word.
+                        offset = wordEnd;
                     } else {
                         offset = mPreviousOffset;
                     }
                 }
-                if (layout != null && offset < initialOffset) {
+                if (layout != null && (isStartHandle() && offset < initialOffset)
+                        || (!isStartHandle() && offset > initialOffset)) {
                     final float adjustedX = layout.getPrimaryHorizontal(offset);
                     mTouchWordDelta =
                             mTextView.convertToLocalHorizontalCoordinate(x) - adjustedX;
@@ -4249,12 +4291,16 @@
             } else {
                 final int adjustedOffset =
                         mTextView.getOffsetAtCoordinate(currLine, x - mTouchWordDelta);
-                if (adjustedOffset > mPreviousOffset || currLine > mPrevLine) {
+                final boolean shrinking = isStartHandle()
+                        ? adjustedOffset > mPreviousOffset || currLine > mPrevLine
+                        : adjustedOffset < mPreviousOffset || currLine < mPrevLine;
+                if (shrinking) {
                     // User is shrinking the selection.
-                    if (currLine > mPrevLine) {
+                    if (currLine != mPrevLine) {
                         // We're on a different line, so we'll snap to word boundaries.
-                        offset = start;
-                        if (layout != null && offset < initialOffset) {
+                        offset = isStartHandle() ? wordStart : wordEnd;
+                        if (layout != null && (isStartHandle() && offset < initialOffset)
+                                || (!isStartHandle() && offset > initialOffset)) {
                             final float adjustedX = layout.getPrimaryHorizontal(offset);
                             mTouchWordDelta =
                                     mTextView.convertToLocalHorizontalCoordinate(x) - adjustedX;
@@ -4265,11 +4311,12 @@
                         offset = adjustedOffset;
                     }
                     positionCursor = true;
-                } else if (adjustedOffset < mPreviousOffset) {
-                    // Handle has jumped to the start of the word, and the user is moving
+                } else if ((isStartHandle() && adjustedOffset < mPreviousOffset)
+                        || (!isStartHandle() && adjustedOffset > mPreviousOffset)) {
+                    // Handle has jumped to the word boundary, and the user is moving
                     // their finger towards the handle, the delta should be updated.
-                    mTouchWordDelta = mTextView.convertToLocalHorizontalCoordinate(x)
-                            - layout.getPrimaryHorizontal(mPreviousOffset);
+                    mTouchWordDelta = mTextView.convertToLocalHorizontalCoordinate(x) -
+                            layout.getPrimaryHorizontal(mPreviousOffset);
                 }
             }
 
@@ -4280,16 +4327,6 @@
             mPrevX = x;
         }
 
-        private void positionAndAdjustForCrossingHandles(int offset) {
-            final int selectionEnd = mTextView.getSelectionEnd();
-            if (offset >= selectionEnd) {
-                // Handles can not cross and selection is at least one character.
-                offset = getNextCursorOffset(selectionEnd, false);
-                mTouchWordDelta = 0.0f;
-            }
-            positionAtCursorOffset(offset, false);
-        }
-
         /**
          * @param offset Cursor offset. Must be in [-1, length].
          * @param parentScrolled If the parent has been scrolled or not.
@@ -4312,256 +4349,28 @@
             return superResult;
         }
 
-        private boolean positionNearEdgeOfScrollingView(float x, boolean atRtl) {
-            mTextView.getLocationOnScreen(mTextViewLocation);
-            boolean nearEdge;
-            if (atRtl) {
-                int rightEdge = mTextViewLocation[0] + mTextView.getWidth()
-                        - mTextView.getPaddingRight();
-                nearEdge = x > rightEdge - mTextViewEdgeSlop;
-            } else {
-                int leftEdge = mTextViewLocation[0] + mTextView.getPaddingLeft();
-                nearEdge = x < leftEdge + mTextViewEdgeSlop;
-            }
-            return nearEdge;
-        }
-    }
-
-    private class SelectionEndHandleView extends HandleView {
-        // Indicates whether the cursor is making adjustments within a word.
-        private boolean mInWord = false;
-        // Difference between touch position and word boundary position.
-        private float mTouchWordDelta;
-        // X value of the previous updatePosition call.
-        private float mPrevX;
-        // Indicates if the handle has moved a boundary between LTR and RTL text.
-        private boolean mLanguageDirectionChanged = false;
-        // Distance from edge of horizontally scrolling text view
-        // to use to switch to character mode.
-        private final float mTextViewEdgeSlop;
-        // Used to save the text view location.
-        private final int[] mTextViewLocation = new int[2];
-
-        public SelectionEndHandleView(Drawable drawableLtr, Drawable drawableRtl) {
-            super(drawableLtr, drawableRtl, com.android.internal.R.id.selection_end_handle);
-            ViewConfiguration viewConfiguration = ViewConfiguration.get(
-                    mTextView.getContext());
-            mTextViewEdgeSlop = viewConfiguration.getScaledTouchSlop() * 4;
-        }
-
-        @Override
-        protected int getHotspotX(Drawable drawable, boolean isRtlRun) {
-            if (isRtlRun) {
-                return (drawable.getIntrinsicWidth() * 3) / 4;
-            } else {
-                return drawable.getIntrinsicWidth() / 4;
-            }
-        }
-
-        @Override
-        protected int getHorizontalGravity(boolean isRtlRun) {
-            return isRtlRun ? Gravity.RIGHT : Gravity.LEFT;
-        }
-
-        @Override
-        public int getCurrentCursorOffset() {
-            return mTextView.getSelectionEnd();
-        }
-
-        @Override
-        public void updateSelection(int offset) {
-            Selection.setSelection((Spannable) mTextView.getText(),
-                    mTextView.getSelectionStart(), offset);
-            if (mTextActionMode != null) {
-                mTextActionMode.invalidate();
-            }
-            updateDrawable();
-        }
-
-        @Override
-        public void updatePosition(float x, float y) {
-            final Layout layout = mTextView.getLayout();
-            if (layout == null) {
-                // HandleView will deal appropriately in positionAtCursorOffset when
-                // layout is null.
-                positionAndAdjustForCrossingHandles(mTextView.getOffsetForPosition(x, y));
-                return;
-            }
-
-            if (mPreviousLineTouched == UNSET_LINE) {
-                mPreviousLineTouched = mTextView.getLineAtCoordinate(y);
-            }
-
-            boolean positionCursor = false;
-            final int selectionStart = mTextView.getSelectionStart();
-            int currLine = getCurrentLineAdjustedForSlop(layout, mPreviousLineTouched, y);
-            int initialOffset = mTextView.getOffsetAtCoordinate(currLine, x);
-
-            if (initialOffset <= selectionStart) {
-                // Handles have crossed, bound it to the first selected line and
-                // adjust by word / char as normal.
-                currLine = layout.getLineForOffset(selectionStart);
-                initialOffset = mTextView.getOffsetAtCoordinate(currLine, x);
-            }
-
-            int offset = initialOffset;
-            int end = getWordEnd(offset);
-            int start = getWordStart(offset);
-
-            if (mPrevX == UNSET_X_VALUE) {
-                mPrevX = x;
-            }
-
-            final int selectionEnd = mTextView.getSelectionEnd();
-            final boolean selectionEndRtl = layout.isRtlCharAt(selectionEnd);
-            final boolean atRtl = layout.isRtlCharAt(offset);
-            final boolean isLvlBoundary = layout.isLevelBoundary(offset);
-            boolean isExpanding;
-
-            // We can't determine if the user is expanding or shrinking the selection if they're
-            // on a bi-di boundary, so until they've moved past the boundary we'll just place
-            // the cursor at the current position.
-            if (isLvlBoundary || (selectionEndRtl && !atRtl) || (!selectionEndRtl && atRtl)) {
-                // We're on a boundary or this is the first direction change -- just update
-                // to the current position.
-                mLanguageDirectionChanged = true;
-                mTouchWordDelta = 0.0f;
-                positionAndAdjustForCrossingHandles(offset);
-                return;
-            } else if (mLanguageDirectionChanged && !isLvlBoundary) {
-                // We've just moved past the boundary so update the position. After this we can
-                // figure out if the user is expanding or shrinking to go by word or character.
-                positionAndAdjustForCrossingHandles(offset);
-                mTouchWordDelta = 0.0f;
-                mLanguageDirectionChanged = false;
-                return;
-            } else {
-                final float xDiff = x - mPrevX;
-                if (atRtl) {
-                    isExpanding = xDiff < 0 || currLine < mPreviousLineTouched;
-                } else {
-                    isExpanding = xDiff > 0 || currLine > mPreviousLineTouched;
-                }
-            }
-
-            if (mTextView.getHorizontallyScrolling()) {
-                if (positionNearEdgeOfScrollingView(x, atRtl)
-                        && mTextView.canScrollHorizontally(atRtl ? -1 : 1)
-                        && ((isExpanding && offset > selectionEnd) || !isExpanding)) {
-                    // If we're expanding ensure that the offset is actually greater than the
-                    // selection end, if the handle snapped to the word, the finger position
-                    // may be out of sync and we don't want the selection to jump back.
-                    mTouchWordDelta = 0.0f;
-                    final int nextOffset = atRtl ? layout.getOffsetToLeftOf(mPreviousOffset)
-                            : layout.getOffsetToRightOf(mPreviousOffset);
-                    positionAndAdjustForCrossingHandles(nextOffset);
-                    return;
-                }
-            }
-
-            if (isExpanding) {
-                // User is increasing the selection.
-                if (!mInWord || currLine > mPrevLine) {
-                    // Sometimes words can be broken across lines (Chinese, hyphenation).
-                    // We still snap to the end of the word but we only use the letters on the
-                    // current line to determine if the user is far enough into the word to snap.
-                    int wordEndOnCurrLine = end;
-                    if (layout != null && layout.getLineForOffset(end) != currLine) {
-                        wordEndOnCurrLine = layout.getLineEnd(currLine);
-                    }
-                    final int offsetThresholdToSnap = start + ((wordEndOnCurrLine - start) / 2);
-                    if (offset >= offsetThresholdToSnap || currLine > mPrevLine) {
-                        // User is far enough into the word or on a different
-                        // line so we expand by word.
-                        offset = end;
-                    } else {
-                        offset = mPreviousOffset;
-                    }
-                }
-                if (offset > initialOffset) {
-                    final float adjustedX = layout.getPrimaryHorizontal(offset);
-                    mTouchWordDelta =
-                            adjustedX - mTextView.convertToLocalHorizontalCoordinate(x);
-                } else {
-                    mTouchWordDelta = 0.0f;
-                }
-                positionCursor = true;
-            } else {
-                final int adjustedOffset =
-                        mTextView.getOffsetAtCoordinate(currLine, x + mTouchWordDelta);
-                if (adjustedOffset < mPreviousOffset || currLine < mPrevLine) {
-                    // User is shrinking the selection.
-                    if (currLine < mPrevLine) {
-                        // We're on a different line, so we'll snap to word boundaries.
-                        offset = end;
-                        if (offset > initialOffset) {
-                            final float adjustedX = layout.getPrimaryHorizontal(offset);
-                            mTouchWordDelta =
-                                    adjustedX - mTextView.convertToLocalHorizontalCoordinate(x);
-                        } else {
-                            mTouchWordDelta = 0.0f;
-                        }
-                    } else {
-                        offset = adjustedOffset;
-                    }
-                    positionCursor = true;
-                } else if (adjustedOffset > mPreviousOffset) {
-                    // Handle has jumped to the end of the word, and the user is moving
-                    // their finger towards the handle, the delta should be updated.
-                    mTouchWordDelta = layout.getPrimaryHorizontal(mPreviousOffset)
-                            - mTextView.convertToLocalHorizontalCoordinate(x);
-                }
-            }
-
-            if (positionCursor) {
-                mPreviousLineTouched = currLine;
-                positionAndAdjustForCrossingHandles(offset);
-            }
-            mPrevX = x;
-        }
-
         private void positionAndAdjustForCrossingHandles(int offset) {
-            final int selectionStart = mTextView.getSelectionStart();
-            if (offset <= selectionStart) {
+            final int anotherHandleOffset =
+                    isStartHandle() ? mTextView.getSelectionEnd() : mTextView.getSelectionStart();
+            if ((isStartHandle() && offset >= anotherHandleOffset)
+                    || (!isStartHandle() && offset <= anotherHandleOffset)) {
                 // Handles can not cross and selection is at least one character.
-                offset = getNextCursorOffset(selectionStart, true);
+                offset = getNextCursorOffset(anotherHandleOffset, !isStartHandle());
                 mTouchWordDelta = 0.0f;
             }
             positionAtCursorOffset(offset, false);
         }
 
-        /**
-         * @param offset Cursor offset. Must be in [-1, length].
-         * @param parentScrolled If the parent has been scrolled or not.
-         */
-        @Override
-        protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
-            super.positionAtCursorOffset(offset, parentScrolled);
-            mInWord = (offset != -1) && !getWordIteratorWithText().isBoundary(offset);
-        }
-
-        @Override
-        public boolean onTouchEvent(MotionEvent event) {
-            boolean superResult = super.onTouchEvent(event);
-            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
-                // Reset the touch word offset and x value when the user
-                // re-engages the handle.
-                mTouchWordDelta = 0.0f;
-                mPrevX = UNSET_X_VALUE;
-            }
-            return superResult;
-        }
-
         private boolean positionNearEdgeOfScrollingView(float x, boolean atRtl) {
             mTextView.getLocationOnScreen(mTextViewLocation);
             boolean nearEdge;
-            if (atRtl) {
-                int leftEdge = mTextViewLocation[0] + mTextView.getPaddingLeft();
-                nearEdge = x < leftEdge + mTextViewEdgeSlop;
-            } else {
+            if (atRtl == isStartHandle()) {
                 int rightEdge = mTextViewLocation[0] + mTextView.getWidth()
                         - mTextView.getPaddingRight();
                 nearEdge = x > rightEdge - mTextViewEdgeSlop;
+            } else {
+                int leftEdge = mTextViewLocation[0] + mTextView.getPaddingLeft();
+                nearEdge = x < leftEdge + mTextViewEdgeSlop;
             }
             return nearEdge;
         }
@@ -4673,8 +4482,8 @@
 
     class SelectionModifierCursorController implements CursorController {
         // The cursor controller handles, lazily created when shown.
-        private SelectionStartHandleView mStartHandle;
-        private SelectionEndHandleView mEndHandle;
+        private SelectionHandleView mStartHandle;
+        private SelectionHandleView mEndHandle;
         // The offsets of that last touch down event. Remembered to start selection there.
         private int mMinTouchOffset, mMaxTouchOffset;
 
@@ -4718,10 +4527,14 @@
         private void initHandles() {
             // Lazy object creation has to be done before updatePosition() is called.
             if (mStartHandle == null) {
-                mStartHandle = new SelectionStartHandleView(mSelectHandleLeft, mSelectHandleRight);
+                mStartHandle = new SelectionHandleView(mSelectHandleLeft, mSelectHandleRight,
+                        com.android.internal.R.id.selection_start_handle,
+                        HANDLE_TYPE_SELECTION_START);
             }
             if (mEndHandle == null) {
-                mEndHandle = new SelectionEndHandleView(mSelectHandleRight, mSelectHandleLeft);
+                mEndHandle = new SelectionHandleView(mSelectHandleRight, mSelectHandleLeft,
+                        com.android.internal.R.id.selection_end_handle,
+                        HANDLE_TYPE_SELECTION_END);
             }
 
             mStartHandle.show();
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 04c68ae..2099b04 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -121,7 +121,7 @@
  *     }
  * }</pre>
  *
- * <p>To add a progress bar to a layout file, you can use the {@code &lt;ProgressBar&gt;} element.
+ * <p>To add a progress bar to a layout file, you can use the {@code <ProgressBar>} element.
  * By default, the progress bar is a spinning wheel (an indeterminate indicator). To change to a
  * horizontal progress bar, apply the {@link android.R.style#Widget_ProgressBar_Horizontal
  * Widget.ProgressBar.Horizontal} style, like so:</p>
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index ce1c108..0dd803a2 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -1638,6 +1638,48 @@
     }
 
     /**
+     * Helper action to set layout margin on a View.
+     */
+    private class ViewMarginEndAction extends Action {
+        public ViewMarginEndAction(int viewId, int end) {
+            this.viewId = viewId;
+            this.end = end;
+        }
+
+        public ViewMarginEndAction(Parcel parcel) {
+            viewId = parcel.readInt();
+            end = parcel.readInt();
+        }
+
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeInt(TAG);
+            dest.writeInt(viewId);
+            dest.writeInt(end);
+        }
+
+        @Override
+        public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
+            final View target = root.findViewById(viewId);
+            if (target == null) {
+                return;
+            }
+            ViewGroup.LayoutParams layoutParams = target.getLayoutParams();
+            if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
+                ((ViewGroup.MarginLayoutParams) layoutParams).setMarginEnd(end);
+                target.setLayoutParams(layoutParams);
+            }
+        }
+
+        public String getActionName() {
+            return "ViewMarginEndAction";
+        }
+
+        int end;
+
+        public final static int TAG = 19;
+    }
+
+    /**
      * Helper action to set a color filter on a compound drawable on a TextView. Supports relative
      * (s/t/e/b) or cardinal (l/t/r/b) arrangement.
      */
@@ -1942,6 +1984,9 @@
                         case SetRemoteInputsAction.TAG:
                             mActions.add(new SetRemoteInputsAction(parcel));
                             break;
+                        case ViewMarginEndAction.TAG:
+                            mActions.add(new ViewMarginEndAction(parcel));
+                            break;
                         default:
                             throw new ActionException("Tag " + tag + " not found");
                     }
@@ -2549,6 +2594,19 @@
     }
 
     /**
+     * @hide
+     * Equivalent to calling {@link android.view.ViewGroup.MarginLayoutParams#setMarginEnd(int)}.
+     * Only works if the {@link View#getLayoutParams()} supports margins.
+     * Hidden for now since we don't want to support this for all different layout margins yet.
+     *
+     * @param viewId The id of the view to change
+     * @param endMargin the left padding in pixels
+     */
+    public void setViewLayoutMarginEnd(int viewId, int endMargin) {
+        addAction(new ViewMarginEndAction(viewId, endMargin));
+    }
+
+    /**
      * Call a method taking one boolean on a view in the layout for this RemoteViews.
      *
      * @param viewId The id of the view on which to call the method.
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 476c6a2..cca84ee 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6439,6 +6439,9 @@
                 outAttrs.initialCapsMode = ic.getCursorCapsMode(getInputType());
                 return ic;
             }
+            // LocaleList is designed to be immutable.  This is theoretically equivalent to copy
+            // the snapshot of the current text locales.
+            outAttrs.locales = getTextLocales();
         }
         return null;
     }
@@ -6828,7 +6831,10 @@
         if (mEditor != null) mEditor.prepareCursorControllers();
     }
 
-    private Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth,
+    /**
+     * @hide
+     */
+    protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth,
             Layout.Alignment alignment, boolean shouldEllipsize, TruncateAt effectiveEllipsize,
             boolean useSaved) {
         Layout result = null;
@@ -7225,6 +7231,7 @@
         // of the intended optimizations as part of requestLayoutForChild.
         nullLayouts();
         requestLayout();
+        invalidate();
     }
 
     @Override
@@ -9707,7 +9714,10 @@
         }
     }
 
-    TextDirectionHeuristic getTextDirectionHeuristic() {
+    /**
+     * @hide
+     */
+    protected TextDirectionHeuristic getTextDirectionHeuristic() {
         if (hasPasswordTransformationMethod()) {
             // passwords fields should be LTR
             return TextDirectionHeuristics.LTR;
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 01ac22e..f0c1094 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -371,17 +371,17 @@
         }
         // TODO: Use {@link Locale#toLanguageTag()} and {@link Locale#forLanguageTag(languageTag)}.
         String[] localeParams = localeStr.split("_", 3);
+        if (localeParams.length >= 1 && "tl".equals(localeParams[0])) {
+             // Convert a locale whose language is "tl" to one whose language is "fil".
+             // For example, "tl_PH" will get converted to "fil_PH".
+             // Versions of Android earlier than Lollipop did not support three letter language
+             // codes, and used "tl" (Tagalog) as the language string for "fil" (Filipino).
+             // On Lollipop and above, the current three letter version must be used.
+             localeParams[0] = "fil";
+        }
         // The length of localeStr is guaranteed to always return a 1 <= value <= 3
         // because localeStr is not empty.
         if (localeParams.length == 1) {
-            if (localeParams.length >= 1 && "tl".equals(localeParams[0])) {
-                // Convert a locale whose language is "tl" to one whose language is "fil".
-                // For example, "tl_PH" will get converted to "fil_PH".
-                // Versions of Android earlier than Lollipop did not support three letter language
-                // codes, and used "tl" (Tagalog) as the language string for "fil" (Filipino).
-                // On Lollipop and above, the current three letter version must be used.
-                localeParams[0] = "fil";
-            }
             return new Locale(localeParams[0]);
         } else if (localeParams.length == 2) {
             return new Locale(localeParams[0], localeParams[1]);
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index c992c70..cc677cc 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -34,6 +34,7 @@
     public static final int ACTION_ZEN_ALLOW_PEEK = 261;
     public static final int ACTION_ZEN_ALLOW_LIGHTS = 262;
     public static final int NOTIFICATION_TOPIC_NOTIFICATION = 263;
+    public static final int ACTION_DEFAULT_SMS_APP_CHANGED = 264;
 
     public static void visible(Context context, int category) throws IllegalArgumentException {
         if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 9391c60..4a969b2 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -105,7 +105,7 @@
     private static final int MAGIC = 0xBA757475; // 'BATSTATS'
 
     // Current on-disk Parcel version
-    private static final int VERSION = 136 + (USE_OLD_HISTORY ? 1000 : 0);
+    private static final int VERSION = 138 + (USE_OLD_HISTORY ? 1000 : 0);
 
     // Maximum number of items we will record in the history.
     private static final int MAX_HISTORY_ITEMS = 2000;
@@ -2621,10 +2621,9 @@
         }
     }
 
-    public void noteProcessStateLocked(String name, int uid, int state) {
+    public void noteUidProcessStateLocked(int uid, int state) {
         uid = mapUid(uid);
-        final long elapsedRealtime = SystemClock.elapsedRealtime();
-        getUidStatsLocked(uid).updateProcessStateLocked(name, state, elapsedRealtime);
+        getUidStatsLocked(uid).updateUidProcessStateLocked(state);
     }
 
     public void noteProcessFinishLocked(String name, int uid) {
@@ -2632,13 +2631,11 @@
         if (!mActiveEvents.updateState(HistoryItem.EVENT_PROC_FINISH, name, uid, 0)) {
             return;
         }
-        final long elapsedRealtime = SystemClock.elapsedRealtime();
-        final long uptime = SystemClock.uptimeMillis();
-        getUidStatsLocked(uid).updateProcessStateLocked(name, Uid.PROCESS_STATE_NONE,
-                elapsedRealtime);
         if (!mRecordAllHistory) {
             return;
         }
+        final long elapsedRealtime = SystemClock.elapsedRealtime();
+        final long uptime = SystemClock.uptimeMillis();
         addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_PROC_FINISH, name, uid);
     }
 
@@ -4446,8 +4443,7 @@
 
         StopwatchTimer mForegroundActivityTimer;
 
-        static final int PROCESS_STATE_NONE = NUM_PROCESS_STATE;
-        int mProcessState = PROCESS_STATE_NONE;
+        int mProcessState = ActivityManager.PROCESS_STATE_NONEXISTENT;
         StopwatchTimer[] mProcessStateTimer;
 
         BatchTimer mVibratorOnTimer;
@@ -4812,21 +4808,6 @@
             }
         }
 
-        void updateUidProcessStateLocked(int state, long elapsedRealtimeMs) {
-            if (mProcessState == state) return;
-
-            if (mProcessState != PROCESS_STATE_NONE) {
-                mProcessStateTimer[mProcessState].stopRunningLocked(elapsedRealtimeMs);
-            }
-            mProcessState = state;
-            if (state != PROCESS_STATE_NONE) {
-                if (mProcessStateTimer[state] == null) {
-                    makeProcessState(state, null);
-                }
-                mProcessStateTimer[state].startRunningLocked(elapsedRealtimeMs);
-            }
-        }
-
         public BatchTimer createVibratorOnTimerLocked() {
             if (mVibratorOnTimer == null) {
                 mVibratorOnTimer = new BatchTimer(Uid.this, VIBRATOR_ON, mOnBatteryTimeBase);
@@ -5167,7 +5148,7 @@
                         active |= !mProcessStateTimer[i].reset(false);
                     }
                 }
-                active |= (mProcessState != PROCESS_STATE_NONE);
+                active |= (mProcessState != ActivityManager.PROCESS_STATE_NONEXISTENT);
             }
             if (mVibratorOnTimer != null) {
                 if (mVibratorOnTimer.reset(false)) {
@@ -5261,14 +5242,9 @@
             }
             for (int ip=mProcessStats.size()-1; ip>=0; ip--) {
                 Proc proc = mProcessStats.valueAt(ip);
-                if (proc.mProcessState == PROCESS_STATE_NONE) {
-                    proc.detach();
-                    mProcessStats.removeAt(ip);
-                } else {
-                    proc.reset();
-                    active = true;
-                }
+                proc.detach();
             }
+            mProcessStats.clear();
             if (mPids.size() > 0) {
                 for (int i=mPids.size()-1; i>=0; i--) {
                     Pid pid = mPids.valueAt(i);
@@ -5697,7 +5673,7 @@
             } else {
                 mForegroundActivityTimer = null;
             }
-            mProcessState = PROCESS_STATE_NONE;
+            mProcessState = ActivityManager.PROCESS_STATE_NONEXISTENT;
             for (int i = 0; i < NUM_PROCESS_STATE; i++) {
                 if (in.readInt() != 0) {
                     makeProcessState(i, in);
@@ -6080,11 +6056,6 @@
              */
             int mUnpluggedNumAnrs;
 
-            /**
-             * Current process state.
-             */
-            int mProcessState = PROCESS_STATE_NONE;
-
             ArrayList<ExcessivePower> mExcessivePower;
 
             Proc(String name) {
@@ -6104,16 +6075,6 @@
             public void onTimeStopped(long elapsedRealtime, long baseUptime, long baseRealtime) {
             }
 
-            void reset() {
-                mUserTime = mSystemTime = mForegroundTime = 0;
-                mStarts = mNumCrashes = mNumAnrs = 0;
-                mLoadedUserTime = mLoadedSystemTime = mLoadedForegroundTime = 0;
-                mLoadedStarts = mLoadedNumCrashes = mLoadedNumAnrs = 0;
-                mUnpluggedUserTime = mUnpluggedSystemTime = mUnpluggedForegroundTime = 0;
-                mUnpluggedStarts = mUnpluggedNumCrashes = mUnpluggedNumAnrs = 0;
-                mExcessivePower = null;
-            }
-
             void detach() {
                 mActive = false;
                 mOnBatteryTimeBase.remove(this);
@@ -6668,46 +6629,39 @@
             return ps;
         }
 
-        public void updateProcessStateLocked(String procName, int state, long elapsedRealtimeMs) {
-            int procState;
-            if (state <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
-                procState = PROCESS_STATE_FOREGROUND;
-            } else if (state <= ActivityManager.PROCESS_STATE_RECEIVER) {
-                procState = PROCESS_STATE_ACTIVE;
+        public void updateUidProcessStateLocked(int procState) {
+            int uidRunningState;
+            if (procState == ActivityManager.PROCESS_STATE_NONEXISTENT) {
+                uidRunningState = ActivityManager.PROCESS_STATE_NONEXISTENT;
+            } else if (procState == ActivityManager.PROCESS_STATE_TOP) {
+                uidRunningState = PROCESS_STATE_TOP;
+            } else if (procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE) {
+                // Persistent and other foreground states go here.
+                uidRunningState = PROCESS_STATE_FOREGROUND_SERVICE;
+            } else if (procState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) {
+                uidRunningState = PROCESS_STATE_TOP_SLEEPING;
+            } else if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
+                // Persistent and other foreground states go here.
+                uidRunningState = PROCESS_STATE_FOREGROUND;
+            } else if (procState <= ActivityManager.PROCESS_STATE_RECEIVER) {
+                uidRunningState = PROCESS_STATE_BACKGROUND;
             } else {
-                procState = PROCESS_STATE_RUNNING;
+                uidRunningState = PROCESS_STATE_CACHED;
             }
-            updateRealProcessStateLocked(procName, procState, elapsedRealtimeMs);
-        }
 
-        public void updateRealProcessStateLocked(String procName, int procState,
-                long elapsedRealtimeMs) {
-            Proc proc = getProcessStatsLocked(procName);
-            if (proc.mProcessState != procState) {
-                boolean changed;
-                if (procState < proc.mProcessState) {
-                    // Has this process become more important?  If so,
-                    // we may need to change the uid if the currrent uid proc state
-                    // is not as important as what we are now setting.
-                    changed = mProcessState > procState;
-                } else {
-                    // Has this process become less important?  If so,
-                    // we may need to change the uid if the current uid proc state
-                    // is the same importance as the old setting.
-                    changed = mProcessState == proc.mProcessState;
+            if (mProcessState == uidRunningState) return;
+
+            final long elapsedRealtime = SystemClock.elapsedRealtime();
+
+            if (mProcessState != ActivityManager.PROCESS_STATE_NONEXISTENT) {
+                mProcessStateTimer[mProcessState].stopRunningLocked(elapsedRealtime);
+            }
+            mProcessState = uidRunningState;
+            if (uidRunningState != ActivityManager.PROCESS_STATE_NONEXISTENT) {
+                if (mProcessStateTimer[uidRunningState] == null) {
+                    makeProcessState(uidRunningState, null);
                 }
-                proc.mProcessState = procState;
-                if (changed) {
-                    // uid's state may have changed; compute what the new state should be.
-                    int uidProcState = PROCESS_STATE_NONE;
-                    for (int ip=mProcessStats.size()-1; ip>=0; ip--) {
-                        proc = mProcessStats.valueAt(ip);
-                        if (proc.mProcessState < uidProcState) {
-                            uidProcState = proc.mProcessState;
-                        }
-                    }
-                    updateUidProcessStateLocked(uidProcState, elapsedRealtimeMs);
-                }
+                mProcessStateTimer[uidRunningState].startRunningLocked(elapsedRealtime);
             }
         }
 
@@ -9423,7 +9377,7 @@
             if (in.readInt() != 0) {
                 u.createForegroundActivityTimerLocked().readSummaryFromParcelLocked(in);
             }
-            u.mProcessState = Uid.PROCESS_STATE_NONE;
+            u.mProcessState = ActivityManager.PROCESS_STATE_NONEXISTENT;
             for (int i = 0; i < Uid.NUM_PROCESS_STATE; i++) {
                 if (in.readInt() != 0) {
                     u.makeProcessState(i, null);
diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
index b101733..75ca639 100644
--- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java
+++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java
@@ -17,6 +17,7 @@
 package com.android.internal.policy;
 
 import android.graphics.Rect;
+import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Looper;
 import android.view.Choreographer;
@@ -44,6 +45,7 @@
     // The render nodes for the multi threaded renderer.
     private ThreadedRenderer mRenderer;
     private RenderNode mFrameAndBackdropNode;
+    private RenderNode mSystemBarBackgroundNode;
 
     private final Rect mOldTargetRect = new Rect();
     private final Rect mNewTargetRect = new Rect();
@@ -62,13 +64,16 @@
 
     private Drawable mCaptionBackgroundDrawable;
     private Drawable mResizingBackgroundDrawable;
+    private ColorDrawable mStatusBarColor;
 
     public BackdropFrameRenderer(DecorView decorView, ThreadedRenderer renderer, Rect initialBounds,
-            Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable) {
+            Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable,
+            int statusBarColor) {
         setName("ResizeFrame");
 
         mRenderer = renderer;
-        onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable);
+        onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable,
+                statusBarColor);
 
         // Create a render node for the content and frame backdrop
         // which can be resized independently from the content.
@@ -87,10 +92,24 @@
     }
 
     void onResourcesLoaded(DecorView decorView, Drawable resizingBackgroundDrawable,
-            Drawable captionBackgroundDrawableDrawable) {
+            Drawable captionBackgroundDrawableDrawable, int statusBarColor) {
         mDecorView = decorView;
         mResizingBackgroundDrawable = resizingBackgroundDrawable;
         mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable;
+        if (statusBarColor != 0) {
+            mStatusBarColor = new ColorDrawable(statusBarColor);
+            addSystemBarNodeIfNeeded();
+        } else {
+            mStatusBarColor = null;
+        }
+    }
+
+    private void addSystemBarNodeIfNeeded() {
+        if (mSystemBarBackgroundNode != null) {
+            return;
+        }
+        mSystemBarBackgroundNode = RenderNode.create("SystemBarBackgroundNode", null);
+        mRenderer.addRenderNode(mSystemBarBackgroundNode, false);
     }
 
     /**
@@ -132,6 +151,9 @@
                 // Remove the render node again
                 // (see comment above - better to do that only once).
                 mRenderer.removeRenderNode(mFrameAndBackdropNode);
+                if (mSystemBarBackgroundNode != null) {
+                    mRenderer.removeRenderNode(mSystemBarBackgroundNode);
+                }
 
                 mRenderer = null;
 
@@ -232,6 +254,8 @@
         // inaccessible. For that case we remember the previous metrics to avoid flashes.
         // Note that even when there is no visible caption, the caption child will exist.
         final int captionHeight = mDecorView.getCaptionHeight();
+        final int statusBarHeight = mDecorView.getStatusBarHeight();
+
         // The caption height will probably never dynamically change while we are resizing.
         // Once set to something other then 0 it should be kept that way.
         if (captionHeight != 0) {
@@ -256,7 +280,7 @@
         mFrameAndBackdropNode.setLeftTopRightBottom(left, top, left + width, top + height);
 
         // Draw the caption and content backdrops in to our render node.
-        final DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
+        DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height);
         mCaptionBackgroundDrawable.setBounds(0, 0, left + width, top + mLastCaptionHeight);
         mCaptionBackgroundDrawable.draw(canvas);
 
@@ -265,6 +289,15 @@
         mResizingBackgroundDrawable.draw(canvas);
         mFrameAndBackdropNode.end(canvas);
 
+        if (mSystemBarBackgroundNode != null && mStatusBarColor != null) {
+            canvas = mSystemBarBackgroundNode.start(width, height);
+            mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height);
+            mStatusBarColor.setBounds(0, 0, left + width, statusBarHeight);
+            mStatusBarColor.draw(canvas);
+            mSystemBarBackgroundNode.end(canvas);
+            mRenderer.drawRenderNode(mSystemBarBackgroundNode);
+        }
+
         // We need to render the node explicitly
         mRenderer.drawRenderNode(mFrameAndBackdropNode);
 
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 27fe03c..9107b1f 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -21,8 +21,7 @@
 import com.android.internal.view.RootViewSurfaceTaker;
 import com.android.internal.view.StandaloneActionMode;
 import com.android.internal.view.menu.ContextMenuBuilder;
-import com.android.internal.view.menu.MenuDialogHelper;
-import com.android.internal.view.menu.MenuPopupHelper;
+import com.android.internal.view.menu.MenuHelper;
 import com.android.internal.widget.ActionBarContextView;
 import com.android.internal.widget.BackgroundFallback;
 import com.android.internal.widget.DecorCaptionView;
@@ -152,6 +151,8 @@
     private final Interpolator mShowInterpolator;
     private final Interpolator mHideInterpolator;
     private final int mBarEnterExitDuration;
+    private final boolean mForceWindowDrawsStatusBarBackground;
+    private final int mSemiTransparentStatusBarColor;
 
     private final BackgroundFallback mBackgroundFallback = new BackgroundFallback();
 
@@ -198,6 +199,10 @@
 
         mBarEnterExitDuration = context.getResources().getInteger(
                 R.integer.dock_enter_exit_duration);
+        mForceWindowDrawsStatusBarBackground = context.getResources().getBoolean(
+                R.bool.config_forceWindowDrawsStatusBarBackground);
+        mSemiTransparentStatusBarColor = context.getResources().getColor(
+                R.color.system_bar_background_semi_transparent, null /* theme */);
 
         setWindow(window);
     }
@@ -659,30 +664,23 @@
 
     @Override
     public boolean showContextMenuForChild(View originalView) {
-        // Reuse the context menu builder
-        if (mWindow.mContextMenu == null) {
-            mWindow.mContextMenu = new ContextMenuBuilder(getContext());
-            mWindow.mContextMenu.setCallback(mWindow.mContextMenuCallback);
-        } else {
-            mWindow.mContextMenu.clearAll();
-        }
-
-        final MenuDialogHelper helper = mWindow.mContextMenu.show(originalView,
-                originalView.getWindowToken());
-        if (helper != null) {
-            helper.setPresenterCallback(mWindow.mContextMenuCallback);
-        } else if (mWindow.mContextMenuHelper != null) {
-            // No menu to show, but if we have a menu currently showing it just became blank.
-            // Close it.
-            mWindow.mContextMenuHelper.dismiss();
-        }
-        mWindow.mContextMenuHelper = helper;
-        return helper != null;
+        return showContextMenuForChildInternal(originalView, 0, 0, false);
     }
 
     @Override
     public boolean showContextMenuForChild(View originalView, float x, float y) {
-        // Reuse the context menu builder
+        return showContextMenuForChildInternal(originalView, x, y, true);
+    }
+
+    private boolean showContextMenuForChildInternal(View originalView,
+            float x, float y, boolean isPopup) {
+        // Only allow one context menu at a time.
+        if (mWindow.mContextMenuHelper != null) {
+            mWindow.mContextMenuHelper.dismiss();
+            mWindow.mContextMenuHelper = null;
+        }
+
+        // Reuse the context menu builder.
         if (mWindow.mContextMenu == null) {
             mWindow.mContextMenu = new ContextMenuBuilder(getContext());
             mWindow.mContextMenu.setCallback(mWindow.mContextMenuCallback);
@@ -690,16 +688,18 @@
             mWindow.mContextMenu.clearAll();
         }
 
-        final MenuPopupHelper helper = mWindow.mContextMenu.showPopup(
-                getContext(), originalView, x, y);
-        if (helper != null) {
-            helper.setCallback(mWindow.mContextMenuCallback);
-        } else if (mWindow.mContextMenuPopupHelper != null) {
-            // No menu to show, but if we have a menu currently showing it just became blank.
-            // Close it.
-            mWindow.mContextMenuPopupHelper.dismiss();
+        final MenuHelper helper;
+        if (isPopup) {
+            helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
+        } else {
+            helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
         }
-        mWindow.mContextMenuPopupHelper = helper;
+
+        if (helper != null) {
+            helper.setPresenterCallback(mWindow.mContextMenuCallback);
+        }
+
+        mWindow.mContextMenuHelper = helper;
         return helper != null;
     }
 
@@ -890,14 +890,15 @@
             int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
             updateColorViewInt(mNavigationColorViewState, sysUiVisibility,
                     mWindow.mNavigationBarColor, navBarSize, navBarToRightEdge,
-                    0 /* rightInset */, animate && !disallowAnimate);
+                    0 /* rightInset */, animate && !disallowAnimate, false /* force */);
 
             boolean statusBarNeedsRightInset = navBarToRightEdge
                     && mNavigationColorViewState.present;
             int statusBarRightInset = statusBarNeedsRightInset ? mLastRightInset : 0;
-            updateColorViewInt(mStatusColorViewState, sysUiVisibility, mWindow.mStatusBarColor,
-                    mLastTopInset, false /* matchVertical */, statusBarRightInset,
-                    animate && !disallowAnimate);
+            updateColorViewInt(mStatusColorViewState, sysUiVisibility,
+                    calculateStatusBarColor(), mLastTopInset,
+                    false /* matchVertical */, statusBarRightInset, animate && !disallowAnimate,
+                    mForceWindowDrawsStatusBarBackground);
         }
 
         // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
@@ -941,6 +942,21 @@
         return insets;
     }
 
+    private int calculateStatusBarColor() {
+        int flags = mWindow.getAttributes().flags;
+        return (flags & FLAG_TRANSLUCENT_STATUS) != 0 ? mSemiTransparentStatusBarColor
+                : (flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 ? mWindow.mStatusBarColor
+                : Color.BLACK;
+    }
+
+    private int getCurrentColor(ColorViewState state) {
+        if (state.visible) {
+            return state.color;
+        } else {
+            return 0;
+        }
+    }
+
     /**
      * Update a color view
      *
@@ -954,13 +970,15 @@
      * @param animate if true, the change will be animated.
      */
     private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
-            int size, boolean verticalBar, int rightMargin, boolean animate) {
+            int size, boolean verticalBar, int rightMargin, boolean animate, boolean force) {
         state.present = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
                 && (mWindow.getAttributes().flags & state.hideWindowFlag) == 0
-                && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
+                && ((mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
+                        || force);
         boolean show = state.present
                 && (color & Color.BLACK) != 0
-                && (mWindow.getAttributes().flags & state.translucentFlag) == 0;
+                && ((mWindow.getAttributes().flags & state.translucentFlag) == 0  || force);
+        boolean showView = show && !isResizing();
 
         boolean visibilityChanged = false;
         View view = state.view;
@@ -970,7 +988,7 @@
         int resolvedGravity = verticalBar ? state.horizontalGravity : state.verticalGravity;
 
         if (view == null) {
-            if (show) {
+            if (showView) {
                 state.view = view = new View(mContext);
                 view.setBackgroundColor(color);
                 view.setTransitionName(state.transitionName);
@@ -986,7 +1004,7 @@
                 updateColorViewTranslations();
             }
         } else {
-            int vis = show ? VISIBLE : INVISIBLE;
+            int vis = showView ? VISIBLE : INVISIBLE;
             visibilityChanged = state.targetVisibility != vis;
             state.targetVisibility = vis;
             LayoutParams lp = (LayoutParams) view.getLayoutParams();
@@ -998,14 +1016,14 @@
                 lp.rightMargin = rightMargin;
                 view.setLayoutParams(lp);
             }
-            if (show) {
+            if (showView) {
                 view.setBackgroundColor(color);
             }
         }
         if (visibilityChanged) {
             view.animate().cancel();
-            if (animate) {
-                if (show) {
+            if (animate && !isResizing()) {
+                if (showView) {
                     if (view.getVisibility() != VISIBLE) {
                         view.setVisibility(VISIBLE);
                         view.setAlpha(0.0f);
@@ -1025,9 +1043,11 @@
                 }
             } else {
                 view.setAlpha(1.0f);
-                view.setVisibility(show ? VISIBLE : INVISIBLE);
+                view.setVisibility(showView ? VISIBLE : INVISIBLE);
             }
         }
+        state.visible = show;
+        state.color = color;
     }
 
     private void updateColorViewTranslations() {
@@ -1559,7 +1579,8 @@
 
         if (mBackdropFrameRenderer != null) {
             mBackdropFrameRenderer.onResourcesLoaded(
-                    this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable);
+                    this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
+                    getCurrentColor(mStatusColorViewState));
         }
 
         mDecorCaptionView = createDecorCaptionView(inflater);
@@ -1674,9 +1695,15 @@
         if (mDecorCaptionView != null) {
             mDecorCaptionView.removeContentView();
         } else {
-            // This window doesn't have caption, so we need to just remove the
-            // children of the decor view.
-            removeAllViews();
+            // This window doesn't have caption, so we need to remove everything except our views
+            // we might have added.
+            for (int i = getChildCount() - 1; i >= 0; i--) {
+                View v = getChildAt(i);
+                if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view
+                        && v != mStatusGuard && v != mNavigationGuard) {
+                    removeViewAt(i);
+                }
+            }
         }
     }
 
@@ -1700,18 +1727,22 @@
         final ThreadedRenderer renderer = (ThreadedRenderer) getHardwareRenderer();
         if (renderer != null) {
             mBackdropFrameRenderer = new BackdropFrameRenderer(this, renderer,
-                    initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable);
+                    initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
+                    getCurrentColor(mStatusColorViewState));
 
             // Get rid of the shadow while we are resizing. Shadow drawing takes considerable time.
             // If we want to get the shadow shown while resizing, we would need to elevate a new
             // element which owns the caption and has the elevation.
             updateElevation();
+
+            updateColorViews(null /* insets */, false);
         }
     }
 
     @Override
     public void onWindowDragResizeEnd() {
         releaseThreadedRenderer();
+        updateColorViews(null /* insets */, false);
     }
 
     @Override
@@ -1744,6 +1775,10 @@
         }
     }
 
+    private boolean isResizing() {
+        return mBackdropFrameRenderer != null;
+    }
+
     /**
      * The elevation gets set for the first time and the framework needs to be informed that
      * the surface layer gets created with the shadow size in mind.
@@ -1759,8 +1794,7 @@
         final boolean wasAdjustedForStack = mElevationAdjustedForStack;
         // Do not use a shadow when we are in resizing mode (mBackdropFrameRenderer not null)
         // since the shadow is bound to the content size and not the target size.
-        if (ActivityManager.StackId.hasWindowShadow(mStackId)
-                && mBackdropFrameRenderer == null) {
+        if (ActivityManager.StackId.hasWindowShadow(mStackId) && !isResizing()) {
             elevation = hasWindowFocus() ?
                     DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP;
             // TODO(skuhne): Remove this if clause once b/22668382 got fixed.
@@ -1790,6 +1824,10 @@
         return isShowingCaption() ? mDecorCaptionView.getCaptionHeight() : 0;
     }
 
+    int getStatusBarHeight() {
+        return mStatusColorViewState.view != null ? mStatusColorViewState.view.getHeight() : 0;
+    }
+
     /**
      * Converts a DIP measure into physical pixels.
      * @param dip The dip value.
@@ -1804,6 +1842,8 @@
         View view = null;
         int targetVisibility = View.INVISIBLE;
         boolean present = false;
+        boolean visible;
+        int color;
 
         final int id;
         final int systemUiHideFlag;
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 6e7e5cf..57d2244 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -53,7 +53,7 @@
 import com.android.internal.view.menu.ListMenuPresenter;
 import com.android.internal.view.menu.MenuBuilder;
 import com.android.internal.view.menu.MenuDialogHelper;
-import com.android.internal.view.menu.MenuPopupHelper;
+import com.android.internal.view.menu.MenuHelper;
 import com.android.internal.view.menu.MenuPresenter;
 import com.android.internal.view.menu.MenuView;
 import com.android.internal.widget.DecorContentParent;
@@ -232,8 +232,7 @@
     private boolean mAlwaysReadCloseOnTouchAttr = false;
 
     ContextMenuBuilder mContextMenu;
-    MenuDialogHelper mContextMenuHelper;
-    MenuPopupHelper mContextMenuPopupHelper;
+    MenuHelper mContextMenuHelper;
     private boolean mClosingActionMenu;
 
     private int mVolumeControlStreamType = AudioManager.USE_DEFAULT_STREAM_TYPE;
@@ -1103,10 +1102,6 @@
             mContextMenuHelper.dismiss();
             mContextMenuHelper = null;
         }
-        if (mContextMenuPopupHelper != null) {
-            mContextMenuPopupHelper.dismiss();
-            mContextMenuPopupHelper = null;
-        }
     }
 
     @Override
@@ -2411,6 +2406,13 @@
             setNeedsMenuKey(WindowManager.LayoutParams.NEEDS_MENU_SET_FALSE);
         }
 
+        if (!mForcedStatusBarColor) {
+            mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000);
+        }
+        if (!mForcedNavigationBarColor) {
+            mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000);
+        }
+
         // Non-floating windows on high end devices must put up decor beneath the system bars and
         // therefore must know about visibility changes of those.
         if (!mIsFloating && ActivityManager.isHighEndGfx()) {
@@ -2421,12 +2423,6 @@
                         FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS & ~getForcedWindowFlags());
             }
         }
-        if (!mForcedStatusBarColor) {
-            mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000);
-        }
-        if (!mForcedNavigationBarColor) {
-            mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000);
-        }
         if (a.getBoolean(R.styleable.Window_windowLightStatusBar, false)) {
             decor.setSystemUiVisibility(
                     decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
diff --git a/core/java/com/android/internal/view/menu/ContextMenuBuilder.java b/core/java/com/android/internal/view/menu/ContextMenuBuilder.java
index aaa1bf1..82f061c 100644
--- a/core/java/com/android/internal/view/menu/ContextMenuBuilder.java
+++ b/core/java/com/android/internal/view/menu/ContextMenuBuilder.java
@@ -17,7 +17,6 @@
 package com.android.internal.view.menu;
 
 import android.content.Context;
-import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.os.IBinder;
 import android.util.EventLog;
@@ -35,7 +34,7 @@
  * <p>
  * To use this class, instantiate it via {@link #ContextMenuBuilder(Context)},
  * and optionally populate it with any of your custom items.  Finally,
- * call {@link #show(View, IBinder)} which will populate the menu
+ * call {@link #showDialog(View, IBinder)} which will populate the menu
  * with a view's context menu items and show the context menu.
  */
 public class ContextMenuBuilder extends MenuBuilder implements ContextMenu {
@@ -75,7 +74,7 @@
      * @return If the context menu was shown, the {@link MenuDialogHelper} for
      *         dismissing it. Otherwise, null.
      */
-    public MenuDialogHelper show(View originalView, IBinder token) {
+    public MenuDialogHelper showDialog(View originalView, IBinder token) {
         if (originalView != null) {
             // Let relevant views and their populate context listeners populate
             // the context menu
diff --git a/core/java/com/android/internal/view/menu/MenuDialogHelper.java b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
index b9e0e40..ecab29f 100644
--- a/core/java/com/android/internal/view/menu/MenuDialogHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
@@ -26,13 +26,10 @@
 import android.view.WindowManager;
 
 /**
- * Helper for menus that appear as Dialogs (context and submenus).
- * 
- * @hide
+ * Presents a menu as a modal dialog.
  */
-public class MenuDialogHelper implements DialogInterface.OnKeyListener,
-        DialogInterface.OnClickListener,
-        DialogInterface.OnDismissListener,
+public class MenuDialogHelper implements MenuHelper, DialogInterface.OnKeyListener,
+        DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
         MenuPresenter.Callback {
     private MenuBuilder mMenu;
     private AlertDialog mDialog;
@@ -125,6 +122,7 @@
 
     }
 
+    @Override
     public void setPresenterCallback(MenuPresenter.Callback cb) {
         mPresenterCallback = cb;
     }
@@ -134,6 +132,7 @@
      * 
      * @see Dialog#dismiss()
      */
+    @Override
     public void dismiss() {
         if (mDialog != null) {
             mDialog.dismiss();
diff --git a/core/java/com/android/internal/view/menu/MenuHelper.java b/core/java/com/android/internal/view/menu/MenuHelper.java
new file mode 100644
index 0000000..9534722
--- /dev/null
+++ b/core/java/com/android/internal/view/menu/MenuHelper.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.view.menu;
+
+/**
+ * Interface for a helper capable of presenting a menu.
+ */
+public interface MenuHelper {
+    void setPresenterCallback(MenuPresenter.Callback cb);
+    void dismiss();
+}
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index 59d5f94..044ee6e 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -30,7 +30,7 @@
 /**
  * Presents a menu as a small, simple popup anchored to another view.
  */
-public class MenuPopupHelper {
+public class MenuPopupHelper implements MenuHelper {
     private final Context mContext;
 
     // Immutable cached popup menu properties.
@@ -244,6 +244,7 @@
     /**
      * Dismisses the popup, if showing.
      */
+    @Override
     public void dismiss() {
         if (isShowing()) {
             mPopup.dismiss();
@@ -270,7 +271,8 @@
         return mPopup != null && mPopup.isShowing();
     }
 
-    public void setCallback(@Nullable MenuPresenter.Callback cb) {
+    @Override
+    public void setPresenterCallback(@Nullable MenuPresenter.Callback cb) {
         mPresenterCallback = cb;
         if (mPopup != null) {
             mPopup.setCallback(cb);
diff --git a/core/java/com/android/internal/view/menu/StandardMenuPopup.java b/core/java/com/android/internal/view/menu/StandardMenuPopup.java
index caee0d2..6a5f6d8 100644
--- a/core/java/com/android/internal/view/menu/StandardMenuPopup.java
+++ b/core/java/com/android/internal/view/menu/StandardMenuPopup.java
@@ -245,7 +245,7 @@
             MenuPopupHelper subPopup = new MenuPopupHelper(
                     mContext, subMenu, mShownAnchorView, mOverflowOnly, mPopupStyleAttr,
                     mPopupStyleRes);
-            subPopup.setCallback(mPresenterCallback);
+            subPopup.setPresenterCallback(mPresenterCallback);
             subPopup.setForceShowIcon(mAdapter.getForceShowIcon());
 
             if (subPopup.tryShow()) {
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 7bab446..3a00469 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -20,6 +20,7 @@
 import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
 import android.content.ComponentCallbacks;
 import android.content.Context;
 import android.content.res.Configuration;
@@ -28,7 +29,9 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.Region;
+import android.graphics.drawable.AnimatedVectorDrawable;
 import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
 import android.util.Size;
 import android.view.ContextThemeWrapper;
@@ -36,6 +39,7 @@
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.MeasureSpec;
 import android.view.ViewGroup;
@@ -45,6 +49,8 @@
 import android.view.animation.Animation;
 import android.view.animation.AnimationSet;
 import android.view.animation.Transformation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.Button;
@@ -277,70 +283,56 @@
      * A popup window used by the floating toolbar.
      *
      * This class is responsible for the rendering/animation of the floating toolbar.
-     * It can hold one of 2 panels (i.e. main panel and overflow panel) at a time.
-     * It delegates specific panel functionality to the appropriate panel.
+     * It holds 2 panels (i.e. main panel and overflow panel) and an overflow button
+     * to transition between panels.
      */
     private static final class FloatingToolbarPopup {
 
-        public static final int OVERFLOW_DIRECTION_UP = 0;
-        public static final int OVERFLOW_DIRECTION_DOWN = 1;
+        /* Minimum and maximum number of items allowed in the overflow. */
+        private static final int MIN_OVERFLOW_SIZE = 2;
+        private static final int MAX_OVERFLOW_SIZE = 4;
+
+        /* The duration of the overflow button vector animation duration. */
+        private static final int OVERFLOW_BUTTON_ANIMATION_DELAY = 400;
 
         private final Context mContext;
-        private final View mParent;
+        private final View mParent;  // Parent for the popup window.
         private final PopupWindow mPopupWindow;
-        private final ViewGroup mContentContainer;
+
+        /* Margins between the popup window and it's content. */
         private final int mMarginHorizontal;
         private final int mMarginVertical;
 
-        private final Animation.AnimationListener mOnOverflowOpened =
-                new Animation.AnimationListener() {
-                    @Override
-                    public void onAnimationStart(Animation animation) {}
+        /* View components */
+        private final ViewGroup mContentContainer;  // holds all contents.
+        private final ViewGroup mMainPanel;  // holds menu items that are initially displayed.
+        private final ListView mOverflowPanel;  // holds menu items hidden in the overflow.
+        private final ImageButton mOverflowButton;  // opens/closes the overflow.
+        /* overflow button drawables. */
+        private final Drawable mArrow;
+        private final Drawable mOverflow;
+        private final AnimatedVectorDrawable mToArrow;
+        private final AnimatedVectorDrawable mToOverflow;
 
-                    @Override
-                    public void onAnimationEnd(Animation animation) {
-                        setOverflowPanelAsContent();
-                        mOverflowPanel.fadeIn(true);
-                    }
+        private final OverflowPanelViewHelper mOverflowPanelViewHelper;
 
-                    @Override
-                    public void onAnimationRepeat(Animation animation) {}
-                };
-        private final Animation.AnimationListener mOnOverflowClosed =
-                new Animation.AnimationListener() {
-                    @Override
-                    public void onAnimationStart(Animation animation) {}
+        /* Animation interpolators. */
+        private final Interpolator mLogAccelerateInterpolator;
+        private final Interpolator mFastOutSlowInInterpolator;
+        private final Interpolator mLinearOutSlowInInterpolator;
+        private final Interpolator mFastOutLinearInInterpolator;
 
-                    @Override
-                    public void onAnimationEnd(Animation animation) {
-                        setMainPanelAsContent();
-                        mMainPanel.fadeIn(true);
-                    }
-
-                    @Override
-                    public void onAnimationRepeat(Animation animation) {
-                    }
-                };
+        /* Animations. */
+        private final AnimatorSet mShowAnimation;
         private final AnimatorSet mDismissAnimation;
         private final AnimatorSet mHideAnimation;
-        private final AnimationSet mOpenOverflowAnimation = new AnimationSet(true);
-        private final AnimationSet mCloseOverflowAnimation = new AnimationSet(true);
+        private final AnimationSet mOpenOverflowAnimation;
+        private final AnimationSet mCloseOverflowAnimation;
+        private final Animation.AnimationListener mOverflowAnimationListener;
 
-        private final Runnable mOpenOverflow = new Runnable() {
-            @Override
-            public void run() {
-                openOverflow();
-            }
-        };
-        private final Runnable mCloseOverflow = new Runnable() {
-            @Override
-            public void run() {
-                closeOverflow();
-            }
-        };
-
-        private final Rect mViewPortOnScreen = new Rect();
-        private final Point mCoordsOnWindow = new Point();
+        private final Rect mViewPortOnScreen = new Rect();  // portion of screen we can draw in.
+        private final Point mCoordsOnWindow = new Point();  // popup window coordinates.
+        /* Temporary data holders. Reset values before using. */
         private final int[] mTmpCoords = new int[2];
         private final Rect mTmpRect = new Rect();
 
@@ -357,12 +349,56 @@
                     }
                 };
 
+        /**
+         * @see OverflowPanelViewHelper#preparePopupContent().
+         */
+        private final Runnable mPreparePopupContentRTLHelper = new Runnable() {
+            @Override
+            public void run() {
+                setPanelsStatesAtRestingPosition();
+                setContentAreaAsTouchableSurface();
+                mContentContainer.setAlpha(1);
+            }
+        };
+
+        /* Runnable to reset the overflow button's drawable after an overflow transition. */
+        private final Runnable mResetOverflowButtonDrawable = new Runnable() {
+            @Override
+            public void run() {
+                if (mIsOverflowOpen) {
+                    mOverflowButton.setImageDrawable(mArrow);
+                } else {
+                    mOverflowButton.setImageDrawable(mOverflow);
+                }
+            }
+        };
+
         private boolean mDismissed = true; // tracks whether this popup is dismissed or dismissing.
         private boolean mHidden; // tracks whether this popup is hidden or hiding.
 
-        private FloatingToolbarOverflowPanel mOverflowPanel;
-        private FloatingToolbarMainPanel mMainPanel;
-        private int mOverflowDirection;
+        /* Calculated sizes for panels and overflow button. */
+        private final Size mOverflowButtonSize;
+        private Size mOverflowPanelSize;  // Should be null when there is no overflow.
+        private Size mMainPanelSize;
+
+        /* Item click listeners */
+        private MenuItem.OnMenuItemClickListener mOnMenuItemClickListener;
+        private final View.OnClickListener mMenuItemButtonOnClickListener =
+                new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        if (v.getTag() instanceof MenuItem) {
+                            if (mOnMenuItemClickListener != null) {
+                                mOnMenuItemClickListener.onMenuItemClick((MenuItem) v.getTag());
+                            }
+                        }
+                    }
+                };
+
+        private boolean mOpenOverflowUpwards;  // Whether the overflow opens upwards or downwards.
+        private boolean mIsOverflowOpen;
+
+        private int mTransitionDurationScale;  // Used to scale the toolbar transition duration.
 
         /**
          * Initializes a new floating toolbar popup.
@@ -375,6 +411,48 @@
             mContext = Preconditions.checkNotNull(context);
             mContentContainer = createContentContainer(context);
             mPopupWindow = createPopupWindow(mContentContainer);
+            mMarginHorizontal = parent.getResources()
+                    .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
+            mMarginVertical = parent.getResources()
+                    .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
+
+            // Interpolators
+            mLogAccelerateInterpolator = new LogAccelerateInterpolator();
+            mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(
+                    mContext, android.R.interpolator.fast_out_slow_in);
+            mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(
+                    mContext, android.R.interpolator.linear_out_slow_in);
+            mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator(
+                    mContext, android.R.interpolator.fast_out_linear_in);
+
+            // Drawables. Needed for views.
+            mArrow = mContext.getResources()
+                    .getDrawable(R.drawable.ft_avd_tooverflow, mContext.getTheme());
+            mArrow.setAutoMirrored(true);
+            mOverflow = mContext.getResources()
+                    .getDrawable(R.drawable.ft_avd_toarrow, mContext.getTheme());
+            mOverflow.setAutoMirrored(true);
+            mToArrow = (AnimatedVectorDrawable) mContext.getResources()
+                    .getDrawable(R.drawable.ft_avd_toarrow_animation, mContext.getTheme());
+            mToArrow.setAutoMirrored(true);
+            mToOverflow = (AnimatedVectorDrawable) mContext.getResources()
+                    .getDrawable(R.drawable.ft_avd_tooverflow_animation, mContext.getTheme());
+            mToOverflow.setAutoMirrored(true);
+
+            // Views
+            mOverflowButton = createOverflowButton();
+            mOverflowButtonSize = measure(mOverflowButton);
+            mMainPanel = createMainPanel();
+            mOverflowPanelViewHelper = new OverflowPanelViewHelper(mContext);
+            mOverflowPanel = createOverflowPanel();
+
+            // Animation. Need views.
+            mOverflowAnimationListener = createOverflowAnimationListener();
+            mOpenOverflowAnimation = new AnimationSet(true);
+            mOpenOverflowAnimation.setAnimationListener(mOverflowAnimationListener);
+            mCloseOverflowAnimation = new AnimationSet(true);
+            mCloseOverflowAnimation.setAnimationListener(mOverflowAnimationListener);
+            mShowAnimation = createEnterAnimation(mContentContainer);
             mDismissAnimation = createExitAnimation(
                     mContentContainer,
                     150,  // startDelay
@@ -394,35 +472,23 @@
                             mPopupWindow.dismiss();
                         }
                     });
-            mMarginHorizontal = parent.getResources()
-                    .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
-            mMarginVertical = parent.getResources()
-                    .getDimensionPixelSize(R.dimen.floating_toolbar_vertical_margin);
         }
 
         /**
          * Lays out buttons for the specified menu items.
+         * Requires a subsequent call to {@link #show()} to show the items.
          */
         public void layoutMenuItems(
                 List<MenuItem> menuItems,
                 MenuItem.OnMenuItemClickListener menuItemClickListener,
                 int suggestedWidth) {
-            Preconditions.checkNotNull(menuItems);
-
-            mContentContainer.removeAllViews();
-            if (mMainPanel == null) {
-                mMainPanel = new FloatingToolbarMainPanel(mContext, mOpenOverflow);
-            }
-            List<MenuItem> overflowMenuItems =
-                    mMainPanel.layoutMenuItems(menuItems, getToolbarWidth(suggestedWidth));
-            mMainPanel.setOnMenuItemClickListener(menuItemClickListener);
-            if (!overflowMenuItems.isEmpty()) {
-                if (mOverflowPanel == null) {
-                    mOverflowPanel =
-                            new FloatingToolbarOverflowPanel(mContext, mCloseOverflow);
-                }
-                mOverflowPanel.setMenuItems(overflowMenuItems);
-                mOverflowPanel.setOnMenuItemClickListener(menuItemClickListener);
+            mOnMenuItemClickListener = menuItemClickListener;
+            cancelOverflowAnimations();
+            clearPanels();
+            menuItems = layoutMainPanelItems(menuItems, getAdjustedToolbarWidth(suggestedWidth));
+            if (!menuItems.isEmpty()) {
+                // Add remaining items to the overflow.
+                layoutOverflowPanelItems(menuItems);
             }
             updatePopupSize();
         }
@@ -443,20 +509,13 @@
             cancelDismissAndHideAnimations();
             cancelOverflowAnimations();
 
-            // Make sure a panel is set as the content.
-            if (mContentContainer.getChildCount() == 0) {
-                setMainPanelAsContent();
-                // If we're yet to show the popup, set the container visibility to zero.
-                // The "show" animation will make this visible.
-                mContentContainer.setAlpha(0);
-            }
             refreshCoordinatesAndOverflowDirection(contentRectOnScreen);
             preparePopupContent();
             // We need to specify the position in window coordinates.
             // TODO: Consider to use PopupWindow.setLayoutInScreenEnabled(true) so that we can
-            // specify the popup poision in screen coordinates.
-            mPopupWindow.showAtLocation(mParent, Gravity.NO_GRAVITY, mCoordsOnWindow.x,
-                    mCoordsOnWindow.y);
+            // specify the popup position in screen coordinates.
+            mPopupWindow.showAtLocation(
+                    mParent, Gravity.NO_GRAVITY, mCoordsOnWindow.x, mCoordsOnWindow.y);
             setTouchableSurfaceInsetsComputer();
             runShowAnimation();
         }
@@ -472,6 +531,7 @@
             mHidden = false;
             mDismissed = true;
             mHideAnimation.cancel();
+
             runDismissAnimation();
             setZeroTouchableSurface();
         }
@@ -521,104 +581,90 @@
             preparePopupContent();
             // We need to specify the position in window coordinates.
             // TODO: Consider to use PopupWindow.setLayoutInScreenEnabled(true) so that we can
-            // specify the popup poision in screen coordinates.
-            mPopupWindow.update(mCoordsOnWindow.x, mCoordsOnWindow.y, getWidth(), getHeight());
-        }
-
-        /**
-         * Returns the width of this popup.
-         */
-        public int getWidth() {
-            return mPopupWindow.getWidth();
-        }
-
-        /**
-         * Returns the height of this popup.
-         */
-        public int getHeight() {
-            return mPopupWindow.getHeight();
-        }
-
-        /**
-         * Returns the context this popup is running in.
-         */
-        public Context getContext() {
-            return mContext;
+            // specify the popup position in screen coordinates.
+            mPopupWindow.update(
+                    mCoordsOnWindow.x, mCoordsOnWindow.y,
+                    mPopupWindow.getWidth(), mPopupWindow.getHeight());
         }
 
         private void refreshCoordinatesAndOverflowDirection(Rect contentRectOnScreen) {
             refreshViewPort();
 
-            int x = contentRectOnScreen.centerX() - getWidth() / 2;
+            int x = contentRectOnScreen.centerX() - mPopupWindow.getWidth() / 2;
             // Update x so that the toolbar isn't rendered behind the nav bar in landscape.
-            x = Math.max(0, Math.min(x, mViewPortOnScreen.right - getWidth()));
+            x = Math.max(0, Math.min(x, mViewPortOnScreen.right - mPopupWindow.getWidth()));
 
-            int y;
+            final int y;
 
-            int availableHeightAboveContent = contentRectOnScreen.top - mViewPortOnScreen.top;
-            int availableHeightBelowContent = mViewPortOnScreen.bottom - contentRectOnScreen.bottom;
+            final int availableHeightAboveContent =
+                    contentRectOnScreen.top - mViewPortOnScreen.top;
+            final int availableHeightBelowContent =
+                    mViewPortOnScreen.bottom - contentRectOnScreen.bottom;
 
-            if (mOverflowPanel == null) {  // There is no overflow.
-                if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin()) {
+            final int margin = 2 * mMarginVertical;
+            final int toolbarHeightWithVerticalMargin = getLineHeight(mContext) + margin;
+
+            if (!hasOverflow()) {
+                if (availableHeightAboveContent >= toolbarHeightWithVerticalMargin) {
                     // There is enough space at the top of the content.
-                    y = contentRectOnScreen.top - getToolbarHeightWithVerticalMargin();
-                } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin()) {
+                    y = contentRectOnScreen.top - toolbarHeightWithVerticalMargin;
+                } else if (availableHeightBelowContent >= toolbarHeightWithVerticalMargin) {
                     // There is enough space at the bottom of the content.
                     y = contentRectOnScreen.bottom;
-                } else if (availableHeightBelowContent >= getEstimatedToolbarHeight(mContext)) {
+                } else if (availableHeightBelowContent >= getLineHeight(mContext)) {
                     // Just enough space to fit the toolbar with no vertical margins.
                     y = contentRectOnScreen.bottom - mMarginVertical;
                 } else {
                     // Not enough space. Prefer to position as high as possible.
                     y = Math.max(
                             mViewPortOnScreen.top,
-                            contentRectOnScreen.top - getToolbarHeightWithVerticalMargin());
+                            contentRectOnScreen.top - toolbarHeightWithVerticalMargin);
                 }
-            } else {  // There is an overflow.
-                int margin = 2 * mMarginVertical;
-                int minimumOverflowHeightWithMargin = mOverflowPanel.getMinimumHeight() + margin;
-                int availableHeightThroughContentDown = mViewPortOnScreen.bottom -
-                        contentRectOnScreen.top + getToolbarHeightWithVerticalMargin();
-                int availableHeightThroughContentUp = contentRectOnScreen.bottom -
-                        mViewPortOnScreen.top + getToolbarHeightWithVerticalMargin();
+            } else {
+                // Has an overflow.
+                final int minimumOverflowHeightWithMargin =
+                        calculateOverflowHeight(MIN_OVERFLOW_SIZE) + margin;
+                final int availableHeightThroughContentDown = mViewPortOnScreen.bottom -
+                        contentRectOnScreen.top + toolbarHeightWithVerticalMargin;
+                final int availableHeightThroughContentUp = contentRectOnScreen.bottom -
+                        mViewPortOnScreen.top + toolbarHeightWithVerticalMargin;
 
                 if (availableHeightAboveContent >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the top of the content rect for the overflow.
                     // Position above and open upwards.
                     updateOverflowHeight(availableHeightAboveContent - margin);
-                    y = contentRectOnScreen.top - getHeight();
-                    mOverflowDirection = OVERFLOW_DIRECTION_UP;
-                } else if (availableHeightAboveContent >= getToolbarHeightWithVerticalMargin()
+                    y = contentRectOnScreen.top - mPopupWindow.getHeight();
+                    mOpenOverflowUpwards = true;
+                } else if (availableHeightAboveContent >= toolbarHeightWithVerticalMargin
                         && availableHeightThroughContentDown >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the top of the content rect for the main panel
                     // but not the overflow.
                     // Position above but open downwards.
                     updateOverflowHeight(availableHeightThroughContentDown - margin);
-                    y = contentRectOnScreen.top - getToolbarHeightWithVerticalMargin();
-                    mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
+                    y = contentRectOnScreen.top - toolbarHeightWithVerticalMargin;
+                    mOpenOverflowUpwards = false;
                 } else if (availableHeightBelowContent >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the bottom of the content rect for the overflow.
                     // Position below and open downwards.
                     updateOverflowHeight(availableHeightBelowContent - margin);
                     y = contentRectOnScreen.bottom;
-                    mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
-                } else if (availableHeightBelowContent >= getToolbarHeightWithVerticalMargin()
+                    mOpenOverflowUpwards = false;
+                } else if (availableHeightBelowContent >= toolbarHeightWithVerticalMargin
                         && mViewPortOnScreen.height() >= minimumOverflowHeightWithMargin) {
                     // There is enough space at the bottom of the content rect for the main panel
                     // but not the overflow.
                     // Position below but open upwards.
                     updateOverflowHeight(availableHeightThroughContentUp - margin);
-                    y = contentRectOnScreen.bottom + getToolbarHeightWithVerticalMargin() -
-                            getHeight();
-                    mOverflowDirection = OVERFLOW_DIRECTION_UP;
+                    y = contentRectOnScreen.bottom + toolbarHeightWithVerticalMargin -
+                            mPopupWindow.getHeight();
+                    mOpenOverflowUpwards = true;
                 } else {
                     // Not enough space.
                     // Position at the top of the view port and open downwards.
                     updateOverflowHeight(mViewPortOnScreen.height() - margin);
                     y = mViewPortOnScreen.top;
-                    mOverflowDirection = OVERFLOW_DIRECTION_DOWN;
+                    mOpenOverflowUpwards = false;
                 }
-                mOverflowPanel.setOverflowDirection(mOverflowDirection);
             }
 
             // We later specify the location of PopupWindow relative to the attached window.
@@ -639,15 +685,11 @@
             mCoordsOnWindow.set(x - windowLeftOnScreen, y - windowTopOnScreen);
         }
 
-        private int getToolbarHeightWithVerticalMargin() {
-            return getEstimatedToolbarHeight(mContext) + mMarginVertical * 2;
-        }
-
         /**
          * Performs the "show" animation on the floating popup.
          */
         private void runShowAnimation() {
-            createEnterAnimation(mContentContainer).start();
+            mShowAnimation.start();
         }
 
         /**
@@ -670,42 +712,16 @@
         }
 
         private void cancelOverflowAnimations() {
-            if (mOpenOverflowAnimation.hasStarted()
-                    && !mOpenOverflowAnimation.hasEnded()) {
-                // Remove the animation listener, stop the animation,
-                // then trigger the lister explicitly so it is not posted
-                // to the message queue.
-                mOpenOverflowAnimation.setAnimationListener(null);
-                mContentContainer.clearAnimation();
-                mOnOverflowOpened.onAnimationEnd(null);
-            }
-            if (mCloseOverflowAnimation.hasStarted()
-                    && !mCloseOverflowAnimation.hasEnded()) {
-                // Remove the animation listener, stop the animation,
-                // then trigger the lister explicitly so it is not posted
-                // to the message queue.
-                mCloseOverflowAnimation.setAnimationListener(null);
-                mContentContainer.clearAnimation();
-                mOnOverflowClosed.onAnimationEnd(null);
-            }
+            mContentContainer.clearAnimation();
+            mMainPanel.animate().cancel();
+            mOverflowPanel.animate().cancel();
+            mToArrow.stop();
+            mToOverflow.stop();
         }
 
-        /**
-         * Opens the floating toolbar overflow.
-         * This method should not be called if menu items have not been laid out with
-         * {@link #layoutMenuItems(java.util.List, MenuItem.OnMenuItemClickListener, int)}.
-         *
-         * @throws IllegalStateException if called when menu items have not been laid out.
-         */
         private void openOverflow() {
-            Preconditions.checkState(mMainPanel != null);
-            Preconditions.checkState(mOverflowPanel != null);
-
-            mMainPanel.fadeOut(true);
-            Size overflowPanelSize = mOverflowPanel.measure();
-            final int targetWidth = overflowPanelSize.getWidth();
-            final int targetHeight = overflowPanelSize.getHeight();
-            final boolean morphUpwards = (mOverflowDirection == OVERFLOW_DIRECTION_UP);
+            final int targetWidth = mOverflowPanelSize.getWidth();
+            final int targetHeight = mOverflowPanelSize.getHeight();
             final int startWidth = mContentContainer.getWidth();
             final int startHeight = mContentContainer.getHeight();
             final float startY = mContentContainer.getY();
@@ -714,230 +730,281 @@
             Animation widthAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
-                    ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
                     int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth));
-                    params.width = startWidth + deltaWidth;
-                    mContentContainer.setLayoutParams(params);
+                    setWidth(mContentContainer, startWidth + deltaWidth);
                     if (isRTL()) {
                         mContentContainer.setX(left);
+
+                        // Lock the panels in place.
+                        mMainPanel.setX(0);
+                        mOverflowPanel.setX(0);
                     } else {
                         mContentContainer.setX(right - mContentContainer.getWidth());
+
+                        // Offset the panels' positions so they look like they're locked in place
+                        // on the screen.
+                        mMainPanel.setX(mContentContainer.getWidth() - startWidth);
+                        mOverflowPanel.setX(mContentContainer.getWidth() - targetWidth);
                     }
                 }
             };
             Animation heightAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
-                    ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
                     int deltaHeight = (int) (interpolatedTime * (targetHeight - startHeight));
-                    params.height = startHeight + deltaHeight;
-                    mContentContainer.setLayoutParams(params);
-                    if (morphUpwards) {
-                        float y = startY - (mContentContainer.getHeight() - startHeight);
-                        mContentContainer.setY(y);
+                    setHeight(mContentContainer, startHeight + deltaHeight);
+                    if (mOpenOverflowUpwards) {
+                        mContentContainer.setY(
+                                startY - (mContentContainer.getHeight() - startHeight));
+                        positionContentYCoordinatesIfOpeningOverflowUpwards();
                     }
                 }
             };
-            widthAnimation.setDuration(240);
-            heightAnimation.setDuration(180);
-            heightAnimation.setStartOffset(60);
+            final float overflowButtonStartX = mOverflowButton.getX();
+            final float overflowButtonTargetX = isRTL() ?
+                    overflowButtonStartX + targetWidth - mOverflowButton.getWidth() :
+                    overflowButtonStartX - targetWidth + mOverflowButton.getWidth();
+            Animation overflowButtonAnimation = new Animation() {
+                @Override
+                protected void applyTransformation(float interpolatedTime, Transformation t) {
+                    float overflowButtonX = overflowButtonStartX
+                            + interpolatedTime * (overflowButtonTargetX - overflowButtonStartX);
+                    float deltaContainerWidth = isRTL() ?
+                            0 :
+                            mContentContainer.getWidth() - startWidth;
+                    float actualOverflowButtonX = overflowButtonX + deltaContainerWidth;
+                    mOverflowButton.setX(actualOverflowButtonX);
+                }
+            };
+            widthAnimation.setInterpolator(mLogAccelerateInterpolator);
+            widthAnimation.setDuration(getAdjustedDuration(250));
+            heightAnimation.setInterpolator(mFastOutSlowInInterpolator);
+            heightAnimation.setDuration(getAdjustedDuration(250));
+            overflowButtonAnimation.setInterpolator(mFastOutSlowInInterpolator);
+            overflowButtonAnimation.setDuration(getAdjustedDuration(250));
             mOpenOverflowAnimation.getAnimations().clear();
-            mOpenOverflowAnimation.setAnimationListener(mOnOverflowOpened);
+            mOpenOverflowAnimation.getAnimations().clear();
             mOpenOverflowAnimation.addAnimation(widthAnimation);
             mOpenOverflowAnimation.addAnimation(heightAnimation);
+            mOpenOverflowAnimation.addAnimation(overflowButtonAnimation);
             mContentContainer.startAnimation(mOpenOverflowAnimation);
+            mIsOverflowOpen = true;
+            mMainPanel.animate()
+                    .alpha(0).withLayer()
+                    .setInterpolator(mLinearOutSlowInInterpolator)
+                    .setDuration(250)
+                    .start();
+            mOverflowPanel.setAlpha(1); // fadeIn in 0ms.
         }
 
-        /**
-         * Opens the floating toolbar overflow.
-         * This method should not be called if menu items have not been laid out with
-         * {@link #layoutMenuItems(java.util.List, MenuItem.OnMenuItemClickListener, int)}.
-         *
-         * @throws IllegalStateException if called when menu items have not been laid out.
-         */
         private void closeOverflow() {
-            Preconditions.checkState(mMainPanel != null);
-            Preconditions.checkState(mOverflowPanel != null);
-
-            mOverflowPanel.fadeOut(true);
-            Size mainPanelSize = mMainPanel.measure();
-            final int targetWidth = mainPanelSize.getWidth();
-            final int targetHeight = mainPanelSize.getHeight();
+            final int targetWidth = mMainPanelSize.getWidth();
             final int startWidth = mContentContainer.getWidth();
-            final int startHeight = mContentContainer.getHeight();
-            final float bottom = mContentContainer.getY() + mContentContainer.getHeight();
-            final boolean morphedUpwards = (mOverflowDirection == OVERFLOW_DIRECTION_UP);
             final float left = mContentContainer.getX();
             final float right = left + mContentContainer.getWidth();
             Animation widthAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
-                    ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
                     int deltaWidth = (int) (interpolatedTime * (targetWidth - startWidth));
-                    params.width = startWidth + deltaWidth;
-                    mContentContainer.setLayoutParams(params);
+                    setWidth(mContentContainer, startWidth + deltaWidth);
                     if (isRTL()) {
                         mContentContainer.setX(left);
+
+                        // Lock the panels in place.
+                        mMainPanel.setX(0);
+                        mOverflowPanel.setX(0);
                     } else {
                         mContentContainer.setX(right - mContentContainer.getWidth());
+
+                        // Offset the panels' positions so they look like they're locked in place
+                        // on the screen.
+                        mMainPanel.setX(mContentContainer.getWidth() - targetWidth);
+                        mOverflowPanel.setX(mContentContainer.getWidth() - startWidth);
                     }
                 }
             };
+            final int targetHeight = mMainPanelSize.getHeight();
+            final int startHeight = mContentContainer.getHeight();
+            final float bottom = mContentContainer.getY() + mContentContainer.getHeight();
             Animation heightAnimation = new Animation() {
                 @Override
                 protected void applyTransformation(float interpolatedTime, Transformation t) {
-                    ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
                     int deltaHeight = (int) (interpolatedTime * (targetHeight - startHeight));
-                    params.height = startHeight + deltaHeight;
-                    mContentContainer.setLayoutParams(params);
-                    if (morphedUpwards) {
+                    setHeight(mContentContainer, startHeight + deltaHeight);
+                    if (mOpenOverflowUpwards) {
                         mContentContainer.setY(bottom - mContentContainer.getHeight());
+                        positionContentYCoordinatesIfOpeningOverflowUpwards();
                     }
                 }
             };
-            widthAnimation.setDuration(150);
-            widthAnimation.setStartOffset(150);
-            heightAnimation.setDuration(210);
+            final float overflowButtonStartX = mOverflowButton.getX();
+            final float overflowButtonTargetX = isRTL() ?
+                    overflowButtonStartX - startWidth + mOverflowButton.getWidth() :
+                    overflowButtonStartX + startWidth - mOverflowButton.getWidth();
+            Animation overflowButtonAnimation = new Animation() {
+                @Override
+                protected void applyTransformation(float interpolatedTime, Transformation t) {
+                    float overflowButtonX = overflowButtonStartX
+                            + interpolatedTime * (overflowButtonTargetX - overflowButtonStartX);
+                    float deltaContainerWidth = isRTL() ?
+                            0 :
+                            mContentContainer.getWidth() - startWidth;
+                    float actualOverflowButtonX = overflowButtonX + deltaContainerWidth;
+                    mOverflowButton.setX(actualOverflowButtonX);
+                }
+            };
+            widthAnimation.setInterpolator(mFastOutSlowInInterpolator);
+            widthAnimation.setDuration(getAdjustedDuration(250));
+            heightAnimation.setInterpolator(mLogAccelerateInterpolator);
+            heightAnimation.setDuration(getAdjustedDuration(250));
+            overflowButtonAnimation.setInterpolator(mFastOutSlowInInterpolator);
+            overflowButtonAnimation.setDuration(getAdjustedDuration(250));
             mCloseOverflowAnimation.getAnimations().clear();
-            mCloseOverflowAnimation.setAnimationListener(mOnOverflowClosed);
             mCloseOverflowAnimation.addAnimation(widthAnimation);
             mCloseOverflowAnimation.addAnimation(heightAnimation);
+            mCloseOverflowAnimation.addAnimation(overflowButtonAnimation);
             mContentContainer.startAnimation(mCloseOverflowAnimation);
+            mIsOverflowOpen = false;
+            mMainPanel.animate()
+                    .alpha(1).withLayer()
+                    .setInterpolator(mFastOutLinearInInterpolator)
+                    .setDuration(100)
+                    .start();
+            mOverflowPanel.animate()
+                    .alpha(0).withLayer()
+                    .setInterpolator(mLinearOutSlowInInterpolator)
+                    .setDuration(150)
+                    .start();
         }
 
-        /**
-         * Prepares the content container for show and update calls.
-         */
-        private void preparePopupContent() {
-            // Reset visibility.
-            if (mMainPanel != null) {
-                mMainPanel.fadeIn(false);
-            }
-            if (mOverflowPanel != null) {
-                mOverflowPanel.fadeIn(false);
-            }
+        private void setPanelsStatesAtRestingPosition() {
+            mOverflowButton.setEnabled(true);
 
-            // Reset position.
-            if (isMainPanelContent()) {
-                positionMainPanel();
-            }
-            if (isOverflowPanelContent()) {
-                positionOverflowPanel();
-            }
-        }
+            if (mIsOverflowOpen) {
+                // Set open state.
+                final Size containerSize = mOverflowPanelSize;
+                setSize(mContentContainer, containerSize);
+                mMainPanel.setAlpha(0);
+                mOverflowPanel.setAlpha(1);
+                mOverflowButton.setImageDrawable(mArrow);
 
-        private boolean isMainPanelContent() {
-            return mMainPanel != null
-                    && mContentContainer.getChildAt(0) == mMainPanel.getView();
-        }
+                // Update x-coordinates depending on RTL state.
+                if (isRTL()) {
+                    mContentContainer.setX(mMarginHorizontal);  // align left
+                    mMainPanel.setX(0);  // align left
+                    mOverflowButton.setX(  // align right
+                            containerSize.getWidth() - mOverflowButtonSize.getWidth());
+                    mOverflowPanel.setX(0);  // align left
+                } else {
+                    mContentContainer.setX(  // align right
+                            mMarginHorizontal +
+                                    mMainPanelSize.getWidth() - containerSize.getWidth());
+                    mMainPanel.setX(-mContentContainer.getX());  // align right
+                    mOverflowButton.setX(0);  // align left
+                    mOverflowPanel.setX(0);  // align left
+                }
 
-        private boolean isOverflowPanelContent() {
-            return mOverflowPanel != null
-                    && mContentContainer.getChildAt(0) == mOverflowPanel.getView();
-        }
-
-        /**
-         * Sets the current content to be the main view panel.
-         */
-        private void setMainPanelAsContent() {
-            // This should never be called if the main panel has not been initialized.
-            Preconditions.checkNotNull(mMainPanel);
-            mContentContainer.removeAllViews();
-            Size mainPanelSize = mMainPanel.measure();
-            ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
-            params.width = mainPanelSize.getWidth();
-            params.height = mainPanelSize.getHeight();
-            mContentContainer.setLayoutParams(params);
-            mContentContainer.addView(mMainPanel.getView());
-            setContentAreaAsTouchableSurface();
-        }
-
-        /**
-         * Sets the current content to be the overflow view panel.
-         */
-        private void setOverflowPanelAsContent() {
-            // This should never be called if the overflow panel has not been initialized.
-            Preconditions.checkNotNull(mOverflowPanel);
-            mContentContainer.removeAllViews();
-            Size overflowPanelSize = mOverflowPanel.measure();
-            ViewGroup.LayoutParams params = mContentContainer.getLayoutParams();
-            params.width = overflowPanelSize.getWidth();
-            params.height = overflowPanelSize.getHeight();
-            mContentContainer.setLayoutParams(params);
-            mContentContainer.addView(mOverflowPanel.getView());
-            setContentAreaAsTouchableSurface();
-        }
-
-        /**
-         * Places the main view panel at the appropriate resting coordinates.
-         */
-        private void positionMainPanel() {
-            Preconditions.checkNotNull(mMainPanel);
-            mContentContainer.setX(mMarginHorizontal);
-
-            float y = mMarginVertical;
-            if  (mOverflowDirection == OVERFLOW_DIRECTION_UP) {
-                y = getHeight()
-                        - (mMainPanel.getView().getMeasuredHeight() + mMarginVertical);
-            }
-            mContentContainer.setY(y);
-            setContentAreaAsTouchableSurface();
-        }
-
-        /**
-         * Places the main view panel at the appropriate resting coordinates.
-         */
-        private void positionOverflowPanel() {
-            Preconditions.checkNotNull(mOverflowPanel);
-            float x;
-            if (isRTL()) {
-                x = mMarginHorizontal;
+                // Update y-coordinates depending on overflow's open direction.
+                if (mOpenOverflowUpwards) {
+                    mContentContainer.setY(mMarginVertical);  // align top
+                    mMainPanel.setY(  // align bottom
+                            containerSize.getHeight() - mContentContainer.getHeight());
+                    mOverflowButton.setY(  // align bottom
+                            containerSize.getHeight() - mOverflowButtonSize.getHeight());
+                    mOverflowPanel.setY(0);  // align top
+                } else {
+                    // opens downwards.
+                    mContentContainer.setY(mMarginVertical);  // align top
+                    mMainPanel.setY(0);  // align top
+                    mOverflowButton.setY(0);  // align top
+                    mOverflowPanel.setY(mOverflowButtonSize.getHeight());  // align bottom
+                }
             } else {
-                x = mPopupWindow.getWidth()
-                    - (mOverflowPanel.getView().getMeasuredWidth() + mMarginHorizontal);
+                if (hasOverflow()) {
+                    // overflow not open. Set closed state.
+                    final Size containerSize = mMainPanelSize;
+                    setSize(mContentContainer, containerSize);
+                    mMainPanel.setAlpha(1);
+                    mOverflowPanel.setAlpha(0);
+                    mOverflowButton.setImageDrawable(mOverflow);
+
+                    // Update x-coordinates depending on RTL state.
+                    if (isRTL()) {
+                        mContentContainer.setX(mMarginHorizontal);  // align left
+                        mMainPanel.setX(0);  // align left
+                        mOverflowButton.setX(0);  // align left
+                        mOverflowPanel.setX(0);  // align left
+                    } else {
+                        mContentContainer.setX(mMarginHorizontal);  // align left
+                        mMainPanel.setX(0);  // align left
+                        mOverflowButton.setX(  // align right
+                                containerSize.getWidth() - mOverflowButtonSize.getWidth());
+                        mOverflowPanel.setX(  // align right
+                                containerSize.getWidth() - mOverflowPanelSize.getWidth());
+                    }
+
+                    // Update y-coordinates depending on overflow's open direction.
+                    if (mOpenOverflowUpwards) {
+                        mContentContainer.setY(  // align bottom
+                                mMarginVertical +
+                                        mOverflowPanelSize.getHeight() - containerSize.getHeight());
+                        mMainPanel.setY(0);  // align top
+                        mOverflowButton.setY(0);  // align top
+                        mOverflowPanel.setY(  // align bottom
+                                containerSize.getHeight() - mOverflowPanelSize.getHeight());
+                    } else {
+                        // opens downwards.
+                        mContentContainer.setY(mMarginVertical);  // align top
+                        mMainPanel.setY(0);  // align top
+                        mOverflowButton.setY(0);  // align top
+                        mOverflowPanel.setY(mOverflowButtonSize.getHeight());  // align bottom
+                    }
+                } else {
+                    mContentContainer.setX(mMarginHorizontal);
+                    mContentContainer.setY(mMarginVertical);
+                }
             }
-            mContentContainer.setX(x);
-            mContentContainer.setY(mMarginVertical);
-            setContentAreaAsTouchableSurface();
         }
 
-        private void updateOverflowHeight(int height) {
-            if (mOverflowPanel != null) {
-                mOverflowPanel.setSuggestedHeight(height);
-
-                // Re-measure the popup and it's contents.
-                boolean mainPanelContent = isMainPanelContent();
-                boolean overflowPanelContent = isOverflowPanelContent();
-                mContentContainer.removeAllViews();  // required to update popup size.
+        private void updateOverflowHeight(int suggestedHeight) {
+            if (hasOverflow()) {
+                final int maxItemSize = (suggestedHeight - mOverflowButtonSize.getHeight()) /
+                        getLineHeight(mContext);
+                final int newHeight = calculateOverflowHeight(maxItemSize);
+                if (mOverflowPanelSize.getHeight() != newHeight) {
+                    mOverflowPanelSize = new Size(mOverflowPanelSize.getWidth(), newHeight);
+                }
+                setSize(mOverflowPanel, mOverflowPanelSize);
+                if (mIsOverflowOpen) {
+                    setSize(mContentContainer, mOverflowPanelSize);
+                    if (mOpenOverflowUpwards) {
+                        final int deltaHeight = mOverflowPanelSize.getHeight() - newHeight;
+                        mContentContainer.setY(mContentContainer.getY() + deltaHeight);
+                        mOverflowButton.setY(mOverflowButton.getY() - deltaHeight);
+                    }
+                } else {
+                    setSize(mContentContainer, mMainPanelSize);
+                }
                 updatePopupSize();
-                // Reset the appropriate content.
-                if (mainPanelContent) {
-                    setMainPanelAsContent();
-                }
-                if (overflowPanelContent) {
-                    setOverflowPanelAsContent();
-                }
             }
         }
 
         private void updatePopupSize() {
             int width = 0;
             int height = 0;
-            if (mMainPanel != null) {
-                Size mainPanelSize = mMainPanel.measure();
-                width = mainPanelSize.getWidth();
-                height = mainPanelSize.getHeight();
+            if (mMainPanelSize != null) {
+                width = Math.max(width, mMainPanelSize.getWidth());
+                height = Math.max(height, mMainPanelSize.getHeight());
             }
-            if (mOverflowPanel != null) {
-                Size overflowPanelSize = mOverflowPanel.measure();
-                width = Math.max(width, overflowPanelSize.getWidth());
-                height = Math.max(height, overflowPanelSize.getHeight());
+            if (mOverflowPanelSize != null) {
+                width = Math.max(width, mOverflowPanelSize.getWidth());
+                height = Math.max(height, mOverflowPanelSize.getHeight());
             }
             mPopupWindow.setWidth(width + mMarginHorizontal * 2);
             mPopupWindow.setHeight(height + mMarginVertical * 2);
+            maybeComputeTransitionDurationScale();
         }
 
-
         private void refreshViewPort() {
             mParent.getWindowVisibleDisplayFrame(mViewPortOnScreen);
         }
@@ -947,7 +1014,7 @@
             return !mTmpRect.equals(mViewPortOnScreen);
         }
 
-        private int getToolbarWidth(int suggestedWidth) {
+        private int getAdjustedToolbarWidth(int suggestedWidth) {
             int width = suggestedWidth;
             refreshViewPort();
             int maximumWidth = mViewPortOnScreen.width() - 2 * mParent.getResources()
@@ -971,11 +1038,17 @@
          * Sets the touchable region of this popup to be the area occupied by its content.
          */
         private void setContentAreaAsTouchableSurface() {
-            if (!mPopupWindow.isShowing()) {
-                mContentContainer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
+            Preconditions.checkNotNull(mMainPanelSize);
+            final int width;
+            final int height;
+            if (mIsOverflowOpen) {
+                Preconditions.checkNotNull(mOverflowPanelSize);
+                width = mOverflowPanelSize.getWidth();
+                height = mOverflowPanelSize.getHeight();
+            } else {
+                width = mMainPanelSize.getWidth();
+                height = mMainPanelSize.getHeight();
             }
-            int width = mContentContainer.getMeasuredWidth();
-            int height = mContentContainer.getMeasuredHeight();
             mTouchableRegion.set(
                     (int) mContentContainer.getX(),
                     (int) mContentContainer.getY(),
@@ -997,45 +1070,12 @@
         }
 
         private boolean isRTL() {
-            return mContentContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
+            return mContext.getResources().getConfiguration().getLayoutDirection()
+                    == View.LAYOUT_DIRECTION_RTL;
         }
-    }
 
-    /**
-     * A widget that holds the primary menu items in the floating toolbar.
-     */
-    private static final class FloatingToolbarMainPanel {
-
-        private final Context mContext;
-        private final ViewGroup mContentView;
-        private final View.OnClickListener mMenuItemButtonOnClickListener =
-                new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        if (v.getTag() instanceof MenuItem) {
-                            if (mOnMenuItemClickListener != null) {
-                                mOnMenuItemClickListener.onMenuItemClick((MenuItem) v.getTag());
-                            }
-                        }
-                    }
-                };
-        private final ViewFader viewFader;
-        private final Runnable mOpenOverflow;
-
-        private View mOpenOverflowButton;
-        private MenuItem.OnMenuItemClickListener mOnMenuItemClickListener;
-
-        /**
-         * Initializes a floating toolbar popup main view panel.
-         *
-         * @param context
-         * @param openOverflow  The code that opens the toolbar popup overflow.
-         */
-        public FloatingToolbarMainPanel(Context context, Runnable openOverflow) {
-            mContext = Preconditions.checkNotNull(context);
-            mContentView = new LinearLayout(context);
-            viewFader = new ViewFader(mContentView);
-            mOpenOverflow = Preconditions.checkNotNull(openOverflow);
+        private boolean hasOverflow() {
+            return mOverflowPanelSize != null;
         }
 
         /**
@@ -1044,16 +1084,14 @@
          *
          * @return The menu items that are not included in this main panel.
          */
-        public List<MenuItem> layoutMenuItems(List<MenuItem> menuItems, int width) {
+        public List<MenuItem> layoutMainPanelItems(
+                List<MenuItem> menuItems, final int toolbarWidth) {
             Preconditions.checkNotNull(menuItems);
 
-            // Reserve space for the "open overflow" button.
-            final int toolbarWidth = width - getEstimatedOpenOverflowButtonWidth(mContext);
-
             int availableWidth = toolbarWidth;
             final LinkedList<MenuItem> remainingMenuItems = new LinkedList<MenuItem>(menuItems);
 
-            mContentView.removeAllViews();
+            mMainPanel.removeAllViews();
 
             boolean isFirstItem = true;
             while (!remainingMenuItems.isEmpty()) {
@@ -1081,59 +1119,119 @@
 
                 menuItemButton.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
                 int menuItemButtonWidth = Math.min(menuItemButton.getMeasuredWidth(), toolbarWidth);
-                if (menuItemButtonWidth <= availableWidth) {
+                // Check if we can fit an item while reserving space for the overflowButton.
+                boolean canFitWithOverflow =
+                        menuItemButtonWidth <= availableWidth - mOverflowButtonSize.getWidth();
+                boolean canFitNoOverflow =
+                        remainingMenuItems.size() == 1 && menuItemButtonWidth <= availableWidth;
+                if (canFitWithOverflow || canFitNoOverflow) {
                     setButtonTagAndClickListener(menuItemButton, menuItem);
-                    mContentView.addView(menuItemButton);
+                    mMainPanel.addView(menuItemButton);
                     ViewGroup.LayoutParams params = menuItemButton.getLayoutParams();
                     params.width = menuItemButtonWidth;
                     menuItemButton.setLayoutParams(params);
                     availableWidth -= menuItemButtonWidth;
                     remainingMenuItems.pop();
                 } else {
-                    if (mOpenOverflowButton == null) {
-                        mOpenOverflowButton = LayoutInflater.from(mContext)
-                                .inflate(R.layout.floating_popup_open_overflow_button, null);
-                        mOpenOverflowButton.setOnClickListener(new View.OnClickListener() {
-                            @Override
-                            public void onClick(View v) {
-                                if (mOpenOverflowButton != null) {
-                                    mOpenOverflow.run();
-                                }
-                            }
-                        });
-                    }
-                    mContentView.addView(mOpenOverflowButton);
+                    // Reserve space for overflowButton.
+                    mMainPanel.setPaddingRelative(0, 0, mOverflowButtonSize.getWidth(), 0);
                     break;
                 }
             }
+            mMainPanelSize = measure(mMainPanel);
             return remainingMenuItems;
         }
 
-        public void setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener listener) {
-            mOnMenuItemClickListener = listener;
-        }
+        private void layoutOverflowPanelItems(List<MenuItem> menuItems) {
+            ArrayAdapter<MenuItem> overflowPanelAdapter =
+                    (ArrayAdapter<MenuItem>) mOverflowPanel.getAdapter();
+            overflowPanelAdapter.clear();
+            final int size = menuItems.size();
+            for (int i = 0; i < size; i++) {
+                overflowPanelAdapter.add(menuItems.get(i));
+            }
+            mOverflowPanel.setAdapter(overflowPanelAdapter);
+            if (mOpenOverflowUpwards) {
+                mOverflowPanel.setY(0);
+            } else {
+                mOverflowPanel.setY(mOverflowButtonSize.getHeight());
+            }
 
-        public View getView() {
-            return mContentView;
-        }
-
-        public void fadeIn(boolean animate) {
-            viewFader.fadeIn(animate);
-        }
-
-        public void fadeOut(boolean animate) {
-            viewFader.fadeOut(animate);
+            int width = Math.max(getOverflowWidth(), mOverflowButtonSize.getWidth());
+            int height = calculateOverflowHeight(MAX_OVERFLOW_SIZE);
+            mOverflowPanelSize = new Size(width, height);
+            setSize(mOverflowPanel, mOverflowPanelSize);
         }
 
         /**
-         * Returns how big this panel's view should be.
-         * This method should only be called when the view has not been attached to a parent
-         * otherwise it will throw an illegal state.
+         * Resets the content container and appropriately position it's panels.
          */
-        public Size measure() throws IllegalStateException {
-            Preconditions.checkState(mContentView.getParent() == null);
-            mContentView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
-            return new Size(mContentView.getMeasuredWidth(), mContentView.getMeasuredHeight());
+        private void preparePopupContent() {
+            mContentContainer.removeAllViews();
+
+            // Add views in the specified order so they stack up as expected.
+            // Order: overflowPanel, mainPanel, overflowButton.
+            if (hasOverflow()) {
+                mContentContainer.addView(mOverflowPanel);
+            }
+            mContentContainer.addView(mMainPanel);
+            if (hasOverflow()) {
+                mContentContainer.addView(mOverflowButton);
+            }
+            setPanelsStatesAtRestingPosition();
+            setContentAreaAsTouchableSurface();
+
+            // The positioning of contents in RTL is wrong when the view is first rendered.
+            // Hide the view and post a runnable to recalculate positions and render the view.
+            // TODO: Investigate why this happens and fix.
+            if (isRTL()) {
+                mContentContainer.setAlpha(0);
+                mContentContainer.post(mPreparePopupContentRTLHelper);
+            }
+        }
+
+        /**
+         * Clears out the panels and their container. Resets their calculated sizes.
+         */
+        private void clearPanels() {
+            mOverflowPanelSize = null;
+            mMainPanelSize = null;
+            mIsOverflowOpen = false;
+            mMainPanel.removeAllViews();
+            ArrayAdapter<MenuItem> overflowPanelAdapter =
+                    (ArrayAdapter<MenuItem>) mOverflowPanel.getAdapter();
+            overflowPanelAdapter.clear();
+            mOverflowPanel.setAdapter(overflowPanelAdapter);
+            mContentContainer.removeAllViews();
+        }
+
+        private void positionContentYCoordinatesIfOpeningOverflowUpwards() {
+            if (mOpenOverflowUpwards) {
+                mMainPanel.setY(mContentContainer.getHeight() - mMainPanelSize.getHeight());
+                mOverflowButton.setY(mContentContainer.getHeight() - mOverflowButton.getHeight());
+                mOverflowPanel.setY(mContentContainer.getHeight() - mOverflowPanelSize.getHeight());
+            }
+        }
+
+        private int getOverflowWidth() {
+            int overflowWidth = 0;
+            final int count = mOverflowPanel.getAdapter().getCount();
+            for (int i = 0; i < count; i++) {
+                MenuItem menuItem = (MenuItem) mOverflowPanel.getAdapter().getItem(i);
+                overflowWidth =
+                        Math.max(mOverflowPanelViewHelper.calculateWidth(menuItem), overflowWidth);
+            }
+            return overflowWidth;
+        }
+
+        private int calculateOverflowHeight(int maxItemSize) {
+            // Maximum of 4 items, minimum of 2 if the overflow has to scroll.
+            int actualSize = Math.min(
+                    MAX_OVERFLOW_SIZE,
+                    Math.min(
+                            Math.max(MIN_OVERFLOW_SIZE, maxItemSize),
+                            mOverflowPanel.getCount()));
+            return actualSize * getLineHeight(mContext) + mOverflowButtonSize.getHeight();
         }
 
         private void setButtonTagAndClickListener(View menuItemButton, MenuItem menuItem) {
@@ -1144,281 +1242,326 @@
             button.setTag(menuItem);
             button.setOnClickListener(mMenuItemButtonOnClickListener);
         }
-    }
-
-
-    /**
-     * A widget that holds the overflow items in the floating toolbar.
-     */
-    private static final class FloatingToolbarOverflowPanel {
-
-        private final LinearLayout mContentView;
-        private final ViewGroup mBackButtonContainer;
-        private final View mBackButton;
-        private final ListView mListView;
-        private final TextView mListViewItemWidthCalculator;
-        private final ViewFader mViewFader;
-        private final Runnable mCloseOverflow;
-
-        private MenuItem.OnMenuItemClickListener mOnMenuItemClickListener;
-        private int mOverflowWidth;
-        private int mSuggestedHeight;
 
         /**
-         * Initializes a floating toolbar popup overflow view panel.
-         *
-         * @param context
-         * @param closeOverflow  The code that closes the toolbar popup's overflow.
+         * NOTE: Use only in android.view.animation.* animations. Do not use in android.animation.*
+         * animations. See comment about this in the code.
          */
-        public FloatingToolbarOverflowPanel(Context context, Runnable closeOverflow) {
-            mCloseOverflow = Preconditions.checkNotNull(closeOverflow);
+        private int getAdjustedDuration(int originalDuration) {
+            if (mTransitionDurationScale < 150) {
+                // For smaller transition, decrease the time.
+                return Math.max(originalDuration - 50, 0);
+            } else if (mTransitionDurationScale > 300) {
+                // For bigger transition, increase the time.
+                return originalDuration + 50;
+            }
 
-            mContentView = new LinearLayout(context);
-            mContentView.setOrientation(LinearLayout.VERTICAL);
-            mViewFader = new ViewFader(mContentView);
+            // Scale the animation duration with getDurationScale(). This allows
+            // android.view.animation.* animations to scale just like android.animation.* animations
+            // when  animator duration scale is adjusted in "Developer Options".
+            // For this reason, do not use this method for android.animation.* animations.
+            return (int) (originalDuration * ValueAnimator.getDurationScale());
+        }
 
-            mBackButton = LayoutInflater.from(context)
-                    .inflate(R.layout.floating_popup_close_overflow_button, null);
-            mBackButton.setOnClickListener(new View.OnClickListener() {
+        private void maybeComputeTransitionDurationScale() {
+            if (mMainPanelSize == null || mOverflowPanel == null) {
+                int w = mMainPanelSize.getWidth() - mOverflowPanelSize.getWidth();
+                int h = mOverflowPanelSize.getHeight() - mMainPanelSize.getHeight();
+                mTransitionDurationScale = (int) (Math.sqrt(w * w + h * h) /
+                        mContentContainer.getContext().getResources().getDisplayMetrics().density);
+            }
+        }
+
+        private ViewGroup createMainPanel() {
+            ViewGroup mainPanel = new LinearLayout(mContext) {
+                @Override
+                protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+                    if (isOverflowAnimating()) {
+                        // Update widthMeasureSpec to make sure that this view is not clipped
+                        // as we offset it's coordinates with respect to it's parent.
+                        widthMeasureSpec = MeasureSpec.makeMeasureSpec(
+                                mMainPanelSize.getWidth(),
+                                MeasureSpec.EXACTLY);
+                    }
+                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+                }
+
+                @Override
+                public boolean onInterceptTouchEvent(MotionEvent ev) {
+                    // Intercept the touch event while the overflow is animating.
+                    return isOverflowAnimating();
+                }
+            };
+            return mainPanel;
+        }
+
+        private ImageButton createOverflowButton() {
+            final ImageButton overflowButton = (ImageButton) LayoutInflater.from(mContext)
+                    .inflate(R.layout.floating_popup_overflow_button, null);
+            overflowButton.setImageDrawable(mOverflow);
+            overflowButton.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    mCloseOverflow.run();
+                    final Drawable drawable = overflowButton.getDrawable();
+                    if (mIsOverflowOpen) {
+                        overflowButton.setImageDrawable(mToOverflow);
+                        mToOverflow.start();
+                        closeOverflow();
+                    } else {
+                        overflowButton.setImageDrawable(mToArrow);
+                        mToArrow.start();
+                        openOverflow();
+                    }
+                    overflowButton.postDelayed(
+                            mResetOverflowButtonDrawable, OVERFLOW_BUTTON_ANIMATION_DELAY);
                 }
             });
-            mBackButtonContainer = new LinearLayout(context);
-            mBackButtonContainer.addView(mBackButton);
+            return overflowButton;
+        }
 
-            mListView = createOverflowListView();
-            mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+        private ListView createOverflowPanel() {
+            final ListView overflowPanel = new ListView(FloatingToolbarPopup.this.mContext) {
+                @Override
+                protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+                    // Update heightMeasureSpec to make sure that this view is not clipped
+                    // as we offset it's coordinates with respect to it's parent.
+                    heightMeasureSpec = MeasureSpec.makeMeasureSpec(
+                            mOverflowPanelSize.getHeight() - mOverflowButtonSize.getHeight(),
+                            MeasureSpec.EXACTLY);
+                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+                }
+
+                @Override
+                public boolean dispatchTouchEvent(MotionEvent ev) {
+                    if (isOverflowAnimating()) {
+                        // Eat the touch event.
+                        return true;
+                    }
+                    return super.dispatchTouchEvent(ev);
+                }
+            };
+            overflowPanel.setLayoutParams(new ViewGroup.LayoutParams(
+                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+            overflowPanel.setDivider(null);
+            overflowPanel.setDividerHeight(0);
+
+            final ArrayAdapter adapter =
+                    new ArrayAdapter<MenuItem>(mContext, 0) {
+                        @Override
+                        public int getViewTypeCount() {
+                            return mOverflowPanelViewHelper.getViewTypeCount();
+                        }
+
+                        @Override
+                        public int getItemViewType(int position) {
+                            return mOverflowPanelViewHelper.getItemViewType(getItem(position));
+                        }
+
+                        @Override
+                        public View getView(int position, View convertView, ViewGroup parent) {
+                            return mOverflowPanelViewHelper.getView(
+                                    getItem(position), mOverflowPanelSize.getWidth(), convertView);
+                        }
+                    };
+            overflowPanel.setAdapter(adapter);
+
+            overflowPanel.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                 @Override
                 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                    MenuItem menuItem = (MenuItem) mListView.getAdapter().getItem(position);
+                    MenuItem menuItem = (MenuItem) overflowPanel.getAdapter().getItem(position);
                     if (mOnMenuItemClickListener != null) {
                         mOnMenuItemClickListener.onMenuItemClick(menuItem);
                     }
                 }
             });
 
-            mContentView.addView(mListView);
-            mContentView.addView(mBackButtonContainer);
+            return overflowPanel;
+        }
 
-            mListViewItemWidthCalculator = createOverflowMenuItemButton(context);
-            mListViewItemWidthCalculator.setLayoutParams(new ViewGroup.LayoutParams(
-                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+        private boolean isOverflowAnimating() {
+            final boolean overflowOpening = mOpenOverflowAnimation.hasStarted()
+                    && !mOpenOverflowAnimation.hasEnded();
+            final boolean overflowClosing = mCloseOverflowAnimation.hasStarted()
+                    && !mCloseOverflowAnimation.hasEnded();
+            return overflowOpening || overflowClosing;
+        }
+
+        private Animation.AnimationListener createOverflowAnimationListener() {
+            Animation.AnimationListener listener = new Animation.AnimationListener() {
+                @Override
+                public void onAnimationStart(Animation animation) {
+                    // Disable the overflow button while it's animating.
+                    // It will be re-enabled when the animation stops.
+                    mOverflowButton.setEnabled(false);
+                }
+
+                @Override
+                public void onAnimationEnd(Animation animation) {
+                    // Posting this because it seems like this is called before the animation
+                    // actually ends.
+                    mContentContainer.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            setPanelsStatesAtRestingPosition();
+                            setContentAreaAsTouchableSurface();
+                        }
+                    });
+                }
+
+                @Override
+                public void onAnimationRepeat(Animation animation) {
+                }
+            };
+            return listener;
+        }
+
+        private static Size measure(View view) {
+            Preconditions.checkState(view.getParent() == null);
+            view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
+            return new Size(view.getMeasuredWidth(), view.getMeasuredHeight());
+        }
+
+        private static void setSize(View view, int width, int height) {
+            view.setMinimumWidth(width);
+            view.setMinimumHeight(height);
+            ViewGroup.LayoutParams params = view.getLayoutParams();
+            params = (params == null) ? new ViewGroup.LayoutParams(0, 0) : params;
+            params.width = width;
+            params.height = height;
+            view.setLayoutParams(params);
+        }
+
+        private static void setSize(View view, Size size) {
+            setSize(view, size.getWidth(), size.getHeight());
+        }
+
+        private static void setWidth(View view, int width) {
+            ViewGroup.LayoutParams params = view.getLayoutParams();
+            setSize(view, width, params.height);
+        }
+
+        private static void setHeight(View view, int height) {
+            ViewGroup.LayoutParams params = view.getLayoutParams();
+            setSize(view, params.width, height);
+        }
+
+        private static int getLineHeight(Context context) {
+            return context.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_height);
         }
 
         /**
-         * Sets the menu items to be displayed in the overflow.
+         * A custom interpolator used for various floating toolbar animations.
          */
-        public void setMenuItems(List<MenuItem> menuItems) {
-            ArrayAdapter overflowListViewAdapter = (ArrayAdapter) mListView.getAdapter();
-            overflowListViewAdapter.clear();
-            overflowListViewAdapter.addAll(menuItems);
-            setListViewHeight();
-            setOverflowWidth();
-        }
+        private static final class LogAccelerateInterpolator implements Interpolator {
 
-        public void setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener listener) {
-            mOnMenuItemClickListener = listener;
-        }
+            private static final int BASE = 100;
+            private static final float LOGS_SCALE = 1f / computeLog(1, BASE);
 
-        /**
-         * Notifies the overflow of the current direction in which the overflow will be opened.
-         *
-         * @param overflowDirection  {@link FloatingToolbarPopup#OVERFLOW_DIRECTION_UP}
-         *   or {@link FloatingToolbarPopup#OVERFLOW_DIRECTION_DOWN}.
-         */
-        public void setOverflowDirection(int overflowDirection) {
-            mContentView.removeView(mBackButtonContainer);
-            int index = (overflowDirection == FloatingToolbarPopup.OVERFLOW_DIRECTION_UP)? 1 : 0;
-            mContentView.addView(mBackButtonContainer, index);
-        }
-
-        public void setSuggestedHeight(int height) {
-            mSuggestedHeight = height;
-            setListViewHeight();
-        }
-
-        public int getMinimumHeight() {
-            return mContentView.getContext().getResources().
-                    getDimensionPixelSize(R.dimen.floating_toolbar_minimum_overflow_height)
-                    + getEstimatedToolbarHeight(mContentView.getContext());
-        }
-
-        /**
-         * Returns the content view of the overflow.
-         */
-        public View getView() {
-            return mContentView;
-        }
-
-        public void fadeIn(boolean animate) {
-            mViewFader.fadeIn(animate);
-        }
-
-        public void fadeOut(boolean animate) {
-            mViewFader.fadeOut(animate);
-        }
-
-        /**
-         * Returns how big this panel's view should be.
-         * This method should only be called when the view has not been attached to a parent.
-         *
-         * @throws IllegalStateException
-         */
-        public Size measure() {
-            Preconditions.checkState(mContentView.getParent() == null);
-            mContentView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
-            return new Size(mContentView.getMeasuredWidth(), mContentView.getMeasuredHeight());
-        }
-
-        private void setListViewHeight() {
-            int itemHeight = getEstimatedToolbarHeight(mContentView.getContext());
-            int height = mListView.getAdapter().getCount() * itemHeight;
-            int maxHeight = mContentView.getContext().getResources().
-                    getDimensionPixelSize(R.dimen.floating_toolbar_maximum_overflow_height);
-            int minHeight = mContentView.getContext().getResources().
-                    getDimensionPixelSize(R.dimen.floating_toolbar_minimum_overflow_height);
-            int suggestedListViewHeight = mSuggestedHeight - (mSuggestedHeight % itemHeight)
-                    - itemHeight;  // reserve space for the back button.
-            ViewGroup.LayoutParams params = mListView.getLayoutParams();
-            if (suggestedListViewHeight <= 0) {
-                // Invalid height. Use the maximum height available.
-                params.height = Math.min(maxHeight, height);
-            } else if (suggestedListViewHeight < minHeight) {
-                // Height is smaller than minimum allowed. Use minimum height.
-                params.height = minHeight;
-            } else {
-                // Use the suggested height. Cap it at the maximum available height.
-                params.height = Math.min(Math.min(suggestedListViewHeight, maxHeight), height);
+            private static float computeLog(float t, int base) {
+                return (float) (1 - Math.pow(base, -t));
             }
-            mListView.setLayoutParams(params);
+
+            @Override
+            public float getInterpolation(float t) {
+                return 1 - computeLog(1 - t, BASE) * LOGS_SCALE;
+            }
         }
 
-        private void setOverflowWidth() {
-            mOverflowWidth = 0;
-            for (int i = 0; i < mListView.getAdapter().getCount(); i++) {
-                MenuItem menuItem = (MenuItem) mListView.getAdapter().getItem(i);
+        /**
+         * A helper for generating views for the overflow panel.
+         */
+        private static final class OverflowPanelViewHelper {
+
+            private static final int NUM_OF_VIEW_TYPES = 2;
+            private static final int VIEW_TYPE_STRING_TITLE = 0;
+            private static final int VIEW_TYPE_ICON_ONLY = 1;
+
+            private final TextView mStringTitleViewCalculator;
+            private final View mIconOnlyViewCalculator;
+
+            private final Context mContext;
+
+            public OverflowPanelViewHelper(Context context) {
+                mContext = Preconditions.checkNotNull(context);
+                mStringTitleViewCalculator = getStringTitleView(null, 0, null);
+                mIconOnlyViewCalculator = getIconOnlyView(null, 0, null);
+            }
+
+            public int getViewTypeCount() {
+                return NUM_OF_VIEW_TYPES;
+            }
+
+            public View getView(MenuItem menuItem, int minimumWidth, View convertView) {
                 Preconditions.checkNotNull(menuItem);
-                mListViewItemWidthCalculator.setText(menuItem.getTitle());
-                mListViewItemWidthCalculator.measure(
-                        MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
-                mOverflowWidth = Math.max(
-                        mListViewItemWidthCalculator.getMeasuredWidth(), mOverflowWidth);
+                if (getItemViewType(menuItem) == VIEW_TYPE_ICON_ONLY) {
+                    return getIconOnlyView(menuItem, minimumWidth, convertView);
+                }
+                return getStringTitleView(menuItem, minimumWidth, convertView);
             }
-        }
 
-        private ListView createOverflowListView() {
-            final Context context = mContentView.getContext();
-            final ListView overflowListView = new ListView(context);
-            overflowListView.setLayoutParams(new ViewGroup.LayoutParams(
-                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
-            overflowListView.setDivider(null);
-            overflowListView.setDividerHeight(0);
-
-            final int viewTypeCount = 2;
-            final int stringLabelViewType = 0;
-            final int iconOnlyViewType = 1;
-            final ArrayAdapter overflowListViewAdapter =
-                    new ArrayAdapter<MenuItem>(context, 0) {
-                        @Override
-                        public int getViewTypeCount() {
-                            return viewTypeCount;
-                        }
-
-                        @Override
-                        public int getItemViewType(int position) {
-                            if (isIconOnlyMenuItem(getItem(position))) {
-                                return iconOnlyViewType;
-                            }
-                            return stringLabelViewType;
-                        }
-
-                        @Override
-                        public View getView(int position, View convertView, ViewGroup parent) {
-                            if (getItemViewType(position) == iconOnlyViewType) {
-                                return getIconOnlyView(position, convertView);
-                            }
-                            return getStringTitleView(position, convertView);
-                        }
-
-                        private View getStringTitleView(int position, View convertView) {
-                            TextView menuButton;
-                            if (convertView != null) {
-                                menuButton = (TextView) convertView;
-                            } else {
-                                menuButton = createOverflowMenuItemButton(context);
-                            }
-                            MenuItem menuItem = getItem(position);
-                            menuButton.setText(menuItem.getTitle());
-                            menuButton.setContentDescription(menuItem.getTitle());
-                            menuButton.setMinimumWidth(mOverflowWidth);
-                            return menuButton;
-                        }
-
-                        private View getIconOnlyView(int position, View convertView) {
-                            View menuButton;
-                            if (convertView != null) {
-                                menuButton = convertView;
-                            } else {
-                                menuButton = LayoutInflater.from(context).inflate(
-                                        R.layout.floating_popup_overflow_image_list_item, null);
-                            }
-                            MenuItem menuItem = getItem(position);
-                            ((ImageView) menuButton
-                                    .findViewById(R.id.floating_toolbar_menu_item_image_button))
-                                    .setImageDrawable(menuItem.getIcon());
-                            menuButton.setMinimumWidth(mOverflowWidth);
-                            return menuButton;
-                        }
-                    };
-            overflowListView.setAdapter(overflowListViewAdapter);
-            return overflowListView;
-        }
-    }
-
-
-    /**
-     * A helper for fading in or out a view.
-     */
-    private static final class ViewFader {
-
-        private static final int FADE_OUT_DURATION = 250;
-        private static final int FADE_IN_DURATION = 150;
-
-        private final View mView;
-        private final ObjectAnimator mFadeOutAnimation;
-        private final ObjectAnimator mFadeInAnimation;
-
-        private ViewFader(View view) {
-            mView = Preconditions.checkNotNull(view);
-            mFadeOutAnimation = ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0)
-                    .setDuration(FADE_OUT_DURATION);
-            mFadeInAnimation = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1)
-                    .setDuration(FADE_IN_DURATION);
-        }
-
-        public void fadeIn(boolean animate) {
-            cancelFadeAnimations();
-            if (animate) {
-                mFadeInAnimation.start();
-            } else {
-                mView.setAlpha(1);
+            public int getItemViewType(MenuItem menuItem) {
+                Preconditions.checkNotNull(menuItem);
+                if (isIconOnlyMenuItem(menuItem)) {
+                    return VIEW_TYPE_ICON_ONLY;
+                }
+                return VIEW_TYPE_STRING_TITLE;
             }
-        }
 
-        public void fadeOut(boolean animate) {
-            cancelFadeAnimations();
-            if (animate) {
-                mFadeOutAnimation.start();
-            } else {
-                mView.setAlpha(0);
+            public int calculateWidth(MenuItem menuItem) {
+                final View calculator;
+                if (isIconOnlyMenuItem(menuItem)) {
+                    ((ImageView) mIconOnlyViewCalculator
+                            .findViewById(R.id.floating_toolbar_menu_item_image_button))
+                            .setImageDrawable(menuItem.getIcon());
+                    calculator = mIconOnlyViewCalculator;
+                } else {
+                    mStringTitleViewCalculator.setText(menuItem.getTitle());
+                    calculator = mStringTitleViewCalculator;
+                }
+                calculator.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
+                return calculator.getMeasuredWidth();
             }
-        }
 
-        private void cancelFadeAnimations() {
-            mFadeInAnimation.cancel();
-            mFadeOutAnimation.cancel();
+            private TextView getStringTitleView(
+                    MenuItem menuItem, int minimumWidth, View convertView) {
+                TextView menuButton;
+                if (convertView != null) {
+                    menuButton = (TextView) convertView;
+                } else {
+                    menuButton = (TextView) LayoutInflater.from(mContext)
+                            .inflate(R.layout.floating_popup_overflow_list_item, null);
+                    menuButton.setLayoutParams(new ViewGroup.LayoutParams(
+                            ViewGroup.LayoutParams.MATCH_PARENT,
+                            ViewGroup.LayoutParams.WRAP_CONTENT));
+                }
+                if (menuItem != null) {
+                    menuButton.setText(menuItem.getTitle());
+                    menuButton.setContentDescription(menuItem.getTitle());
+                    menuButton.setMinimumWidth(minimumWidth);
+                }
+                return menuButton;
+            }
+
+            private View getIconOnlyView(
+                    MenuItem menuItem, int minimumWidth, View convertView) {
+                View menuButton;
+                if (convertView != null) {
+                    menuButton = convertView;
+                } else {
+                    menuButton = LayoutInflater.from(mContext).inflate(
+                            R.layout.floating_popup_overflow_image_list_item, null);
+                    menuButton.setLayoutParams(new ViewGroup.LayoutParams(
+                            ViewGroup.LayoutParams.WRAP_CONTENT,
+                            ViewGroup.LayoutParams.WRAP_CONTENT));
+                }
+                if (menuItem != null) {
+                    ((ImageView) menuButton
+                            .findViewById(R.id.floating_toolbar_menu_item_image_button))
+                            .setImageDrawable(menuItem.getIcon());
+                    menuButton.setMinimumWidth(minimumWidth);
+                }
+                return menuButton;
+            }
         }
     }
 
@@ -1453,14 +1596,6 @@
         return menuItemButton;
     }
 
-    /**
-     * Creates and returns a styled floating toolbar overflow list view item.
-     */
-    private static TextView createOverflowMenuItemButton(Context context) {
-        return (TextView) LayoutInflater.from(context)
-                .inflate(R.layout.floating_popup_overflow_list_item, null);
-    }
-
     private static ViewGroup createContentContainer(Context context) {
         ViewGroup contentContainer = (ViewGroup) LayoutInflater.from(context)
                 .inflate(R.layout.floating_popup_container, null);
@@ -1468,7 +1603,7 @@
         return contentContainer;
     }
 
-    private static PopupWindow createPopupWindow(View content) {
+    private static PopupWindow createPopupWindow(ViewGroup content) {
         ViewGroup popupContentHolder = new LinearLayout(content.getContext());
         PopupWindow popupWindow = new PopupWindow(popupContentHolder);
         // TODO: Use .setLayoutInScreenEnabled(true) instead of .setClippingEnabled(false)
@@ -1490,11 +1625,9 @@
      * @param view  The view to animate
      */
     private static AnimatorSet createEnterAnimation(View view) {
-        AnimatorSet animation =  new AnimatorSet();
+        AnimatorSet animation = new AnimatorSet();
         animation.playTogether(
-                ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(150),
-                // Make sure that view.x is always fixed throughout the duration of this animation.
-                ObjectAnimator.ofFloat(view, View.X, view.getX(), view.getX()));
+                ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(150));
         return animation;
     }
 
@@ -1525,13 +1658,4 @@
         a.recycle();
         return new ContextThemeWrapper(originalContext, themeId);
     }
-
-    private static int getEstimatedToolbarHeight(Context context) {
-        return context.getResources().getDimensionPixelSize(R.dimen.floating_toolbar_height);
-    }
-
-    private static int getEstimatedOpenOverflowButtonWidth(Context context) {
-        return context.getResources()
-                .getDimensionPixelSize(R.dimen.floating_toolbar_menu_button_minimum_width);
-    }
-}
+}
\ No newline at end of file
diff --git a/core/java/com/android/internal/widget/ImageFloatingTextView.java b/core/java/com/android/internal/widget/ImageFloatingTextView.java
new file mode 100644
index 0000000..c4ed2e1
--- /dev/null
+++ b/core/java/com/android/internal/widget/ImageFloatingTextView.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.internal.widget;
+
+import android.annotation.Nullable;
+import android.content.Context;
+import android.text.BoringLayout;
+import android.text.Layout;
+import android.text.StaticLayout;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.RemotableViewMethod;
+import android.widget.RemoteViews;
+import android.widget.TextView;
+
+/**
+ * A TextView that can float around an image on the end.
+ *
+ * @hide
+ */
+@RemoteViews.RemoteView
+public class ImageFloatingTextView extends TextView {
+
+    private boolean mHasImage;
+
+    public ImageFloatingTextView(Context context) {
+        this(context, null);
+    }
+
+    public ImageFloatingTextView(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ImageFloatingTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        this(context, attrs, defStyleAttr, 0);
+    }
+
+    public ImageFloatingTextView(Context context, AttributeSet attrs, int defStyleAttr,
+            int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+    }
+
+    @Override
+    protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth,
+            Layout.Alignment alignment, boolean shouldEllipsize,
+            TextUtils.TruncateAt effectiveEllipsize, boolean useSaved) {
+        CharSequence text = getText() == null ? "" : getText();
+        StaticLayout.Builder builder = StaticLayout.Builder.obtain(text, 0, text.length(),
+                getPaint(), wantWidth)
+                .setAlignment(alignment)
+                .setTextDirection(getTextDirectionHeuristic())
+                .setLineSpacing(getLineSpacingExtra(), getLineSpacingMultiplier())
+                .setIncludePad(getIncludeFontPadding())
+                .setBreakStrategy(Layout.BREAK_STRATEGY_HIGH_QUALITY)
+                .setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
+        // we set the endmargin on the first 2 lines. this works just in our case but that's
+        // sufficient for now.
+        int endMargin = (int) (getResources().getDisplayMetrics().density * 52);
+        int[] margins = mHasImage ? new int[] {endMargin, endMargin, 0} : null;
+        if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
+            builder.setIndents(margins, null);
+        } else {
+            builder.setIndents(null, margins);
+        }
+
+        return builder.build();
+    }
+
+    @RemotableViewMethod
+    public void setHasImage(boolean hasImage) {
+        mHasImage = hasImage;
+        // The new layout will be automatically created when the text is
+        // set again by the notification.
+    }
+}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 889c7b3..6c223c3 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -1270,6 +1270,10 @@
         }
     }
 
+    public static boolean isSeparateWorkChallengeEnabled() {
+        return StorageManager.isFileBasedEncryptionEnabled();
+    }
+
     public void registerStrongAuthTracker(final StrongAuthTracker strongAuthTracker) {
         try {
             getLockSettings().registerStrongAuthTracker(strongAuthTracker.mStub);
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 4d648ce..f1e7afb 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -93,6 +93,7 @@
     android_util_Process.cpp \
     android_util_StringBlock.cpp \
     android_util_XmlBlock.cpp \
+    android_util_jar_StrictJarFile.cpp \
     android_graphics_Canvas.cpp \
     android_graphics_Picture.cpp \
     android/graphics/AutoDecodeCancel.cpp \
@@ -198,7 +199,6 @@
     external/sqlite/android \
     external/expat/lib \
     external/tremor/Tremor \
-    external/jpeg \
     external/harfbuzz_ng/src \
     libcore/include \
     $(call include-path-for, audio-utils) \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index bd41c5d..f6f45b5 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -176,6 +176,7 @@
 extern int register_android_app_ActivityThread(JNIEnv *env);
 extern int register_android_app_NativeActivity(JNIEnv *env);
 extern int register_android_media_RemoteDisplay(JNIEnv *env);
+extern int register_android_util_jar_StrictJarFile(JNIEnv* env);
 extern int register_android_view_InputChannel(JNIEnv* env);
 extern int register_android_view_InputDevice(JNIEnv* env);
 extern int register_android_view_InputEventReceiver(JNIEnv* env);
@@ -1359,6 +1360,7 @@
     REG_JNI(register_android_app_backup_FullBackup),
     REG_JNI(register_android_app_ActivityThread),
     REG_JNI(register_android_app_NativeActivity),
+    REG_JNI(register_android_util_jar_StrictJarFile),
     REG_JNI(register_android_view_InputChannel),
     REG_JNI(register_android_view_InputEventReceiver),
     REG_JNI(register_android_view_InputEventSender),
@@ -1374,6 +1376,8 @@
     REG_JNI(register_android_animation_PropertyValuesHolder),
     REG_JNI(register_com_android_internal_content_NativeLibraryHelper),
     REG_JNI(register_com_android_internal_net_NetworkStatsFactory),
+
+
 };
 
 /*
diff --git a/core/jni/android/graphics/BitmapRegionDecoder.cpp b/core/jni/android/graphics/BitmapRegionDecoder.cpp
index 3cdf640..f10f4bd 100644
--- a/core/jni/android/graphics/BitmapRegionDecoder.cpp
+++ b/core/jni/android/graphics/BitmapRegionDecoder.cpp
@@ -16,17 +16,20 @@
 
 #define LOG_TAG "BitmapRegionDecoder"
 
-#include "AutoDecodeCancel.h"
 #include "BitmapFactory.h"
 #include "CreateJavaOutputStreamAdaptor.h"
-#include "SkBitmap.h"
-#include "SkData.h"
 #include "GraphicsJNI.h"
-#include "SkImageEncoder.h"
+#include "Utils.h"
+
+#include "SkBitmap.h"
+#include "SkBitmapRegionDecoder.h"
+#include "SkCodec.h"
+#include "SkData.h"
+#include "SkEncodedFormat.h"
 #include "SkUtils.h"
 #include "SkPixelRef.h"
 #include "SkStream.h"
-#include "Utils.h"
+
 #include "android_nio_utils.h"
 #include "android_util_Binder.h"
 #include "core_jni_helpers.h"
@@ -39,60 +42,54 @@
 
 using namespace android;
 
-class BitmapRegionDecoder {
-public:
-    BitmapRegionDecoder(SkImageDecoder* decoder, int width, int height) {
-        fDecoder = decoder;
-        fWidth = width;
-        fHeight = height;
-    }
-    ~BitmapRegionDecoder() {
-        delete fDecoder;
+// This is very similar to, and based on, getMimeTypeString() in BitmapFactory.
+jstring encodedFormatToString(JNIEnv* env, SkEncodedFormat format) {
+    const char* mimeType;
+    switch (format) {
+        case SkEncodedFormat::kBMP_SkEncodedFormat:
+            mimeType = "image/bmp";
+            break;
+        case SkEncodedFormat::kGIF_SkEncodedFormat:
+            mimeType = "image/gif";
+            break;
+        case SkEncodedFormat::kICO_SkEncodedFormat:
+            mimeType = "image/x-ico";
+            break;
+        case SkEncodedFormat::kJPEG_SkEncodedFormat:
+            mimeType = "image/jpeg";
+            break;
+        case SkEncodedFormat::kPNG_SkEncodedFormat:
+            mimeType = "image/png";
+            break;
+        case SkEncodedFormat::kWEBP_SkEncodedFormat:
+            mimeType = "image/webp";
+            break;
+        case SkEncodedFormat::kWBMP_SkEncodedFormat:
+            mimeType = "image/vnd.wap.wbmp";
+            break;
+        default:
+            mimeType = nullptr;
+            break;
     }
 
-    bool decodeRegion(SkBitmap* bitmap, const SkIRect& rect,
-                      SkColorType pref, int sampleSize) {
-        fDecoder->setSampleSize(sampleSize);
-        return fDecoder->decodeSubset(bitmap, rect, pref);
+    jstring jstr = nullptr;
+    if (mimeType != nullptr) {
+        jstr = env->NewStringUTF(mimeType);
     }
-
-    SkImageDecoder* getDecoder() const { return fDecoder; }
-    int getWidth() const { return fWidth; }
-    int getHeight() const { return fHeight; }
-
-private:
-    SkImageDecoder* fDecoder;
-    int fWidth;
-    int fHeight;
-};
+    return jstr;
+}
 
 // Takes ownership of the SkStreamRewindable. For consistency, deletes stream even
 // when returning null.
 static jobject createBitmapRegionDecoder(JNIEnv* env, SkStreamRewindable* stream) {
-    SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
-    int width, height;
-    if (NULL == decoder) {
-        delete stream;
+    SkAutoTDelete<SkBitmapRegionDecoder> brd(
+            SkBitmapRegionDecoder::Create(stream, SkBitmapRegionDecoder::kAndroidCodec_Strategy));
+    if (NULL == brd) {
         doThrowIOE(env, "Image format not supported");
-        return nullObjectReturn("SkImageDecoder::Factory returned null");
+        return nullObjectReturn("CreateBitmapRegionDecoder returned null");
     }
 
-    JavaPixelAllocator *javaAllocator = new JavaPixelAllocator(env);
-    decoder->setAllocator(javaAllocator);
-    javaAllocator->unref();
-
-    // This call passes ownership of stream to the decoder, or deletes on failure.
-    if (!decoder->buildTileIndex(stream, &width, &height)) {
-        char msg[100];
-        snprintf(msg, sizeof(msg), "Image failed to decode using %s decoder",
-                decoder->getFormatName());
-        doThrowIOE(env, msg);
-        delete decoder;
-        return nullObjectReturn("decoder->buildTileIndex returned false");
-    }
-
-    BitmapRegionDecoder *bm = new BitmapRegionDecoder(decoder, width, height);
-    return GraphicsJNI::createBitmapRegionDecoder(env, bm);
+    return GraphicsJNI::createBitmapRegionDecoder(env, brd.detach());
 }
 
 static jobject nativeNewInstanceFromByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
@@ -160,102 +157,106 @@
 
 /*
  * nine patch not supported
- *
  * purgeable not supported
  * reportSizeToVM not supported
  */
-static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle,
-                                jint start_x, jint start_y, jint width, jint height, jobject options) {
-    BitmapRegionDecoder *brd = reinterpret_cast<BitmapRegionDecoder*>(brdHandle);
-    jobject tileBitmap = NULL;
-    SkImageDecoder *decoder = brd->getDecoder();
-    int sampleSize = 1;
-    SkColorType prefColorType = kUnknown_SkColorType;
-    bool doDither = true;
-    bool preferQualityOverSpeed = false;
-    bool requireUnpremultiplied = false;
+static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, jint inputX,
+        jint inputY, jint inputWidth, jint inputHeight, jobject options) {
 
+    // Set default options.
+    int sampleSize = 1;
+    SkColorType colorType = kN32_SkColorType;
+    bool requireUnpremul = false;
+    jobject javaBitmap = NULL;
+
+    // Update the default options with any options supplied by the client.
     if (NULL != options) {
         sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID);
-        // initialize these, in case we fail later on
+        jobject jconfig = env->GetObjectField(options, gOptions_configFieldID);
+        colorType = GraphicsJNI::getNativeBitmapColorType(env, jconfig);
+        if (kAlpha_8_SkColorType == colorType) {
+            colorType = kGray_8_SkColorType;
+        }
+        requireUnpremul = !env->GetBooleanField(options, gOptions_premultipliedFieldID);
+        javaBitmap = env->GetObjectField(options, gOptions_bitmapFieldID);
+        // The Java options of ditherMode and preferQualityOverSpeed are deprecated.  We will
+        // ignore the values of these fields.
+
+        // Initialize these fields to indicate a failure.  If the decode succeeds, we
+        // will update them later on.
         env->SetIntField(options, gOptions_widthFieldID, -1);
         env->SetIntField(options, gOptions_heightFieldID, -1);
         env->SetObjectField(options, gOptions_mimeFieldID, 0);
-
-        jobject jconfig = env->GetObjectField(options, gOptions_configFieldID);
-        prefColorType = GraphicsJNI::getNativeBitmapColorType(env, jconfig);
-        doDither = env->GetBooleanField(options, gOptions_ditherFieldID);
-        preferQualityOverSpeed = env->GetBooleanField(options,
-                gOptions_preferQualityOverSpeedFieldID);
-        // Get the bitmap for re-use if it exists.
-        tileBitmap = env->GetObjectField(options, gOptions_bitmapFieldID);
-        requireUnpremultiplied = !env->GetBooleanField(options, gOptions_premultipliedFieldID);
     }
 
-    decoder->setDitherImage(doDither);
-    decoder->setPreferQualityOverSpeed(preferQualityOverSpeed);
-    decoder->setRequireUnpremultipliedColors(requireUnpremultiplied);
-    AutoDecoderCancel adc(options, decoder);
-
-    // To fix the race condition in case "requestCancelDecode"
-    // happens earlier than AutoDecoderCancel object is added
-    // to the gAutoDecoderCancelMutex linked list.
-    if (NULL != options && env->GetBooleanField(options, gOptions_mCancelID)) {
-        return nullObjectReturn("gOptions_mCancelID");;
+    // Recycle a bitmap if possible.
+    android::Bitmap* recycledBitmap = nullptr;
+    size_t recycledBytes = 0;
+    if (javaBitmap) {
+        recycledBitmap = GraphicsJNI::getBitmap(env, javaBitmap);
+        if (recycledBitmap->peekAtPixelRef()->isImmutable()) {
+            ALOGW("Warning: Reusing an immutable bitmap as an image decoder target.");
+        }
+        recycledBytes = GraphicsJNI::getBitmapAllocationByteCount(env, javaBitmap);
     }
 
-    SkIRect region;
-    region.fLeft = start_x;
-    region.fTop = start_y;
-    region.fRight = start_x + width;
-    region.fBottom = start_y + height;
+    // Set up the pixel allocator
+    SkBRDAllocator* allocator = nullptr;
+    RecyclingClippingPixelAllocator recycleAlloc(recycledBitmap, recycledBytes);
+    JavaPixelAllocator javaAlloc(env);
+    if (javaBitmap) {
+        allocator = &recycleAlloc;
+        // We are required to match the color type of the recycled bitmap.
+        colorType = recycledBitmap->info().colorType();
+    } else {
+        allocator = &javaAlloc;
+    }
+
+    // Decode the region.
+    SkIRect subset = SkIRect::MakeXYWH(inputX, inputY, inputWidth, inputHeight);
+    SkBitmapRegionDecoder* brd =
+            reinterpret_cast<SkBitmapRegionDecoder*>(brdHandle);
     SkBitmap bitmap;
-
-    if (tileBitmap != NULL) {
-        // Re-use bitmap.
-        GraphicsJNI::getSkBitmap(env, tileBitmap, &bitmap);
+    if (!brd->decodeRegion(&bitmap, allocator, subset, sampleSize, colorType, requireUnpremul)) {
+        return nullObjectReturn("Failed to decode region.");
     }
 
-    if (!brd->decodeRegion(&bitmap, region, prefColorType, sampleSize)) {
-        return nullObjectReturn("decoder->decodeRegion returned false");
-    }
-
-    // update options (if any)
+    // If the client provided options, indicate that the decode was successful.
     if (NULL != options) {
         env->SetIntField(options, gOptions_widthFieldID, bitmap.width());
         env->SetIntField(options, gOptions_heightFieldID, bitmap.height());
-        // TODO: set the mimeType field with the data from the codec.
-        // but how to reuse a set of strings, rather than allocating new one
-        // each time?
         env->SetObjectField(options, gOptions_mimeFieldID,
-                            getMimeTypeString(env, decoder->getFormat()));
+                encodedFormatToString(env, brd->getEncodedFormat()));
     }
 
-    if (tileBitmap != NULL) {
-        bitmap.notifyPixelsChanged();
-        return tileBitmap;
+    // If we may have reused a bitmap, we need to indicate that the pixels have changed.
+    if (javaBitmap) {
+        recycleAlloc.copyIfNecessary();
+        return javaBitmap;
     }
 
-    JavaPixelAllocator* allocator = (JavaPixelAllocator*) decoder->getAllocator();
-
     int bitmapCreateFlags = 0;
-    if (!requireUnpremultiplied) bitmapCreateFlags |= GraphicsJNI::kBitmapCreateFlag_Premultiplied;
-    return GraphicsJNI::createBitmap(env, allocator->getStorageObjAndReset(),
-            bitmapCreateFlags);
+    if (!requireUnpremul) {
+        bitmapCreateFlags |= GraphicsJNI::kBitmapCreateFlag_Premultiplied;
+    }
+    return GraphicsJNI::createBitmap(env, javaAlloc.getStorageObjAndReset(), bitmapCreateFlags);
 }
 
 static jint nativeGetHeight(JNIEnv* env, jobject, jlong brdHandle) {
-    BitmapRegionDecoder *brd = reinterpret_cast<BitmapRegionDecoder*>(brdHandle);
-    return static_cast<jint>(brd->getHeight());
+    SkBitmapRegionDecoder* brd =
+            reinterpret_cast<SkBitmapRegionDecoder*>(brdHandle);
+    return static_cast<jint>(brd->height());
 }
 
 static jint nativeGetWidth(JNIEnv* env, jobject, jlong brdHandle) {
-    BitmapRegionDecoder *brd = reinterpret_cast<BitmapRegionDecoder*>(brdHandle);
-    return static_cast<jint>(brd->getWidth());
+    SkBitmapRegionDecoder* brd =
+            reinterpret_cast<SkBitmapRegionDecoder*>(brdHandle);
+    return static_cast<jint>(brd->width());
 }
 
 static void nativeClean(JNIEnv* env, jobject, jlong brdHandle) {
-    BitmapRegionDecoder *brd = reinterpret_cast<BitmapRegionDecoder*>(brdHandle);
+    SkBitmapRegionDecoder* brd =
+            reinterpret_cast<SkBitmapRegionDecoder*>(brdHandle);
     delete brd;
 }
 
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index ed44019..3d5091a 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -439,7 +439,7 @@
     return env->CallIntMethod(javaBitmap, gBitmap_getAllocationByteCountMethodID);
 }
 
-jobject GraphicsJNI::createBitmapRegionDecoder(JNIEnv* env, BitmapRegionDecoder* bitmap)
+jobject GraphicsJNI::createBitmapRegionDecoder(JNIEnv* env, SkBitmapRegionDecoder* bitmap)
 {
     SkASSERT(bitmap != NULL);
 
@@ -677,6 +677,91 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
+RecyclingClippingPixelAllocator::RecyclingClippingPixelAllocator(
+        android::Bitmap* recycledBitmap, size_t recycledBytes)
+    : mRecycledBitmap(recycledBitmap)
+    , mRecycledBytes(recycledBytes)
+    , mSkiaBitmap(nullptr)
+    , mNeedsCopy(false)
+{}
+
+RecyclingClippingPixelAllocator::~RecyclingClippingPixelAllocator() {}
+
+bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
+    // Ensure that the caller did not pass in a NULL bitmap to the constructor or this
+    // function.
+    LOG_ALWAYS_FATAL_IF(!mRecycledBitmap);
+    LOG_ALWAYS_FATAL_IF(!bitmap);
+    mSkiaBitmap = bitmap;
+
+    // This behaves differently than the RecyclingPixelAllocator.  For backwards
+    // compatibility, the original color type of the recycled bitmap must be maintained.
+    if (mRecycledBitmap->info().colorType() != bitmap->colorType()) {
+        return false;
+    }
+
+    // The Skia bitmap specifies the width and height needed by the decoder.
+    // mRecycledBitmap specifies the width and height of the bitmap that we
+    // want to reuse.  Neither can be changed.  We will try to find a way
+    // to reuse the memory.
+    const int maxWidth = SkTMax(bitmap->width(), mRecycledBitmap->info().width());
+    const int maxHeight = SkTMax(bitmap->height(), mRecycledBitmap->info().height());
+    const SkImageInfo maxInfo = bitmap->info().makeWH(maxWidth, maxHeight);
+    const size_t rowBytes = maxInfo.minRowBytes();
+    const size_t bytesNeeded = maxInfo.getSafeSize(rowBytes);
+    if (bytesNeeded <= mRecycledBytes) {
+        // Here we take advantage of reconfigure() to reset the rowBytes and ctable
+        // of mRecycledBitmap.  It is very important that we pass in
+        // mRecycledBitmap->info() for the SkImageInfo.  According to the
+        // specification for BitmapRegionDecoder, we are not allowed to change
+        // the SkImageInfo.
+        mRecycledBitmap->reconfigure(mRecycledBitmap->info(), rowBytes, ctable);
+
+        // This call will give the bitmap the same pixelRef as mRecycledBitmap.
+        bitmap->setPixelRef(mRecycledBitmap->refPixelRef())->unref();
+
+        // Make sure that the recycled bitmap has the correct alpha type.
+        mRecycledBitmap->setAlphaType(bitmap->alphaType());
+
+        bitmap->lockPixels();
+        mNeedsCopy = false;
+
+        // TODO: If the dimensions of the SkBitmap are smaller than those of
+        // mRecycledBitmap, should we zero the memory in mRecycledBitmap?
+        return true;
+    }
+
+    // In the event that mRecycledBitmap is not large enough, allocate new memory
+    // on the heap.
+    SkBitmap::HeapAllocator heapAllocator;
+
+    // We will need to copy from heap memory to mRecycledBitmap's memory after the
+    // decode is complete.
+    mNeedsCopy = true;
+
+    return heapAllocator.allocPixelRef(bitmap, ctable);
+}
+
+void RecyclingClippingPixelAllocator::copyIfNecessary() {
+    if (mNeedsCopy) {
+        SkPixelRef* recycledPixels = mRecycledBitmap->refPixelRef();
+        void* dst = recycledPixels->pixels();
+        size_t dstRowBytes = mRecycledBitmap->rowBytes();
+        size_t bytesToCopy = SkTMin(mRecycledBitmap->info().minRowBytes(),
+                mSkiaBitmap->info().minRowBytes());
+        for (int y = 0; y < mRecycledBitmap->info().height(); y++) {
+            memcpy(dst, mSkiaBitmap->getAddr(0, y), bytesToCopy);
+            dst = SkTAddOffset<void>(dst, dstRowBytes);
+        }
+        recycledPixels->notifyPixelsChanged();
+        recycledPixels->unref();
+    }
+    mRecycledBitmap = nullptr;
+    mSkiaBitmap = nullptr;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
 AshmemPixelAllocator::AshmemPixelAllocator(JNIEnv *env) {
     LOG_ALWAYS_FATAL_IF(env->GetJavaVM(&mJavaVM) != JNI_OK,
             "env->GetJavaVM failed");
diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h
index 90f8291..e99a3ff 100644
--- a/core/jni/android/graphics/GraphicsJNI.h
+++ b/core/jni/android/graphics/GraphicsJNI.h
@@ -3,6 +3,8 @@
 
 #include "Bitmap.h"
 #include "SkBitmap.h"
+#include "SkBRDAllocator.h"
+#include "SkCodec.h"
 #include "SkDevice.h"
 #include "SkPixelRef.h"
 #include "SkMallocPixelRef.h"
@@ -12,7 +14,7 @@
 #include <Canvas.h>
 #include <jni.h>
 
-class BitmapRegionDecoder;
+class SkBitmapRegionDecoder;
 class SkCanvas;
 
 namespace android {
@@ -90,7 +92,7 @@
 
     static jobject createRegion(JNIEnv* env, SkRegion* region);
 
-    static jobject createBitmapRegionDecoder(JNIEnv* env, BitmapRegionDecoder* bitmap);
+    static jobject createBitmapRegionDecoder(JNIEnv* env, SkBitmapRegionDecoder* bitmap);
 
     static android::Bitmap* allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
             SkColorTable* ctable);
@@ -123,7 +125,7 @@
  *  ensure that the allocated buffer is properly accounted for with a
  *  reference in the heap (or a JNI global reference).
  */
-class JavaPixelAllocator : public SkBitmap::Allocator {
+class JavaPixelAllocator : public SkBRDAllocator {
 public:
     JavaPixelAllocator(JNIEnv* env);
     ~JavaPixelAllocator();
@@ -139,11 +141,78 @@
         return result;
     };
 
+    /**
+     *  Indicates that this allocator allocates zero initialized
+     *  memory.
+     */
+    SkCodec::ZeroInitialized zeroInit() const override { return SkCodec::kYes_ZeroInitialized; }
+
 private:
     JavaVM* mJavaVM;
     android::Bitmap* mStorage = nullptr;
 };
 
+/**
+ *  Allocator to handle reusing bitmaps for BitmapRegionDecoder.
+ *
+ *  The BitmapRegionDecoder documentation states that, if it is
+ *  provided, the recycled bitmap will always be reused, clipping
+ *  the decoded output to fit in the recycled bitmap if necessary.
+ *  This allocator implements that behavior.
+ *
+ *  Skia's SkBitmapRegionDecoder expects the memory that
+ *  is allocated to be large enough to decode the entire region
+ *  that is requested.  It will decode directly into the memory
+ *  that is provided.
+ *
+ *  FIXME: BUG:25465958
+ *  If the recycled bitmap is not large enough for the decode
+ *  requested, meaning that a clip is required, we will allocate
+ *  enough memory for Skia to perform the decode, and then copy
+ *  from the decoded output into the recycled bitmap.
+ *
+ *  If the recycled bitmap is large enough for the decode requested,
+ *  we will provide that memory for Skia to decode directly into.
+ *
+ *  This allocator should only be used for a single allocation.
+ *  After we reuse the recycledBitmap once, it is dangerous to
+ *  reuse it again, given that it still may be in use from our
+ *  first allocation.
+ */
+class RecyclingClippingPixelAllocator : public SkBRDAllocator {
+public:
+
+    RecyclingClippingPixelAllocator(android::Bitmap* recycledBitmap,
+            size_t recycledBytes);
+
+    ~RecyclingClippingPixelAllocator();
+
+    virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) override;
+
+    /**
+     *  Must be called!
+     *
+     *  In the event that the recycled bitmap is not large enough for
+     *  the allocation requested, we will allocate memory on the heap
+     *  instead.  As a final step, once we are done using this memory,
+     *  we will copy the contents of the heap memory into the recycled
+     *  bitmap's memory, clipping as necessary.
+     */
+    void copyIfNecessary();
+
+    /**
+     *  Indicates that this allocator does not allocate zero initialized
+     *  memory.
+     */
+    SkCodec::ZeroInitialized zeroInit() const override { return SkCodec::kNo_ZeroInitialized; }
+
+private:
+    android::Bitmap* mRecycledBitmap;
+    const size_t     mRecycledBytes;
+    SkBitmap*        mSkiaBitmap;
+    bool             mNeedsCopy;
+};
+
 class AshmemPixelAllocator : public SkBitmap::Allocator {
 public:
     AshmemPixelAllocator(JNIEnv* env);
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index c139cd7..ae109c6 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -711,6 +711,9 @@
             jniThrowException(env, "java/lang/RuntimeException",
                     "Not allowed to write file descriptors here");
             break;
+        case UNEXPECTED_NULL:
+            jniThrowNullPointerException(env, NULL);
+            break;
         case -EBADF:
             jniThrowException(env, "java/lang/RuntimeException",
                     "Bad file descriptor");
diff --git a/core/jni/android_util_jar_StrictJarFile.cpp b/core/jni/android_util_jar_StrictJarFile.cpp
new file mode 100644
index 0000000..7f8f708
--- /dev/null
+++ b/core/jni/android_util_jar_StrictJarFile.cpp
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#define LOG_TAG "StrictJarFile"
+
+#include <memory>
+#include <string>
+
+#include "JNIHelp.h"
+#include "JniConstants.h"
+#include "ScopedLocalRef.h"
+#include "ScopedUtfChars.h"
+#include "jni.h"
+#include "ziparchive/zip_archive.h"
+#include "cutils/log.h"
+
+namespace android {
+
+// The method ID for ZipEntry.<init>(String,String,JJJIII[BJJ)
+static jmethodID zipEntryCtor;
+
+static void throwIoException(JNIEnv* env, const int32_t errorCode) {
+  jniThrowException(env, "java/io/IOException", ErrorCodeString(errorCode));
+}
+
+static jobject newZipEntry(JNIEnv* env, const ZipEntry& entry, jstring entryName) {
+  return env->NewObject(JniConstants::zipEntryClass,
+                        zipEntryCtor,
+                        entryName,
+                        NULL,  // comment
+                        static_cast<jlong>(entry.crc32),
+                        static_cast<jlong>(entry.compressed_length),
+                        static_cast<jlong>(entry.uncompressed_length),
+                        static_cast<jint>(entry.method),
+                        static_cast<jint>(0),  // time
+                        NULL,  // byte[] extra
+                        static_cast<jlong>(entry.offset));
+}
+
+static jlong StrictJarFile_nativeOpenJarFile(JNIEnv* env, jobject, jstring fileName) {
+  ScopedUtfChars fileChars(env, fileName);
+  if (fileChars.c_str() == NULL) {
+    return static_cast<jlong>(-1);
+  }
+
+  ZipArchiveHandle handle;
+  int32_t error = OpenArchive(fileChars.c_str(), &handle);
+  if (error) {
+    CloseArchive(handle);
+    throwIoException(env, error);
+    return static_cast<jlong>(-1);
+  }
+
+  return reinterpret_cast<jlong>(handle);
+}
+
+class IterationHandle {
+ public:
+  IterationHandle() :
+    cookie_(NULL) {
+  }
+
+  void** CookieAddress() {
+    return &cookie_;
+  }
+
+  ~IterationHandle() {
+    EndIteration(cookie_);
+  }
+
+ private:
+  void* cookie_;
+};
+
+
+static jlong StrictJarFile_nativeStartIteration(JNIEnv* env, jobject, jlong nativeHandle,
+                                                jstring prefix) {
+  ScopedUtfChars prefixChars(env, prefix);
+  if (prefixChars.c_str() == NULL) {
+    return static_cast<jlong>(-1);
+  }
+
+  IterationHandle* handle = new IterationHandle();
+  int32_t error = 0;
+  if (prefixChars.size() == 0) {
+    error = StartIteration(reinterpret_cast<ZipArchiveHandle>(nativeHandle),
+                           handle->CookieAddress(), NULL, NULL);
+  } else {
+    ZipString entry_name(prefixChars.c_str());
+    error = StartIteration(reinterpret_cast<ZipArchiveHandle>(nativeHandle),
+                           handle->CookieAddress(), &entry_name, NULL);
+  }
+
+  if (error) {
+    throwIoException(env, error);
+    return static_cast<jlong>(-1);
+  }
+
+  return reinterpret_cast<jlong>(handle);
+}
+
+static jobject StrictJarFile_nativeNextEntry(JNIEnv* env, jobject, jlong iterationHandle) {
+  ZipEntry data;
+  ZipString entryName;
+
+  IterationHandle* handle = reinterpret_cast<IterationHandle*>(iterationHandle);
+  const int32_t error = Next(*handle->CookieAddress(), &data, &entryName);
+  if (error) {
+    delete handle;
+    return NULL;
+  }
+
+  std::unique_ptr<char[]> entryNameCString(new char[entryName.name_length + 1]);
+  memcpy(entryNameCString.get(), entryName.name, entryName.name_length);
+  entryNameCString[entryName.name_length] = '\0';
+  ScopedLocalRef<jstring> entryNameString(env, env->NewStringUTF(entryNameCString.get()));
+
+  return newZipEntry(env, data, entryNameString.get());
+}
+
+static jobject StrictJarFile_nativeFindEntry(JNIEnv* env, jobject, jlong nativeHandle,
+                                             jstring entryName) {
+  ScopedUtfChars entryNameChars(env, entryName);
+  if (entryNameChars.c_str() == NULL) {
+    return NULL;
+  }
+
+  ZipEntry data;
+  const int32_t error = FindEntry(reinterpret_cast<ZipArchiveHandle>(nativeHandle),
+                                  ZipString(entryNameChars.c_str()), &data);
+  if (error) {
+    return NULL;
+  }
+
+  return newZipEntry(env, data, entryName);
+}
+
+static void StrictJarFile_nativeClose(JNIEnv*, jobject, jlong nativeHandle) {
+  CloseArchive(reinterpret_cast<ZipArchiveHandle>(nativeHandle));
+}
+
+static JNINativeMethod gMethods[] = {
+  NATIVE_METHOD(StrictJarFile, nativeOpenJarFile, "(Ljava/lang/String;)J"),
+  NATIVE_METHOD(StrictJarFile, nativeStartIteration, "(JLjava/lang/String;)J"),
+  NATIVE_METHOD(StrictJarFile, nativeNextEntry, "(J)Ljava/util/zip/ZipEntry;"),
+  NATIVE_METHOD(StrictJarFile, nativeFindEntry, "(JLjava/lang/String;)Ljava/util/zip/ZipEntry;"),
+  NATIVE_METHOD(StrictJarFile, nativeClose, "(J)V"),
+};
+
+void register_android_util_jar_StrictJarFile(JNIEnv* env) {
+  jniRegisterNativeMethods(env, "android/util/jar/StrictJarFile", gMethods, NELEM(gMethods));
+
+  zipEntryCtor = env->GetMethodID(JniConstants::zipEntryClass, "<init>",
+      "(Ljava/lang/String;Ljava/lang/String;JJJII[BJ)V");
+  LOG_ALWAYS_FATAL_IF(zipEntryCtor == NULL, "Unable to find ZipEntry.<init>");
+}
+
+}; // namespace android
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 57338be..ee493019 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -709,8 +709,8 @@
 
     <!-- Required to be able to access the camera device.
          <p>This will automatically enforce the <a
-         href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-         &lt;uses-feature&gt;}</a> manifest element for <em>all</em> camera features.
+         href="{@docRoot}guide/topics/manifest/uses-feature-element.html">
+         <uses-feature>}</a> manifest element for <em>all</em> camera features.
          If you do not require all camera features or can properly operate if a camera
          is not available, then you must modify your manifest as appropriate in order to
          install on devices that don't support all camera features.</p>
@@ -1460,6 +1460,12 @@
         android:description="@string/permdesc_killBackgroundProcesses"
         android:protectionLevel="normal" />
 
+    <!-- @SystemApi @hide Allows an application to query process states and current
+         OOM adjustment scores.
+         <p>Not for use by third-party applications. -->
+    <permission android:name="android.permission.GET_PROCESS_STATE_AND_OOM_SCORE"
+        android:protectionLevel="signature|privileged|development" />
+
     <!-- @SystemApi @hide Allows an application to retrieve a package's importance.
          This permission is not available to third party applications. -->
     <permission android:name="android.permission.GET_PACKAGE_IMPORTANCE"
@@ -1877,6 +1883,11 @@
     <permission android:name="android.permission.MANAGE_APP_TOKENS"
         android:protectionLevel="signature" />
 
+    <!-- Allows System UI to register listeners for events from Window Manager.
+         @hide -->
+    <permission android:name="android.permission.REGISTER_WINDOW_MANAGER_LISTENERS"
+        android:protectionLevel="signature" />
+
     <!-- @hide Allows the application to temporarily freeze the screen for a
          full-screen transition. -->
     <permission android:name="android.permission.FREEZE_SCREEN"
@@ -2596,6 +2607,14 @@
     <permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
         android:protectionLevel="signature" />
 
+    <!-- Must be required by an {@link
+         android.service.notification.NotificationAssistantService},
+         to ensure that only the system can bind to it.
+         <p>Protection level: signature
+    -->
+    <permission android:name="android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE"
+        android:protectionLevel="signature" />
+
     <!-- Must be required by a {@link
          android.service.chooser.ChooserTargetService}, to ensure that
          only the system can bind to it.
@@ -2701,6 +2720,13 @@
     <permission android:name="android.permission.DISPATCH_NFC_MESSAGE"
                 android:protectionLevel="signature|privileged" />
 
+    <!-- @SystemApi Allows changing day / night mode when system is configured with
+         config_lockDayNightMode set to true. If requesting app does not have permission,
+         it will be ignored.
+        @hide -->
+    <permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE"
+                android:protectionLevel="signature|privileged" />
+
     <!-- The system process is explicitly the only one allowed to launch the
          confirmation UI for full backup/restore -->
     <uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP"/>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_1_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_1_animation.xml
new file mode 100644
index 0000000..e6a28bb
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_1_animation.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="600"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -6.5,0.0 c 1.08333,-1.0 5.41667,-5.0 6.5,-6.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_4" />
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="300"
+            android:propertyName="rotation"
+            android:valueFrom="-45.0"
+            android:valueTo="-45.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="150"
+            android:propertyName="rotation"
+            android:valueFrom="-45.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_0_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_0_animation.xml
new file mode 100644
index 0000000..c2414de
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_0_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="200"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,0.0 c 0.75,0.0 3.75,0.0 4.5,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_5" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_animation.xml
new file mode 100644
index 0000000..593a0ea
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_1_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="450"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 4.5,0.0 c -0.75,0.0 -3.75,0.0 -4.5,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_0" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_2_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_2_animation.xml
new file mode 100644
index 0000000..5b09a41
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_2_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="600"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -8.0,0.0 c 1.33333,0.0 6.66667,0.0 8.0,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_3" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_0_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_0_animation.xml
new file mode 100644
index 0000000..dccbc67
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_0_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="250"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,0.0 c 1.66667,0.0 8.5,0.0 10.0,0.0 c 0.13052,0.0 -0.83333,0.0 -1.0,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_2" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_animation.xml
new file mode 100644
index 0000000..c1c0c1c
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_2_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="516"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 9.0,0.0 c -1.5,0.0 -7.5,0.0 -9.0,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_6" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_3_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_3_animation.xml
new file mode 100644
index 0000000..df69bf7
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_3_animation.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="600"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -6.5,0.0 c 1.08333,1.0 5.41667,5.0 6.5,6.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_4" />
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="300"
+            android:propertyName="rotation"
+            android:valueFrom="45.0"
+            android:valueTo="45.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="150"
+            android:propertyName="rotation"
+            android:valueFrom="45.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_0_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_0_animation.xml
new file mode 100644
index 0000000..c2414de
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_0_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="200"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,0.0 c 0.75,0.0 3.75,0.0 4.5,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_5" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_animation.xml
new file mode 100644
index 0000000..593a0ea
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_3_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="450"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 4.5,0.0 c -0.75,0.0 -3.75,0.0 -4.5,0.0"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_0" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_4_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_4_animation.xml
new file mode 100644
index 0000000..a375330
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_4_animation.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="300"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,6.0 c -1.08333,-1.0 -5.41667,-5.0 -6.5,-6.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+    <objectAnimator
+        android:duration="400"
+        android:propertyName="rotation"
+        android:valueFrom="0.0"
+        android:valueTo="45.0"
+        android:valueType="floatType"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_1" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_5_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_5_animation.xml
new file mode 100644
index 0000000..ae7ee47
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_5_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="250"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,0.0 c -1.33333,0.0 -6.66667,0.0 -8.0,0.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_6_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_6_animation.xml
new file mode 100644
index 0000000..3b872af
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_6_animation.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="300"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 0.0,-6.0 c -1.08333,1.0 -5.41667,5.0 -6.5,6.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+    <objectAnimator
+        android:duration="400"
+        android:propertyName="rotation"
+        android:valueFrom="0.0"
+        android:valueTo="-45.0"
+        android:valueType="floatType"
+        android:interpolator="@interpolator/ft_avd_toarrow_animation_interpolator_1" />
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_1_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_1_animation.xml
new file mode 100644
index 0000000..94e04b4
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_1_animation.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="300"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -4.54266574364,-1.0 l 9.08533148727,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -9.08533148727,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.54266574364,-1.0 l 9.08533148727,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -9.08533148727,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueTo="M -3.54375000003,-1.21249999999 l 7.08750000005,0.0 c 0.669645259129,0.0 1.21249999999,0.542854740865 1.21249999999,1.21249999999 l 0.0,0.0 c 0.0,0.669645259129 -0.542854740865,1.21249999999 -1.21249999999,1.21249999999 l -7.08750000005,0.0 c -0.669645259129,0.0 -1.21249999999,-0.542854740865 -1.21249999999,-1.21249999999 l 0.0,0.0 c 0.0,-0.669645259129 0.542854740865,-1.21249999999 1.21249999999,-1.21249999999 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -3.54375000003,-1.21249999999 l 7.08750000005,0.0 c 0.669645259129,0.0 1.21249999999,0.542854740865 1.21249999999,1.21249999999 l 0.0,0.0 c 0.0,0.669645259129 -0.542854740865,1.21249999999 -1.21249999999,1.21249999999 l -7.08750000005,0.0 c -0.669645259129,0.0 -1.21249999999,-0.542854740865 -1.21249999999,-1.21249999999 l 0.0,0.0 c 0.0,-0.669645259129 0.542854740865,-1.21249999999 1.21249999999,-1.21249999999 Z"
+            android:valueTo="M -1.68627963028,-1.62527119327 l 3.37255926056,0.0 c 0.897612494333,0.0 1.62527119327,0.727658698938 1.62527119327,1.62527119327 l 0.0,0.0 c 0.0,0.897612494333 -0.727658698938,1.62527119327 -1.62527119327,1.62527119327 l -3.37255926056,0.0 c -0.897612494333,0.0 -1.62527119327,-0.727658698938 -1.62527119327,-1.62527119327 l 0.0,0.0 c 0.0,-0.897612494333 0.727658698938,-1.62527119327 1.62527119327,-1.62527119327 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.68627963028,-1.62527119327 l 3.37255926056,0.0 c 0.897612494333,0.0 1.62527119327,0.727658698938 1.62527119327,1.62527119327 l 0.0,0.0 c 0.0,0.897612494333 -0.727658698938,1.62527119327 -1.62527119327,1.62527119327 l -3.37255926056,0.0 c -0.897612494333,0.0 -1.62527119327,-0.727658698938 -1.62527119327,-1.62527119327 l 0.0,0.0 c 0.0,-0.897612494333 0.727658698938,-1.62527119327 1.62527119327,-1.62527119327 Z"
+            android:valueTo="M -0.866611597071,-1.8074196451 l 1.73322319414,0.0 c 0.998210306475,0.0 1.8074196451,0.80920933862 1.8074196451,1.8074196451 l 0.0,0.0 c 0.0,0.998210306475 -0.80920933862,1.8074196451 -1.8074196451,1.8074196451 l -1.73322319414,0.0 c -0.998210306475,0.0 -1.8074196451,-0.80920933862 -1.8074196451,-1.8074196451 l 0.0,0.0 c 0.0,-0.998210306475 0.80920933862,-1.8074196451 1.8074196451,-1.8074196451 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.866611597071,-1.8074196451 l 1.73322319414,0.0 c 0.998210306475,0.0 1.8074196451,0.80920933862 1.8074196451,1.8074196451 l 0.0,0.0 c 0.0,0.998210306475 -0.80920933862,1.8074196451 -1.8074196451,1.8074196451 l -1.73322319414,0.0 c -0.998210306475,0.0 -1.8074196451,-0.80920933862 -1.8074196451,-1.8074196451 l 0.0,0.0 c 0.0,-0.998210306475 0.80920933862,-1.8074196451 1.8074196451,-1.8074196451 Z"
+            android:valueTo="M -0.416762258226,-1.90738616484 l 0.833524516453,0.0 c 1.05342029082,0.0 1.90738616484,0.853965874019 1.90738616484,1.90738616484 l 0.0,0.0 c 0.0,1.05342029082 -0.853965874019,1.90738616484 -1.90738616484,1.90738616484 l -0.833524516453,0.0 c -1.05342029082,0.0 -1.90738616484,-0.853965874019 -1.90738616484,-1.90738616484 l 0.0,0.0 c 0.0,-1.05342029082 0.853965874019,-1.90738616484 1.90738616484,-1.90738616484 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.416762258226,-1.90738616484 l 0.833524516453,0.0 c 1.05342029082,0.0 1.90738616484,0.853965874019 1.90738616484,1.90738616484 l 0.0,0.0 c 0.0,1.05342029082 -0.853965874019,1.90738616484 -1.90738616484,1.90738616484 l -0.833524516453,0.0 c -1.05342029082,0.0 -1.90738616484,-0.853965874019 -1.90738616484,-1.90738616484 l 0.0,0.0 c 0.0,-1.05342029082 0.853965874019,-1.90738616484 1.90738616484,-1.90738616484 Z"
+            android:valueTo="M -0.163643891635,-1.96363469075 l 0.32728778327,0.0 c 1.08448549388,0.0 1.96363469075,0.87914919687 1.96363469075,1.96363469075 l 0.0,0.0 c 0.0,1.08448549388 -0.87914919687,1.96363469075 -1.96363469075,1.96363469075 l -0.32728778327,0.0 c -1.08448549388,0.0 -1.96363469075,-0.87914919687 -1.96363469075,-1.96363469075 l 0.0,0.0 c 0.0,-1.08448549388 0.87914919687,-1.96363469075 1.96363469075,-1.96363469075 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.163643891635,-1.96363469075 l 0.32728778327,0.0 c 1.08448549388,0.0 1.96363469075,0.87914919687 1.96363469075,1.96363469075 l 0.0,0.0 c 0.0,1.08448549388 -0.87914919687,1.96363469075 -1.96363469075,1.96363469075 l -0.32728778327,0.0 c -1.08448549388,0.0 -1.96363469075,-0.87914919687 -1.96363469075,-1.96363469075 l 0.0,0.0 c 0.0,-1.08448549388 0.87914919687,-1.96363469075 1.96363469075,-1.96363469075 Z"
+            android:valueTo="M -0.0368976091105,-1.99180053131 l 0.073795218221,0.0 c 1.10004105809,0.0 1.99180053131,0.891759473223 1.99180053131,1.99180053131 l 0.0,0.0 c 0.0,1.10004105809 -0.891759473223,1.99180053131 -1.99180053131,1.99180053131 l -0.073795218221,0.0 c -1.10004105809,0.0 -1.99180053131,-0.891759473223 -1.99180053131,-1.99180053131 l 0.0,0.0 c 0.0,-1.10004105809 0.891759473223,-1.99180053131 1.99180053131,-1.99180053131 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0368976091105,-1.99180053131 l 0.073795218221,0.0 c 1.10004105809,0.0 1.99180053131,0.891759473223 1.99180053131,1.99180053131 l 0.0,0.0 c 0.0,1.10004105809 -0.891759473223,1.99180053131 -1.99180053131,1.99180053131 l -0.073795218221,0.0 c -1.10004105809,0.0 -1.99180053131,-0.891759473223 -1.99180053131,-1.99180053131 l 0.0,0.0 c 0.0,-1.10004105809 0.891759473223,-1.99180053131 1.99180053131,-1.99180053131 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_2_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_2_animation.xml
new file mode 100644
index 0000000..423f8d7
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_2_animation.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="300"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -4.54266574364,-1.0 l 9.08533148727,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -9.08533148727,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.54266574364,-1.0 l 9.08533148727,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -9.08533148727,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueTo="M -2.49262086719,-1.44608425174 l 4.98524173437,0.0 c 0.79865027916,0.0 1.44608425174,0.647433972576 1.44608425174,1.44608425174 l 0.0,0.0 c 0.0,0.79865027916 -0.647433972576,1.44608425174 -1.44608425174,1.44608425174 l -4.98524173437,0.0 c -0.79865027916,0.0 -1.44608425174,-0.647433972576 -1.44608425174,-1.44608425174 l 0.0,0.0 c 0.0,-0.79865027916 0.647433972576,-1.44608425174 1.44608425174,-1.44608425174 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -2.49262086719,-1.44608425174 l 4.98524173437,0.0 c 0.79865027916,0.0 1.44608425174,0.647433972576 1.44608425174,1.44608425174 l 0.0,0.0 c 0.0,0.79865027916 -0.647433972576,1.44608425174 -1.44608425174,1.44608425174 l -4.98524173437,0.0 c -0.79865027916,0.0 -1.44608425174,-0.647433972576 -1.44608425174,-1.44608425174 l 0.0,0.0 c 0.0,-0.79865027916 0.647433972576,-1.44608425174 1.44608425174,-1.44608425174 Z"
+            android:valueTo="M -1.39285008918,-1.69047775796 l 2.78570017836,0.0 c 0.933625085597,0.0 1.69047775796,0.756852672362 1.69047775796,1.69047775796 l 0.0,0.0 c 0.0,0.933625085597 -0.756852672362,1.69047775796 -1.69047775796,1.69047775796 l -2.78570017836,0.0 c -0.933625085597,0.0 -1.69047775796,-0.756852672362 -1.69047775796,-1.69047775796 l 0.0,0.0 c 0.0,-0.933625085597 0.756852672362,-1.69047775796 1.69047775796,-1.69047775796 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.39285008918,-1.69047775796 l 2.78570017836,0.0 c 0.933625085597,0.0 1.69047775796,0.756852672362 1.69047775796,1.69047775796 l 0.0,0.0 c 0.0,0.933625085597 -0.756852672362,1.69047775796 -1.69047775796,1.69047775796 l -2.78570017836,0.0 c -0.933625085597,0.0 -1.69047775796,-0.756852672362 -1.69047775796,-1.69047775796 l 0.0,0.0 c 0.0,-0.933625085597 0.756852672362,-1.69047775796 1.69047775796,-1.69047775796 Z"
+            android:valueTo="M -0.77117021921,-1.82862884018 l 1.54234043842,0.0 c 1.00992382147,0.0 1.82862884018,0.818705018702 1.82862884018,1.82862884018 l 0.0,0.0 c 0.0,1.00992382147 -0.818705018702,1.82862884018 -1.82862884018,1.82862884018 l -1.54234043842,0.0 c -1.00992382147,0.0 -1.82862884018,-0.818705018702 -1.82862884018,-1.82862884018 l 0.0,0.0 c 0.0,-1.00992382147 0.818705018702,-1.82862884018 1.82862884018,-1.82862884018 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.77117021921,-1.82862884018 l 1.54234043842,0.0 c 1.00992382147,0.0 1.82862884018,0.818705018702 1.82862884018,1.82862884018 l 0.0,0.0 c 0.0,1.00992382147 -0.818705018702,1.82862884018 -1.82862884018,1.82862884018 l -1.54234043842,0.0 c -1.00992382147,0.0 -1.82862884018,-0.818705018702 -1.82862884018,-1.82862884018 l 0.0,0.0 c 0.0,-1.00992382147 0.818705018702,-1.82862884018 1.82862884018,-1.82862884018 Z"
+            android:valueTo="M -0.387649645988,-1.91385563422 l 0.775299291975,0.0 c 1.0569932801,0.0 1.91385563422,0.856862354124 1.91385563422,1.91385563422 l 0.0,0.0 c 0.0,1.0569932801 -0.856862354124,1.91385563422 -1.91385563422,1.91385563422 l -0.775299291975,0.0 c -1.0569932801,0.0 -1.91385563422,-0.856862354124 -1.91385563422,-1.91385563422 l 0.0,0.0 c 0.0,-1.0569932801 0.856862354124,-1.91385563422 1.91385563422,-1.91385563422 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.387649645988,-1.91385563422 l 0.775299291975,0.0 c 1.0569932801,0.0 1.91385563422,0.856862354124 1.91385563422,1.91385563422 l 0.0,0.0 c 0.0,1.0569932801 -0.856862354124,1.91385563422 -1.91385563422,1.91385563422 l -0.775299291975,0.0 c -1.0569932801,0.0 -1.91385563422,-0.856862354124 -1.91385563422,-1.91385563422 l 0.0,0.0 c 0.0,-1.0569932801 0.856862354124,-1.91385563422 1.91385563422,-1.91385563422 Z"
+            android:valueTo="M -0.156963485208,-1.96511922551 l 0.313926970417,0.0 c 1.08530537979,0.0 1.96511922551,0.879813845722 1.96511922551,1.96511922551 l 0.0,0.0 c 0.0,1.08530537979 -0.879813845722,1.96511922551 -1.96511922551,1.96511922551 l -0.313926970417,0.0 c -1.08530537979,0.0 -1.96511922551,-0.879813845722 -1.96511922551,-1.96511922551 l 0.0,0.0 c 0.0,-1.08530537979 0.879813845722,-1.96511922551 1.96511922551,-1.96511922551 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.156963485208,-1.96511922551 l 0.313926970417,0.0 c 1.08530537979,0.0 1.96511922551,0.879813845722 1.96511922551,1.96511922551 l 0.0,0.0 c 0.0,1.08530537979 -0.879813845722,1.96511922551 -1.96511922551,1.96511922551 l -0.313926970417,0.0 c -1.08530537979,0.0 -1.96511922551,-0.879813845722 -1.96511922551,-1.96511922551 l 0.0,0.0 c 0.0,-1.08530537979 0.879813845722,-1.96511922551 1.96511922551,-1.96511922551 Z"
+            android:valueTo="M -0.0362224951386,-1.99195055664 l 0.0724449902773,0.0 c 1.10012391479,0.0 1.99195055664,0.89182664185 1.99195055664,1.99195055664 l 0.0,0.0 c 0.0,1.10012391479 -0.89182664185,1.99195055664 -1.99195055664,1.99195055664 l -0.0724449902773,0.0 c -1.10012391479,0.0 -1.99195055664,-0.89182664185 -1.99195055664,-1.99195055664 l 0.0,0.0 c 0.0,-1.10012391479 0.89182664185,-1.99195055664 1.99195055664,-1.99195055664 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0362224951386,-1.99195055664 l 0.0724449902773,0.0 c 1.10012391479,0.0 1.99195055664,0.89182664185 1.99195055664,1.99195055664 l 0.0,0.0 c 0.0,1.10012391479 -0.89182664185,1.99195055664 -1.99195055664,1.99195055664 l -0.0724449902773,0.0 c -1.10012391479,0.0 -1.99195055664,-0.89182664185 -1.99195055664,-1.99195055664 l 0.0,0.0 c 0.0,-1.10012391479 0.89182664185,-1.99195055664 1.99195055664,-1.99195055664 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_3_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_3_animation.xml
new file mode 100644
index 0000000..444f6b6
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_3_animation.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="300"
+            android:propertyName="pathData"
+            android:valueFrom="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -6.04266574364,-1.0 l 12.0853314873,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -12.0853314873,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -6.04266574364,-1.0 l 12.0853314873,0.0 c 0.528721110251,0.0 0.957334256364,0.428613146113 0.957334256364,0.957334256364 l 0.0,0.0853314872718 c 0.0,0.528721110251 -0.428613146113,0.957334256364 -0.957334256364,0.957334256364 l -12.0853314873,0.0 c -0.528721110251,0.0 -0.957334256364,-0.428613146113 -0.957334256364,-0.957334256364 l 0.0,-0.0853314872718 c 0.0,-0.528721110251 0.428613146113,-0.957334256364 0.957334256364,-0.957334256364 Z"
+            android:valueTo="M -3.32349448958,-1.44608425174 l 6.64698897916,0.0 c 0.79865027916,0.0 1.44608425174,0.647433972576 1.44608425174,1.44608425174 l 0.0,0.0 c 0.0,0.79865027916 -0.647433972576,1.44608425174 -1.44608425174,1.44608425174 l -6.64698897916,0.0 c -0.79865027916,0.0 -1.44608425174,-0.647433972576 -1.44608425174,-1.44608425174 l 0.0,0.0 c 0.0,-0.79865027916 0.647433972576,-1.44608425174 1.44608425174,-1.44608425174 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -3.32349448958,-1.44608425174 l 6.64698897916,0.0 c 0.79865027916,0.0 1.44608425174,0.647433972576 1.44608425174,1.44608425174 l 0.0,0.0 c 0.0,0.79865027916 -0.647433972576,1.44608425174 -1.44608425174,1.44608425174 l -6.64698897916,0.0 c -0.79865027916,0.0 -1.44608425174,-0.647433972576 -1.44608425174,-1.44608425174 l 0.0,0.0 c 0.0,-0.79865027916 0.647433972576,-1.44608425174 1.44608425174,-1.44608425174 Z"
+            android:valueTo="M -1.85713345224,-1.69047775796 l 3.71426690449,0.0 c 0.933625085597,0.0 1.69047775796,0.756852672362 1.69047775796,1.69047775796 l 0.0,0.0 c 0.0,0.933625085597 -0.756852672362,1.69047775796 -1.69047775796,1.69047775796 l -3.71426690449,0.0 c -0.933625085597,0.0 -1.69047775796,-0.756852672362 -1.69047775796,-1.69047775796 l 0.0,0.0 c 0.0,-0.933625085597 0.756852672362,-1.69047775796 1.69047775796,-1.69047775796 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.85713345224,-1.69047775796 l 3.71426690449,0.0 c 0.933625085597,0.0 1.69047775796,0.756852672362 1.69047775796,1.69047775796 l 0.0,0.0 c 0.0,0.933625085597 -0.756852672362,1.69047775796 -1.69047775796,1.69047775796 l -3.71426690449,0.0 c -0.933625085597,0.0 -1.69047775796,-0.756852672362 -1.69047775796,-1.69047775796 l 0.0,0.0 c 0.0,-0.933625085597 0.756852672362,-1.69047775796 1.69047775796,-1.69047775796 Z"
+            android:valueTo="M -1.02822695895,-1.82862884018 l 2.05645391789,0.0 c 1.00992382147,0.0 1.82862884018,0.818705018702 1.82862884018,1.82862884018 l 0.0,0.0 c 0.0,1.00992382147 -0.818705018702,1.82862884018 -1.82862884018,1.82862884018 l -2.05645391789,0.0 c -1.00992382147,0.0 -1.82862884018,-0.818705018702 -1.82862884018,-1.82862884018 l 0.0,0.0 c 0.0,-1.00992382147 0.818705018702,-1.82862884018 1.82862884018,-1.82862884018 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.02822695895,-1.82862884018 l 2.05645391789,0.0 c 1.00992382147,0.0 1.82862884018,0.818705018702 1.82862884018,1.82862884018 l 0.0,0.0 c 0.0,1.00992382147 -0.818705018702,1.82862884018 -1.82862884018,1.82862884018 l -2.05645391789,0.0 c -1.00992382147,0.0 -1.82862884018,-0.818705018702 -1.82862884018,-1.82862884018 l 0.0,0.0 c 0.0,-1.00992382147 0.818705018702,-1.82862884018 1.82862884018,-1.82862884018 Z"
+            android:valueTo="M -0.51686619465,-1.91385563422 l 1.0337323893,0.0 c 1.0569932801,0.0 1.91385563422,0.856862354124 1.91385563422,1.91385563422 l 0.0,0.0 c 0.0,1.0569932801 -0.856862354124,1.91385563422 -1.91385563422,1.91385563422 l -1.0337323893,0.0 c -1.0569932801,0.0 -1.91385563422,-0.856862354124 -1.91385563422,-1.91385563422 l 0.0,0.0 c 0.0,-1.0569932801 0.856862354124,-1.91385563422 1.91385563422,-1.91385563422 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.51686619465,-1.91385563422 l 1.0337323893,0.0 c 1.0569932801,0.0 1.91385563422,0.856862354124 1.91385563422,1.91385563422 l 0.0,0.0 c 0.0,1.0569932801 -0.856862354124,1.91385563422 -1.91385563422,1.91385563422 l -1.0337323893,0.0 c -1.0569932801,0.0 -1.91385563422,-0.856862354124 -1.91385563422,-1.91385563422 l 0.0,0.0 c 0.0,-1.0569932801 0.856862354124,-1.91385563422 1.91385563422,-1.91385563422 Z"
+            android:valueTo="M -0.209284646944,-1.96511922551 l 0.418569293889,0.0 c 1.08530537979,0.0 1.96511922551,0.879813845722 1.96511922551,1.96511922551 l 0.0,0.0 c 0.0,1.08530537979 -0.879813845722,1.96511922551 -1.96511922551,1.96511922551 l -0.418569293889,0.0 c -1.08530537979,0.0 -1.96511922551,-0.879813845722 -1.96511922551,-1.96511922551 l 0.0,0.0 c 0.0,-1.08530537979 0.879813845722,-1.96511922551 1.96511922551,-1.96511922551 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.209284646944,-1.96511922551 l 0.418569293889,0.0 c 1.08530537979,0.0 1.96511922551,0.879813845722 1.96511922551,1.96511922551 l 0.0,0.0 c 0.0,1.08530537979 -0.879813845722,1.96511922551 -1.96511922551,1.96511922551 l -0.418569293889,0.0 c -1.08530537979,0.0 -1.96511922551,-0.879813845722 -1.96511922551,-1.96511922551 l 0.0,0.0 c 0.0,-1.08530537979 0.879813845722,-1.96511922551 1.96511922551,-1.96511922551 Z"
+            android:valueTo="M -0.0482966601849,-1.99195055664 l 0.0965933203697,0.0 c 1.10012391479,0.0 1.99195055664,0.89182664185 1.99195055664,1.99195055664 l 0.0,0.0 c 0.0,1.10012391479 -0.89182664185,1.99195055664 -1.99195055664,1.99195055664 l -0.0965933203697,0.0 c -1.10012391479,0.0 -1.99195055664,-0.89182664185 -1.99195055664,-1.99195055664 l 0.0,0.0 c 0.0,-1.10012391479 0.89182664185,-1.99195055664 1.99195055664,-1.99195055664 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0482966601849,-1.99195055664 l 0.0965933203697,0.0 c 1.10012391479,0.0 1.99195055664,0.89182664185 1.99195055664,1.99195055664 l 0.0,0.0 c 0.0,1.10012391479 -0.89182664185,1.99195055664 -1.99195055664,1.99195055664 l -0.0965933203697,0.0 c -1.10012391479,0.0 -1.99195055664,-0.89182664185 -1.99195055664,-1.99195055664 l 0.0,0.0 c 0.0,-1.10012391479 0.89182664185,-1.99195055664 1.99195055664,-1.99195055664 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_4_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_4_animation.xml
new file mode 100644
index 0000000..db294c7
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_4_animation.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="100"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M -4.0950630677,-1.30952224204 l 8.1901261354,0.0 c 0.177619793131,0.0 0.32160908516,0.143989292029 0.32160908516,0.32160908516 l 0.0,1.97582631376 c 0.0,0.177619793131 -0.143989292029,0.32160908516 -0.32160908516,0.32160908516 l -8.1901261354,0.0 c -0.177619793131,0.0 -0.32160908516,-0.143989292029 -0.32160908516,-0.32160908516 l 0.0,-1.97582631376 c 0.0,-0.177619793131 0.143989292029,-0.32160908516 0.32160908516,-0.32160908516 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="50"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.0950630677,-1.30952224204 l 8.1901261354,0.0 c 0.177619793131,0.0 0.32160908516,0.143989292029 0.32160908516,0.32160908516 l 0.0,1.97582631376 c 0.0,0.177619793131 -0.143989292029,0.32160908516 -0.32160908516,0.32160908516 l -8.1901261354,0.0 c -0.177619793131,0.0 -0.32160908516,-0.143989292029 -0.32160908516,-0.32160908516 l 0.0,-1.97582631376 c 0.0,-0.177619793131 0.143989292029,-0.32160908516 0.32160908516,-0.32160908516 Z"
+            android:valueTo="M -5.11454284324,-1.11013061622 l 10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.11454284324,-1.11013061622 l 10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.41755510258,-1.02355568498 l 10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.41755510258,-1.02355568498 l 10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_5_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_5_animation.xml
new file mode 100644
index 0000000..86e4dd6
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_5_animation.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="50"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M -0.510644950991,-1.91489250817 l 1.02128990198,0.0 c 1.05756592977,0.0 1.91489250817,0.857326578401 1.91489250817,1.91489250817 l 0.0,0.0 c 0.0,1.05756592977 -0.857326578401,1.91489250817 -1.91489250817,1.91489250817 l -1.02128990198,0.0 c -1.05756592977,0.0 -1.91489250817,-0.857326578401 -1.91489250817,-1.91489250817 l 0.0,0.0 c 0.0,-1.05756592977 0.857326578401,-1.91489250817 1.91489250817,-1.91489250817 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.510644950991,-1.91489250817 l 1.02128990198,0.0 c 1.05756592977,0.0 1.91489250817,0.857326578401 1.91489250817,1.91489250817 l 0.0,0.0 c 0.0,1.05756592977 -0.857326578401,1.91489250817 -1.91489250817,1.91489250817 l -1.02128990198,0.0 c -1.05756592977,0.0 -1.91489250817,-0.857326578401 -1.91489250817,-1.91489250817 l 0.0,0.0 c 0.0,-1.05756592977 0.857326578401,-1.91489250817 1.91489250817,-1.91489250817 Z"
+            android:valueTo="M -3.66172292328,-1.54166666667 l 7.32344584656,0.0 c 0.347908322704,0.0 0.629943743386,0.282035420682 0.629943743386,0.629943743386 l 0.0,1.82344584656 c 0.0,0.347908322704 -0.282035420682,0.629943743386 -0.629943743386,0.629943743386 l -7.32344584656,0.0 c -0.347908322704,0.0 -0.629943743386,-0.282035420682 -0.629943743386,-0.629943743386 l 0.0,-1.82344584656 c 0.0,-0.347908322704 0.282035420682,-0.629943743386 0.629943743386,-0.629943743386 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M -3.66172292328,-1.54166666667 l 7.32344584656,0.0 c 0.347908322704,0.0 0.629943743386,0.282035420682 0.629943743386,0.629943743386 l 0.0,1.82344584656 c 0.0,0.347908322704 -0.282035420682,0.629943743386 -0.629943743386,0.629943743386 l -7.32344584656,0.0 c -0.347908322704,0.0 -0.629943743386,-0.282035420682 -0.629943743386,-0.629943743386 l 0.0,-1.82344584656 c 0.0,-0.347908322704 0.282035420682,-0.629943743386 0.629943743386,-0.629943743386 Z"
+            android:valueTo="M -5.80605656225,-1.22447422869 l 11.6121131245,0.0 c 0.0395282866537,0.0 0.0715722943065,0.0320440076528 0.0715722943065,0.0715722943065 l 0.0,2.30580386877 c 0.0,0.0395282866537 -0.0320440076528,0.0715722943065 -0.0715722943065,0.0715722943065 l -11.6121131245,0.0 c -0.0395282866537,0.0 -0.0715722943065,-0.0320440076528 -0.0715722943065,-0.0715722943065 l 0.0,-2.30580386877 c 0.0,-0.0395282866537 0.0320440076528,-0.0715722943065 0.0715722943065,-0.0715722943065 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.80605656225,-1.22447422869 l 11.6121131245,0.0 c 0.0395282866537,0.0 0.0715722943065,0.0320440076528 0.0715722943065,0.0715722943065 l 0.0,2.30580386877 c 0.0,0.0395282866537 -0.0320440076528,0.0715722943065 -0.0715722943065,0.0715722943065 l -11.6121131245,0.0 c -0.0395282866537,0.0 -0.0715722943065,-0.0320440076528 -0.0715722943065,-0.0715722943065 l 0.0,-2.30580386877 c 0.0,-0.0395282866537 0.0320440076528,-0.0715722943065 0.0715722943065,-0.0715722943065 Z"
+            android:valueTo="M -6.60386380145,-1.07922723971 l 13.2077276029,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.15845447942 c 0.0,0.0 0.0,0.0 0.0,0.0 l -13.2077276029,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.15845447942 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M -6.60386380145,-1.07922723971 l 13.2077276029,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.15845447942 c 0.0,0.0 0.0,0.0 0.0,0.0 l -13.2077276029,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.15845447942 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -6.91679014084,-1.01664197183 l 13.8335802817,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.03328394367 c 0.0,0.0 0.0,0.0 0.0,0.0 l -13.8335802817,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.03328394367 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="41"
+            android:propertyName="pathData"
+            android:valueFrom="M -6.91679014084,-1.01664197183 l 13.8335802817,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.03328394367 c 0.0,0.0 0.0,0.0 0.0,0.0 l -13.8335802817,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.03328394367 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_toarrow_rectangle_path_6_animation.xml b/core/res/res/anim/ft_avd_toarrow_rectangle_path_6_animation.xml
new file mode 100644
index 0000000..db294c7
--- /dev/null
+++ b/core/res/res/anim/ft_avd_toarrow_rectangle_path_6_animation.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="100"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueTo="M -4.0950630677,-1.30952224204 l 8.1901261354,0.0 c 0.177619793131,0.0 0.32160908516,0.143989292029 0.32160908516,0.32160908516 l 0.0,1.97582631376 c 0.0,0.177619793131 -0.143989292029,0.32160908516 -0.32160908516,0.32160908516 l -8.1901261354,0.0 c -0.177619793131,0.0 -0.32160908516,-0.143989292029 -0.32160908516,-0.32160908516 l 0.0,-1.97582631376 c 0.0,-0.177619793131 0.143989292029,-0.32160908516 0.32160908516,-0.32160908516 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="50"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.0950630677,-1.30952224204 l 8.1901261354,0.0 c 0.177619793131,0.0 0.32160908516,0.143989292029 0.32160908516,0.32160908516 l 0.0,1.97582631376 c 0.0,0.177619793131 -0.143989292029,0.32160908516 -0.32160908516,0.32160908516 l -8.1901261354,0.0 c -0.177619793131,0.0 -0.32160908516,-0.143989292029 -0.32160908516,-0.32160908516 l 0.0,-1.97582631376 c 0.0,-0.177619793131 0.143989292029,-0.32160908516 0.32160908516,-0.32160908516 Z"
+            android:valueTo="M -5.11454284324,-1.11013061622 l 10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.11454284324,-1.11013061622 l 10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.2290856865,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.22026123243 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.41755510258,-1.02355568498 l 10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="49"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.41755510258,-1.02355568498 l 10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.8351102052,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.04711136995 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_1_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_1_animation.xml
new file mode 100644
index 0000000..3869ced
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_1_animation.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="400"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -6.5,0.0 c 1.08333,-1.0 5.41667,-5.0 6.5,-6.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+    <objectAnimator
+        android:duration="400"
+        android:propertyName="rotation"
+        android:valueFrom="-45.0"
+        android:valueTo="0.0"
+        android:valueType="floatType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_1_pivot_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_1_pivot_animation.xml
new file mode 100644
index 0000000..90010a75
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_1_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="300"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 4.5,0.0 c -0.75,0.0 -3.75,0.0 -4.5,0.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_2_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_2_animation.xml
new file mode 100644
index 0000000..b5e031e
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_2_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="300"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -8.0,0.0 c 1.33333,0.0 6.66667,0.0 8.0,0.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_2_pivot_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_2_pivot_animation.xml
new file mode 100644
index 0000000..55c72c6e
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_2_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="216"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 9.0,0.0 c -1.5,0.0 -7.5,0.0 -9.0,0.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_3_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_3_animation.xml
new file mode 100644
index 0000000..0524f2a
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_3_animation.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="400"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M -6.5,0.0 c 1.08333,1.0 5.41667,5.0 6.5,6.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+    <objectAnimator
+        android:duration="400"
+        android:propertyName="rotation"
+        android:valueFrom="45.0"
+        android:valueTo="0.0"
+        android:valueType="floatType"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_3_pivot_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_3_pivot_animation.xml
new file mode 100644
index 0000000..90010a75
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_3_pivot_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="300"
+        android:propertyXName="translateX"
+        android:propertyYName="translateY"
+        android:pathData="M 4.5,0.0 c -0.75,0.0 -3.75,0.0 -4.5,0.0"
+        android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_path_1_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_1_animation.xml
new file mode 100644
index 0000000..ced8cf5
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_1_animation.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.349609375,-1.04296875 l 10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.349609375,-1.04296875 l 10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -4.57327108594,-1.25 l 9.14654217189,0.0 c 0.0285690903566,0.0 0.0517289140556,0.023159823699 0.0517289140556,0.0517289140556 l 0.0,2.39654217189 c 0.0,0.0285690903566 -0.023159823699,0.0517289140556 -0.0517289140556,0.0517289140556 l -9.14654217189,0.0 c -0.0285690903566,0.0 -0.0517289140556,-0.023159823699 -0.0517289140556,-0.0517289140556 l 0.0,-2.39654217189 c 0.0,-0.0285690903566 0.023159823699,-0.0517289140556 0.0517289140556,-0.0517289140556 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.57327108594,-1.25 l 9.14654217189,0.0 c 0.0285690903566,0.0 0.0517289140556,0.023159823699 0.0517289140556,0.0517289140556 l 0.0,2.39654217189 c 0.0,0.0285690903566 -0.023159823699,0.0517289140556 -0.0517289140556,0.0517289140556 l -9.14654217189,0.0 c -0.0285690903566,0.0 -0.0517289140556,-0.023159823699 -0.0517289140556,-0.0517289140556 l 0.0,-2.39654217189 c 0.0,-0.0285690903566 0.023159823699,-0.0517289140556 0.0517289140556,-0.0517289140556 Z"
+            android:valueTo="M -3.04137381938,-1.55960748018 l 6.08274763876,0.0 c 0.2761423749,0.0 0.5,0.2238576251 0.5,0.5 l 0.0,2.11921496035 c 0.0,0.2761423749 -0.2238576251,0.5 -0.5,0.5 l -6.08274763876,0.0 c -0.2761423749,0.0 -0.5,-0.2238576251 -0.5,-0.5 l 0.0,-2.11921496035 c 0.0,-0.2761423749 0.2238576251,-0.5 0.5,-0.5 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -3.04137381938,-1.55960748018 l 6.08274763876,0.0 c 0.2761423749,0.0 0.5,0.2238576251 0.5,0.5 l 0.0,2.11921496035 c 0.0,0.2761423749 -0.2238576251,0.5 -0.5,0.5 l -6.08274763876,0.0 c -0.2761423749,0.0 -0.5,-0.2238576251 -0.5,-0.5 l 0.0,-2.11921496035 c 0.0,-0.2761423749 0.2238576251,-0.5 0.5,-0.5 Z"
+            android:valueTo="M -1.55858989728,-1.77552577131 l 3.11717979456,0.0 c 0.677691994437,0.0 1.22706990313,0.549377908693 1.22706990313,1.22706990313 l 0.0,1.09691173636 c 0.0,0.677691994437 -0.549377908693,1.22706990313 -1.22706990313,1.22706990313 l -3.11717979456,0.0 c -0.677691994437,0.0 -1.22706990313,-0.549377908693 -1.22706990313,-1.22706990313 l 0.0,-1.09691173636 c 0.0,-0.677691994437 0.549377908693,-1.22706990313 1.22706990313,-1.22706990313 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.55858989728,-1.77552577131 l 3.11717979456,0.0 c 0.677691994437,0.0 1.22706990313,0.549377908693 1.22706990313,1.22706990313 l 0.0,1.09691173636 c 0.0,0.677691994437 -0.549377908693,1.22706990313 -1.22706990313,1.22706990313 l -3.11717979456,0.0 c -0.677691994437,0.0 -1.22706990313,-0.549377908693 -1.22706990313,-1.22706990313 l 0.0,-1.09691173636 c 0.0,-0.677691994437 0.549377908693,-1.22706990313 1.22706990313,-1.22706990313 Z"
+            android:valueTo="M -0.706008791281,-1.89447268498 l 1.41201758256,0.0 c 0.918635554655,0.0 1.66333681129,0.744701256633 1.66333681129,1.66333681129 l 0.0,0.462271747384 c 0.0,0.918635554655 -0.744701256633,1.66333681129 -1.66333681129,1.66333681129 l -1.41201758256,0.0 c -0.918635554655,0.0 -1.66333681129,-0.744701256633 -1.66333681129,-1.66333681129 l 0.0,-0.462271747384 c 0.0,-0.918635554655 0.744701256633,-1.66333681129 1.66333681129,-1.66333681129 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.706008791281,-1.89447268498 l 1.41201758256,0.0 c 0.918635554655,0.0 1.66333681129,0.744701256633 1.66333681129,1.66333681129 l 0.0,0.462271747384 c 0.0,0.918635554655 -0.744701256633,1.66333681129 -1.66333681129,1.66333681129 l -1.41201758256,0.0 c -0.918635554655,0.0 -1.66333681129,-0.744701256633 -1.66333681129,-1.66333681129 l 0.0,-0.462271747384 c 0.0,-0.918635554655 0.744701256633,-1.66333681129 1.66333681129,-1.66333681129 Z"
+            android:valueTo="M -0.265730251554,-1.95936709392 l 0.531460503108,0.0 c 1.03635400439,0.0 1.87648491973,0.840130915331 1.87648491973,1.87648491973 l 0.0,0.165764348389 c 0.0,1.03635400439 -0.840130915331,1.87648491973 -1.87648491973,1.87648491973 l -0.531460503108,0.0 c -1.03635400439,0.0 -1.87648491973,-0.840130915331 -1.87648491973,-1.87648491973 l 0.0,-0.165764348389 c 0.0,-1.03635400439 0.840130915331,-1.87648491973 1.87648491973,-1.87648491973 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.265730251554,-1.95936709392 l 0.531460503108,0.0 c 1.03635400439,0.0 1.87648491973,0.840130915331 1.87648491973,1.87648491973 l 0.0,0.165764348389 c 0.0,1.03635400439 -0.840130915331,1.87648491973 -1.87648491973,1.87648491973 l -0.531460503108,0.0 c -1.03635400439,0.0 -1.87648491973,-0.840130915331 -1.87648491973,-1.87648491973 l 0.0,-0.165764348389 c 0.0,-1.03635400439 0.840130915331,-1.87648491973 1.87648491973,-1.87648491973 Z"
+            android:valueTo="M -0.0581061000545,-1.99098433926 l 0.116212200109,0.0 c 1.08990562844,0.0 1.97344871252,0.883543084083 1.97344871252,1.97344871252 l 0.0,0.0350712534878 c 0.0,1.08990562844 -0.883543084083,1.97344871252 -1.97344871252,1.97344871252 l -0.116212200109,0.0 c -1.08990562844,0.0 -1.97344871252,-0.883543084083 -1.97344871252,-1.97344871252 l 0.0,-0.0350712534878 c 0.0,-1.08990562844 0.883543084083,-1.97344871252 1.97344871252,-1.97344871252 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0581061000545,-1.99098433926 l 0.116212200109,0.0 c 1.08990562844,0.0 1.97344871252,0.883543084083 1.97344871252,1.97344871252 l 0.0,0.0350712534878 c 0.0,1.08990562844 -0.883543084083,1.97344871252 -1.97344871252,1.97344871252 l -0.116212200109,0.0 c -1.08990562844,0.0 -1.97344871252,-0.883543084083 -1.97344871252,-1.97344871252 l 0.0,-0.0350712534878 c 0.0,-1.08990562844 0.883543084083,-1.97344871252 1.97344871252,-1.97344871252 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_path_2_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_2_animation.xml
new file mode 100644
index 0000000..ced8cf5
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_2_animation.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -5.349609375,-1.04296875 l 10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -5.349609375,-1.04296875 l 10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 l -10.69921875,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0859375 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -4.57327108594,-1.25 l 9.14654217189,0.0 c 0.0285690903566,0.0 0.0517289140556,0.023159823699 0.0517289140556,0.0517289140556 l 0.0,2.39654217189 c 0.0,0.0285690903566 -0.023159823699,0.0517289140556 -0.0517289140556,0.0517289140556 l -9.14654217189,0.0 c -0.0285690903566,0.0 -0.0517289140556,-0.023159823699 -0.0517289140556,-0.0517289140556 l 0.0,-2.39654217189 c 0.0,-0.0285690903566 0.023159823699,-0.0517289140556 0.0517289140556,-0.0517289140556 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.57327108594,-1.25 l 9.14654217189,0.0 c 0.0285690903566,0.0 0.0517289140556,0.023159823699 0.0517289140556,0.0517289140556 l 0.0,2.39654217189 c 0.0,0.0285690903566 -0.023159823699,0.0517289140556 -0.0517289140556,0.0517289140556 l -9.14654217189,0.0 c -0.0285690903566,0.0 -0.0517289140556,-0.023159823699 -0.0517289140556,-0.0517289140556 l 0.0,-2.39654217189 c 0.0,-0.0285690903566 0.023159823699,-0.0517289140556 0.0517289140556,-0.0517289140556 Z"
+            android:valueTo="M -3.04137381938,-1.55960748018 l 6.08274763876,0.0 c 0.2761423749,0.0 0.5,0.2238576251 0.5,0.5 l 0.0,2.11921496035 c 0.0,0.2761423749 -0.2238576251,0.5 -0.5,0.5 l -6.08274763876,0.0 c -0.2761423749,0.0 -0.5,-0.2238576251 -0.5,-0.5 l 0.0,-2.11921496035 c 0.0,-0.2761423749 0.2238576251,-0.5 0.5,-0.5 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -3.04137381938,-1.55960748018 l 6.08274763876,0.0 c 0.2761423749,0.0 0.5,0.2238576251 0.5,0.5 l 0.0,2.11921496035 c 0.0,0.2761423749 -0.2238576251,0.5 -0.5,0.5 l -6.08274763876,0.0 c -0.2761423749,0.0 -0.5,-0.2238576251 -0.5,-0.5 l 0.0,-2.11921496035 c 0.0,-0.2761423749 0.2238576251,-0.5 0.5,-0.5 Z"
+            android:valueTo="M -1.55858989728,-1.77552577131 l 3.11717979456,0.0 c 0.677691994437,0.0 1.22706990313,0.549377908693 1.22706990313,1.22706990313 l 0.0,1.09691173636 c 0.0,0.677691994437 -0.549377908693,1.22706990313 -1.22706990313,1.22706990313 l -3.11717979456,0.0 c -0.677691994437,0.0 -1.22706990313,-0.549377908693 -1.22706990313,-1.22706990313 l 0.0,-1.09691173636 c 0.0,-0.677691994437 0.549377908693,-1.22706990313 1.22706990313,-1.22706990313 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.55858989728,-1.77552577131 l 3.11717979456,0.0 c 0.677691994437,0.0 1.22706990313,0.549377908693 1.22706990313,1.22706990313 l 0.0,1.09691173636 c 0.0,0.677691994437 -0.549377908693,1.22706990313 -1.22706990313,1.22706990313 l -3.11717979456,0.0 c -0.677691994437,0.0 -1.22706990313,-0.549377908693 -1.22706990313,-1.22706990313 l 0.0,-1.09691173636 c 0.0,-0.677691994437 0.549377908693,-1.22706990313 1.22706990313,-1.22706990313 Z"
+            android:valueTo="M -0.706008791281,-1.89447268498 l 1.41201758256,0.0 c 0.918635554655,0.0 1.66333681129,0.744701256633 1.66333681129,1.66333681129 l 0.0,0.462271747384 c 0.0,0.918635554655 -0.744701256633,1.66333681129 -1.66333681129,1.66333681129 l -1.41201758256,0.0 c -0.918635554655,0.0 -1.66333681129,-0.744701256633 -1.66333681129,-1.66333681129 l 0.0,-0.462271747384 c 0.0,-0.918635554655 0.744701256633,-1.66333681129 1.66333681129,-1.66333681129 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.706008791281,-1.89447268498 l 1.41201758256,0.0 c 0.918635554655,0.0 1.66333681129,0.744701256633 1.66333681129,1.66333681129 l 0.0,0.462271747384 c 0.0,0.918635554655 -0.744701256633,1.66333681129 -1.66333681129,1.66333681129 l -1.41201758256,0.0 c -0.918635554655,0.0 -1.66333681129,-0.744701256633 -1.66333681129,-1.66333681129 l 0.0,-0.462271747384 c 0.0,-0.918635554655 0.744701256633,-1.66333681129 1.66333681129,-1.66333681129 Z"
+            android:valueTo="M -0.265730251554,-1.95936709392 l 0.531460503108,0.0 c 1.03635400439,0.0 1.87648491973,0.840130915331 1.87648491973,1.87648491973 l 0.0,0.165764348389 c 0.0,1.03635400439 -0.840130915331,1.87648491973 -1.87648491973,1.87648491973 l -0.531460503108,0.0 c -1.03635400439,0.0 -1.87648491973,-0.840130915331 -1.87648491973,-1.87648491973 l 0.0,-0.165764348389 c 0.0,-1.03635400439 0.840130915331,-1.87648491973 1.87648491973,-1.87648491973 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.265730251554,-1.95936709392 l 0.531460503108,0.0 c 1.03635400439,0.0 1.87648491973,0.840130915331 1.87648491973,1.87648491973 l 0.0,0.165764348389 c 0.0,1.03635400439 -0.840130915331,1.87648491973 -1.87648491973,1.87648491973 l -0.531460503108,0.0 c -1.03635400439,0.0 -1.87648491973,-0.840130915331 -1.87648491973,-1.87648491973 l 0.0,-0.165764348389 c 0.0,-1.03635400439 0.840130915331,-1.87648491973 1.87648491973,-1.87648491973 Z"
+            android:valueTo="M -0.0581061000545,-1.99098433926 l 0.116212200109,0.0 c 1.08990562844,0.0 1.97344871252,0.883543084083 1.97344871252,1.97344871252 l 0.0,0.0350712534878 c 0.0,1.08990562844 -0.883543084083,1.97344871252 -1.97344871252,1.97344871252 l -0.116212200109,0.0 c -1.08990562844,0.0 -1.97344871252,-0.883543084083 -1.97344871252,-1.97344871252 l 0.0,-0.0350712534878 c 0.0,-1.08990562844 0.883543084083,-1.97344871252 1.97344871252,-1.97344871252 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0581061000545,-1.99098433926 l 0.116212200109,0.0 c 1.08990562844,0.0 1.97344871252,0.883543084083 1.97344871252,1.97344871252 l 0.0,0.0350712534878 c 0.0,1.08990562844 -0.883543084083,1.97344871252 -1.97344871252,1.97344871252 l -0.116212200109,0.0 c -1.08990562844,0.0 -1.97344871252,-0.883543084083 -1.97344871252,-1.97344871252 l 0.0,-0.0350712534878 c 0.0,-1.08990562844 0.883543084083,-1.97344871252 1.97344871252,-1.97344871252 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/anim/ft_avd_tooverflow_rectangle_path_3_animation.xml b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_3_animation.xml
new file mode 100644
index 0000000..cb29410
--- /dev/null
+++ b/core/res/res/anim/ft_avd_tooverflow_rectangle_path_3_animation.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="50"
+            android:propertyName="pathData"
+            android:valueFrom="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+            android:valueTo="M -4.36843359242,-1.49992262412 l 8.73686718484,0.0 c 0.0728757880921,0.0 0.131953286993,0.0590774989007 0.131953286993,0.131953286993 l 0.0,2.73593867425 c 0.0,0.0728757880921 -0.0590774989007,0.131953286993 -0.131953286993,0.131953286993 l -8.73686718484,0.0 c -0.0728757880921,0.0 -0.131953286993,-0.0590774989007 -0.131953286993,-0.131953286993 l 0.0,-2.73593867425 c 0.0,-0.0728757880921 0.0590774989007,-0.131953286993 0.131953286993,-0.131953286993 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -4.36843359242,-1.49992262412 l 8.73686718484,0.0 c 0.0728757880921,0.0 0.131953286993,0.0590774989007 0.131953286993,0.131953286993 l 0.0,2.73593867425 c 0.0,0.0728757880921 -0.0590774989007,0.131953286993 -0.131953286993,0.131953286993 l -8.73686718484,0.0 c -0.0728757880921,0.0 -0.131953286993,-0.0590774989007 -0.131953286993,-0.131953286993 l 0.0,-2.73593867425 c 0.0,-0.0728757880921 0.0590774989007,-0.131953286993 0.131953286993,-0.131953286993 Z"
+            android:valueTo="M -2.7976112102,-1.69047775796 l 5.59522242041,0.0 c 0.41421356235,0.0 0.75,0.33578643765 0.75,0.75 l 0.0,1.88095551592 c 0.0,0.41421356235 -0.33578643765,0.75 -0.75,0.75 l -5.59522242041,0.0 c -0.41421356235,0.0 -0.75,-0.33578643765 -0.75,-0.75 l 0.0,-1.88095551592 c 0.0,-0.41421356235 0.33578643765,-0.75 0.75,-0.75 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -2.7976112102,-1.69047775796 l 5.59522242041,0.0 c 0.41421356235,0.0 0.75,0.33578643765 0.75,0.75 l 0.0,1.88095551592 c 0.0,0.41421356235 -0.33578643765,0.75 -0.75,0.75 l -5.59522242041,0.0 c -0.41421356235,0.0 -0.75,-0.33578643765 -0.75,-0.75 l 0.0,-1.88095551592 c 0.0,-0.41421356235 0.33578643765,-0.75 0.75,-0.75 Z"
+            android:valueTo="M -1.5412962309,-1.81003891076 l 3.08259246181,0.0 c 0.777898159561,0.0 1.4085092153,0.630611055735 1.4085092153,1.4085092153 l 0.0,0.803059390927 c 0.0,0.777898159561 -0.630611055735,1.4085092153 -1.4085092153,1.4085092153 l -3.08259246181,0.0 c -0.777898159561,0.0 -1.4085092153,-0.630611055735 -1.4085092153,-1.4085092153 l 0.0,-0.803059390927 c 0.0,-0.777898159561 0.630611055735,-1.4085092153 1.4085092153,-1.4085092153 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -1.5412962309,-1.81003891076 l 3.08259246181,0.0 c 0.777898159561,0.0 1.4085092153,0.630611055735 1.4085092153,1.4085092153 l 0.0,0.803059390927 c 0.0,0.777898159561 -0.630611055735,1.4085092153 -1.4085092153,1.4085092153 l -3.08259246181,0.0 c -0.777898159561,0.0 -1.4085092153,-0.630611055735 -1.4085092153,-1.4085092153 l 0.0,-0.803059390927 c 0.0,-0.777898159561 0.630611055735,-1.4085092153 1.4085092153,-1.4085092153 Z"
+            android:valueTo="M -0.798718330914,-1.88987363368 l 1.59743666183,0.0 c 0.967555109393,0.0 1.75191350068,0.784358391285 1.75191350068,1.75191350068 l 0.0,0.275920266008 c 0.0,0.967555109393 -0.784358391285,1.75191350068 -1.75191350068,1.75191350068 l -1.59743666183,0.0 c -0.967555109393,0.0 -1.75191350068,-0.784358391285 -1.75191350068,-1.75191350068 l 0.0,-0.275920266008 c 0.0,-0.967555109393 0.784358391285,-1.75191350068 1.75191350068,-1.75191350068 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.798718330914,-1.88987363368 l 1.59743666183,0.0 c 0.967555109393,0.0 1.75191350068,0.784358391285 1.75191350068,1.75191350068 l 0.0,0.275920266008 c 0.0,0.967555109393 -0.784358391285,1.75191350068 -1.75191350068,1.75191350068 l -1.59743666183,0.0 c -0.967555109393,0.0 -1.75191350068,-0.784358391285 -1.75191350068,-1.75191350068 l 0.0,-0.275920266008 c 0.0,-0.967555109393 0.784358391285,-1.75191350068 1.75191350068,-1.75191350068 Z"
+            android:valueTo="M -0.366220962052,-1.94300934217 l 0.732441924103,0.0 c 1.05968660322,0.0 1.91873232712,0.859045723904 1.91873232712,1.91873232712 l 0.0,0.0485540300878 c 0.0,1.05968660322 -0.859045723904,1.91873232712 -1.91873232712,1.91873232712 l -0.732441924103,0.0 c -1.05968660322,0.0 -1.91873232712,-0.859045723904 -1.91873232712,-1.91873232712 l 0.0,-0.0485540300878 c 0.0,-1.05968660322 0.859045723904,-1.91873232712 1.91873232712,-1.91873232712 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.366220962052,-1.94300934217 l 0.732441924103,0.0 c 1.05968660322,0.0 1.91873232712,0.859045723904 1.91873232712,1.91873232712 l 0.0,0.0485540300878 c 0.0,1.05968660322 -0.859045723904,1.91873232712 -1.91873232712,1.91873232712 l -0.732441924103,0.0 c -1.05968660322,0.0 -1.91873232712,-0.859045723904 -1.91873232712,-1.91873232712 l 0.0,-0.0485540300878 c 0.0,-1.05968660322 0.859045723904,-1.91873232712 1.91873232712,-1.91873232712 Z"
+            android:valueTo="M -0.141334109858,-1.97644431502 l 0.282668219716,0.0 c 1.09156005402,0.0 1.97644431502,0.884884261007 1.97644431502,1.97644431502 l 0.0,0.0 c 0.0,1.09156005402 -0.884884261007,1.97644431502 -1.97644431502,1.97644431502 l -0.282668219716,0.0 c -1.09156005402,0.0 -1.97644431502,-0.884884261007 -1.97644431502,-1.97644431502 l 0.0,0.0 c 0.0,-1.09156005402 0.884884261007,-1.97644431502 1.97644431502,-1.97644431502 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.141334109858,-1.97644431502 l 0.282668219716,0.0 c 1.09156005402,0.0 1.97644431502,0.884884261007 1.97644431502,1.97644431502 l 0.0,0.0 c 0.0,1.09156005402 -0.884884261007,1.97644431502 -1.97644431502,1.97644431502 l -0.282668219716,0.0 c -1.09156005402,0.0 -1.97644431502,-0.884884261007 -1.97644431502,-1.97644431502 l 0.0,0.0 c 0.0,-1.09156005402 0.884884261007,-1.97644431502 1.97644431502,-1.97644431502 Z"
+            android:valueTo="M -0.0331287849506,-1.99447853584 l 0.0662575699012,0.0 c 1.10152007915,0.0 1.99447853584,0.892958456693 1.99447853584,1.99447853584 l 0.0,0.0 c 0.0,1.10152007915 -0.892958456693,1.99447853584 -1.99447853584,1.99447853584 l -0.0662575699012,0.0 c -1.10152007915,0.0 -1.99447853584,-0.892958456693 -1.99447853584,-1.99447853584 l 0.0,0.0 c 0.0,-1.10152007915 0.892958456693,-1.99447853584 1.99447853584,-1.99447853584 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="37"
+            android:propertyName="pathData"
+            android:valueFrom="M -0.0331287849506,-1.99447853584 l 0.0662575699012,0.0 c 1.10152007915,0.0 1.99447853584,0.892958456693 1.99447853584,1.99447853584 l 0.0,0.0 c 0.0,1.10152007915 -0.892958456693,1.99447853584 -1.99447853584,1.99447853584 l -0.0662575699012,0.0 c -1.10152007915,0.0 -1.99447853584,-0.892958456693 -1.99447853584,-1.99447853584 l 0.0,0.0 c 0.0,-1.10152007915 0.892958456693,-1.99447853584 1.99447853584,-1.99447853584 Z"
+            android:valueTo="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z"
+            android:valueType="pathType"
+            android:interpolator="@android:interpolator/linear" />
+    </set>
+</set>
diff --git a/core/res/res/drawable-mdpi/pointer_alias_large.png b/core/res/res/drawable-mdpi/pointer_alias_large.png
new file mode 100644
index 0000000..283bf7f
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_alias_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_all_scroll_large.png b/core/res/res/drawable-mdpi/pointer_all_scroll_large.png
new file mode 100644
index 0000000..c29db87
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_all_scroll_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_arrow_large.png b/core/res/res/drawable-mdpi/pointer_arrow_large.png
new file mode 100644
index 0000000..9f59c4c
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_arrow_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_cell_large.png b/core/res/res/drawable-mdpi/pointer_cell_large.png
new file mode 100644
index 0000000..3dec5e5
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_cell_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_context_menu_large.png b/core/res/res/drawable-mdpi/pointer_context_menu_large.png
new file mode 100644
index 0000000..7c9e250
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_context_menu_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_copy_large.png b/core/res/res/drawable-mdpi/pointer_copy_large.png
new file mode 100644
index 0000000..18f4696
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_copy_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_crosshair_large.png b/core/res/res/drawable-mdpi/pointer_crosshair_large.png
new file mode 100644
index 0000000..ea1f5fc
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_crosshair_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_grab_large.png b/core/res/res/drawable-mdpi/pointer_grab_large.png
new file mode 100644
index 0000000..2e32766
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_grab_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_grabbing_large.png b/core/res/res/drawable-mdpi/pointer_grabbing_large.png
new file mode 100644
index 0000000..3c54751
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_grabbing_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_hand_large.png b/core/res/res/drawable-mdpi/pointer_hand_large.png
new file mode 100644
index 0000000..785047f
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_hand_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_help_large.png b/core/res/res/drawable-mdpi/pointer_help_large.png
new file mode 100644
index 0000000..6552f9b
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_help_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png
new file mode 100644
index 0000000..7086106
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_nodrop_large.png b/core/res/res/drawable-mdpi/pointer_nodrop_large.png
new file mode 100644
index 0000000..da981df
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_nodrop_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_text_large.png b/core/res/res/drawable-mdpi/pointer_text_large.png
new file mode 100644
index 0000000..2fba190
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_text_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png
new file mode 100644
index 0000000..eecaa89
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png
new file mode 100644
index 0000000..9d47ecf
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png
new file mode 100644
index 0000000..fd777b1
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_vertical_text_large.png b/core/res/res/drawable-mdpi/pointer_vertical_text_large.png
new file mode 100644
index 0000000..1cbe49a
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_vertical_text_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_zoom_in_large.png b/core/res/res/drawable-mdpi/pointer_zoom_in_large.png
new file mode 100644
index 0000000..923ad79
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_zoom_in_large.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_zoom_out_large.png b/core/res/res/drawable-mdpi/pointer_zoom_out_large.png
new file mode 100644
index 0000000..aa47eb9
--- /dev/null
+++ b/core/res/res/drawable-mdpi/pointer_zoom_out_large.png
Binary files differ
diff --git a/core/res/res/drawable/ft_avd_toarrow.xml b/core/res/res/drawable/ft_avd_toarrow.xml
new file mode 100644
index 0000000..087ea74
--- /dev/null
+++ b/core/res/res/drawable/ft_avd_toarrow.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:name="ft_avd_toarrow"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:height="24dp"
+    android:viewportHeight="24" >
+    <group
+        android:name="carrot_3"
+        android:translateX="12"
+        android:translateY="12" >
+        <group
+            android:name="rectangle_4"
+            android:translateY="6" >
+            <group
+                android:name="rectangle_3_pivot_0" >
+                <path
+                    android:name="rectangle_path_4"
+                    android:fillColor="#FF000000"
+                    android:pathData="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z" />
+            </group>
+        </group>
+        <group
+            android:name="rectangle_5" >
+            <group
+                android:name="rectangle_2_pivot_0" >
+                <path
+                    android:name="rectangle_path_5"
+                    android:fillColor="#FF000000"
+                    android:pathData="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z" />
+            </group>
+        </group>
+        <group
+            android:name="rectangle_6"
+            android:translateY="-6" >
+            <group
+                android:name="rectangle_1_pivot_0" >
+                <path
+                    android:name="rectangle_path_6"
+                    android:fillColor="#FF000000"
+                    android:pathData="M 0.0,-2.0 l 0.0,0.0 c 1.1045694996,0.0 2.0,0.8954305004 2.0,2.0 l 0.0,0.0 c 0.0,1.1045694996 -0.8954305004,2.0 -2.0,2.0 l 0.0,0.0 c -1.1045694996,0.0 -2.0,-0.8954305004 -2.0,-2.0 l 0.0,0.0 c 0.0,-1.1045694996 0.8954305004,-2.0 2.0,-2.0 Z" />
+            </group>
+        </group>
+    </group>
+</vector>
diff --git a/core/res/res/drawable/ft_avd_toarrow_animation.xml b/core/res/res/drawable/ft_avd_toarrow_animation.xml
new file mode 100644
index 0000000..e31067d
--- /dev/null
+++ b/core/res/res/drawable/ft_avd_toarrow_animation.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<animated-vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ft_avd_toarrow" >
+    <target
+        android:name="rectangle_4"
+        android:animation="@anim/ft_avd_toarrow_rectangle_4_animation" />
+    <target
+        android:name="rectangle_3_pivot_0"
+        android:animation="@anim/ft_avd_toarrow_rectangle_3_pivot_0_animation" />
+    <target
+        android:name="rectangle_path_4"
+        android:animation="@anim/ft_avd_toarrow_rectangle_path_4_animation" />
+    <target
+        android:name="rectangle_5"
+        android:animation="@anim/ft_avd_toarrow_rectangle_5_animation" />
+    <target
+        android:name="rectangle_2_pivot_0"
+        android:animation="@anim/ft_avd_toarrow_rectangle_2_pivot_0_animation" />
+    <target
+        android:name="rectangle_path_5"
+        android:animation="@anim/ft_avd_toarrow_rectangle_path_5_animation" />
+    <target
+        android:name="rectangle_6"
+        android:animation="@anim/ft_avd_toarrow_rectangle_6_animation" />
+    <target
+        android:name="rectangle_1_pivot_0"
+        android:animation="@anim/ft_avd_toarrow_rectangle_1_pivot_0_animation" />
+    <target
+        android:name="rectangle_path_6"
+        android:animation="@anim/ft_avd_toarrow_rectangle_path_6_animation" />
+</animated-vector>
diff --git a/core/res/res/drawable/ft_avd_tooverflow.xml b/core/res/res/drawable/ft_avd_tooverflow.xml
new file mode 100644
index 0000000..a2b9cec
--- /dev/null
+++ b/core/res/res/drawable/ft_avd_tooverflow.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:name="ft_avd_tooverflow"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:height="24dp"
+    android:viewportHeight="24" >
+    <group
+        android:name="carrot_5"
+        android:translateX="12"
+        android:translateY="12" >
+        <group
+            android:name="rectangle_3"
+            android:translateX="-6.5"
+            android:rotation="45" >
+            <group
+                android:name="rectangle_3_pivot"
+                android:translateX="4.5" >
+                <path
+                    android:name="rectangle_path_2"
+                    android:fillColor="#FF000000"
+                    android:pathData="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z" />
+            </group>
+        </group>
+        <group
+            android:name="rectangle_2"
+            android:translateX="-8" >
+            <group
+                android:name="rectangle_2_pivot"
+                android:translateX="9" >
+                <path
+                    android:name="rectangle_path_3"
+                    android:fillColor="#FF000000"
+                    android:pathData="M -7.0,-1.0 l 14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -14.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z" />
+            </group>
+        </group>
+        <group
+            android:name="rectangle_1"
+            android:translateX="-6.5"
+            android:rotation="-45" >
+            <group
+                android:name="rectangle_1_pivot"
+                android:translateX="4.5" >
+                <path
+                    android:name="rectangle_path_1"
+                    android:fillColor="#FF000000"
+                    android:pathData="M -5.5,-1.0 l 11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l -11.0,0.0 c 0.0,0.0 0.0,0.0 0.0,0.0 l 0.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z" />
+            </group>
+        </group>
+    </group>
+</vector>
diff --git a/core/res/res/drawable/ft_avd_tooverflow_animation.xml b/core/res/res/drawable/ft_avd_tooverflow_animation.xml
new file mode 100644
index 0000000..ed9975b
--- /dev/null
+++ b/core/res/res/drawable/ft_avd_tooverflow_animation.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<animated-vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/ft_avd_tooverflow" >
+    <target
+        android:name="rectangle_3"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_3_animation" />
+    <target
+        android:name="rectangle_3_pivot"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_3_pivot_animation" />
+    <target
+        android:name="rectangle_path_2"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_path_2_animation" />
+    <target
+        android:name="rectangle_2"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_2_animation" />
+    <target
+        android:name="rectangle_2_pivot"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_2_pivot_animation" />
+    <target
+        android:name="rectangle_path_3"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_path_3_animation" />
+    <target
+        android:name="rectangle_1"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_1_animation" />
+    <target
+        android:name="rectangle_1_pivot"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_1_pivot_animation" />
+    <target
+        android:name="rectangle_path_1"
+        android:animation="@anim/ft_avd_tooverflow_rectangle_path_1_animation" />
+</animated-vector>
diff --git a/core/res/res/drawable/ic_arrow_drop_down.xml b/core/res/res/drawable/ic_arrow_drop_down.xml
new file mode 100644
index 0000000..c8bb411
--- /dev/null
+++ b/core/res/res/drawable/ic_arrow_drop_down.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="14.0dp"
+    android:height="14.0dp"
+    android:viewportWidth="24.0"
+    android:viewportHeight="24.0">
+    <path
+        android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
+        android:fillColor="#FF000000"/>
+</vector>
diff --git a/core/res/res/drawable/ic_arrow_up_14dp.xml b/core/res/res/drawable/ic_arrow_up_14dp.xml
new file mode 100644
index 0000000..c4cc0d1
--- /dev/null
+++ b/core/res/res/drawable/ic_arrow_up_14dp.xml
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="14.0dp"
+        android:height="14.0dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:pathData="M12.000000,8.000000l-6.000000,6.000000 1.400000,1.400000 4.600000,-4.599999 4.600000,4.599999 1.400000,-1.400000z"
+        android:fillColor="#FF000000"/>
+</vector>
diff --git a/core/res/res/drawable/pointer_alias_large_icon.xml b/core/res/res/drawable/pointer_alias_large_icon.xml
new file mode 100644
index 0000000..149f58c
--- /dev/null
+++ b/core/res/res/drawable/pointer_alias_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_alias_large"
+    android:hotSpotX="19dp"
+    android:hotSpotY="11dp" />
diff --git a/core/res/res/drawable/pointer_all_scroll_large_icon.xml b/core/res/res/drawable/pointer_all_scroll_large_icon.xml
new file mode 100644
index 0000000..c580f76
--- /dev/null
+++ b/core/res/res/drawable/pointer_all_scroll_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_all_scroll_large"
+    android:hotSpotX="32dp"
+    android:hotSpotY="31dp" />
diff --git a/core/res/res/drawable/pointer_arrow_large_icon.xml b/core/res/res/drawable/pointer_arrow_large_icon.xml
new file mode 100644
index 0000000..22c7bfe
--- /dev/null
+++ b/core/res/res/drawable/pointer_arrow_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_arrow_large"
+    android:hotSpotX="10dp"
+    android:hotSpotY="10dp" />
diff --git a/core/res/res/drawable/pointer_cell_large_icon.xml b/core/res/res/drawable/pointer_cell_large_icon.xml
new file mode 100644
index 0000000..f2530b7
--- /dev/null
+++ b/core/res/res/drawable/pointer_cell_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_cell_large"
+    android:hotSpotX="30dp"
+    android:hotSpotY="30dp" />
diff --git a/core/res/res/drawable/pointer_context_menu_large_icon.xml b/core/res/res/drawable/pointer_context_menu_large_icon.xml
new file mode 100644
index 0000000..c57e615
--- /dev/null
+++ b/core/res/res/drawable/pointer_context_menu_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_context_menu_large"
+    android:hotSpotX="11dp"
+    android:hotSpotY="11dp" />
diff --git a/core/res/res/drawable/pointer_copy_large_icon.xml b/core/res/res/drawable/pointer_copy_large_icon.xml
new file mode 100644
index 0000000..4ee3f18
--- /dev/null
+++ b/core/res/res/drawable/pointer_copy_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_copy_large"
+    android:hotSpotX="10dp"
+    android:hotSpotY="10dp" />
diff --git a/core/res/res/drawable/pointer_crosshair_large_icon.xml b/core/res/res/drawable/pointer_crosshair_large_icon.xml
new file mode 100644
index 0000000..6a71b7b
--- /dev/null
+++ b/core/res/res/drawable/pointer_crosshair_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_crosshair_large"
+    android:hotSpotX="31dp"
+    android:hotSpotY="30dp" />
diff --git a/core/res/res/drawable/pointer_grab_large_icon.xml b/core/res/res/drawable/pointer_grab_large_icon.xml
new file mode 100644
index 0000000..f2df1cb
--- /dev/null
+++ b/core/res/res/drawable/pointer_grab_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_grab_large"
+    android:hotSpotX="21dp"
+    android:hotSpotY="11dp" />
diff --git a/core/res/res/drawable/pointer_grabbing_large_icon.xml b/core/res/res/drawable/pointer_grabbing_large_icon.xml
new file mode 100644
index 0000000..e4042bf
--- /dev/null
+++ b/core/res/res/drawable/pointer_grabbing_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_grabbing_large"
+    android:hotSpotX="20dp"
+    android:hotSpotY="12dp" />
diff --git a/core/res/res/drawable/pointer_hand_large_icon.xml b/core/res/res/drawable/pointer_hand_large_icon.xml
new file mode 100644
index 0000000..e34422a
--- /dev/null
+++ b/core/res/res/drawable/pointer_hand_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_hand_large"
+    android:hotSpotX="25dp"
+    android:hotSpotY="7dp" />
diff --git a/core/res/res/drawable/pointer_help_large_icon.xml b/core/res/res/drawable/pointer_help_large_icon.xml
new file mode 100644
index 0000000..4c60a55
--- /dev/null
+++ b/core/res/res/drawable/pointer_help_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_help_large"
+    android:hotSpotX="10dp"
+    android:hotSpotY="11dp" />
diff --git a/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml
new file mode 100644
index 0000000..a2039e6
--- /dev/null
+++ b/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_horizontal_double_arrow_large"
+    android:hotSpotX="35dp"
+    android:hotSpotY="29dp" />
diff --git a/core/res/res/drawable/pointer_nodrop_large_icon.xml b/core/res/res/drawable/pointer_nodrop_large_icon.xml
new file mode 100644
index 0000000..cde2e41
--- /dev/null
+++ b/core/res/res/drawable/pointer_nodrop_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_nodrop_large"
+    android:hotSpotX="10dp"
+    android:hotSpotY="10dp" />
diff --git a/core/res/res/drawable/pointer_text_large_icon.xml b/core/res/res/drawable/pointer_text_large_icon.xml
new file mode 100644
index 0000000..24d35b0
--- /dev/null
+++ b/core/res/res/drawable/pointer_text_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_text_large"
+    android:hotSpotX="30dp"
+    android:hotSpotY="32dp" />
diff --git a/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml
new file mode 100644
index 0000000..270ccc9
--- /dev/null
+++ b/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_top_left_diagonal_double_arrow_large"
+    android:hotSpotX="32dp"
+    android:hotSpotY="30dp" />
diff --git a/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml
new file mode 100644
index 0000000..e350a43
--- /dev/null
+++ b/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_top_right_diagonal_double_arrow_large"
+    android:hotSpotX="32dp"
+    android:hotSpotY="31dp" />
diff --git a/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml
new file mode 100644
index 0000000..65728ad
--- /dev/null
+++ b/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_vertical_double_arrow_large"
+    android:hotSpotX="29dp"
+    android:hotSpotY="32dp" />
diff --git a/core/res/res/drawable/pointer_vertical_text_large_icon.xml b/core/res/res/drawable/pointer_vertical_text_large_icon.xml
new file mode 100644
index 0000000..48211cb
--- /dev/null
+++ b/core/res/res/drawable/pointer_vertical_text_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_vertical_text_large"
+    android:hotSpotX="32dp"
+    android:hotSpotY="30dp" />
diff --git a/core/res/res/drawable/pointer_zoom_in_large_icon.xml b/core/res/res/drawable/pointer_zoom_in_large_icon.xml
new file mode 100644
index 0000000..3eb89f56
--- /dev/null
+++ b/core/res/res/drawable/pointer_zoom_in_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_zoom_in_large"
+    android:hotSpotX="25dp"
+    android:hotSpotY="26dp" />
diff --git a/core/res/res/drawable/pointer_zoom_out_large_icon.xml b/core/res/res/drawable/pointer_zoom_out_large_icon.xml
new file mode 100644
index 0000000..df6412e
--- /dev/null
+++ b/core/res/res/drawable/pointer_zoom_out_large_icon.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android"
+    android:bitmap="@drawable/pointer_zoom_out_large"
+    android:hotSpotX="26dp"
+    android:hotSpotY="26dp" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_0.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_0.xml
new file mode 100644
index 0000000..c6db901
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_0.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 l 0.668316831683,0.0 c 0.00003,0.0 0.0663366336634,1.0 0.331683168317,1.0 L 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_1.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_1.xml
new file mode 100644
index 0000000..584385d
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_1.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.0001,0.0 0.0,1.0 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_2.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_2.xml
new file mode 100644
index 0000000..334dee7
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_2.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.161290322581,0.0 0.0806451612903,0.909090909091 0.403225806452,0.909090909091 c 0.238709677419,0.0 0.11935483871,0.0909090909091 0.596774193548,0.0909090909091 L 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_3.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_3.xml
new file mode 100644
index 0000000..67891fc
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_3.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 l 0.5,0.0 c 0.2,0.0 0.1,1.0 0.5,1.0 L 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_4.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_4.xml
new file mode 100644
index 0000000..756a9e1
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_4.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 l 0.5,0.0 c 0.00005,0.0 0.1,1.0 0.5,1.0 L 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_5.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_5.xml
new file mode 100644
index 0000000..584385d
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_5.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.0001,0.0 0.0,1.0 1.0,1.0" />
diff --git a/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_6.xml b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_6.xml
new file mode 100644
index 0000000..bed54d4
--- /dev/null
+++ b/core/res/res/interpolator/ft_avd_toarrow_animation_interpolator_6.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 l 0.582706766917,0.0 c 0.166917293233,0.0 0.0834586466165,1.0 0.417293233083,1.0 L 1.0,1.0" />
diff --git a/core/res/res/layout/floating_popup_container.xml b/core/res/res/layout/floating_popup_container.xml
index 63dae44..dd161e3 100644
--- a/core/res/res/layout/floating_popup_container.xml
+++ b/core/res/res/layout/floating_popup_container.xml
@@ -15,12 +15,11 @@
 ** limitations under the License.
 */
 -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
-    android:layout_height="@dimen/floating_toolbar_height"
+    android:layout_height="wrap_content"
     android:padding="0dp"
-    android:layout_margin="0dp"
+    android:layout_margin="20dp"
     android:elevation="2dp"
     android:focusable="true"
     android:focusableInTouchMode="true"
diff --git a/core/res/res/layout/floating_popup_overflow_button.xml b/core/res/res/layout/floating_popup_overflow_button.xml
new file mode 100644
index 0000000..7053f3e
--- /dev/null
+++ b/core/res/res/layout/floating_popup_overflow_button.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 2015, 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.
+*/
+-->
+<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/overflow"
+    android:layout_width="@dimen/floating_toolbar_menu_image_button_width"
+    android:layout_height="@dimen/floating_toolbar_height"
+    android:paddingStart="@dimen/floating_toolbar_menu_button_side_padding"
+    android:paddingTop="@dimen/floating_toolbar_menu_image_button_vertical_padding"
+    android:paddingEnd="@dimen/floating_toolbar_menu_button_side_padding"
+    android:paddingBottom="@dimen/floating_toolbar_menu_image_button_vertical_padding"
+    android:scaleType="centerInside"
+    android:background="?attr/selectableItemBackgroundBorderless"
+    android:tint="?attr/floatingToolbarForegroundColor" />
diff --git a/core/res/res/layout/notification_material_action.xml b/core/res/res/layout/notification_material_action.xml
index f4bc918..62602d8 100644
--- a/core/res/res/layout/notification_material_action.xml
+++ b/core/res/res/layout/notification_material_action.xml
@@ -21,7 +21,7 @@
     android:layout_width="wrap_content"
     android:layout_height="48dp"
     android:layout_gravity="center"
-    android:layout_marginStart="8dp"
+    android:layout_marginStart="4dp"
     android:textColor="@color/secondary_text_material_light"
     android:singleLine="true"
     android:ellipsize="end"
diff --git a/core/res/res/layout/notification_material_action_list.xml b/core/res/res/layout/notification_material_action_list.xml
index edaf020..2a89faa 100644
--- a/core/res/res/layout/notification_material_action_list.xml
+++ b/core/res/res/layout/notification_material_action_list.xml
@@ -17,13 +17,14 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/actions_container"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
+        android:layout_height="wrap_content"
+        android:layout_marginStart="-16dp"
+        android:layout_marginEnd="-16dp">
     <LinearLayout
             android:id="@+id/actions"
             android:layout_width="match_parent"
             android:layout_height="56dp"
-            android:paddingEnd="8dp"
+            android:paddingEnd="4dp"
             android:orientation="horizontal"
             android:visibility="gone"
             android:background="#ffeeeeee"
diff --git a/core/res/res/layout/notification_material_media_action.xml b/core/res/res/layout/notification_material_media_action.xml
index 1d52e54..19a6f84 100644
--- a/core/res/res/layout/notification_material_media_action.xml
+++ b/core/res/res/layout/notification_material_media_action.xml
@@ -19,10 +19,12 @@
     style="@android:style/Widget.Material.Button.Borderless.Small"
     android:id="@+id/action0"
     android:layout_width="48dp"
-    android:layout_height="match_parent"
-    android:layout_marginLeft="2dp"
-    android:layout_marginRight="2dp"
-    android:layout_weight="1"
+    android:layout_height="48dp"
+    android:paddingBottom="8dp"
+    android:paddingTop="8dp"
+    android:paddingStart="8dp"
+    android:paddingEnd="8dp"
+    android:layout_marginEnd="2dp"
     android:gravity="center"
     android:background="@drawable/notification_material_media_action_background"
     />
diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml
new file mode 100644
index 0000000..aceae9f
--- /dev/null
+++ b/core/res/res/layout/notification_template_header.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+
+<NotificationHeaderView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/notification_header"
+    android:orientation="horizontal"
+    android:layout_width="wrap_content"
+    android:layout_height="48dp"
+    android:clipChildren="false"
+    android:layout_gravity="start|top"
+    android:gravity="center_vertical"
+    android:paddingTop="5dp"
+    android:paddingBottom="16dp"
+    android:paddingStart="@dimen/notification_content_margin_start"
+    android:paddingEnd="16dp">
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="18dp"
+        android:layout_height="18dp"
+        android:layout_marginEnd="3dp"
+        />
+    <TextView
+        android:id="@+id/number_of_children"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification"
+        android:layout_marginEnd="3dp"
+        android:layout_marginStart="2dp"
+        android:visibility="gone"
+        android:singleLine="true"
+        />
+    <TextView
+        android:id="@+id/app_name_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="3dp"
+        android:layout_marginEnd="2dp"
+        android:singleLine="true"
+        />
+    <TextView
+        android:id="@+id/sub_text_divider"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:text="@string/notification_header_divider_symbol"
+        android:visibility="gone"/>
+    <TextView
+        android:id="@+id/header_sub_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:visibility="gone"
+        android:singleLine="true"/>
+    <TextView
+        android:id="@+id/content_info_divider"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:text="@string/notification_header_divider_symbol"
+        android:singleLine="true"
+        android:visibility="gone"/>
+    <TextView
+        android:id="@+id/header_content_info"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:visibility="gone"
+        android:maxWidth="72dp"
+        android:singleLine="true"/>
+    <TextView
+        android:id="@+id/time_divider"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="@style/TextAppearance.Material.Notification.Info"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:text="@string/notification_header_divider_symbol"
+        android:singleLine="true"
+        android:visibility="gone"/>
+    <ViewStub
+        android:id="@+id/time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:layout="@layout/notification_template_part_time"
+        android:visibility="gone"
+        />
+    <ViewStub
+        android:id="@+id/chronometer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="2dp"
+        android:layout_marginEnd="2dp"
+        android:layout="@layout/notification_template_part_chronometer"
+        android:visibility="gone"
+        />
+    <ImageView
+        android:id="@+id/expand_button"
+        android:background="@null"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingTop="1dp"
+        android:src="@drawable/ic_arrow_drop_down"
+        android:visibility="gone"
+        />
+</NotificationHeaderView>
+
diff --git a/core/res/res/layout/notification_template_icon_group.xml b/core/res/res/layout/notification_template_icon_group.xml
deleted file mode 100644
index fa66163..0000000
--- a/core/res/res/layout/notification_template_icon_group.xml
+++ /dev/null
@@ -1,45 +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:layout_width="@dimen/notification_large_icon_width"
-    android:layout_height="@dimen/notification_large_icon_height"
-    android:id="@+id/icon_group"
-    >
-    <ImageView android:id="@+id/icon"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_marginTop="12dp"
-        android:layout_marginBottom="12dp"
-        android:layout_marginStart="12dp"
-        android:layout_marginEnd="12dp"
-        android:scaleType="centerInside"
-        />
-    <ImageView android:id="@+id/right_icon"
-        android:layout_width="16dp"
-        android:layout_height="16dp"
-        android:padding="3dp"
-        android:layout_gravity="end|bottom"
-        android:scaleType="centerInside"
-        android:visibility="gone"
-        android:layout_marginEnd="8dp"
-        android:layout_marginBottom="8dp"
-        />
-</FrameLayout>
-
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml
index 94bbec8..b69eb24 100644
--- a/core/res/res/layout/notification_template_material_base.xml
+++ b/core/res/res/layout/notification_template_material_base.xml
@@ -18,24 +18,32 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/status_bar_latest_event_content"
     android:layout_width="match_parent"
-    android:layout_height="64dp"
+    android:layout_height="wrap_content"
     android:tag="base"
     >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        />
+    <include layout="@layout/notification_template_header" />
     <LinearLayout
         android:id="@+id/notification_main_column"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_gravity="top"
-        android:layout_marginStart="@dimen/notification_large_icon_width"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:layout_marginStart="@dimen/notification_content_margin_start"
+        android:layout_marginEnd="@dimen/notification_content_margin_end"
+        android:layout_marginTop="@dimen/notification_content_margin_top"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
         <include layout="@layout/notification_template_part_line3" />
     </LinearLayout>
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom"
+        android:layout_marginStart="@dimen/notification_content_margin_start"
+        android:layout_marginBottom="11dp"
+        android:layout_marginEnd="@dimen/notification_content_margin_end">
+        <include layout="@layout/notification_template_progress" />
+    </FrameLayout>
+    <include layout="@layout/notification_template_right_icon" />
 </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 97df978e..8c78b8d 100644
--- a/core/res/res/layout/notification_template_material_big_base.xml
+++ b/core/res/res/layout/notification_template_material_big_base.xml
@@ -14,71 +14,56 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/status_bar_latest_event_content"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:orientation="vertical"
     android:tag="big"
     >
-    <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:id="@+id/notification_main_column"
+    <FrameLayout
+        android:id="@+id/status_bar_latest_event_content"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/notification_min_height"
+        android:layout_gravity="top"
+        android:tag="base"
+        >
+        <include layout="@layout/notification_template_header" />
+        <LinearLayout
+            android:id="@+id/notification_main_column"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_gravity="top"
+            android:layout_marginStart="@dimen/notification_content_margin_start"
+            android:layout_marginEnd="@dimen/notification_content_margin_end"
+            android:layout_marginTop="@dimen/notification_content_margin_top"
+            android:minHeight="@dimen/notification_min_content_height"
+            android:orientation="vertical"
+            >
+            <include layout="@layout/notification_template_part_line1" />
+            <include layout="@layout/notification_template_part_line3" />
+        </LinearLayout>
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom"
+            android:layout_marginStart="@dimen/notification_content_margin_start"
+            android:layout_marginBottom="11dp"
+            android:layout_marginEnd="@dimen/notification_content_margin_end">
+            <include layout="@layout/notification_template_progress" />
+        </FrameLayout>
+        <include layout="@layout/notification_template_right_icon" />
+    </FrameLayout>
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:id="@+id/action_divider"
+        android:visibility="gone"
+        android:background="@drawable/notification_template_divider" />
+    <include
+        layout="@layout/notification_material_action_list"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="top"
-        android:layout_marginStart="@dimen/notification_large_icon_width"
-        android:minHeight="@dimen/notification_large_icon_height"
-        android:orientation="vertical"
-        >
-        <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
-            android:orientation="horizontal"
-            android:gravity="top"
-            >
-            <TextView android:id="@+id/big_text"
-                android:textAppearance="@style/TextAppearance.Material.Notification"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:singleLine="false"
-                android:visibility="gone"
-                />
-            <ImageView android:id="@+id/profile_badge_large_template"
-                android:layout_width="@dimen/notification_badge_size"
-                android:layout_height="@dimen/notification_badge_size"
-                android:layout_weight="0"
-                android:layout_marginStart="4dp"
-                android:scaleType="fitCenter"
-                android:visibility="gone"
-                android:contentDescription="@string/notification_work_profile_content_description"
-                />
-        </LinearLayout>
-        <include
-            layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
-            />
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dp"
-            android:layout_marginTop="10dp"
-            android:id="@+id/action_divider"
-            android:visibility="gone"
-            android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_material_action_list"
-            android:layout_marginStart="-8dp"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            />
-    </LinearLayout>
-</FrameLayout>
+        />
+</LinearLayout>
diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml
index 7fd93de..0427c8a 100644
--- a/core/res/res/layout/notification_template_material_big_media.xml
+++ b/core/res/res/layout/notification_template_material_big_media.xml
@@ -15,44 +15,53 @@
   ~ limitations under the License
   -->
 
+<!-- Layout for the expanded media notification -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/status_bar_latest_event_content"
     android:layout_width="match_parent"
     android:layout_height="128dp"
     android:background="#00000000"
-    android:tag="bigMedia"
+    android:tag="bigMediaNarrow"
     >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        />
+    <include layout="@layout/notification_template_header"
+        android:layout_width="fill_parent"
+        android:layout_height="48dp"
+        android:layout_marginEnd="106dp"/>
     <LinearLayout
+        android:id="@+id/notification_main_column"
         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:layout_marginTop="@dimen/notification_content_margin_top"
+        android:layout_marginStart="@dimen/notification_content_margin_start"
+        android:layout_marginEnd="24dp"
+        android:layout_toStartOf="@id/right_icon"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
         <include layout="@layout/notification_template_part_line3" />
     </LinearLayout>
     <LinearLayout
         android:id="@+id/media_actions"
-        android:layout_width="match_parent"
-        android:layout_height="48dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:layout_marginStart="12dp"
-        android:layout_marginEnd="12dp"
+        android:layout_alignParentStart="true"
+        android:paddingStart="8dp"
+        android:paddingBottom="8dp"
         android:orientation="horizontal"
         android:layoutDirection="ltr"
         >
         <!-- media buttons will be added here -->
     </LinearLayout>
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_above="@id/media_actions"
-        android:id="@+id/action_divider"
-        android:background="@drawable/notification_template_divider_media" />
+
+    <ImageView android:id="@+id/right_icon"
+        android:layout_width="96dp"
+        android:layout_height="96dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginTop="16dp"
+        android:layout_alignParentEnd="true"
+        android:layout_alignParentTop="true"
+        android:scaleType="centerCrop"
+        />
 </RelativeLayout>
diff --git a/core/res/res/layout/notification_template_material_big_media_narrow.xml b/core/res/res/layout/notification_template_material_big_media_narrow.xml
deleted file mode 100644
index 807cfaf..0000000
--- a/core/res/res/layout/notification_template_material_big_media_narrow.xml
+++ /dev/null
@@ -1,63 +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
-  -->
-
-<!-- Layout to be used with only max 3 actions. It has a much larger picture at the left side-->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/status_bar_latest_event_content"
-    android:layout_width="match_parent"
-    android:layout_height="128dp"
-    android:background="#00000000"
-    android:tag="bigMediaNarrow"
-    >
-    <ImageView android:id="@+id/icon"
-        android:layout_width="128dp"
-        android:layout_height="128dp"
-        android:scaleType="centerCrop"
-        />
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="12dp"
-        android:layout_toEndOf="@id/icon"
-        android:minHeight="@dimen/notification_large_icon_height"
-        android:orientation="vertical"
-        >
-        <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
-        <include layout="@layout/notification_template_part_line3" />
-    </LinearLayout>
-    <LinearLayout
-        android:id="@+id/media_actions"
-        android:layout_width="match_parent"
-        android:layout_height="48dp"
-        android:layout_toEndOf="@id/icon"
-        android:layout_alignParentBottom="true"
-        android:layout_marginStart="12dp"
-        android:layout_marginEnd="12dp"
-        android:orientation="horizontal"
-        android:layoutDirection="ltr"
-        >
-        <!-- media buttons will be added here -->
-    </LinearLayout>
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="1dp"
-        android:layout_toEndOf="@id/icon"
-        android:layout_above="@id/media_actions"
-        android:id="@+id/action_divider"
-        android:background="@drawable/notification_template_divider_media" />
-</RelativeLayout>
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 f3768b5..74e7775 100644
--- a/core/res/res/layout/notification_template_material_big_picture.xml
+++ b/core/res/res/layout/notification_template_material_big_picture.xml
@@ -21,39 +21,45 @@
     android:layout_height="match_parent"
     android:tag="bigPicture"
     >
-    <ImageView
-        android:id="@+id/big_picture"
-        android:layout_width="match_parent"
-        android:layout_height="192dp"
-        android:layout_marginTop="64dp"
-        android:layout_gravity="bottom"
-        android:scaleType="centerCrop"
-        />
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="6dp"
-        android:layout_marginTop="64dp"
-        android:scaleType="fitXY"
-        android:src="@drawable/title_bar_shadow"
-        />
-    <include layout="@layout/notification_template_material_base"
-        android:layout_width="match_parent"
-        android:layout_height="64dp"
-        />
-  <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="208dp"
-        android:paddingStart="@dimen/notification_large_icon_width"
-        android:layout_gravity="bottom"
-        android:background="#CCEEEEEE"
-        >
-        <include
-            layout="@layout/notification_material_action_list"
-            android:id="@+id/actions"
-            android:layout_gravity="bottom"
+    <include layout="@layout/notification_template_header" />
+    <include layout="@layout/notification_template_right_icon" />
+    <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_gravity="top"
+            android:paddingStart="@dimen/notification_content_margin_start"
+            android:paddingEnd="@dimen/notification_content_margin_end"
+            android:layout_marginTop="@dimen/notification_content_margin_top"
+            android:clipToPadding="false"
+            android:orientation="vertical"
+            >
+        <LinearLayout
+            android:id="@+id/notification_main_column"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            />
-    </FrameLayout>
+            android:orientation="vertical">
+            <include layout="@layout/notification_template_part_line1"/>
+            <include layout="@layout/notification_template_progress"/>
+            <include layout="@layout/notification_template_part_line3"/>
+        </LinearLayout>
+        <ImageView
+                android:id="@+id/big_picture"
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:adjustViewBounds="true"
+                android:layout_weight="1"
+                android:layout_marginTop="13dp"
+                android:layout_marginBottom="16dp"
+                android:scaleType="centerCrop"
+                />
+        <ImageView
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:layout_marginStart="-16dp"
+                android:layout_marginEnd="-16dp"
+                android:id="@+id/action_divider"
+                android:visibility="gone"
+                android:background="@drawable/notification_template_divider" />
+        <include layout="@layout/notification_material_action_list" />
+    </LinearLayout>
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
index 7ae29fb..354c0fb 100644
--- a/core/res/res/layout/notification_template_material_big_text.xml
+++ b/core/res/res/layout/notification_template_material_big_text.xml
@@ -21,31 +21,30 @@
     android:layout_height="wrap_content"
     android:tag="bigText"
     >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        />
+    <include layout="@layout/notification_template_header" />
     <LinearLayout
         android:id="@+id/notification_main_column"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="top"
-        android:layout_marginStart="@dimen/notification_large_icon_width"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:paddingStart="@dimen/notification_content_margin_start"
+        android:paddingEnd="@dimen/notification_content_margin_end"
+        android:layout_marginTop="@dimen/notification_content_margin_top"
+        android:clipToPadding="false"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
+        <include layout="@layout/notification_template_progress" />
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="10dp"
+            android:paddingBottom="13dp"
             android:orientation="horizontal"
             android:gravity="top"
             android:layout_weight="1"
             >
-            <TextView android:id="@+id/big_text"
+            <com.android.internal.widget.ImageFloatingTextView android:id="@+id/big_text"
                 android:textAppearance="@style/TextAppearance.Material.Notification"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
@@ -66,27 +65,12 @@
         <ImageView
             android:layout_width="match_parent"
             android:layout_height="1dp"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
             android:id="@+id/action_divider"
             android:visibility="gone"
             android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_material_action_list"
-            android:layout_marginStart="-8dp"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            />
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:id="@+id/overflow_divider"
-            android:visibility="visible"
-            android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginBottom="10dp" />
+        <include layout="@layout/notification_material_action_list" />
     </LinearLayout>
+    <include layout="@layout/notification_template_right_icon" />
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml
index 950ae40..4f12d76 100644
--- a/core/res/res/layout/notification_template_material_inbox.xml
+++ b/core/res/res/layout/notification_template_material_inbox.xml
@@ -21,21 +21,26 @@
     android:layout_height="wrap_content"
     android:tag="inbox"
     >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        />
+    <include layout="@layout/notification_template_header" />
     <LinearLayout
         android:id="@+id/notification_main_column"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="top"
-        android:layout_marginStart="@dimen/notification_large_icon_width"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:paddingStart="@dimen/notification_content_margin_start"
+        android:paddingEnd="@dimen/notification_content_margin_end"
+        android:layout_marginTop="@dimen/notification_content_margin_top"
+        android:minHeight="@dimen/notification_min_content_height"
+        android:clipToPadding="false"
         android:orientation="vertical"
         >
-        <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
+        <include layout="@layout/notification_template_part_line1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+        <include layout="@layout/notification_template_progress"
+            android:layout_width="match_parent"
+            android:layout_height="15dp"
+            android:layout_marginTop="4dp"/>
 
         <!-- We can't have another vertical linear layout here with weight != 0 so this forces us to
              put the badge on the first line. -->
@@ -43,7 +48,6 @@
             android:layout_width="match_parent"
             android:layout_weight="1"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:orientation="horizontal"
             >
             <TextView android:id="@+id/inbox_text0"
@@ -69,7 +73,6 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:ellipsize="end"
             android:visibility="gone"
@@ -79,7 +82,6 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:ellipsize="end"
             android:visibility="gone"
@@ -89,7 +91,6 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:ellipsize="end"
             android:visibility="gone"
@@ -99,7 +100,6 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:ellipsize="end"
             android:visibility="gone"
@@ -109,7 +109,6 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
             android:singleLine="true"
             android:ellipsize="end"
             android:visibility="gone"
@@ -119,27 +118,15 @@
             android:textAppearance="@style/TextAppearance.Material.Notification"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            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.Material.Notification"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_marginEnd="8dp"
-            android:singleLine="true"
-            android:ellipsize="end"
-            android:visibility="gone"
-            android:layout_weight="1"
-            android:text="@android:string/notification_inbox_ellipsis"
-            />
         <FrameLayout
             android:id="@+id/inbox_end_pad"
             android:layout_width="match_parent"
-            android:layout_height="10dp"
+            android:layout_height="13dp"
             android:visibility="gone"
             android:layout_weight="0"
         />
@@ -148,27 +135,10 @@
             android:layout_height="1dip"
             android:id="@+id/action_divider"
             android:visibility="gone"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
             android:background="@drawable/notification_template_divider" />
-        <include
-            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
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:id="@+id/overflow_divider"
-            android:visibility="visible"
-            android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="8dp"
-            android:layout_marginTop="8dp"
-            android:layout_marginBottom="10dp" />
+        <include layout="@layout/notification_material_action_list" />
     </LinearLayout>
+    <include layout="@layout/notification_template_right_icon" />
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_media.xml b/core/res/res/layout/notification_template_material_media.xml
index f6c22c8..dc4afb8 100644
--- a/core/res/res/layout/notification_template_material_media.xml
+++ b/core/res/res/layout/notification_template_material_media.xml
@@ -15,40 +15,52 @@
   ~ limitations under the License
   -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout
     android:id="@+id/status_bar_latest_event_content"
+    xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="64dp"
-    android:orientation="horizontal"
-    android:background="#00000000"
+    android:layout_height="wrap_content"
     android:tag="media"
     >
-    <include layout="@layout/notification_template_icon_group"
-        android:layout_width="@dimen/notification_large_icon_width"
-        android:layout_height="@dimen/notification_large_icon_height"
-        android:layout_weight="0"
-        />
+    <include layout="@layout/notification_template_header"
+        android:layout_width="fill_parent"
+        android:layout_height="48dp"
+        android:layout_marginEnd="106dp"/>
     <LinearLayout
+        android:id="@+id/notification_main_column"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:layout_gravity="fill_vertical"
-        android:minHeight="@dimen/notification_large_icon_height"
-        android:orientation="vertical"
-        >
-        <include layout="@layout/notification_template_part_line1" />
-        <include layout="@layout/notification_template_part_line2" />
-        <include layout="@layout/notification_template_part_line3" />
-    </LinearLayout>
-    <LinearLayout
-        android:id="@+id/media_actions"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_marginEnd="6dp"
-        android:layout_gravity="center_vertical|end"
+        android:layout_height="@dimen/notification_min_content_height"
+        android:background="#00000000"
         android:orientation="horizontal"
-        android:layoutDirection="ltr"
+        android:layout_marginStart="@dimen/notification_content_margin_start"
+        android:layout_marginTop="@dimen/notification_content_margin_top"
+        android:layout_marginEnd="72dp"
+        android:tag="media"
         >
-        <!-- media buttons will be added here -->
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="fill_vertical"
+            android:layout_weight="1"
+            android:minHeight="@dimen/notification_min_content_height"
+            android:orientation="vertical"
+            >
+            <include layout="@layout/notification_template_part_line1"/>
+            <include layout="@layout/notification_template_progress"/>
+            <include layout="@layout/notification_template_part_line3"/>
+        </LinearLayout>
+        <LinearLayout
+            android:id="@+id/media_actions"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_gravity="bottom|end"
+            android:layout_marginStart="10dp"
+            android:layout_marginBottom="8dp"
+            android:layoutDirection="ltr"
+            android:orientation="horizontal"
+            >
+            <!-- media buttons will be added here -->
+        </LinearLayout>
     </LinearLayout>
-</LinearLayout>
+    <include layout="@layout/notification_template_right_icon" />
+</FrameLayout>
diff --git a/core/res/res/layout/notification_template_part_chronometer.xml b/core/res/res/layout/notification_template_part_chronometer.xml
index 1f0430e..c5ffbea 100644
--- a/core/res/res/layout/notification_template_part_chronometer.xml
+++ b/core/res/res/layout/notification_template_part_chronometer.xml
@@ -18,9 +18,7 @@
     android:textAppearance="@style/TextAppearance.Material.Notification.Time"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
-    android:layout_gravity="center"
+    android:layout_marginEnd="4dp"
     android:layout_weight="0"
     android:singleLine="true"
-    android:gravity="center"
-    android:paddingStart="8dp"
     />
diff --git a/core/res/res/layout/notification_template_part_line1.xml b/core/res/res/layout/notification_template_part_line1.xml
index 78bc1ed..e7ac408 100644
--- a/core/res/res/layout/notification_template_part_line1.xml
+++ b/core/res/res/layout/notification_template_part_line1.xml
@@ -19,30 +19,25 @@
     android:id="@+id/line1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginEnd="8dp"
     android:orientation="horizontal"
+    android:layout_marginBottom="1dp"
     >
     <TextView android:id="@+id/title"
         android:textAppearance="@style/TextAppearance.Material.Notification.Title"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         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"
+    <TextView android:id="@+id/text_line_1"
+        android:textAppearance="@style/TextAppearance.Material.Notification"
+        android:layout_width="match_parent"
         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"
+        android:gravity="end|bottom"
+        android:layout_marginStart="16dp"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:fadingEdge="horizontal"
         />
 </LinearLayout>
diff --git a/core/res/res/layout/notification_template_part_line2.xml b/core/res/res/layout/notification_template_part_line2.xml
deleted file mode 100644
index db43271..0000000
--- a/core/res/res/layout/notification_template_part_line2.xml
+++ /dev/null
@@ -1,58 +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
-  -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:orientation="horizontal"
-        android:gravity="center_vertical"
-        >
-        <TextView
-            android:id="@+id/text2"
-            android:textAppearance="@style/TextAppearance.Material.Notification.Line2"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="-1dp"
-            android:layout_marginBottom="-1dp"
-            android:singleLine="true"
-            android:fadingEdge="horizontal"
-            android:ellipsize="marquee"
-            android:visibility="gone"
-            android:layout_weight="1"
-        />
-        <ImageView android:id="@+id/profile_badge_line2"
-            android:layout_width="@dimen/notification_badge_size"
-            android:layout_height="@dimen/notification_badge_size"
-            android:layout_weight="0"
-            android:layout_marginStart="4dp"
-            android:scaleType="fitCenter"
-            android:visibility="gone"
-            android:contentDescription="@string/notification_work_profile_content_description"
-            />
-    </LinearLayout>
-    <ViewStub
-        android:id="@android:id/progress"
-        android:layout="@layout/notification_template_progressbar"
-        android:layout_width="match_parent"
-        android:layout_height="15dp"
-        android:layout_marginEnd="8dp"
-        android:visibility="gone"
-        android:layout_weight="0"
-        />
-</merge>
diff --git a/core/res/res/layout/notification_template_part_line3.xml b/core/res/res/layout/notification_template_part_line3.xml
index da3c5c5..76337ac 100644
--- a/core/res/res/layout/notification_template_part_line3.xml
+++ b/core/res/res/layout/notification_template_part_line3.xml
@@ -19,7 +19,6 @@
     android:id="@+id/line3"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginEnd="8dp"
     android:orientation="horizontal"
     android:gravity="center_vertical"
     >
@@ -33,16 +32,6 @@
         android:ellipsize="marquee"
         android:fadingEdge="horizontal"
         />
-    <TextView android:id="@+id/info"
-        android:textAppearance="@style/TextAppearance.Material.Notification.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_badge_line3"
         android:layout_width="@dimen/notification_badge_size"
         android:layout_height="@dimen/notification_badge_size"
diff --git a/core/res/res/layout/notification_template_part_time.xml b/core/res/res/layout/notification_template_part_time.xml
index 37c7ebe..442ff8c 100644
--- a/core/res/res/layout/notification_template_part_time.xml
+++ b/core/res/res/layout/notification_template_part_time.xml
@@ -19,8 +19,7 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
+    android:layout_marginEnd="4dp"
     android:layout_weight="0"
     android:singleLine="true"
-    android:gravity="center"
-    android:paddingStart="8dp"
     />
diff --git a/core/res/res/drawable/notification_icon_legacy_bg.xml b/core/res/res/layout/notification_template_progress.xml
similarity index 64%
rename from core/res/res/drawable/notification_icon_legacy_bg.xml
rename to core/res/res/layout/notification_template_progress.xml
index cc5755d..85532ad 100644
--- a/core/res/res/drawable/notification_icon_legacy_bg.xml
+++ b/core/res/res/layout/notification_template_progress.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ Copyright (C) 2014 The Android Open Source Project
+  ~ Copyright (C) 2015 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.
@@ -14,9 +14,11 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="oval">
-    <solid
-            android:color="@color/notification_icon_bg_color"/>
-</shape>
+<ViewStub
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/progress"
+    android:layout="@layout/notification_template_progressbar"
+    android:layout_width="match_parent"
+    android:layout_height="15dp"
+    android:visibility="gone"
+    />
diff --git a/core/res/res/drawable/notification_icon_legacy_bg.xml b/core/res/res/layout/notification_template_right_icon.xml
similarity index 62%
copy from core/res/res/drawable/notification_icon_legacy_bg.xml
copy to core/res/res/layout/notification_template_right_icon.xml
index cc5755d..3b358ab 100644
--- a/core/res/res/drawable/notification_icon_legacy_bg.xml
+++ b/core/res/res/layout/notification_template_right_icon.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  ~ Copyright (C) 2014 The Android Open Source Project
+  ~ Copyright (C) 2015 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.
@@ -15,8 +15,13 @@
   ~ limitations under the License
   -->
 
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="oval">
-    <solid
-            android:color="@color/notification_icon_bg_color"/>
-</shape>
+<ImageView android:id="@+id/right_icon" xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="40dp"
+    android:layout_height="40dp"
+    android:layout_marginEnd="16dp"
+    android:layout_marginTop="32dp"
+    android:layout_gravity="top|end"
+    android:scaleType="centerCrop"
+    />
+
+
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 669eba1..c3f7afc 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Stembystand"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Sluit nou"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Veiligmodus"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-stelsel"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Persoonlik"</string>
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index a7af0f1..4de0097 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"የድምጽ እርዳታ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"አሁን ቆልፍ"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"የሚያስተማምን ሁነታ"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android ስርዓት"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"የግል"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 4a9b163..0c05bc4 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -226,6 +226,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"المساعد الصوتي"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"قفل الآن"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"الوضع الآمن"</string>
     <string name="android_system_label" msgid="6577375335728551336">"‏نظام Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"شخصي"</string>
@@ -1470,8 +1472,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"المطالبة برقم التعريف الشخصي قبل إزالة التثبيت"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"المطالبة بنقش إلغاء القفل قبل إزالة التثبيت"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"المطالبة بكلمة المرور قبل إزالة التثبيت"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"التطبيق غير قابل لتغيير الحجم، يمكنك تمريره بإصبعين."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"تم تثبيت الحزمة عن طريق المشرف"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"تم التحديث بواسطة المشرف"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"تم حذف الحزمة عن طريق المشرف"</string>
diff --git a/core/res/res/values-az-rAZ/strings.xml b/core/res/res/values-az-rAZ/strings.xml
index 54dbc39e..593400e 100644
--- a/core/res/res/values-az-rAZ/strings.xml
+++ b/core/res/res/values-az-rAZ/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Səs Yardımçısı"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"İndi kilidləyin"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Təhlükəsiz rejim"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android sistemi"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Şəxsi"</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index 233d709..50f2938 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Гласова помощ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Заключване сега"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Безопасен режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Системно от Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Личен"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Запитване за ПИН код преди освобождаване"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Запитване за фигура за отключване преди освобождаване"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Запитване за парола преди освобождаване"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Приложението не може да се преоразмерява. Превъртете го с два пръста."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Инсталирано от администратора ви"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Актуализирано от администратора ви"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Изтрито от администратора ви"</string>
diff --git a/core/res/res/values-bn-rBD/strings.xml b/core/res/res/values-bn-rBD/strings.xml
index f5fb017..fdd46172 100644
--- a/core/res/res/values-bn-rBD/strings.xml
+++ b/core/res/res/values-bn-rBD/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ভয়েস সহায়তা"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"এখনই লক করুন"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"৯৯৯+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"নিরাপদ মোড"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android সিস্টেম"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ব্যক্তিগত"</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 0e731f6..cb24d26 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Assist. per veu"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloqueja ara"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"+999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mode segur"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index fd3ed4b..c2f1364 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Hlas. asistence"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Zamknout"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Nouzový režim"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Systém Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Osobní"</string>
@@ -355,7 +357,7 @@
     <string name="permlab_vibrate" msgid="7696427026057705834">"ovládání vibrací"</string>
     <string name="permdesc_vibrate" msgid="6284989245902300945">"Umožňuje aplikaci ovládat vibrace."</string>
     <string name="permlab_flashlight" msgid="2155920810121984215">"ovládání kontrolky"</string>
-    <string name="permdesc_flashlight" msgid="6522284794568368310">"Umožňuje aplikaci ovládat baterku."</string>
+    <string name="permdesc_flashlight" msgid="6522284794568368310">"Umožňuje aplikaci ovládat svítilnu."</string>
     <string name="permlab_callPhone" msgid="3925836347681847954">"přímé volání na telefonní čísla"</string>
     <string name="permdesc_callPhone" msgid="3740797576113760827">"Umožňuje aplikaci volat na telefonní čísla bez vašeho přičinění. Může mít za následek neočekávané poplatky nebo hovory. Toto oprávnění neumožňuje aplikaci volat na tísňová čísla. Škodlivé aplikace vás mohou připravit o peníze uskutečňováním hovorů bez vašeho svolení."</string>
     <string name="permlab_accessImsCallService" msgid="3574943847181793918">"přístup ke službě zasílání rychlých zpráv pro účely hovorů"</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 646f734..42cb42b 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Taleassistent"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lås nu"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Sikker tilstand"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personlig"</string>
@@ -1434,8 +1435,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Bed om pinkode inden frigørelse"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Bed om oplåsningsmønster ved deaktivering"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Bed om adgangskode inden frigørelse"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Appens størrelse kan ikke ændres. Gennemgå den ved at rulle med to fingre."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installeret af din administrator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Opdateret af administrator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Slettet af din administrator"</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index f8b78c0..d52c728 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Sprachassistent"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Jetzt sperren"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Abgesicherter Modus"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-System"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Privat"</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 7a7cce1..f86c2fd 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Φων.υποβοηθ."</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Κλείδωμα τώρα"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Ασφαλής λειτουργία"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Σύστημα Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Προσωπικό"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Να γίνεται ερώτηση για το PIN, πριν από το ξεκαρφίτσωμα"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Να γίνεται ερώτηση για το μοτίβο ξεκλειδώματος, πριν από το ξεκαρφίτσωμα"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Να γίνεται ερώτηση για τον κωδικό πρόσβασης, πριν από το ξεκαρφίτσωμα"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Το μέγεθος της εφαρμογής δεν είναι προσαρμόσιμο. Σύρετε προς τα κάτω με δύο δάχτυλα."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Εγκαταστάθηκε από το διαχειριστή σας"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Ενημερώθηκε από το διαχειριστή σας"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Διαγράφηκε από το διαχειριστή σας"</string>
diff --git a/core/res/res/values-en-rAU/strings.xml b/core/res/res/values-en-rAU/strings.xml
index c66c55a..e23f8d5 100644
--- a/core/res/res/values-en-rAU/strings.xml
+++ b/core/res/res/values-en-rAU/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lock now"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Safe mode"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index c66c55a..e23f8d5 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lock now"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Safe mode"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
diff --git a/core/res/res/values-en-rIN/strings.xml b/core/res/res/values-en-rIN/strings.xml
index c66c55a..e23f8d5 100644
--- a/core/res/res/values-en-rIN/strings.xml
+++ b/core/res/res/values-en-rIN/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lock now"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Safe mode"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index 0168d4f..b442bc1f 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Asistente voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear ahora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo seguro"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Solicitar PIN para quitar fijación"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Solicitar patrón de desbloqueo para quitar fijación"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Solicitar contraseña para quitar fijación"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"No se puede modificar el tamaño de la app, desplázala con dos dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Lo instaló el administrador."</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Actualizado por el administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Lo eliminó el administrador."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 04cdfe0..acbef23 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Asistente voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear ahora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt; 999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo seguro"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
@@ -243,7 +245,7 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Teléfono"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"hacer y administrar llamadas de teléfono"</string>
     <string name="permgrouplab_sensors" msgid="416037179223226722">"Sensores corporales"</string>
-    <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceder a datos del sensor sobre tus constantes vitales"</string>
+    <string name="permgroupdesc_sensors" msgid="7147968539346634043">"acceder a datos de sensores de tus constantes vitales"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Recuperar el contenido de la ventana"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"Inspecciona el contenido de una ventana con la que estés interactuando."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"Activar la exploración táctil"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Solicitar PIN para desactivar"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Solicitar patrón de desbloqueo para desactivar"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Solicitar contraseña para desactivar"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"No se puede cambiar el tamaño de la aplicación: desplázala con dos dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalado por tu administrador"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Actualizado por tu administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Eliminado por tu administrador"</string>
diff --git a/core/res/res/values-et-rEE/strings.xml b/core/res/res/values-et-rEE/strings.xml
index 5898ca0..9a96683 100644
--- a/core/res/res/values-et-rEE/strings.xml
+++ b/core/res/res/values-et-rEE/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Häälabi"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lukusta kohe"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Turvarežiim"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-süsteem"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Isiklik"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Enne vabastamist küsi PIN-koodi"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Enne vabastamist küsi avamismustrit"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Enne vabastamist küsi parooli"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Rakenduse suurust ei saa muuta. Kerige kahe sõrmega."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installis teie administraator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Värskendas administraator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Kustutas teie administraator"</string>
diff --git a/core/res/res/values-eu-rES/strings.xml b/core/res/res/values-eu-rES/strings.xml
index 0986b70..a30c437 100644
--- a/core/res/res/values-eu-rES/strings.xml
+++ b/core/res/res/values-eu-rES/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ahots-laguntza"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Blokeatu"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modu segurua"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android sistema"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Pertsonalak"</string>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 689e9e0..8672171 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -191,7 +191,7 @@
     <string name="reboot_to_update_prepare" msgid="6305853831955310890">"آماده‌سازی برای به‌روزرسانی…"</string>
     <string name="reboot_to_update_package" msgid="3871302324500927291">"در حال پردازش بسته‌بندی به‌روز…"</string>
     <string name="reboot_to_update_reboot" msgid="6428441000951565185">"در حال راه‌اندازی مجدد…"</string>
-    <string name="reboot_to_reset_title" msgid="4142355915340627490">"بازنشانی به داده‌های کارخانه"</string>
+    <string name="reboot_to_reset_title" msgid="4142355915340627490">"بازنشانی داده‌های کارخانه"</string>
     <string name="reboot_to_reset_message" msgid="2432077491101416345">"در حال راه‌اندازی مجدد…"</string>
     <string name="shutdown_progress" msgid="2281079257329981203">"در حال خاموش شدن…"</string>
     <string name="shutdown_confirm" product="tablet" msgid="3385745179555731470">"رایانهٔ لوحی شما خاموش می‌شود."</string>
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"دستیار صوتی"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"اکنون قفل شود"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"بیشتر از 999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"حالت ایمن"</string>
     <string name="android_system_label" msgid="6577375335728551336">"‏سیستم Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"شخصی"</string>
@@ -511,9 +513,9 @@
     <string name="policylab_forceLock" msgid="2274085384704248431">"قفل کردن صفحه"</string>
     <string name="policydesc_forceLock" msgid="1141797588403827138">"نحوه و زمان قفل شدن صفحه را کنترل می‌کند."</string>
     <string name="policylab_wipeData" msgid="3910545446758639713">"پاک کردن تمام داده‌ها"</string>
-    <string name="policydesc_wipeData" product="tablet" msgid="4306184096067756876">"با انجام بازنشانی به داده‌های کارخانه، داده‌های رایانهٔ لوحی بدون هشدار پاک می‌شود."</string>
-    <string name="policydesc_wipeData" product="tv" msgid="5816221315214527028">"داده‌های تلویزیون را بدون هشدار با انجام بازنشانی به داده کارخانه پاک کنید."</string>
-    <string name="policydesc_wipeData" product="default" msgid="5096895604574188391">"با انجام بازنشانی به داده‌های کارخانه، داده‌های تلفن بدون هشدار پاک می‌شود."</string>
+    <string name="policydesc_wipeData" product="tablet" msgid="4306184096067756876">"با انجام بازنشانی داده‌های کارخانه، داده‌های رایانهٔ لوحی بدون هشدار پاک می‌شود."</string>
+    <string name="policydesc_wipeData" product="tv" msgid="5816221315214527028">"داده‌های تلویزیون را بدون هشدار با انجام بازنشانی داده‌های کارخانه پاک کنید."</string>
+    <string name="policydesc_wipeData" product="default" msgid="5096895604574188391">"با انجام بازنشانی داده‌های کارخانه، داده‌های تلفن بدون هشدار پاک می‌شود."</string>
     <string name="policylab_wipeData_secondaryUser" msgid="8362863289455531813">"پاک کردن داده‌های کاربر"</string>
     <string name="policydesc_wipeData_secondaryUser" product="tablet" msgid="6336255514635308054">"داده‌های این کاربر را در این رایانه لوحی بدون هشدار پاک می‌کند."</string>
     <string name="policydesc_wipeData_secondaryUser" product="tv" msgid="2086473496848351810">"داده‌های این کاربر را در این تلویزیون بدون هشدار پاک می‌کند."</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"درخواست کد پین قبل از برداشتن پین"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"درخواست الگوی باز کردن قفل قبل از برداشتن پین"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"درخواست گذرواژه قبل از برداشتن پین"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"اندازه برنامه قابل تغییر نیست، با دو انگشت آن را پیمایش کنید."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"توسط سرپرستتان نصب شد"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"توسط سرپرست شما به‌روزرسانی شد"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"توسط سرپرستتان حذف شد"</string>
@@ -1484,7 +1485,7 @@
     <string name="zen_mode_default_weekends_name" msgid="2786495801019345244">"آخر هفته"</string>
     <string name="zen_mode_default_events_name" msgid="8158334939013085363">"رویداد"</string>
     <string name="muted_by" msgid="6147073845094180001">"<xliff:g id="THIRD_PARTY">%1$s</xliff:g> آن را بی‌صدا کرد"</string>
-    <string name="system_error_wipe_data" msgid="6608165524785354962">"دستگاهتان یک مشکل داخلی دارد، و ممکن است تا زمانی که بازنشانی به داده کارخانه انجام نگیرد، بی‌ثبات بماند."</string>
+    <string name="system_error_wipe_data" msgid="6608165524785354962">"دستگاهتان یک مشکل داخلی دارد، و ممکن است تا زمانی که بازنشانی داده‌های کارخانه انجام نگیرد، بی‌ثبات بماند."</string>
     <string name="system_error_manufacturer" msgid="8086872414744210668">"دستگاهتان یک مشکل داخلی دارد. برای جزئیات آن با سازنده‌تان تماس بگیرید."</string>
     <string name="stk_cc_ussd_to_dial" msgid="5202342984749947872">"‏درخواست USSD به درخواست DIAL اصلاح می‌شود."</string>
     <string name="stk_cc_ussd_to_ss" msgid="2345360594181405482">"‏درخواست USSD به درخواست SS اصلاح می‌شود."</string>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 8af6e56..8100305 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ääniapuri"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lukitse nyt"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Suojattu tila"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-järjestelmä"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Henkilökoht."</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Pyydä PIN ennen irrotusta"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pyydä lukituksenpoistokuvio ennen irrotusta"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pyydä salasana ennen irrotusta"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Sovelluksen koko ei muutu. Vieritä näkymää kahdella sormella."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Järjestelmänvalvoja on asentanut paketin."</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Järjestelmänvalvojasi on päivittänyt paketin."</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Järjestelmänvalvoja on poistanut paketin."</string>
diff --git a/core/res/res/values-fr-rCA/strings.xml b/core/res/res/values-fr-rCA/strings.xml
index e2daae6..b273980 100644
--- a/core/res/res/values-fr-rCA/strings.xml
+++ b/core/res/res/values-fr-rCA/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Assist. vocale"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Verrouiller"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mode sécurisé"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Système Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personnel"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Demander le NIP avant d\'annuler l\'épinglage"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Demander le schéma de déverrouillage avant d\'annuler l\'épinglage"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Demander le mot de passe avant d\'annuler l\'épinglage"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Impossible de redimensionner l\'application. Faites-la défiler avec deux doigts."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installé par votre administrateur"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Mis à jour par votre administrateur"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Supprimé par votre administrateur"</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 5de0971..850c18a 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Assistance vocale"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Verrouiller"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mode sécurisé"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Système Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personnel"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Demander le code PIN avant d\'annuler l\'épinglage"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Demander le schéma de déverrouillage avant d\'annuler l\'épinglage"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Demander le mot de passe avant d\'annuler l\'épinglage"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Il est impossible de redimensionner l\'application. Faites-la défiler avec deux doigts."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installé par votre administrateur"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Mis à jour par votre administrateur"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Supprimé par votre administrateur"</string>
diff --git a/core/res/res/values-gl-rES/strings.xml b/core/res/res/values-gl-rES/strings.xml
index ba25f89..998f494 100644
--- a/core/res/res/values-gl-rES/strings.xml
+++ b/core/res/res/values-gl-rES/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Asistente voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear agora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo seguro"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Persoal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Solicitar un PIN antes de soltar a pantalla"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Solicitar un padrón de desbloqueo antes de soltar a pantalla"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Solicitar un contrasinal antes de soltar a pantalla"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Non se pode cambiar o tamaño da aplicación. Desprázate por ela con dous dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalado polo administrador"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Actualizado polo administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Eliminado polo administrador"</string>
diff --git a/core/res/res/values-gu-rIN/strings.xml b/core/res/res/values-gu-rIN/strings.xml
index ce05ef5..7cfd200 100644
--- a/core/res/res/values-gu-rIN/strings.xml
+++ b/core/res/res/values-gu-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"વૉઇસ સહાય"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"હવે લૉક કરો"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"સુરક્ષિત મોડ"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android સિસ્ટમ"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"વ્યક્તિગત"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"અનપિન કરતાં પહેલાં PIN માટે પૂછો"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"અનપિન કરતા પહેલાં અનલૉક પેટર્ન માટે પૂછો"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"અનપિન કરતાં પહેલાં પાસવર્ડ માટે પૂછો"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"ઍપ્લિકેશનનું કદ બદલવા યોગ્ય નથી, બે આંગળીઓ વડે તેને સ્ક્રોલ કરો."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"તમારા વ્યવસ્થાપક દ્વારા ઇન્સ્ટોલ કરેલ"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"તમારા વ્યવસ્થાપક દ્વારા અપડેટ થયેલ"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"તમારા વ્યવસ્થાપક દ્વારા કાઢી નાખેલ"</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index 47fdd28..a001211 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"वॉइस सहायक"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"अभी लॉक करें"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"सुरक्षित मोड"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android सिस्‍टम"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"व्यक्तिगत"</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index 9bc0267..55399af 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -223,6 +223,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Glasovna pomoć"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Zaključaj sada"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Siguran način rada"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sustav Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Osobno"</string>
@@ -1443,8 +1445,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Traži PIN radi otkvačivanja"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Traži uzorak za otključavanje radi otkvačivanja"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Traži zaporku radi otkvačivanja"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Veličina aplikacije ne može se mijenjati, pomičite je s dva prsta."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalirao administrator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Ažurira vaš administrator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Izbrisao administrator"</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index 1c0257f..dc87943 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Hangsegéd"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Zárolás most"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Biztonsági üzemmód"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android rendszer"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Személyes"</string>
diff --git a/core/res/res/values-hy-rAM/strings.xml b/core/res/res/values-hy-rAM/strings.xml
index 02c6bed..f1d32d8 100644
--- a/core/res/res/values-hy-rAM/strings.xml
+++ b/core/res/res/values-hy-rAM/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ձայնային օգնութ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Կողպել հիմա"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Անվտանգ ռեժիմ"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android համակարգ"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Անձնական"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Ապաամրացնելուց առաջ հարցնել PIN-կոդը"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Ապաամրացնելուց առաջ հարցնել ապակողպող նախշը"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Ապաամրացնելուց առաջ հարցնել գաղտնաբառը"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Հավելվածի չափը հնարավոր չէ փոխել, ոլորեք այն երկու մատի օգնությամբ:"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Ադմինիստրատորը տեղադրել է այն"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Ադմինիստրատորը թարմացրել է այն"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Ադմինիստրատորը ջնջել է այն"</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 7346d31..8e18dae 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Bantuan Suara"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Kunci sekarang"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mode aman"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistem Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Pribadi"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Meminta PIN sebelum melepas sematan"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Meminta pola pembukaan kunci sebelum melepas sematan"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Meminta sandi sebelum melepas sematan"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Aplikasi tidak dapat diubah ukurannya, gulir dengan dua jari."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Dipasang oleh administrator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Diperbarui oleh administrator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Dihapus oleh administrator"</string>
diff --git a/core/res/res/values-is-rIS/strings.xml b/core/res/res/values-is-rIS/strings.xml
index c6ec5b1..b2c98f0 100644
--- a/core/res/res/values-is-rIS/strings.xml
+++ b/core/res/res/values-is-rIS/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Raddaðstoð"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Læsa núna"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Örugg stilling"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android kerfið"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Persónulegt"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Biðja um PIN-númer til að losa"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Biðja um opnunarmynstur til að losa"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Biðja um aðgangsorð til að losa"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Ekki er hægt að breyta stærð forritsins, flettu upp og niður með tveimur fingrum."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Uppsett af kerfisstjóra"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Uppfært af kerfisstjóranum"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Eytt af kerfisstjóra"</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index c4ecbad..b36e2e5 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Blocca ora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Modalità provvisoria"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personale"</string>
@@ -1434,8 +1435,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Richiedi il PIN per lo sblocco"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Richiedi sequenza di sblocco prima di sbloccare"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Richiedi password prima di sbloccare"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Non è posssibile ridimensionare l\'app: scorri con due dita."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installato dall\'amministratore"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Aggiornato dall\'amministratore"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Eliminato dall\'amministratore"</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 55fa332..cf4ca52 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"נעל עכשיו"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"מצב בטוח"</string>
     <string name="android_system_label" msgid="6577375335728551336">"‏מערכת Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"אישי"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"‏בקש PIN לפני ביטול הצמדה"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"בקש קו ביטול נעילה לפני ביטול הצמדה"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"בקש סיסמה לפני ביטול הצמדה"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"אין אפשרות לשנות את גודל האפליקציה, גלול אותה בשתי אצבעות."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"הותקנה על ידי מנהל המערכת שלך"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"עודכן על ידי מנהל המערכת שלך"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"נמחקה על ידי מנהל המערכת שלך"</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index a74d5b7..1ebf699 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"音声アシスト"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"今すぐロック"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g> 件)"</string>
     <string name="safeMode" msgid="2788228061547930246">"セーフモード"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Androidシステム"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"個人用"</string>
@@ -1434,8 +1435,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"オフライン再生を解除する前にPINの入力を求める"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"画面固定を解除する前にロック解除パターンの入力を求める"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"オフライン再生を解除する前にパスワードの入力を求める"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"アプリのサイズは変更できません。2 本の指でスクロールしてください。"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"管理者によってインストールされました"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"管理者によって更新されています"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"管理者によって削除されました"</string>
diff --git a/core/res/res/values-ka-rGE/strings.xml b/core/res/res/values-ka-rGE/strings.xml
index d37f6099..604323a 100644
--- a/core/res/res/values-ka-rGE/strings.xml
+++ b/core/res/res/values-ka-rGE/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ხმოვანი ასისტ."</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ახლა ჩაკეტვა"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"უსაფრთხო რეჟიმი"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-ის სისტემა"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"პირადი"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"ფიქსაციის მოხსნამდე PIN-ის მოთხოვნა"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"ფიქსაციის მოხსნამდე განბლოკვის ნიმუშის მოთხოვნა"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"ფიქსაციის მოხსნამდე პაროლის მოთხოვნა"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"აპის ზომა ვერ შეიცვლება. გადაადგილდით მასში ორი თითის მეშვეობით."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"თქვენი ადმინისტრატორის მიერ დაყენებული"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"განახლებულია თქვენი ადმინისტრატორის მიერ"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"თქვენი ადმინისტრატორის მიერ წაშლილი"</string>
diff --git a/core/res/res/values-kk-rKZ/strings.xml b/core/res/res/values-kk-rKZ/strings.xml
index 0a79c3b..323be5d 100644
--- a/core/res/res/values-kk-rKZ/strings.xml
+++ b/core/res/res/values-kk-rKZ/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Дауыс көмекшісі"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Қазір бекіту"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Қауіпсіз режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android жүйесі"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Жеке"</string>
@@ -1305,7 +1307,7 @@
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Қол жетімділік өшірілді."</string>
     <string name="user_switched" msgid="3768006783166984410">"Ағымдағы пайдаланушы <xliff:g id="NAME">%1$s</xliff:g>."</string>
     <string name="user_switching_message" msgid="2871009331809089783">"<xliff:g id="NAME">%1$s</xliff:g> ауысу орындалуда…"</string>
-    <string name="user_logging_out_message" msgid="8939524935808875155">"<xliff:g id="NAME">%1$s</xliff:g> ішінен шығу орындалуда…"</string>
+    <string name="user_logging_out_message" msgid="8939524935808875155">"<xliff:g id="NAME">%1$s</xliff:g> ішінен шығу…"</string>
     <string name="owner_name" msgid="2716755460376028154">"Пайдаланушы"</string>
     <string name="error_message_title" msgid="4510373083082500195">"Қателік"</string>
     <string name="error_message_change_not_allowed" msgid="1347282344200417578">"Бұл өзгертуге әкімші рұқсат етпеген"</string>
diff --git a/core/res/res/values-km-rKH/strings.xml b/core/res/res/values-km-rKH/strings.xml
index 21b1dc6..c00bc14 100644
--- a/core/res/res/values-km-rKH/strings.xml
+++ b/core/res/res/values-km-rKH/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ជំនួយសម្លេង"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ចាក់សោ​ឥឡូវនេះ"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"របៀប​​​សុវត្ថិភាព"</string>
     <string name="android_system_label" msgid="6577375335728551336">"ប្រព័ន្ធ​​ Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ផ្ទាល់ខ្លួន"</string>
@@ -1436,8 +1438,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"សួរ​រក​កូដ PIN មុន​ពេល​ផ្ដាច់"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"សួរ​រក​លំនាំ​ដោះ​សោ​មុន​ពេល​ផ្ដាច់"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"សួរ​រក​ពាក្យ​សម្ងាត់​មុន​ពេល​ផ្ដាច់"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"កម្មវិធីមិនអាចផ្លាស់ប្តូរទំហំបានទេ សូមរមូរវាដោយប្រើម្រាមដៃពីរ។"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"បានដំឡើងដោយអ្នកគ្រប់គ្រងរបស់អ្នក"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"បានធ្វើបច្ចុប្បន្នភាពដោយអ្នកគ្រប់គ្រងរបស់អ្នក"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"បានលុបដោយអ្នកគ្រប់គ្រងរបស់អ្នក"</string>
diff --git a/core/res/res/values-kn-rIN/strings.xml b/core/res/res/values-kn-rIN/strings.xml
index e828ce0..1aba0bb 100644
--- a/core/res/res/values-kn-rIN/strings.xml
+++ b/core/res/res/values-kn-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ಧ್ವನಿ ಸಹಾಯಕ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ಈಗ ಲಾಕ್ ಮಾಡಿ"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"ಸುರಕ್ಷಿತ ಮೋಡ್"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android ಸಿಸ್ಟಂ"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ವೈಯಕ್ತಿಕ"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 8ed4a6f..3384f09 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"음성 지원"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"지금 잠그기"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"안전 모드"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android 시스템"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"개인"</string>
@@ -229,7 +231,7 @@
     <string name="permgrouplab_contacts" msgid="3657758145679177612">"주소록"</string>
     <string name="permgroupdesc_contacts" msgid="6951499528303668046">"주소록 액세스"</string>
     <string name="permgrouplab_location" msgid="7275582855722310164">"위치"</string>
-    <string name="permgroupdesc_location" msgid="1346617465127855033">"이 기기의 위치에 액세스하기"</string>
+    <string name="permgroupdesc_location" msgid="1346617465127855033">"이 기기의 위치에 액세스"</string>
     <string name="permgrouplab_calendar" msgid="5863508437783683902">"캘린더"</string>
     <string name="permgroupdesc_calendar" msgid="3889615280211184106">"캘린더 액세스"</string>
     <string name="permgrouplab_sms" msgid="228308803364967808">"SMS"</string>
@@ -239,7 +241,7 @@
     <string name="permgrouplab_microphone" msgid="171539900250043464">"마이크"</string>
     <string name="permgroupdesc_microphone" msgid="4988812113943554584">"오디오 녹음"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"카메라"</string>
-    <string name="permgroupdesc_camera" msgid="3250611594678347720">"사진 찍기 및 동영상 녹화"</string>
+    <string name="permgroupdesc_camera" msgid="3250611594678347720">"사진 및 동영상 촬영"</string>
     <string name="permgrouplab_phone" msgid="5229115638567440675">"전화"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"전화 걸기 및 관리"</string>
     <string name="permgrouplab_sensors" msgid="416037179223226722">"신체 센서"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"고정 해제 이전에 PIN 요청"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"고정 해제 이전에 잠금해제 패턴 요청"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"고정 해제 이전에 비밀번호 요청"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"앱에서 크기 조절이 불가능합니다. 두 손가락을 사용해 스크롤하세요."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"관리자가 설치함"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"관리자에 의해 업데이트됨"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"관리자가 삭제함"</string>
diff --git a/core/res/res/values-ky-rKG/strings.xml b/core/res/res/values-ky-rKG/strings.xml
index 8381c32..870c858 100644
--- a/core/res/res/values-ky-rKG/strings.xml
+++ b/core/res/res/values-ky-rKG/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Үн жардамчысы"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Азыр кулпулоо"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Коопсуз режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android Тутуму"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Жеке"</string>
@@ -1435,8 +1437,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Бошотуудан мурун PIN суралсын"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Бошотуудан мурун кулпуну ачкан үлгү суралсын"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Бошотуудан мурун сырсөз суралсын"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Колдонмонун көлөмүн өзгөртүүгө болбойт, андыктан эки манжаңыз менен сыдырып караңыз."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Администраторуңуз тарабынан орнотулган"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Администраторуңуз жаңырткан"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Администраторуңуз тарабынан жок кылынган"</string>
diff --git a/core/res/res/values-lo-rLA/strings.xml b/core/res/res/values-lo-rLA/strings.xml
index 9884bf1..d5484d3 100644
--- a/core/res/res/values-lo-rLA/strings.xml
+++ b/core/res/res/values-lo-rLA/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ຊ່ວຍ​ເຫຼືອ​ທາງ​ສຽງ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ລັອກ​ດຽວ​ນີ້"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Safe mode"</string>
     <string name="android_system_label" msgid="6577375335728551336">"ລະບົບ Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"​ສ່ວນ​ໂຕ"</string>
@@ -1305,7 +1307,7 @@
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"ຍົກເລີກໂຕຊ່ວຍການເຂົ້າເຖິງແລ້ວ."</string>
     <string name="user_switched" msgid="3768006783166984410">"ຜູ່ໃຊ້ປັດຈຸບັນ <xliff:g id="NAME">%1$s</xliff:g> ."</string>
     <string name="user_switching_message" msgid="2871009331809089783">"ກຳ​ລັງ​ສະ​ລັບ​​ໄປ​ຫາ <xliff:g id="NAME">%1$s</xliff:g>…"</string>
-    <string name="user_logging_out_message" msgid="8939524935808875155">"ກຳລັງ​ອອກ​ຈາກ​ລະບົບ <xliff:g id="NAME">%1$s</xliff:g>…"</string>
+    <string name="user_logging_out_message" msgid="8939524935808875155">"ກຳລັງອອກຈາກລະບົບ <xliff:g id="NAME">%1$s</xliff:g>…"</string>
     <string name="owner_name" msgid="2716755460376028154">"ເຈົ້າຂອງ"</string>
     <string name="error_message_title" msgid="4510373083082500195">"ຜິດພາດ"</string>
     <string name="error_message_change_not_allowed" msgid="1347282344200417578">"​ຜູ່​ເບິ່ງ​ແຍງ​ລະ​ບົບ​ຂອງ​ທ່ານບໍ່​ອະ​ນຸ​ຍາດ​ໃຫ້​ປ່ຽນ​ແປງ​ສິ່ງ​ນີ້"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"​ຖາມ​ຫາ PIN ກ່ອນ​ຍົກ​ເລີກ​ການປັກ​ໝຸດ"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"​ຖາມ​ຫາ​ຮູບ​ແບບ​ປົດ​ລັອກ​ກ່ອນ​ຍົກ​ເລີກ​ການ​ປັກ​ໝຸດ"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"​ຖາມ​ຫາ​ລະ​ຫັດ​ຜ່ານ​ກ່ອນ​ຍົກ​ເລີກ​ການ​ປັກ​ໝຸດ"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"ບໍ່ສາມາດປັບຂະໜາດແອັບຯໄດ້, ກະລຸນາເລື່ອນມັນໂດຍໃຊ້ນິ້ວສອງນິ້ວແທນ."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"ຜູ້​ຄວບ​ຄຸມ​ຂອງ​ທ່ານ​ຕິດ​ຕັ້ງ​ໃສ່​ແລ້ວ"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"ອັບ​ເດດ​ໂດຍ​ຜູ້​ຄວບ​ຄຸມ​ຂອງ​ທ່ານ​ແລ້ວ"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"ຖືກ​ຜູ້​ຄວບ​ຄຸມ​ຂອງ​ທ່ານ​ລຶບ​ໄປ​ແລ້ວ"</string>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index 1c326fe..6ee24cf 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Užrakinti dabar"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Saugos režimas"</string>
     <string name="android_system_label" msgid="6577375335728551336">"„Android“ sistema"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Asmeninė"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Prašyti PIN kodo prieš atsegant"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Prašyti atrakinimo piešinio prieš atsegant"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Prašyti slaptažodžio prieš atsegant"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Programos dydis nekeičiamas, slinkite dviem pirštais."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Įdiegė administratorius"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Atnaujino administratorius"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Ištrynė administratorius"</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index 23be85a..7785965 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -223,6 +223,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Balss palīgs"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloķēt tūlīt"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"Pārsniedz"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Drošais režīms"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android sistēma"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personisks"</string>
diff --git a/core/res/res/values-mcc302-mnc220/config.xml b/core/res/res/values-mcc302-mnc220/config.xml
index 09a63aa..454e4b6 100644
--- a/core/res/res/values-mcc302-mnc220/config.xml
+++ b/core/res/res/values-mcc302-mnc220/config.xml
@@ -37,7 +37,7 @@
          Or string format of ApnSettingV3.
          note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
     <string-array translatable="false" name="config_tether_apndata">
-        <item>[ApnSettingV3]TELUS ISP,isp.telus.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,54</item>
+        <item>[ApnSettingV3]TELUS ISP,isp.telus.com,,,,,,,,,302,220,,DUN,IP,IP,true,0,,,,,,,gid,54</item>
         <item>[ApnSettingV3]Tethered Mobile Internet,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,50</item>
         <item>[ApnSettingV3]Tethered Public Mobile,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,4D4F</item>
     </string-array>
diff --git a/core/res/res/values-mk-rMK/strings.xml b/core/res/res/values-mk-rMK/strings.xml
index cd2efc4..eb90369 100644
--- a/core/res/res/values-mk-rMK/strings.xml
+++ b/core/res/res/values-mk-rMK/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Гласовна помош"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Заклучи сега"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Безбеден режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Систем Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Лични"</string>
@@ -1436,8 +1437,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Прашај за ПИН пред откачување"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Прашај за шема за отклучување пред откачување"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Прашај за лозинка пред откачување"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Не може да се промени големината на апликацијата. Движете ја со два прста."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Инсталирано од администраторот"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Ажурирано од администраторот"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Избришано од администраторот"</string>
diff --git a/core/res/res/values-ml-rIN/strings.xml b/core/res/res/values-ml-rIN/strings.xml
index c8eae7e..a83928e 100644
--- a/core/res/res/values-ml-rIN/strings.xml
+++ b/core/res/res/values-ml-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"വോയ്‌സ് സഹായം"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ഇപ്പോൾ ലോക്കുചെയ്യുക"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"സുരക്ഷിത മോഡ്"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android സിസ്റ്റം"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"വ്യക്തിഗതം"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"ചെയ്യുംമുമ്പ് പിൻ ചോദിക്കൂ"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"അൺപിൻ ചെയ്യുന്നതിനുമുമ്പ് അൺലോക്ക് പാറ്റേൺ ആവശ്യപ്പെടുക"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"അൺപിൻ ചെയ്യുന്നതിനുമുമ്പ് പാസ്‌വേഡ് ആവശ്യപ്പെടുക"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"ആപ്പിന്റെ വലുപ്പം ക്രമീകരിക്കാൻ കഴിയില്ല, രണ്ട് വിരലുകൾ ഉപയോഗിച്ച് അത് സ്ക്രോൾ ചെയ്യുക."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"നിങ്ങളുടെ അഡ്‌മിനിസ്‌ട്രേറ്റർ ഇൻസ്റ്റാളുചെയ്‌തു"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"നിങ്ങളുടെ അഡ്‌മിനിസ്‌ട്രേറ്റർ അപ്‌ഡേറ്റുചെയ്‌തു"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"നിങ്ങളുടെ അഡ്‌മിനിസ്‌ട്രേറ്റർ ഇല്ലാതാക്കി"</string>
diff --git a/core/res/res/values-mn-rMN/strings.xml b/core/res/res/values-mn-rMN/strings.xml
index 7b7d4b1..a9fb8593 100644
--- a/core/res/res/values-mn-rMN/strings.xml
+++ b/core/res/res/values-mn-rMN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Дуут туслах"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Одоо түгжих"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Аюулгүй горим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Андройд систем"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Хувийн"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Тогтоосныг суллахаас өмнө PIN асуух"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Тогтоосныг суллахаас өмнө түгжээ тайлах хээ асуух"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Тогтоосныг суллахаас өмнө нууц үг асуух"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Апп-н хэмжээ нь өөрчлөгддөггүй. Үүнийг 2 хуруугаараа гүйлгэнэ үү."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Таны админ суулгасан байна"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Танай админ шинэчилсэн"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Таны админ устгасан байна"</string>
diff --git a/core/res/res/values-mr-rIN/strings.xml b/core/res/res/values-mr-rIN/strings.xml
index 6ae6e82..a8896c3 100644
--- a/core/res/res/values-mr-rIN/strings.xml
+++ b/core/res/res/values-mr-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"व्हॉइस सहाय्य"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"आता लॉक करा"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"सुरक्षित मोड"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android सिस्‍टम"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"वैयक्तिक"</string>
diff --git a/core/res/res/values-ms-rMY/strings.xml b/core/res/res/values-ms-rMY/strings.xml
index f354ea0..cababdd 100644
--- a/core/res/res/values-ms-rMY/strings.xml
+++ b/core/res/res/values-ms-rMY/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Bantuan Suara"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Kunci sekarang"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mod selamat"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistem Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Peribadi"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Minta PIN sebelum menyahsemat"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Minta corak buka kunci sebelum menyahsemat"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Minta kata laluan sebelum menyahsemat"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Apl tidak boleh tukar saiznya, tatal apl itu menggunakan dua jari."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Dipasang oleh pentadbir anda"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Dikemas kini oleh pentadbir anda"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Dipadamkan oleh pentadbir anda"</string>
diff --git a/core/res/res/values-my-rMM/strings.xml b/core/res/res/values-my-rMM/strings.xml
index 4a0a227..8e61f41 100644
--- a/core/res/res/values-my-rMM/strings.xml
+++ b/core/res/res/values-my-rMM/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"အသံ အကူအညီ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ယခု သော့ပိတ်ရန်"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"၉၉၉+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"အန္တရာယ်ကင်းမှု စနစ်(Safe mode)"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android စနစ်"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ကိုယ်ရေး"</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index 4fc7078..f29a903 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Talehjelp"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lås nå"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Sikkermodus"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personlig"</string>
@@ -235,7 +237,7 @@
     <string name="permgrouplab_sms" msgid="228308803364967808">"SMS"</string>
     <string name="permgroupdesc_sms" msgid="4656988620100940350">"sende og lese SMS-meldinger"</string>
     <string name="permgrouplab_storage" msgid="1971118770546336966">"Lagring"</string>
-    <string name="permgroupdesc_storage" msgid="637758554581589203">"åpne bilder, media og filer på enheten din"</string>
+    <string name="permgroupdesc_storage" msgid="637758554581589203">"åpne bilder, medier og filer på enheten din"</string>
     <string name="permgrouplab_microphone" msgid="171539900250043464">"Mikrofon"</string>
     <string name="permgroupdesc_microphone" msgid="4988812113943554584">"spill inn lyd"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"PIN-kode for å løsne apper"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Krev bruk av opplåsningsmønster for å løsne apper"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Krev passord for å løsne apper"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Du kan ikke endre størrselse på appen – rull med to fingre."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Installert av administratoren"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Oppdatert av administratoren"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Slettet av administratoren"</string>
diff --git a/core/res/res/values-ne-rNP/strings.xml b/core/res/res/values-ne-rNP/strings.xml
index 17e67f8..a33289f 100644
--- a/core/res/res/values-ne-rNP/strings.xml
+++ b/core/res/res/values-ne-rNP/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"आवाज सहायता"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"अब बन्द गर्नुहोस्"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"९९९+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"सुरक्षित मोड"</string>
     <string name="android_system_label" msgid="6577375335728551336">"एन्ड्रोइड प्रणाली"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"व्यक्तिगत"</string>
@@ -1440,12 +1442,11 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"पिन निकाल्नुअघि PIN सोध्नुहोस्"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"पिन निकाल्नुअघि खोल्ने रूपरेखा सोध्नुहोस्"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"पिन निकाल्नुअघि पासवर्ड सोध्नुहोस्"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"अनुप्रयोगको आकार सानो-ठुलो बनाउन मिल्दैन, दुई औँलाले यसलाई स्क्रोल गर्नुहोस्।"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"तपाईँको प्रशासकद्वारा स्थापना गरिएको"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"तपाईँको प्रशासकद्वारा अद्यावधिक गरिएको"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"तपाईँको प्रशासकद्वारा हटाइएको"</string>
-    <string name="battery_saver_description" msgid="1960431123816253034">"ब्याट्रीको आयु सुधार्न, ब्याट्री रक्षकले तपाईँको यन्त्रको कार्यसम्पादन घटाउँछ र भाइब्रेसन, स्थान सेवा र बहुसंख्यक पृष्ठभूमि डेटा सीमित गर्दछ। इमेल, सन्देश, र अन्य अनुप्रयोगहरू जुन सिङ्कमा भर पर्छन् अद्यावधिक नहुन सक्छन् जबसम्म तपाईँ तिनीहरूलाई खोल्नुहुन्न\n\n ब्याट्री रक्षक स्वत: निस्कृय हुन्छ जब तपाईँको यन्त्र चार्ज हुँदै हुन्छ।"</string>
+    <string name="battery_saver_description" msgid="1960431123816253034">"ब्याट्रीको आयु सुधार्न, ब्याट्री संरक्षकले तपाईँको यन्त्रको कार्यसम्पादन घटाउँछ र भाइब्रेसन, स्थान सेवा र बहुसंख्यक पृष्ठभूमि डेटा सीमित गर्दछ। इमेल, सन्देश, र अन्य अनुप्रयोगहरू जुन सिङ्कमा भर पर्छन् अद्यावधिक नहुन सक्छन् जबसम्म तपाईँ तिनीहरूलाई खोल्नुहुन्न\n\n ब्याट्री संरक्षक स्वत: निस्कृय हुन्छ जब तपाईँको यन्त्र चार्ज हुँदै हुन्छ।"</string>
     <plurals name="zen_mode_duration_minutes_summary" formatted="false" msgid="4367877408072000848">
       <item quantity="other"> %1$d मिनेटको लागि (<xliff:g id="FORMATTEDTIME_1">%2$s</xliff:g> सम्म)</item>
       <item quantity="one">एक मिनेटको लागि (<xliff:g id="FORMATTEDTIME_0">%2$s</xliff:g> सम्म)</item>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index d04e10b..53b45b0 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Spraakassistent"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Nu vergrendelen"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999 +"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Veilige modus"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-systeem"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Persoonlijk"</string>
@@ -243,7 +244,7 @@
     <string name="permgrouplab_phone" msgid="5229115638567440675">"Telefoon"</string>
     <string name="permgroupdesc_phone" msgid="6234224354060641055">"bellen en telefoontjes beheren"</string>
     <string name="permgrouplab_sensors" msgid="416037179223226722">"Lichaamssensoren"</string>
-    <string name="permgroupdesc_sensors" msgid="7147968539346634043">"toegang tot sensorgegevens over je vitale functies"</string>
+    <string name="permgroupdesc_sensors" msgid="7147968539346634043">"toegang krijgen tot sensorgegevens over je vitale functies"</string>
     <string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"Inhoud van vensters ophalen"</string>
     <string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"De inhoud inspecteren van een venster waarmee je interactie hebt."</string>
     <string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"\'Verkennen via aanraking\' inschakelen"</string>
diff --git a/core/res/res/values-pa-rIN/strings.xml b/core/res/res/values-pa-rIN/strings.xml
index c3df4ac..d450bf9 100644
--- a/core/res/res/values-pa-rIN/strings.xml
+++ b/core/res/res/values-pa-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ਵੌਇਸ ਅਸਿਸਟ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ਹੁਣ ਲੌਕ ਕਰੋ"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"ਸੁਰੱਖਿਅਤ ਮੋਡ"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android System"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ਨਿੱਜੀ"</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 14e56cb..b7f984d 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Asystent głosowy"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Zablokuj teraz"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Tryb awaryjny"</string>
     <string name="android_system_label" msgid="6577375335728551336">"System Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Osobiste"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Podaj PIN, aby odpiąć"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Aby odpiąć, poproś o wzór odblokowania"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Aby odpiąć, poproś o hasło"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Rozmiaru tej aplikacji nie można zmienić. Przewiń ją dwoma palcami."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Zainstalowany przez administratora"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Zaktualizowane przez administratora"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Usunięty przez administratora"</string>
diff --git a/core/res/res/values-pt-rBR/strings.xml b/core/res/res/values-pt-rBR/strings.xml
index 8212d13..4464259 100644
--- a/core/res/res/values-pt-rBR/strings.xml
+++ b/core/res/res/values-pt-rBR/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ajuda de voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear agora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo de segurança"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Pessoal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Pedir PIN antes de liberar"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pedir padrão de desbloqueio antes de liberar"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pedir senha antes de liberar"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"O app não é redimensionável. Desloque-o com dois dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalado pelo seu administrador"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Atualizado pelo administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Excluído pelo seu administrador"</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 90091d8..af38435 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Assist. de voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear agora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo seguro"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Pessoal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Pedir PIN antes de soltar"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pedir sequência de desbloqueio antes de soltar"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pedir palavra-passe antes de soltar"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"A aplicação não é redimensionável. Desloque-a com dois dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalado pelo administrador"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Atualizado pelo administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Eliminado pelo administrador"</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index 8212d13..4464259 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ajuda de voz"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Bloquear agora"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Modo de segurança"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistema Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Pessoal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Pedir PIN antes de liberar"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pedir padrão de desbloqueio antes de liberar"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pedir senha antes de liberar"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"O app não é redimensionável. Desloque-o com dois dedos."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalado pelo seu administrador"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Atualizado pelo administrador"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Excluído pelo seu administrador"</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 9536c70..7ac92c3 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -223,6 +223,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Asistent vocal"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Blocați acum"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"˃999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mod sigur"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistemul Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
@@ -1443,8 +1445,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Solicită codul PIN înainte de a anula fixarea"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Solicită modelul pentru deblocare înainte de a anula fixarea"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Solicită parola înainte de a anula fixarea"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Aplicația nu poate fi redimensionată. Derulați în ea cu două degete."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Instalat de administrator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Actualizat de un administrator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Șters de administrator"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 613c738..b7ba99f 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Аудиоподсказки"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Заблокировать"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"&gt;999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Безопасный режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Система Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Личные данные"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"PIN-код для отключения"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Запрашивать графический ключ для отключения блокировки"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Запрашивать пароль для отключения блокировки"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Размер окна нельзя изменить. Прокрутите страницу двумя пальцами."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Установлено администратором"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Обновлено администратором"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Удалено администратором"</string>
diff --git a/core/res/res/values-si-rLK/strings.xml b/core/res/res/values-si-rLK/strings.xml
index b9ae0e9..4e265177 100644
--- a/core/res/res/values-si-rLK/strings.xml
+++ b/core/res/res/values-si-rLK/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"හඬ සහායක"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"දැන් අගුළු දමන්න"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"ආරක්‍ෂිත ආකාරය"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android පද්ධතිය"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"පෞද්ගලික"</string>
@@ -1436,8 +1438,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"ගැලවීමට පෙර PIN විමසන්න"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"ගැලවීමට පෙර අගුළු අරින රටාව සඳහා අසන්න"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"ගැලවීමට පෙර මුරපදය විමසන්න"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"යෙදුම ප්‍රතිප්‍රමාණ කළ හැකි නොවේ, එය ඇඟිලි දෙකකින් අනුචලනය කරන්න."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"ඔබගේ පරිපාලක විසින් ස්ථාපනය කරන ලද"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"ඔබගේ පරිපාලක විසින් යාවත්කාලීන කරන ලදී"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"ඔබගේ පරිපාලක විසින් මකන ලද"</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 856f8f7..ba5465e 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Hlasový asistent"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Uzamknúť"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Núdzový režim"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Systém Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Osobné"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Pred uvoľnením požiadať o číslo PIN"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pred uvoľnením požiadať o bezpečnostný vzor"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pred uvoľnením požiadať o heslo"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Veľkosť aplikácie nie je možné zmeniť. Zobrazenie môžete posúvať dvoma prstami."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Inštalovaný správcom"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Aktualizované správcom"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Odstránený správcom"</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index eff1574..04b7fc7 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Glas. pomočnik"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Zakleni zdaj"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999 +"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Varni način"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistem Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Osebno"</string>
@@ -1452,8 +1454,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Zahtevaj PIN pred odpenjanjem"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Pred odpenjanjem vprašaj za vzorec za odklepanje"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Pred odpenjanjem vprašaj za geslo"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Velikosti aplikacije ni mogoče spremeniti. Po njej se pomikajte z dvema prstoma."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Namestil skrbnik"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Posodobil skrbnik"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Izbrisal skrbnik"</string>
diff --git a/core/res/res/values-sq-rAL/strings.xml b/core/res/res/values-sq-rAL/strings.xml
index a29a960..b8ca565 100644
--- a/core/res/res/values-sq-rAL/strings.xml
+++ b/core/res/res/values-sq-rAL/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ndihma zanore"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Kyç tani"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Modaliteti i sigurisë"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Sistemi \"android\""</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
@@ -1434,8 +1435,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Zhgozhdimi kërkon PIN-in"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Kërko model shkyçjeje para heqjes së gozhdimit"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Kërko fjalëkalim para heqjes nga gozhdimi."</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Përmasa e apl. nuk mund të ndryshohet, lëvize atë me të dy gishtat."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"U instalua nga administratori yt"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Përditësuar nga administratori"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"U fshi nga administratori yt"</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index 9d12292..4118c63 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -223,6 +223,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Гласовна помоћ"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Закључај одмах"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Безбедни режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android систем"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Лично"</string>
@@ -1443,8 +1445,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Тражи PIN пре откачињања"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Тражи шаблон за откључавање пре откачињања"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Тражи лозинку пре откачињања"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Величина апликације не може да се мења, померајте је помоћу два прста."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Инсталирао је ваш администратор"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Ажурирао је администратор"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Избрисао је ваш адмиистратор"</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 57edbcb..40141de 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Lås nu"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Säkert läge"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android-system"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personligt"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Be om pinkod innan skärmen slutar fästas"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Be om upplåsningsmönster innan skärmen slutar fästas"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Be om lösenord innan skärmen slutar fästas"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Det går inte att ändra appens storlek. Rulla med två fingrar."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Paketet har installerats av administratören"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Uppdaterat av administratören"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Paketet har raderats av administratören"</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 3de8eeb..196d5dc 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -224,6 +224,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Usaidizi wa Sauti"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Funga sasa"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Mtindo salama"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Mfumo wa Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Binafsi"</string>
diff --git a/core/res/res/values-ta-rIN/strings.xml b/core/res/res/values-ta-rIN/strings.xml
index 30b326a..1113776 100644
--- a/core/res/res/values-ta-rIN/strings.xml
+++ b/core/res/res/values-ta-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"குரல் உதவி"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"இப்போது பூட்டு"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"பாதுகாப்பு பயன்முறை"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android அமைப்பு"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"தனிப்பட்ட"</string>
diff --git a/core/res/res/values-te-rIN/strings.xml b/core/res/res/values-te-rIN/strings.xml
index 3659080..c563e7c 100644
--- a/core/res/res/values-te-rIN/strings.xml
+++ b/core/res/res/values-te-rIN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"వాయిస్ సహాయకం"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ఇప్పుడు లాక్ చేయండి"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"సురక్షిత మోడ్"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android సిస్టమ్"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"వ్యక్తిగతం"</string>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index f168d6c..0080f51 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"ตัวช่วยเสียง"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ล็อกเลย"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"โหมดปลอดภัย"</string>
     <string name="android_system_label" msgid="6577375335728551336">"ระบบ Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ส่วนตัว"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"ขอ PIN ก่อนเลิกตรึง"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"ขอรูปแบบการปลดล็อกก่อนเลิกตรึง"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"ขอรหัสผ่านก่อนเลิกตรึง"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"แอปไม่สามารถปรับขนาดได้ เลื่อนแอปด้วยนิ้ว 2 นิ้ว"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"ติดตั้งโดยผู้ดูแลระบบของคุณ"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"อัปเดตโดยผู้ดูแลระบบ"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"ลบโดยผู้ดูแลระบบของคุณ"</string>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index ab30e30..4f907c1 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"I-lock ngayon"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Safe mode"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android System"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Personal"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Humingi ng PIN bago mag-unpin"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Humingi ng pattern sa pag-unlock bago mag-unpin"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Humingi ng password bago mag-unpin"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Hindi nare-resize ang app, mag-scroll dito gamit ang dalawang daliri."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Na-install ng iyong administrator"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Na-update ng iyong administrator"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Na-delete ng iyong administrator"</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 8cf8935..06f8c75 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Sesli Yardım"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Şimdi kilitle"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Güvenli mod"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android Sistemi"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Kişisel"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Sabitlemeyi kaldırmadan önce PIN\'i sor"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Sabitlemeyi kaldırmadan önce kilit açma desenini sor"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Sabitlemeyi kaldırmadan önce şifre sor"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Uygulama yeniden boyutlandırılamaz. İki parmağınızla kaydırın."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Yöneticiniz tarafından yüklendi"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Yöneticiniz tarafından güncellendi"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Yöneticiniz tarafından silindi"</string>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index 7522e4e..721f24d 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -224,6 +224,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Голос. підказки"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Блокувати зараз"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Безп. режим"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Система Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Особисті дані"</string>
diff --git a/core/res/res/values-ur-rPK/strings.xml b/core/res/res/values-ur-rPK/strings.xml
index c4d2466..e31fa57 100644
--- a/core/res/res/values-ur-rPK/strings.xml
+++ b/core/res/res/values-ur-rPK/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Voice Assist"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"ابھی مقفل کریں"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"‎999+‎"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"حفاظتی وضع"</string>
     <string name="android_system_label" msgid="6577375335728551336">"‏Android سسٹم"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"ذاتی"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"‏پن ہٹانے سے پہلے PIN طلب کریں"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"پن ہٹانے سے پہلے غیر مقفل کرنے کا پیٹرن طلب کریں"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"پن ہٹانے سے پہلے پاس ورڈ طلب کریں"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"ایپ ری سائز ایبل نہیں ہے، اسے دو انگلیوں کے ساتھ سکرول کریں۔"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"آپ کے منتظم کی جانب سے انسٹال کر دیا گیا"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"آپ کے منتظم نے اپ ڈيٹ کر دیا"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"آپ کے منتظم کی جانب سے حذف کر دیا گیا"</string>
diff --git a/core/res/res/values-uz-rUZ/strings.xml b/core/res/res/values-uz-rUZ/strings.xml
index 596bbed..0489638 100644
--- a/core/res/res/values-uz-rUZ/strings.xml
+++ b/core/res/res/values-uz-rUZ/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Ovozli yordam"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Qulflash"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Xavfsiz usul"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android tizimi"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Shaxsiy"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Yechishda PIN-kod so‘ralsin"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Bo‘shatishdan oldin chizmali parol so‘ralsin"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Bo‘shatishdan oldin parol so‘ralsin"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Oyna o‘lchamini o‘zgartirib bo‘lmaydi. Sahifani ikkita barmoq bilan aylantiring."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Administratoringiz tomonidan o‘rnatilgan"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Administratoringiz tomonidan yangilandi"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Administratoringiz tomonidan o‘chirilgan"</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index c5aa37e..ccd1345 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Trợ lý thoại"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Khóa ngay"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"Chế độ an toàn"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Hệ thống Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Cá nhân"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"Hỏi mã PIN trước khi bỏ ghim"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"Hỏi hình mở khóa trước khi bỏ ghim"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"Hỏi mật khẩu trước khi bỏ ghim"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"Ứng dụng không đổi kích thước được, hãy cuộn ứng dụng bằng hai ngón tay."</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"Được cài đặt bởi quản trị viên của bạn"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"Được cập nhật bởi quản trị viên của bạn"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"Đã bị xóa bởi quản trị viên của bạn"</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index 311fe55..1afede0 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"语音助理"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"立即锁定"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"安全模式"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android 系统"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"个人"</string>
@@ -1305,8 +1307,7 @@
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"已取消无障碍功能。"</string>
     <string name="user_switched" msgid="3768006783166984410">"当前用户是<xliff:g id="NAME">%1$s</xliff:g>。"</string>
     <string name="user_switching_message" msgid="2871009331809089783">"正在切换为<xliff:g id="NAME">%1$s</xliff:g>…"</string>
-    <!-- no translation found for user_logging_out_message (8939524935808875155) -->
-    <skip />
+    <string name="user_logging_out_message" msgid="8939524935808875155">"正在将<xliff:g id="NAME">%1$s</xliff:g>退出帐号…"</string>
     <string name="owner_name" msgid="2716755460376028154">"机主"</string>
     <string name="error_message_title" msgid="4510373083082500195">"错误"</string>
     <string name="error_message_change_not_allowed" msgid="1347282344200417578">"您的管理员不允许进行此更改"</string>
@@ -1435,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"取消时要求输入PIN码"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"取消时要求绘制解锁图案"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"取消时要求输入密码"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"无法调整这个应用的大小,请用双指滚动应用。"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"已由管理员安装"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"由您单位的管理员更新"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"已被管理员删除"</string>
diff --git a/core/res/res/values-zh-rHK/strings.xml b/core/res/res/values-zh-rHK/strings.xml
index efab307..84c85bf 100644
--- a/core/res/res/values-zh-rHK/strings.xml
+++ b/core/res/res/values-zh-rHK/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"語音助手"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"立即鎖定"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"安全模式"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android 系統"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"個人"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index 4d23d76..b45fe75 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -222,6 +222,8 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"語音小幫手"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"立即鎖定"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"超過 999"</string>
+    <!-- no translation found for notification_children_count_bracketed (1769425473168347839) -->
+    <skip />
     <string name="safeMode" msgid="2788228061547930246">"安全模式"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Android 系統"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"個人"</string>
@@ -1434,8 +1436,7 @@
     <string name="lock_to_app_unlock_pin" msgid="2552556656504331634">"取消固定時必須輸入 PIN"</string>
     <string name="lock_to_app_unlock_pattern" msgid="4182192144797225137">"取消固定時必須畫出解鎖圖形"</string>
     <string name="lock_to_app_unlock_password" msgid="6380979775916974414">"取消固定時必須輸入密碼"</string>
-    <!-- no translation found for dock_non_resizeble_text (9156251681042762723) -->
-    <skip />
+    <string name="dock_non_resizeble_text" msgid="9156251681042762723">"無法調整這個應用程式的大小,請用雙指捲動該應用程式。"</string>
     <string name="package_installed_device_owner" msgid="8420696545959087545">"已由管理員安裝"</string>
     <string name="package_updated_device_owner" msgid="8856631322440187071">"由您的管理員更新"</string>
     <string name="package_deleted_device_owner" msgid="7650577387493101353">"已遭管理員刪除"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index bd566cd..c2159d7 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -222,6 +222,7 @@
     <string name="global_action_voice_assist" msgid="7751191495200504480">"Isisekeli sezwi"</string>
     <string name="global_action_lockdown" msgid="8751542514724332873">"Khiya manje"</string>
     <string name="status_bar_notification_info_overflow" msgid="5301981741705354993">"999+"</string>
+    <string name="notification_children_count_bracketed" msgid="1769425473168347839">"(<xliff:g id="NOTIFICATIONCOUNT">%d</xliff:g>)"</string>
     <string name="safeMode" msgid="2788228061547930246">"Imodi ephephile"</string>
     <string name="android_system_label" msgid="6577375335728551336">"Uhlelo lwe-Android"</string>
     <string name="user_owner_label" msgid="2804351898001038951">"Okomuntu siqu"</string>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index f9f8162..34a66d0 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1026,9 +1026,6 @@
         <!-- ============== -->
         <eat-comment />
 
-        <!-- Reference to the Pointer style -->
-        <attr name="pointerStyle" format="reference" />
-
         <!-- The drawable for accessibility focused views. -->
         <attr name="accessibilityFocusedDrawable" format="reference" />
 
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 67933cd..2a11081 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -634,7 +634,7 @@
          specified, it will run in the current preferred orientation
          of the screen.
          <p>This attribute is supported by the <a
-            href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a>
+            href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
             element. -->
     <attr name="screenOrientation">
         <!-- No preference specified: let the system decide the best
@@ -923,8 +923,8 @@
         <enum name="preferExternal" value="2" />
     </attr>
 
-    <!-- Extra options for an activity's UI. Applies to either the {@code &lt;activity&gt;} or
-         {@code &lt;application&gt;} tag. If specified on the {@code &lt;application&gt;}
+    <!-- Extra options for an activity's UI. Applies to either the {@code <activity>} or
+         {@code <application>} tag. If specified on the {@code <application>}
          tag these will be considered defaults for all activities in the
          application. -->
     <attr name="uiOptions">
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 7f8c460..af8ff2e 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -130,12 +130,9 @@
     <drawable name="notification_template_divider">#29000000</drawable>
     <drawable name="notification_template_divider_media">#29ffffff</drawable>
 
-    <color name="notification_icon_bg_color">#ff9e9e9e</color>
+    <color name="notification_icon_default_color">#ff616161</color>
     <color name="notification_action_color_filter">@color/secondary_text_material_light</color>
 
-    <color name="notification_media_primary_color">@color/primary_text_material_dark</color>
-    <color name="notification_media_secondary_color">@color/secondary_text_material_dark</color>
-
     <color name="notification_progress_background_color">@color/secondary_text_material_light</color>
 
     <!-- Keyguard colors -->
@@ -176,4 +173,7 @@
     <color name="Red_800">#ffb93221</color>
 
     <color name="chooser_service_row_background_color">#fff5f5f5</color>
+
+    <!-- Status bar color for semi transparent mode. -->
+    <color name="system_bar_background_semi_transparent">#66000000</color> <!-- 40% black -->
 </resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index d9e0472..ea6cf11 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -716,6 +716,13 @@
 
     <bool name="config_carDockEnablesAccelerometer">true</bool>
 
+    <!--  Control whether to launch Car dock home app when user presses home button or when
+          car dock intent is fired.
+          In mobile device, usually separate home app is expected in car mode, and this should be
+          enabled. But in environments like real car, default home app may be enough, and in that
+          case, this can be disabled (set to false). -->
+    <bool name="config_enableCarDockHomeLaunch">true</bool>
+
     <!-- HDMI behavior -->
 
     <!-- The number of degrees to rotate the display when the device has HDMI connected
@@ -733,6 +740,15 @@
          Any other values will have surprising consequences. -->
     <integer name="config_defaultUiModeType">1</integer>
 
+    <!--  Control whether to lock UI mode to what is selected from config_defaultUiModeType.
+          Once UI mode is locked, applications cannot change it anymore. -->
+    <bool name="config_lockUiMode">false</bool>
+
+    <!--  Control whether to lock day/night mode change from normal application. When it is
+          true, day / night mode change is only allowed to apps with MODIFY_DAY_NIGHT_MODE
+          permission. -->
+    <bool name="config_lockDayNightMode">false</bool>
+
     <!-- Control the default night mode to use when there is no other mode override set.
          One of the following values (see UiModeManager.java):
              0 - MODE_NIGHT_AUTO
@@ -2384,4 +2400,9 @@
          The duplication is necessary, because this information is used before the features are
          available to the system.-->
     <bool name="config_freeformWindowManagement">false</bool>
+
+    <!-- If set, this will force all windows to draw the status bar background, including the apps
+         that have not requested doing so (via the WindowManager.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
+         flag). -->
+    <bool name="config_forceWindowDrawsStatusBarBackground">true</bool>
 </resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 01daf26..7b4becc 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -130,11 +130,38 @@
     <!-- Default padding for dialogs. -->
     <dimen name="dialog_padding">16dp</dimen>
 
+    <!-- The margin on the start of the content view -->
+    <dimen name="notification_content_margin_start">16dp</dimen>
+
+    <!-- The margin on the end of the content view -->
+    <dimen name="notification_content_margin_end">16dp</dimen>
+
+    <!-- The margin on the end of the content view with a picture.-->
+    <dimen name="notification_content_picture_margin">56dp</dimen>
+
+    <!-- height of the content margin to accomodate for the header -->
+    <dimen name="notification_content_margin_top">30dp</dimen>
+
+    <!-- height of notification header view if present -->
+    <dimen name="notification_header_height">32dp</dimen>
+
+    <!-- Height of a small notification in the status bar -->
+    <dimen name="notification_min_height">84dp</dimen>
+
     <!-- The width of the big icons in notifications. -->
     <dimen name="notification_large_icon_width">64dp</dimen>
     <!-- The width of the big icons in notifications. -->
     <dimen name="notification_large_icon_height">64dp</dimen>
 
+    <!--  Min height of the notification content. -->
+    <dimen name="notification_min_content_height">54dp</dimen>
+
+    <!-- The minimum width of the app name in the header if it shrinks -->
+    <dimen name="notification_header_shrink_min_width">72dp</dimen>
+
+    <!-- The minimum height of the content if there is a picture present with big picture -->
+    <dimen name="notification_big_picture_content_min_height_with_picture">41dp</dimen>
+
     <!-- Minimum width of the search view text entry area. -->
     <dimen name="search_view_text_min_width">160dip</dimen>
 
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8a00294..d6dd842 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -531,6 +531,12 @@
          [CHAR LIMIT=4] -->
     <string name="status_bar_notification_info_overflow">999+</string>
 
+    <!-- The number of notifications in the notification header. An example would be (2) or (12) -->
+    <string name="notification_children_count_bracketed">(<xliff:g id="notificationCount" example="1">%d</xliff:g>)</string>
+
+    <!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] -->
+    <string name="notification_header_divider_symbol" translatable="false">•</string>
+
     <!-- Displayed to the user to tell them that they have started up the phone in "safe mode" -->
     <string name="safeMode">Safe mode</string>
 
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index e6f279d..9a4016b 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1368,6 +1368,42 @@
         <item name="pointerIconGrabbing">@drawable/pointer_grabbing_icon</item>
     </style>
 
+    <style name="LargePointer">
+        <item name="pointerIconArrow">@drawable/pointer_arrow_large_icon</item>
+        <item name="pointerIconSpotHover">@drawable/pointer_spot_hover_icon</item>
+        <item name="pointerIconSpotTouch">@drawable/pointer_spot_touch_icon</item>
+        <item name="pointerIconSpotAnchor">@drawable/pointer_spot_anchor_icon</item>
+        <item name="pointerIconHand">@drawable/pointer_hand_large_icon</item>
+        <item name="pointerIconContextMenu">@drawable/pointer_context_menu_large_icon</item>
+        <item name="pointerIconHelp">@drawable/pointer_help_large_icon</item>
+        <!-- TODO: create large wait icon. -->
+        <item name="pointerIconWait">@drawable/pointer_wait_icon</item>
+        <item name="pointerIconCell">@drawable/pointer_cell_large_icon</item>
+        <item name="pointerIconCrosshair">@drawable/pointer_crosshair_large_icon</item>
+        <item name="pointerIconText">@drawable/pointer_text_large_icon</item>
+        <item name="pointerIconVerticalText">@drawable/pointer_vertical_text_large_icon</item>
+        <item name="pointerIconAlias">@drawable/pointer_alias_large_icon</item>
+        <item name="pointerIconCopy">@drawable/pointer_copy_large_icon</item>
+        <item name="pointerIconAllScroll">@drawable/pointer_all_scroll_large_icon</item>
+        <item name="pointerIconNodrop">@drawable/pointer_nodrop_large_icon</item>
+        <item name="pointerIconHorizontalDoubleArrow">
+            @drawable/pointer_horizontal_double_arrow_large_icon
+        </item>
+        <item name="pointerIconVerticalDoubleArrow">
+            @drawable/pointer_vertical_double_arrow_large_icon
+        </item>
+        <item name="pointerIconTopRightDiagonalDoubleArrow">
+            @drawable/pointer_top_right_diagonal_double_arrow_large_icon
+        </item>
+        <item name="pointerIconTopLeftDiagonalDoubleArrow">
+            @drawable/pointer_top_left_diagonal_double_arrow_large_icon
+        </item>
+        <item name="pointerIconZoomIn">@drawable/pointer_zoom_in_large_icon</item>
+        <item name="pointerIconZoomOut">@drawable/pointer_zoom_out_large_icon</item>
+        <item name="pointerIconGrab">@drawable/pointer_grab_large_icon</item>
+        <item name="pointerIconGrabbing">@drawable/pointer_grabbing_large_icon</item>
+    </style>
+
     <!-- Wifi dialog styles -->
     <!-- @hide -->
     <style name="wifi_item">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 8cf1134..b5fc08b 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -197,11 +197,8 @@
   <java-symbol type="id" name="inbox_text4" />
   <java-symbol type="id" name="inbox_text5" />
   <java-symbol type="id" name="inbox_text6" />
-  <java-symbol type="id" name="inbox_more" />
-  <java-symbol type="id" name="inbox_end_pad" />
   <java-symbol type="id" name="status_bar_latest_event_content" />
   <java-symbol type="id" name="action_divider" />
-  <java-symbol type="id" name="overflow_divider" />
   <java-symbol type="id" name="notification_main_column" />
   <java-symbol type="id" name="sms_short_code_confirm_message" />
   <java-symbol type="id" name="sms_short_code_detail_layout" />
@@ -218,7 +215,6 @@
   <java-symbol type="id" name="pin_error_message" />
   <java-symbol type="id" name="timePickerLayout" />
   <java-symbol type="id" name="profile_badge_large_template" />
-  <java-symbol type="id" name="profile_badge_line2" />
   <java-symbol type="id" name="profile_badge_line3" />
   <java-symbol type="id" name="transitionPosition" />
   <java-symbol type="id" name="selection_start_handle" />
@@ -231,7 +227,6 @@
   <java-symbol type="attr" name="gestureOverlayViewStyle" />
   <java-symbol type="attr" name="keyboardViewStyle" />
   <java-symbol type="attr" name="numberPickerStyle" />
-  <java-symbol type="attr" name="pointerStyle" />
   <java-symbol type="attr" name="preferenceFrameLayoutStyle" />
   <java-symbol type="attr" name="searchDialogTheme" />
   <java-symbol type="attr" name="textAppearanceAutoCorrectionSuggestion" />
@@ -1428,6 +1423,8 @@
   <java-symbol type="style" name="Theme.DeviceDefault.Dialog.NoFrame" />
   <java-symbol type="style" name="Theme.IconMenu" />
   <java-symbol type="style" name="Theme.DeviceDefault.VoiceInteractionSession" />
+  <java-symbol type="style" name="Pointer" />
+  <java-symbol type="style" name="LargePointer" />
 
   <java-symbol type="attr" name="mediaRouteButtonStyle" />
   <java-symbol type="attr" name="externalRouteEnabledDrawable" />
@@ -1480,11 +1477,14 @@
   <java-symbol type="bool" name="config_carDockEnablesAccelerometer" />
   <java-symbol type="bool" name="config_deskDockEnablesAccelerometer" />
   <java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
+  <java-symbol type="bool" name="config_enableCarDockHomeLaunch" />
   <java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
   <java-symbol type="bool" name="config_enableLockScreenRotation" />
   <java-symbol type="bool" name="config_enableLockScreenTranslucentDecor" />
   <java-symbol type="bool" name="config_enableTranslucentDecor" />
   <java-symbol type="bool" name="config_lidControlsSleep" />
+  <java-symbol type="bool" name="config_lockDayNightMode" />
+  <java-symbol type="bool" name="config_lockUiMode" />
   <java-symbol type="bool" name="config_reverseDefaultRotation" />
   <java-symbol type="bool" name="config_showNavigationBar" />
   <java-symbol type="bool" name="config_supportAutoRotation" />
@@ -1877,15 +1877,11 @@
   <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" />
-  <java-symbol type="layout" name="notification_template_material_big_media_narrow" />
   <java-symbol type="layout" name="notification_template_material_big_text" />
-  <java-symbol type="layout" name="notification_template_icon_group" />
+  <java-symbol type="layout" name="notification_template_header" />
   <java-symbol type="layout" name="notification_material_media_action" />
   <java-symbol type="color" name="notification_action_color_filter" />
-  <java-symbol type="color" name="notification_icon_bg_color" />
-  <java-symbol type="drawable" name="notification_icon_legacy_bg" />
-  <java-symbol type="color" name="notification_media_primary_color" />
-  <java-symbol type="color" name="notification_media_secondary_color" />
+  <java-symbol type="color" name="notification_icon_default_color" />
   <java-symbol type="color" name="notification_progress_background_color" />
   <java-symbol type="id" name="media_actions" />
 
@@ -2276,6 +2272,7 @@
   <java-symbol type="layout" name="floating_popup_menu_image_button" />
   <java-symbol type="layout" name="floating_popup_overflow_list_item" />
   <java-symbol type="layout" name="floating_popup_overflow_image_list_item" />
+  <java-symbol type="layout" name="floating_popup_overflow_button" />
   <java-symbol type="dimen" name="floating_toolbar_height" />
   <java-symbol type="dimen" name="floating_toolbar_menu_button_side_padding" />
   <java-symbol type="dimen" name="floating_toolbar_overflow_side_padding" />
@@ -2287,6 +2284,10 @@
   <java-symbol type="dimen" name="floating_toolbar_horizontal_margin" />
   <java-symbol type="dimen" name="floating_toolbar_vertical_margin" />
   <java-symbol type="dimen" name="content_rect_bottom_clip_allowance" />
+  <java-symbol type="drawable" name="ft_avd_tooverflow" />
+  <java-symbol type="drawable" name="ft_avd_toarrow" />
+  <java-symbol type="drawable" name="ft_avd_toarrow_animation" />
+  <java-symbol type="drawable" name="ft_avd_tooverflow_animation" />
 
   <java-symbol type="string" name="date_picker_prev_month_button" />
   <java-symbol type="string" name="date_picker_next_month_button" />
@@ -2347,9 +2348,31 @@
 
   <java-symbol type="string" name="config_packagedKeyboardName" />
   <java-symbol type="string" name="default_notification_topic_label" />
+  <java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" />
+  <java-symbol type="color" name="system_bar_background_semi_transparent" />
 
   <!-- EditText suggestion popup. -->
   <java-symbol type="id" name="suggestionContainer" />
   <java-symbol type="id" name="addToDictionaryButton" />
   <java-symbol type="id" name="deleteButton" />
+
+  <java-symbol type="string" name="notification_children_count_bracketed" />
+  <java-symbol type="id" name="app_name_text" />
+  <java-symbol type="id" name="number_of_children" />
+  <java-symbol type="id" name="header_sub_text" />
+  <java-symbol type="id" name="expand_button" />
+  <java-symbol type="id" name="notification_header" />
+  <java-symbol type="id" name="header_content_info" />
+  <java-symbol type="id" name="time_divider" />
+  <java-symbol type="id" name="sub_text_divider" />
+  <java-symbol type="id" name="content_info_divider" />
+  <java-symbol type="id" name="text_line_1" />
+  <java-symbol type="drawable" name="ic_arrow_up_14dp" />
+  <java-symbol type="dimen" name="notification_header_height" />
+  <java-symbol type="dimen" name="notification_big_picture_content_min_height_with_picture" />
+  <java-symbol type="dimen" name="notification_header_shrink_min_width" />
+  <java-symbol type="dimen" name="notification_content_margin_start" />
+  <java-symbol type="dimen" name="notification_content_margin_end" />
+  <java-symbol type="dimen" name="notification_content_picture_margin" />
+  <java-symbol type="dimen" name="notification_content_margin_top" />
 </resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index d56674a..bf7718e 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -428,9 +428,6 @@
         <item name="fastScrollOverlayPosition">floating</item>
         <item name="fastScrollTextColor">@color/primary_text_dark</item>
 
-        <!-- Pointer style -->
-        <item name="pointerStyle">@style/Pointer</item>
-
         <!-- Accessibility focused drawable -->
         <item name="accessibilityFocusedDrawable">@drawable/view_accessibility_focused</item>
 
diff --git a/core/res/res/values/themes_holo.xml b/core/res/res/values/themes_holo.xml
index d9599b3..4cbaacb 100644
--- a/core/res/res/values/themes_holo.xml
+++ b/core/res/res/values/themes_holo.xml
@@ -46,7 +46,7 @@
          with API level 14, the default system theme is supplied by {@link #Theme_DeviceDefault},
          which might apply a different style on different devices. If you want to ensure that your
          app consistently uses the Holo theme at all times, you must explicitly declare it in your
-         manifest. For example, {@code &lt;application android:theme="@android:style/Theme.Holo"&gt;}.
+         manifest. For example, {@code <application android:theme="@android:style/Theme.Holo">}.
          For more information, read <a
          href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">Holo
          Everywhere</a>.</p>
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index a5b8476..b011094 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -33,7 +33,7 @@
     <!-- Material theme (dark version).
          <p>If you want to ensure that your
          app consistently uses the Material theme at all times, you must explicitly declare it in your
-         manifest. For example, {@code &lt;application android:theme="@style/Theme.Material"&gt;}.
+         manifest. For example, {@code <application android:theme="@style/Theme.Material">}.
 
          <p>Styles used by the Material theme are named using the convention Type.Material.Etc
          (for example, {@code Widget.Material.Button} and {@code
diff --git a/core/tests/coretests/apks/install_complete_package_info/Android.mk b/core/tests/coretests/apks/install_complete_package_info/Android.mk
index 1edccb4..19bf356 100644
--- a/core/tests/coretests/apks/install_complete_package_info/Android.mk
+++ b/core/tests/coretests/apks/install_complete_package_info/Android.mk
@@ -5,7 +5,9 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := FrameworkCoreTests_install_complete_package_info
+LOCAL_PACKAGE_NAME := install_complete_package_info
+#LOCAL_MANIFEST_FILE := api_test/AndroidManifest.xml
 
-include $(BUILD_PACKAGE)
+include $(FrameworkCoreTests_BUILD_PACKAGE)
+#include $(BUILD_PACKAGE)
 
diff --git a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml b/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml
index 4c7e968..2897bd5 100644
--- a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml
@@ -17,4 +17,11 @@
         package="com.android.frameworks.coretests.keysets_api">
     <application android:hasCode="false">
     </application>
+    <key-sets>
+        <key-set android:name="A" >
+          <public-key android:name="keyA"
+                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="/>
+        </key-set>
+    </key-sets>
+
 </manifest>
diff --git a/core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml b/core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml
index b7645b0..c56079f8 100644
--- a/core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/permUse/AndroidManifest.xml
@@ -21,11 +21,11 @@
     <key-sets>
         <key-set android:name="A">
           <public-key android:name="keyA"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="/>
+                      android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsMpNthdOxud7roPDZMMomOqXgJJdRfIWpkKEqmC61Mv+Nf6QY3TorEwJeghjSmqj7IbBKrtvfQq4E2XJO1HuspmQO4Ng2gvn+r+6EwNfKc9k55d6s+27SR867jKurBbHNtZMG+tjL1yH4r+tNzcuJCsgyAFqLmxFdcxEwzNvREyRpoYc5RDR0mmTwkMCUhJ6CId1EYEKiCEdNzxv+fWPEb21u+/MWpleGCILs8kglRVb2q/WOzAAvGr4FY5plfaE6N+lr7+UschQ+aMi1+uqewo2o0qPFVmZP5hnwj55K4UMzu/NhhDqQQsX4cSGES1KgHo5MTqRqZjN/I7emw5pFQIDAQAB"/>
         </key-set>
         <key-set android:name="B">
           <public-key android:name="keyB"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ==" />
+                      android:value="MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEtGr5cL2N7ztHiHmphB1/1eq+43lEAmP36iiEJAfX+cVReGSPFXqNnnM8Vptd2boAe332lrFw9rKPmbkZA+jOTA==" />
         </key-set>
         <upgrade-key-set android:name="A"/>
         <upgrade-key-set android:name="B"/>
diff --git a/core/tests/coretests/apks/keyset/uA/AndroidManifest.xml b/core/tests/coretests/apks/keyset/uA/AndroidManifest.xml
index f31b75f..8c440f5 100644
--- a/core/tests/coretests/apks/keyset/uA/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/uA/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <key-sets>
         <key-set android:name="A" >
           <public-key android:name="keyA"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="/>
+                      android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsMpNthdOxud7roPDZMMomOqXgJJdRfIWpkKEqmC61Mv+Nf6QY3TorEwJeghjSmqj7IbBKrtvfQq4E2XJO1HuspmQO4Ng2gvn+r+6EwNfKc9k55d6s+27SR867jKurBbHNtZMG+tjL1yH4r+tNzcuJCsgyAFqLmxFdcxEwzNvREyRpoYc5RDR0mmTwkMCUhJ6CId1EYEKiCEdNzxv+fWPEb21u+/MWpleGCILs8kglRVb2q/WOzAAvGr4FY5plfaE6N+lr7+UschQ+aMi1+uqewo2o0qPFVmZP5hnwj55K4UMzu/NhhDqQQsX4cSGES1KgHo5MTqRqZjN/I7emw5pFQIDAQAB"/>
         </key-set>
         <upgrade-key-set android:name="A"/>
     </key-sets>
diff --git a/core/tests/coretests/apks/keyset/uAB/AndroidManifest.xml b/core/tests/coretests/apks/keyset/uAB/AndroidManifest.xml
index 8ad3471..015c3ad 100644
--- a/core/tests/coretests/apks/keyset/uAB/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/uAB/AndroidManifest.xml
@@ -20,9 +20,9 @@
     <key-sets>
         <key-set android:name="AB" >
           <public-key android:name="keyA"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ==" />
+                      android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsMpNthdOxud7roPDZMMomOqXgJJdRfIWpkKEqmC61Mv+Nf6QY3TorEwJeghjSmqj7IbBKrtvfQq4E2XJO1HuspmQO4Ng2gvn+r+6EwNfKc9k55d6s+27SR867jKurBbHNtZMG+tjL1yH4r+tNzcuJCsgyAFqLmxFdcxEwzNvREyRpoYc5RDR0mmTwkMCUhJ6CId1EYEKiCEdNzxv+fWPEb21u+/MWpleGCILs8kglRVb2q/WOzAAvGr4FY5plfaE6N+lr7+UschQ+aMi1+uqewo2o0qPFVmZP5hnwj55K4UMzu/NhhDqQQsX4cSGES1KgHo5MTqRqZjN/I7emw5pFQIDAQAB" />
           <public-key android:name="keyB"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ==" />
+                      android:value="MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEtGr5cL2N7ztHiHmphB1/1eq+43lEAmP36iiEJAfX+cVReGSPFXqNnnM8Vptd2boAe332lrFw9rKPmbkZA+jOTA==" />
         </key-set>
         <upgrade-key-set android:name="AB"/>
     </key-sets>
diff --git a/core/tests/coretests/apks/keyset/uAuB/AndroidManifest.xml b/core/tests/coretests/apks/keyset/uAuB/AndroidManifest.xml
index cdbd639..9491dbea 100644
--- a/core/tests/coretests/apks/keyset/uAuB/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/uAuB/AndroidManifest.xml
@@ -20,11 +20,11 @@
     <key-sets>
         <key-set android:name="A" >
           <public-key android:name="keyA"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ==" />
+                      android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsMpNthdOxud7roPDZMMomOqXgJJdRfIWpkKEqmC61Mv+Nf6QY3TorEwJeghjSmqj7IbBKrtvfQq4E2XJO1HuspmQO4Ng2gvn+r+6EwNfKc9k55d6s+27SR867jKurBbHNtZMG+tjL1yH4r+tNzcuJCsgyAFqLmxFdcxEwzNvREyRpoYc5RDR0mmTwkMCUhJ6CId1EYEKiCEdNzxv+fWPEb21u+/MWpleGCILs8kglRVb2q/WOzAAvGr4FY5plfaE6N+lr7+UschQ+aMi1+uqewo2o0qPFVmZP5hnwj55K4UMzu/NhhDqQQsX4cSGES1KgHo5MTqRqZjN/I7emw5pFQIDAQAB" />
         </key-set>
         <key-set android:name="B" >
           <public-key android:name="keyB"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ==" />
+                      android:value="MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEtGr5cL2N7ztHiHmphB1/1eq+43lEAmP36iiEJAfX+cVReGSPFXqNnnM8Vptd2boAe332lrFw9rKPmbkZA+jOTA==" />
         </key-set>
         <upgrade-key-set android:name="A"/>
         <upgrade-key-set android:name="B"/>
diff --git a/core/tests/coretests/apks/keyset/uB/AndroidManifest.xml b/core/tests/coretests/apks/keyset/uB/AndroidManifest.xml
index 61063c3..f491840 100644
--- a/core/tests/coretests/apks/keyset/uB/AndroidManifest.xml
+++ b/core/tests/coretests/apks/keyset/uB/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <key-sets>
         <key-set android:name="B" >
           <public-key android:name="keyB"
-                      android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMTfQsY8UuXiXmvw/y7Tpr7HoyfAC0nE/8Qdk3ZtEr9asa5qqP0F6xzCI1PGVFV+WLVRwm6FdB9StENL5EKyQFcCAwEAAQ==" />
+                      android:value="MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEtGr5cL2N7ztHiHmphB1/1eq+43lEAmP36iiEJAfX+cVReGSPFXqNnnM8Vptd2boAe332lrFw9rKPmbkZA+jOTA==" />
         </key-set>
         <upgrade-key-set android:name="B"/>
     </key-sets>
diff --git a/core/tests/coretests/certs/keyset_A.pk8 b/core/tests/coretests/certs/keyset_A.pk8
index 3976b94..4076313 100644
--- a/core/tests/coretests/certs/keyset_A.pk8
+++ b/core/tests/coretests/certs/keyset_A.pk8
Binary files differ
diff --git a/core/tests/coretests/certs/keyset_A.x509.pem b/core/tests/coretests/certs/keyset_A.x509.pem
index 0fe334e..548bf13 100644
--- a/core/tests/coretests/certs/keyset_A.x509.pem
+++ b/core/tests/coretests/certs/keyset_A.x509.pem
@@ -1,14 +1,18 @@
 -----BEGIN CERTIFICATE-----
-MIICKjCCAdQCCQCpDXPnNpO5UjANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMC
-VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcx
-DzANBgNVBAoTBkdvb2dsZTEQMA4GA1UECxMHQW5kcm9pZDEYMBYGA1UEAxMPd3d3
-LmV4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNkY2FzaG1hbkBnb29nbGUuY29t
-MB4XDTE0MDQyMTE4MTkwM1oXDTE3MDQyMDE4MTkwM1owgZsxCzAJBgNVBAYTAlVT
-MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MQ8w
-DQYDVQQKEwZHb29nbGUxEDAOBgNVBAsTB0FuZHJvaWQxGDAWBgNVBAMTD3d3dy5l
-eGFtcGxlLmNvbTEiMCAGCSqGSIb3DQEJARYTZGNhc2htYW5AZ29vZ2xlLmNvbTBc
-MA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCaDdTbIKn9FeAv22zfMKPDtl/0uQ++vuTG
-/ZpSLB5FE1E2xwjZPi8RyFGC5vPWGz/cyJq1dG1By1AGVMqDFAojAgMBAAEwDQYJ
-KoZIhvcNAQEFBQADQQCPTVDKxVZpxFH6Nm7sxpRplLzxbs/xyGELLIjEBVrgB0CM
-HAxFpPRHDSFpTxGG2mBCSrf+lD2Bf+WiIojx+RLY
+MIIC+TCCAeGgAwIBAgIJALuyfpZeCDiwMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
+BAMMCGtleXNldF9BMB4XDTE1MTIwMjIxMTEzNFoXDTQzMDQxOTIxMTEzNFowEzER
+MA8GA1UEAwwIa2V5c2V0X0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQCwyk22F07G53uug8NkwyiY6peAkl1F8hamQoSqYLrUy/41/pBjdOisTAl6CGNK
+aqPshsEqu299CrgTZck7Ue6ymZA7g2DaC+f6v7oTA18pz2Tnl3qz7btJHzruMq6s
+Fsc21kwb62MvXIfiv603Ny4kKyDIAWoubEV1zETDM29ETJGmhhzlENHSaZPCQwJS
+EnoIh3URgQqIIR03PG/59Y8RvbW778xamV4YIguzySCVFVvar9Y7MAC8avgVjmmV
+9oTo36Wvv5SxyFD5oyLX66p7CjajSo8VWZk/mGfCPnkrhQzO782GEOpBCxfhxIYR
+LUqAejkxOpGpmM38jt6bDmkVAgMBAAGjUDBOMB0GA1UdDgQWBBTVcIVD9u9538W/
+NE2Y36YiPtYmPzAfBgNVHSMEGDAWgBTVcIVD9u9538W/NE2Y36YiPtYmPzAMBgNV
+HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCjTN3mgaKep55wR1ULf4ULIc/m
+mjfZK7ZnJcynBEIGyjAqt4mMIfKRV/DllLsf997r7bz12qUSLbhWGFSq4a2ceOIp
+RG0+CGXV8Ez5Hz4o99MAP37Zdd5Lfq8fdlg2Mro2MMr21Tf3i2Y2LOfkXEZrW7rQ
+A5ZRVksoRcPQWaaNA85LGRSCiC2XSjg8TLn1qKwQUXVGQ6fwLKqAeeV2+hynADih
+FUaf7HxE5H3bHLByLmLKtab3Ta/g8VXxxRYuyd/rYsWMAHsjZge6xoVajm6Wvj5Q
+AvIxV99+PK7dkjVpg3O2oN1O4DQlqqvxdhjNP733DI4cihfJYV9Vn+wKj3TA
 -----END CERTIFICATE-----
diff --git a/core/tests/coretests/certs/keyset_B.pk8 b/core/tests/coretests/certs/keyset_B.pk8
index a44ebb3..839d96c 100644
--- a/core/tests/coretests/certs/keyset_B.pk8
+++ b/core/tests/coretests/certs/keyset_B.pk8
Binary files differ
diff --git a/core/tests/coretests/certs/keyset_B.x509.pem b/core/tests/coretests/certs/keyset_B.x509.pem
index 2806de5..537e047 100644
--- a/core/tests/coretests/certs/keyset_B.x509.pem
+++ b/core/tests/coretests/certs/keyset_B.x509.pem
@@ -1,14 +1,10 @@
 -----BEGIN CERTIFICATE-----
-MIICKjCCAdQCCQC+5GnAgmYS6DANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMC
-VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcx
-DzANBgNVBAoTBkdvb2dsZTEQMA4GA1UECxMHQW5kcm9pZDEYMBYGA1UEAxMPd3d3
-LmV4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNkY2FzaG1hbkBnb29nbGUuY29t
-MB4XDTE0MDQyMTE4MjczM1oXDTE3MDQyMDE4MjczM1owgZsxCzAJBgNVBAYTAlVT
-MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MQ8w
-DQYDVQQKEwZHb29nbGUxEDAOBgNVBAsTB0FuZHJvaWQxGDAWBgNVBAMTD3d3dy5l
-eGFtcGxlLmNvbTEiMCAGCSqGSIb3DQEJARYTZGNhc2htYW5AZ29vZ2xlLmNvbTBc
-MA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDE30LGPFLl4l5r8P8u06a+x6MnwAtJxP/E
-HZN2bRK/WrGuaqj9BescwiNTxlRVfli1UcJuhXQfUrRDS+RCskBXAgMBAAEwDQYJ
-KoZIhvcNAQEFBQADQQCYYyur2/sMB88MOhQE8RHNmdO0zEQYAz66z3ctTNqiNsbK
-T9iKj0CT3cjqgfN5ex4onhnoIIPtON7DIHFWke5x
+MIIBbDCCAROgAwIBAgIJALP/7jQfVyFBMAoGCCqGSM49BAMCMBMxETAPBgNVBAMM
+CGtleXNldF9CMB4XDTE1MTIwMzIwNDgwNFoXDTQzMDQyMDIwNDgwNFowEzERMA8G
+A1UEAwwIa2V5c2V0X0IwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS0avlwvY3v
+O0eIeamEHX/V6r7jeUQCY/fqKIQkB9f5xVF4ZI8Veo2eczxWm13ZugB7ffaWsXD2
+so+ZuRkD6M5Mo1AwTjAdBgNVHQ4EFgQUHrv1BwZU/MchAsa3VL0n458IwVswHwYD
+VR0jBBgwFoAUHrv1BwZU/MchAsa3VL0n458IwVswDAYDVR0TBAUwAwEB/zAKBggq
+hkjOPQQDAgNHADBEAiBp2nTHHhywNIyLpe8mYUsbwozVWM5/2xFidQe9Edua0AIg
+Wt9BCfzrcsBh2Rlje9Im9sq6hIyLSS1pe6ZcI3+lDis=
 -----END CERTIFICATE-----
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 9498f4c..b5f0617 100644
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -73,7 +73,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-@Suppress  // Failing.
 public class PackageManagerTests extends AndroidTestCase {
     private static final boolean localLOGV = true;
 
@@ -434,14 +433,6 @@
                             SECURE_CONTAINERS_PREFIX, publicSrcPath);
                     assertStartsWith("The native library path should point to the ASEC",
                             SECURE_CONTAINERS_PREFIX, info.nativeLibraryDir);
-                    try {
-                        String compatLib = new File(info.dataDir + "/lib").getCanonicalPath();
-                        assertEquals("The compatibility lib directory should be a symbolic link to "
-                                + info.nativeLibraryDir,
-                                info.nativeLibraryDir, compatLib);
-                    } catch (IOException e) {
-                        fail("compat check: Can't read " + info.dataDir + "/lib");
-                    }
                 } else {
                     assertFalse(
                             (info.privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0);
@@ -1014,7 +1005,8 @@
 
     private static void assertUninstalled(ApplicationInfo info) throws Exception {
         File nativeLibraryFile = new File(info.nativeLibraryDir);
-        assertFalse("Native library directory should be erased", nativeLibraryFile.exists());
+        assertFalse("Native library directory " + info.nativeLibraryDir
+                + " should be erased", nativeLibraryFile.exists());
     }
 
     public void deleteFromRawResource(int iFlags, int dFlags) throws Exception {
@@ -1650,15 +1642,10 @@
                             (info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
                     assertStartsWith("Native library dir should point to ASEC",
                             SECURE_CONTAINERS_PREFIX, info.nativeLibraryDir);
-                    final File nativeLibSymLink = new File(info.dataDir, "lib");
-                    assertStartsWith("The data directory should have a 'lib' symlink that points to the ASEC container",
-                            SECURE_CONTAINERS_PREFIX, nativeLibSymLink.getCanonicalPath());
                 }
             }
         } catch (NameNotFoundException e) {
             failStr("Pkg hasnt been installed correctly");
-        } catch (Exception e) {
-            failStr("Failed with exception : " + e);
         } finally {
             if (ip != null) {
                 cleanUpInstall(ip);
@@ -1689,6 +1676,7 @@
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
 
+    @Suppress
     @LargeTest
     public void testMoveAppInternalToInternal() throws Exception {
         int installFlags = PackageManager.INSTALL_INTERNAL;
@@ -2157,6 +2145,7 @@
                 -1);
     }
 
+    @Suppress
     @LargeTest
     public void testFlagFExistingI() throws Exception {
         int iFlags = PackageManager.INSTALL_INTERNAL;
@@ -3272,14 +3261,15 @@
             assertTrue(false); // should have thrown
         } catch (IllegalArgumentException e) {
         }
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
+        final InstallParams ip = installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
         try {
             ks = pm.getSigningKeySet(otherPkgName);
             assertTrue(false); // should have thrown
         } catch (SecurityException e) {
+        } finally {
+            cleanUpInstall(ip);
         }
-        cleanUpInstall(otherPkgName);
         ks = pm.getSigningKeySet(mContext.getPackageName());
         assertNotNull(ks);
     }
@@ -3318,16 +3308,20 @@
             assertTrue(false); // should have thrown
         } catch(IllegalArgumentException e) {
         }
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
+
+        // make sure we can get a KeySet from our pkg
+        ks = pm.getKeySetByAlias(mPkgName, "A");
+        assertNotNull(ks);
+
+        // and another
+        final InstallParams ip = installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
         try {
             ks = pm.getKeySetByAlias(otherPkgName, "A");
-            assertTrue(false); // should have thrown
-        } catch (SecurityException e) {
+            assertNotNull(ks);
+        } finally {
+            cleanUpInstall(ip);
         }
-        cleanUpInstall(otherPkgName);
-        ks = pm.getKeySetByAlias(mPkgName, "A");
-        assertNotNull(ks);
     }
 
     public void testIsSignedBy() throws Exception {
@@ -3360,17 +3354,23 @@
         assertFalse(pm.isSignedBy(mPkgName, new KeySet(new Binder())));
         assertTrue(pm.isSignedBy(mPkgName, mSigningKS));
 
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
+        final InstallParams ip1 = installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        assertFalse(pm.isSignedBy(otherPkgName, mDefinedKS));
-        assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
-        cleanUpInstall(otherPkgName);
+        try {
+            assertFalse(pm.isSignedBy(otherPkgName, mDefinedKS));
+            assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
+        } finally {
+            cleanUpInstall(ip1);
+        }
 
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
+        final InstallParams ip2 = installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        assertTrue(pm.isSignedBy(otherPkgName, mDefinedKS));
-        assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
-        cleanUpInstall(otherPkgName);
+        try {
+            assertTrue(pm.isSignedBy(otherPkgName, mDefinedKS));
+            assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
+        } finally {
+            cleanUpInstall(ip2);
+        }
     }
 
     public void testIsSignedByExactly() throws Exception {
@@ -3402,17 +3402,23 @@
         assertFalse(pm.isSignedByExactly(mPkgName, new KeySet(new Binder())));
         assertTrue(pm.isSignedByExactly(mPkgName, mSigningKS));
 
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
+        final InstallParams ip1 = installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
-        assertTrue(pm.isSignedByExactly(otherPkgName, mSigningKS));
-        cleanUpInstall(otherPkgName);
+        try {
+            assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
+            assertTrue(pm.isSignedByExactly(otherPkgName, mSigningKS));
+        } finally {
+            cleanUpInstall(ip1);
+        }
 
-        installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
+        final InstallParams ip2 = installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
                 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
-        assertFalse(pm.isSignedByExactly(otherPkgName, mSigningKS));
-        cleanUpInstall(otherPkgName);
+        try {
+            assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
+            assertFalse(pm.isSignedByExactly(otherPkgName, mSigningKS));
+        } finally {
+            cleanUpInstall(ip2);
+        }
     }
 
 
@@ -3465,11 +3471,10 @@
         int apk2 = APP2_CERT1_CERT2;
         String apk1Name = "install1.apk";
         String apk2Name = "install2.apk";
-        InstallParams ip1 = null;
 
+        final InstallParams ip = installFromRawResource(apk1Name, apk1, 0, false,
+                false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
         try {
-            ip1 = installFromRawResource(apk1Name, apk1, 0, false,
-                    false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
             PackageManager pm = mContext.getPackageManager();
             // Delete app2
             File filesDir = mContext.getFilesDir();
@@ -3480,12 +3485,10 @@
             getPm().deletePackage(pkg.packageName, null, PackageManager.DELETE_ALL_USERS);
             // Check signatures now
             int match = mContext.getPackageManager().checkSignatures(
-                    ip1.pkg.packageName, pkg.packageName);
+                    ip.pkg.packageName, pkg.packageName);
             assertEquals(PackageManager.SIGNATURE_UNKNOWN_PACKAGE, match);
         } finally {
-            if (ip1 != null) {
-                cleanUpInstall(ip1);
-            }
+            cleanUpInstall(ip);
         }
     }
 
@@ -3493,14 +3496,10 @@
     public void testInstallNoCertificates() throws Exception {
         int apk1 = APP1_UNSIGNED;
         String apk1Name = "install1.apk";
-        InstallParams ip1 = null;
 
-        try {
-            installFromRawResource(apk1Name, apk1, 0, false,
-                    true, PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES,
-                    PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        } finally {
-        }
+        installFromRawResource(apk1Name, apk1, 0, false,
+                true, PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES,
+                PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
 
     /*
@@ -3766,35 +3765,43 @@
      * Test that getInstalledPackages returns all the data specified in flags.
      */
     public void testGetInstalledPackagesAll() throws Exception {
-        int flags = PackageManager.GET_ACTIVITIES | PackageManager.GET_GIDS
+        final int flags = PackageManager.GET_ACTIVITIES | PackageManager.GET_GIDS
                 | PackageManager.GET_CONFIGURATIONS | PackageManager.GET_INSTRUMENTATION
                 | PackageManager.GET_PERMISSIONS | PackageManager.GET_PROVIDERS
                 | PackageManager.GET_RECEIVERS | PackageManager.GET_SERVICES
                 | PackageManager.GET_SIGNATURES | PackageManager.GET_UNINSTALLED_PACKAGES;
 
-        List<PackageInfo> packages = getPm().getInstalledPackages(flags);
-        assertNotNull("installed packages cannot be null", packages);
-        assertTrue("installed packages cannot be empty", packages.size() > 0);
+        final InstallParams ip =
+                installFromRawResource("install.apk", R.raw.install_complete_package_info,
+                        0 /*flags*/, false /*cleanUp*/, false /*fail*/, -1 /*result*/,
+                        PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
+        try {
+            final List<PackageInfo> packages = getPm().getInstalledPackages(flags);
+            assertNotNull("installed packages cannot be null", packages);
+            assertTrue("installed packages cannot be empty", packages.size() > 0);
 
-        PackageInfo packageInfo = null;
+            PackageInfo packageInfo = null;
 
-        // Find the package with all components specified in the AndroidManifest
-        // to ensure no null values
-        for (PackageInfo pi : packages) {
-            if ("com.android.frameworks.coretests.install_complete_package_info"
-                    .equals(pi.packageName)) {
-                packageInfo = pi;
-                break;
+            // Find the package with all components specified in the AndroidManifest
+            // to ensure no null values
+            for (PackageInfo pi : packages) {
+                if ("com.android.frameworks.coretests.install_complete_package_info"
+                        .equals(pi.packageName)) {
+                    packageInfo = pi;
+                    break;
+                }
             }
+            assertNotNull("activities should not be null", packageInfo.activities);
+            assertNotNull("configPreferences should not be null", packageInfo.configPreferences);
+            assertNotNull("instrumentation should not be null", packageInfo.instrumentation);
+            assertNotNull("permissions should not be null", packageInfo.permissions);
+            assertNotNull("providers should not be null", packageInfo.providers);
+            assertNotNull("receivers should not be null", packageInfo.receivers);
+            assertNotNull("services should not be null", packageInfo.services);
+            assertNotNull("signatures should not be null", packageInfo.signatures);
+        } finally {
+            cleanUpInstall(ip);
         }
-        assertNotNull("activities should not be null", packageInfo.activities);
-        assertNotNull("configPreferences should not be null", packageInfo.configPreferences);
-        assertNotNull("instrumentation should not be null", packageInfo.instrumentation);
-        assertNotNull("permissions should not be null", packageInfo.permissions);
-        assertNotNull("providers should not be null", packageInfo.providers);
-        assertNotNull("receivers should not be null", packageInfo.receivers);
-        assertNotNull("services should not be null", packageInfo.services);
-        assertNotNull("signatures should not be null", packageInfo.signatures);
     }
 
     /**
@@ -3802,38 +3809,52 @@
      * flags when the GET_UNINSTALLED_PACKAGES flag is set.
      */
     public void testGetUnInstalledPackagesAll() throws Exception {
-        int flags = PackageManager.GET_UNINSTALLED_PACKAGES
+        final int flags = PackageManager.GET_UNINSTALLED_PACKAGES
                 | PackageManager.GET_ACTIVITIES | PackageManager.GET_GIDS
                 | PackageManager.GET_CONFIGURATIONS | PackageManager.GET_INSTRUMENTATION
                 | PackageManager.GET_PERMISSIONS | PackageManager.GET_PROVIDERS
                 | PackageManager.GET_RECEIVERS | PackageManager.GET_SERVICES
                 | PackageManager.GET_SIGNATURES | PackageManager.GET_UNINSTALLED_PACKAGES;
 
-        List<PackageInfo> packages = getPm().getInstalledPackages(flags);
-        assertNotNull("installed packages cannot be null", packages);
-        assertTrue("installed packages cannot be empty", packages.size() > 0);
+        // first, install the package
+        final InstallParams ip =
+                installFromRawResource("install.apk", R.raw.install_complete_package_info,
+                        0 /*flags*/, false /*cleanUp*/, false /*fail*/, -1 /*result*/,
+                        PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
+        try {
+            // then, remove it, keeping it's data around
+            final GenericReceiver receiver = new DeleteReceiver(ip.pkg.packageName);
+            invokeDeletePackage(ip.pkg.packageName, PackageManager.DELETE_KEEP_DATA, receiver);
 
-        PackageInfo packageInfo = null;
+            final List<PackageInfo> packages = getPm().getInstalledPackages(flags);
+            assertNotNull("installed packages cannot be null", packages);
+            assertTrue("installed packages cannot be empty", packages.size() > 0);
 
-        // Find the package with all components specified in the AndroidManifest
-        // to ensure no null values
-        for (PackageInfo pi : packages) {
-            if ("com.android.frameworks.coretests.install_complete_package_info"
-                    .equals(pi.packageName)) {
-                packageInfo = pi;
-                break;
+            PackageInfo packageInfo = null;
+
+            // Find the package with all components specified in the AndroidManifest
+            // to ensure no null values
+            for (PackageInfo pi : packages) {
+                if ("com.android.frameworks.coretests.install_complete_package_info"
+                        .equals(pi.packageName)) {
+                    packageInfo = pi;
+                    break;
+                }
             }
+            assertNotNull("activities should not be null", packageInfo.activities);
+            assertNotNull("configPreferences should not be null", packageInfo.configPreferences);
+            assertNotNull("instrumentation should not be null", packageInfo.instrumentation);
+            assertNotNull("permissions should not be null", packageInfo.permissions);
+            assertNotNull("providers should not be null", packageInfo.providers);
+            assertNotNull("receivers should not be null", packageInfo.receivers);
+            assertNotNull("services should not be null", packageInfo.services);
+            assertNotNull("signatures should not be null", packageInfo.signatures);
+        } finally {
+            cleanUpInstall(ip);
         }
-        assertNotNull("activities should not be null", packageInfo.activities);
-        assertNotNull("configPreferences should not be null", packageInfo.configPreferences);
-        assertNotNull("instrumentation should not be null", packageInfo.instrumentation);
-        assertNotNull("permissions should not be null", packageInfo.permissions);
-        assertNotNull("providers should not be null", packageInfo.providers);
-        assertNotNull("receivers should not be null", packageInfo.receivers);
-        assertNotNull("services should not be null", packageInfo.services);
-        assertNotNull("signatures should not be null", packageInfo.signatures);
     }
 
+    @Suppress
     public void testInstall_BadDex_CleanUp() throws Exception {
         int retCode = PackageManager.INSTALL_FAILED_DEXOPT;
         installFromRawResource("install.apk", R.raw.install_bad_dex, 0, true, true, retCode,
diff --git a/core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java b/core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java
index c5e2ae6..ddbdc87 100644
--- a/core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java
@@ -16,7 +16,11 @@
 
 package android.widget;
 
+import static android.widget.espresso.TextViewActions.mouseDoubleClickOnTextAtIndex;
+import static android.widget.espresso.TextViewActions.mouseLongClickOnTextAtIndex;
+import static android.widget.espresso.TextViewActions.mouseDoubleClickAndDragOnText;
 import static android.widget.espresso.TextViewActions.mouseDragOnText;
+import static android.widget.espresso.TextViewActions.mouseLongClickAndDragOnText;
 import static android.widget.espresso.TextViewAssertions.hasSelection;
 import static android.support.test.espresso.Espresso.onView;
 import static android.support.test.espresso.action.ViewActions.click;
@@ -62,4 +66,104 @@
 
         onView(withId(R.id.textview)).check(hasSelection("llo wor"));
     }
+
+    @SmallTest
+    public void testSelectTextByLongClick() throws Exception {
+        getActivity();
+
+        final String helloWorld = "Hello world!";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(helloWorld));
+
+        onView(withId(R.id.textview)).perform(mouseLongClickOnTextAtIndex(0));
+        onView(withId(R.id.textview)).check(hasSelection("Hello"));
+
+        onView(withId(R.id.textview)).perform(mouseLongClickOnTextAtIndex(
+                helloWorld.indexOf("world")));
+        onView(withId(R.id.textview)).check(hasSelection("world"));
+
+        onView(withId(R.id.textview)).perform(mouseLongClickOnTextAtIndex(
+                helloWorld.indexOf("llo")));
+        onView(withId(R.id.textview)).check(hasSelection("Hello"));
+
+        onView(withId(R.id.textview)).perform(mouseLongClickOnTextAtIndex(
+                helloWorld.indexOf("rld")));
+        onView(withId(R.id.textview)).check(hasSelection("world"));
+    }
+
+    @SmallTest
+    public void testSelectTextByDoubleClick() throws Exception {
+        getActivity();
+
+        final String helloWorld = "Hello world!";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(helloWorld));
+
+        onView(withId(R.id.textview)).perform(mouseDoubleClickOnTextAtIndex(0));
+        onView(withId(R.id.textview)).check(hasSelection("Hello"));
+
+        onView(withId(R.id.textview)).perform(mouseDoubleClickOnTextAtIndex(
+                helloWorld.indexOf("world")));
+        onView(withId(R.id.textview)).check(hasSelection("world"));
+
+        onView(withId(R.id.textview)).perform(mouseDoubleClickOnTextAtIndex(
+                helloWorld.indexOf("llo")));
+        onView(withId(R.id.textview)).check(hasSelection("Hello"));
+
+        onView(withId(R.id.textview)).perform(mouseDoubleClickOnTextAtIndex(
+                helloWorld.indexOf("rld")));
+        onView(withId(R.id.textview)).check(hasSelection("world"));
+    }
+
+    @SmallTest
+    public void testSelectTextByDoubleClickAndDrag() throws Exception {
+        getActivity();
+
+        final String text = "abcd efg hijk lmn";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+        onView(withId(R.id.textview)).perform(
+                mouseDoubleClickAndDragOnText(text.indexOf("f"), text.indexOf("j")));
+        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
+    }
+
+    @SmallTest
+    public void testSelectTextByDoubleClickAndDrag_reverse() throws Exception {
+        getActivity();
+
+        final String text = "abcd efg hijk lmn";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+        onView(withId(R.id.textview)).perform(
+                mouseDoubleClickAndDragOnText(text.indexOf("j"), text.indexOf("f")));
+        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
+    }
+
+    @SmallTest
+    public void testSelectTextByLongPressAndDrag() throws Exception {
+        getActivity();
+
+        final String text = "abcd efg hijk lmn";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+        onView(withId(R.id.textview)).perform(
+                mouseLongClickAndDragOnText(text.indexOf("f"), text.indexOf("j")));
+        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
+    }
+
+    @SmallTest
+    public void testSelectTextByLongPressAndDrag_reverse() throws Exception {
+        getActivity();
+
+        final String text = "abcd efg hijk lmn";
+        onView(withId(R.id.textview)).perform(click());
+        onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+        onView(withId(R.id.textview)).perform(
+                mouseLongClickAndDragOnText(text.indexOf("j"), text.indexOf("f")));
+        onView(withId(R.id.textview)).check(hasSelection("efg hijk"));
+    }
 }
diff --git a/core/tests/coretests/src/android/widget/TextViewActivityTest.java b/core/tests/coretests/src/android/widget/TextViewActivityTest.java
index 78a0a59..4614505 100644
--- a/core/tests/coretests/src/android/widget/TextViewActivityTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewActivityTest.java
@@ -34,12 +34,15 @@
 import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
 import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
 import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
 import static android.support.test.espresso.matcher.ViewMatchers.withId;
 import static android.support.test.espresso.matcher.ViewMatchers.withText;
 import static org.hamcrest.Matchers.allOf;
 
 import com.android.frameworks.coretests.R;
 
+import android.support.test.espresso.NoMatchingRootException;
+import android.support.test.espresso.NoMatchingViewException;
 import android.support.test.espresso.ViewInteraction;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.suitebuilder.annotation.SmallTest;
@@ -165,18 +168,21 @@
         assertFloatingToolbarIsDisplayed(getActivity());
     }
 
-    private static ViewInteraction onHandleView(int id) {
-        return onView(allOf(withId(id), isAssignableFrom(Editor.HandleView.class)))
-                .inRoot(withDecorView(hasDescendant(withId(id))));
-    }
-
     @SmallTest
     public void testSelectionHandles() throws Exception {
         final String text = "abcd efg hijk lmn";
         onView(withId(R.id.textview)).perform(click());
         onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+        assertNoSelectionHandles();
+
         onView(withId(R.id.textview)).perform(doubleClickOnTextAtIndex(text.indexOf('f')));
 
+        onHandleView(com.android.internal.R.id.selection_start_handle)
+                .check(matches(isDisplayed()));
+        onHandleView(com.android.internal.R.id.selection_end_handle)
+                .check(matches(isDisplayed()));
+
         final TextView textView = (TextView)getActivity().findViewById(R.id.textview);
         onHandleView(com.android.internal.R.id.selection_start_handle)
                 .perform(dragHandle(textView, Handle.SELECTION_START, text.indexOf('a')));
@@ -336,4 +342,25 @@
                 .perform(dragHandle(textView, Handle.SELECTION_END, text.indexOf('i')));
         onView(withId(R.id.textview)).check(hasSelection("hijk"));
     }
+
+    private static void assertNoSelectionHandles() {
+        try {
+            onHandleView(com.android.internal.R.id.selection_start_handle)
+                    .check(matches(isDisplayed()));
+        } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e) {
+            try {
+                onHandleView(com.android.internal.R.id.selection_end_handle)
+                        .check(matches(isDisplayed()));
+            } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e1) {
+                return;
+            }
+        }
+        throw new AssertionError("Selection handle found");
+    }
+
+    private static ViewInteraction onHandleView(int id)
+            throws NoMatchingRootException, NoMatchingViewException, AssertionError {
+        return onView(allOf(withId(id), isAssignableFrom(Editor.HandleView.class)))
+                .inRoot(withDecorView(hasDescendant(withId(id))));
+    }
 }
diff --git a/core/tests/coretests/src/android/widget/espresso/DragAction.java b/core/tests/coretests/src/android/widget/espresso/DragAction.java
index 1132ce0..ce97568 100644
--- a/core/tests/coretests/src/android/widget/espresso/DragAction.java
+++ b/core/tests/coretests/src/android/widget/espresso/DragAction.java
@@ -91,6 +91,72 @@
         },
 
         /**
+         * Starts a drag with a mouse double click.
+         */
+        MOUSE_DOUBLE_CLICK {
+            private DownMotionPerformer downMotion = new DownMotionPerformer() {
+                @Override
+                @Nullable
+                public MotionEvent perform(
+                        UiController uiController,  float[] coordinates, float[] precision) {
+                    return performDoubleTap(uiController, coordinates, precision);
+                }
+            };
+
+            @Override
+            public Status sendSwipe(
+                    UiController uiController,
+                    float[] startCoordinates, float[] endCoordinates, float[] precision) {
+                return sendLinearDrag(
+                        uiController, downMotion, startCoordinates, endCoordinates, precision);
+            }
+
+            @Override
+            public String toString() {
+                return "mouse double click and drag to select";
+            }
+
+            @Override
+            public UiController wrapUiController(UiController uiController) {
+                return new MouseUiController(uiController);
+            }
+        },
+
+        /**
+         * Starts a drag with a mouse long click.
+         */
+        MOUSE_LONG_CLICK {
+            private DownMotionPerformer downMotion = new DownMotionPerformer() {
+                @Override
+                public MotionEvent perform(
+                        UiController uiController, float[] coordinates, float[] precision) {
+                    MotionEvent downEvent = MotionEvents.sendDown(
+                            uiController, coordinates, precision)
+                            .down;
+                    return performLongPress(uiController, coordinates, precision);
+                }
+            };
+
+            @Override
+            public Status sendSwipe(
+                    UiController uiController,
+                    float[] startCoordinates, float[] endCoordinates, float[] precision) {
+                return sendLinearDrag(
+                        uiController, downMotion, startCoordinates, endCoordinates, precision);
+            }
+
+            @Override
+            public String toString() {
+                return "mouse long click and drag to select";
+            }
+
+            @Override
+            public UiController wrapUiController(UiController uiController) {
+                return new MouseUiController(uiController);
+            }
+        },
+
+        /**
          * Starts a drag with a tap.
          */
         TAP {
@@ -127,15 +193,7 @@
                 @Override
                 public MotionEvent perform(
                         UiController uiController, float[] coordinates, float[] precision) {
-                    MotionEvent downEvent = MotionEvents.sendDown(
-                            uiController, coordinates, precision)
-                            .down;
-                    // Duration before a press turns into a long press.
-                    // Factor 1.5 is needed, otherwise a long press is not safely detected.
-                    // See android.test.TouchUtils longClickView
-                    long longPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f);
-                    uiController.loopMainThreadForAtLeast(longPressTimeout);
-                    return downEvent;
+                    return performLongPress(uiController, coordinates, precision);
                 }
             };
 
@@ -162,25 +220,7 @@
                 @Nullable
                 public MotionEvent perform(
                         UiController uiController,  float[] coordinates, float[] precision) {
-                    MotionEvent downEvent = MotionEvents.sendDown(
-                            uiController, coordinates, precision)
-                            .down;
-                    try {
-                        if (!MotionEvents.sendUp(uiController, downEvent)) {
-                            String logMessage = "Injection of up event as part of the double tap " +
-                                    "failed. Sending cancel event.";
-                            Log.d(TAG, logMessage);
-                            MotionEvents.sendCancel(uiController, downEvent);
-                            return null;
-                        }
-
-                        long doubleTapMinimumTimeout = ViewConfiguration.getDoubleTapMinTime();
-                        uiController.loopMainThreadForAtLeast(doubleTapMinimumTimeout);
-
-                        return MotionEvents.sendDown(uiController, coordinates, precision).down;
-                    } finally {
-                        downEvent.recycle();
-                    }
+                    return performDoubleTap(uiController, coordinates, precision);
                 }
             };
 
@@ -267,6 +307,43 @@
             return res;
         }
 
+        private static MotionEvent performLongPress(
+                UiController uiController, float[] coordinates, float[] precision) {
+            MotionEvent downEvent = MotionEvents.sendDown(
+                    uiController, coordinates, precision)
+                    .down;
+            // Duration before a press turns into a long press.
+            // Factor 1.5 is needed, otherwise a long press is not safely detected.
+            // See android.test.TouchUtils longClickView
+            long longPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f);
+            uiController.loopMainThreadForAtLeast(longPressTimeout);
+            return downEvent;
+        }
+
+        @Nullable
+        private static MotionEvent performDoubleTap(
+                UiController uiController,  float[] coordinates, float[] precision) {
+            MotionEvent downEvent = MotionEvents.sendDown(
+                    uiController, coordinates, precision)
+                    .down;
+            try {
+                if (!MotionEvents.sendUp(uiController, downEvent)) {
+                    String logMessage = "Injection of up event as part of the double tap " +
+                            "failed. Sending cancel event.";
+                    Log.d(TAG, logMessage);
+                    MotionEvents.sendCancel(uiController, downEvent);
+                    return null;
+                }
+
+                long doubleTapMinimumTimeout = ViewConfiguration.getDoubleTapMinTime();
+                uiController.loopMainThreadForAtLeast(doubleTapMinimumTimeout);
+
+                return MotionEvents.sendDown(uiController, coordinates, precision).down;
+            } finally {
+                downEvent.recycle();
+            }
+        }
+
         @Override
         public UiController wrapUiController(UiController uiController) {
             return uiController;
diff --git a/core/tests/coretests/src/android/widget/espresso/MouseClickAction.java b/core/tests/coretests/src/android/widget/espresso/MouseClickAction.java
new file mode 100644
index 0000000..de640ca
--- /dev/null
+++ b/core/tests/coretests/src/android/widget/espresso/MouseClickAction.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 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.widget.espresso;
+
+import org.hamcrest.Matcher;
+
+import android.support.test.espresso.UiController;
+import android.support.test.espresso.ViewAction;
+import android.support.test.espresso.action.CoordinatesProvider;
+import android.support.test.espresso.action.GeneralClickAction;
+import android.support.test.espresso.action.PrecisionDescriber;
+import android.support.test.espresso.action.Tapper;
+import android.view.View;
+
+/**
+ * ViewAction for performing an click on View by a mouse.
+ */
+public final class MouseClickAction implements ViewAction {
+    private final GeneralClickAction mGeneralClickAction;
+
+    public MouseClickAction(Tapper tapper, CoordinatesProvider coordinatesProvider,
+            PrecisionDescriber precisionDescriber) {
+        mGeneralClickAction = new GeneralClickAction(tapper, coordinatesProvider,
+                precisionDescriber);
+    }
+
+    @Override
+    public Matcher<View> getConstraints() {
+        return mGeneralClickAction.getConstraints();
+    }
+
+    @Override
+    public String getDescription() {
+        return mGeneralClickAction.getDescription();
+    }
+
+    @Override
+    public void perform(UiController uiController, View view) {
+        mGeneralClickAction.perform(new MouseUiController(uiController), view);
+    }
+}
diff --git a/core/tests/coretests/src/android/widget/espresso/TextViewActions.java b/core/tests/coretests/src/android/widget/espresso/TextViewActions.java
index 32abc86..32cc6d6 100644
--- a/core/tests/coretests/src/android/widget/espresso/TextViewActions.java
+++ b/core/tests/coretests/src/android/widget/espresso/TextViewActions.java
@@ -53,6 +53,21 @@
     }
 
     /**
+     * Returns an action that clicks by mouse on text at an index on the TextView.<br>
+     * <br>
+     * View constraints:
+     * <ul>
+     * <li>must be a TextView displayed on screen
+     * <ul>
+     *
+     * @param index The index of the TextView's text to click on.
+     */
+    public static ViewAction mouseClickOnTextAtIndex(int index) {
+        return actionWithAssertions(
+                new MouseClickAction(Tap.SINGLE, new TextCoordinates(index), Press.PINPOINT));
+    }
+
+    /**
      * Returns an action that double-clicks on text at an index on the TextView.<br>
      * <br>
      * View constraints:
@@ -68,6 +83,21 @@
     }
 
     /**
+     * Returns an action that double-clicks by mouse on text at an index on the TextView.<br>
+     * <br>
+     * View constraints:
+     * <ul>
+     * <li>must be a TextView displayed on screen
+     * <ul>
+     *
+     * @param index The index of the TextView's text to double-click on.
+     */
+    public static ViewAction mouseDoubleClickOnTextAtIndex(int index) {
+        return actionWithAssertions(
+                new MouseClickAction(Tap.DOUBLE, new TextCoordinates(index), Press.PINPOINT));
+    }
+
+    /**
      * Returns an action that long presses on text at an index on the TextView.<br>
      * <br>
      * View constraints:
@@ -83,6 +113,21 @@
     }
 
     /**
+     * Returns an action that long click by mouse on text at an index on the TextView.<br>
+     * <br>
+     * View constraints:
+     * <ul>
+     * <li>must be a TextView displayed on screen
+     * <ul>
+     *
+     * @param index The index of the TextView's text to long click on.
+     */
+    public static ViewAction mouseLongClickOnTextAtIndex(int index) {
+        return actionWithAssertions(
+                new MouseClickAction(Tap.LONG, new TextCoordinates(index), Press.PINPOINT));
+    }
+
+    /**
      * Returns an action that long presses then drags on text from startIndex to endIndex on the
      * TextView.<br>
      * <br>
@@ -148,6 +193,50 @@
                         TextView.class));
     }
 
+    /**
+     * Returns an action that double click then drags by mouse on text from startIndex to endIndex
+     * on the TextView.<br>
+     * <br>
+     * View constraints:
+     * <ul>
+     * <li>must be a TextView displayed on screen
+     * <ul>
+     *
+     * @param startIndex The index of the TextView's text to start a drag from
+     * @param endIndex The index of the TextView's text to end the drag at
+     */
+    public static ViewAction mouseDoubleClickAndDragOnText(int startIndex, int endIndex) {
+        return actionWithAssertions(
+                new DragAction(
+                        DragAction.Drag.MOUSE_DOUBLE_CLICK,
+                        new TextCoordinates(startIndex),
+                        new TextCoordinates(endIndex),
+                        Press.PINPOINT,
+                        TextView.class));
+    }
+
+    /**
+     * Returns an action that long click then drags by mouse on text from startIndex to endIndex
+     * on the TextView.<br>
+     * <br>
+     * View constraints:
+     * <ul>
+     * <li>must be a TextView displayed on screen
+     * <ul>
+     *
+     * @param startIndex The index of the TextView's text to start a drag from
+     * @param endIndex The index of the TextView's text to end the drag at
+     */
+    public static ViewAction mouseLongClickAndDragOnText(int startIndex, int endIndex) {
+        return actionWithAssertions(
+                new DragAction(
+                        DragAction.Drag.MOUSE_LONG_CLICK,
+                        new TextCoordinates(startIndex),
+                        new TextCoordinates(endIndex),
+                        Press.PINPOINT,
+                        TextView.class));
+    }
+
     public enum Handle {
         SELECTION_START,
         SELECTION_END,
@@ -226,9 +315,25 @@
                     (new TextCoordinates(mIndex)).calculateCoordinates(mTextView);
             final Rect bounds = new Rect();
             view.getBoundsOnScreen(bounds);
-            final float diffX = bounds.centerX() - currentCoordinates[0];
+            final Rect visibleDisplayBounds = new Rect();
+            mTextView.getWindowVisibleDisplayFrame(visibleDisplayBounds);
+            visibleDisplayBounds.right -= 1;
+            visibleDisplayBounds.bottom -= 1;
+            if (!visibleDisplayBounds.intersect(bounds)) {
+                throw new PerformException.Builder()
+                        .withActionDescription(mActionDescription
+                                + " The handle is entirely out of the visible display frame of"
+                                + "the TextView's window.")
+                        .withViewDescription(HumanReadables.describe(view))
+                        .build();
+            }
+            final float dragPointX = Math.max(Math.min(bounds.centerX(),
+                    visibleDisplayBounds.right), visibleDisplayBounds.left);
+            final float diffX = dragPointX - currentCoordinates[0];
             final float verticalOffset = bounds.height() * 0.7f;
-            float diffY = bounds.top + verticalOffset - currentCoordinates[1];
+            final float dragPointY = Math.max(Math.min(bounds.top + verticalOffset,
+                    visibleDisplayBounds.bottom), visibleDisplayBounds.top);
+            float diffY = dragPointY - currentCoordinates[1];
             if (currentLine > targetLine) {
                 diffY -= mTextView.getLineHeight() * LINE_SLOP_MULTIPLIER;
             } else if (currentLine < targetLine) {
diff --git a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
index c279c8f..d133a12 100644
--- a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
+++ b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
@@ -1191,4 +1191,25 @@
                     InputMethodUtils.buildInputMethodsAndSubtypesString(map)));
         }
     }
+
+    @SmallTest
+    public void testConstructLocaleFromString() throws Exception {
+        assertEquals(new Locale("en"), InputMethodUtils.constructLocaleFromString("en"));
+        assertEquals(new Locale("en", "US"), InputMethodUtils.constructLocaleFromString("en_US"));
+        assertEquals(new Locale("en", "US", "POSIX"),
+                InputMethodUtils.constructLocaleFromString("en_US_POSIX"));
+
+        // Special rewrite rule for "tl" for versions of Android earlier than Lollipop that did not
+        // support three letter language codes, and used "tl" (Tagalog) as the language string for
+        // "fil" (Filipino).
+        assertEquals(new Locale("fil"), InputMethodUtils.constructLocaleFromString("tl"));
+        assertEquals(new Locale("fil", "PH"), InputMethodUtils.constructLocaleFromString("tl_PH"));
+        assertEquals(new Locale("fil", "PH", "POSIX"),
+                InputMethodUtils.constructLocaleFromString("tl_PH_POSIX"));
+
+        // So far rejecting an invalid/unexpected locale string is out of the scope of this method.
+        assertEquals(new Locale("a"), InputMethodUtils.constructLocaleFromString("a"));
+        assertEquals(new Locale("a b c"), InputMethodUtils.constructLocaleFromString("a b c"));
+        assertEquals(new Locale("en-US"), InputMethodUtils.constructLocaleFromString("en-US"));
+    }
 }
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
index 78e718f..edeecb2 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
@@ -47,9 +47,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/multidexlegacyandexception/Test.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList)
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk
index 7c699b6..7e4f0a9 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyTestApp/Android.mk
@@ -47,9 +47,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/multidexlegacytestapp/Test.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList)
@@ -88,9 +88,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList2): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList2): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/multidexlegacytestapp/Test.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList2)
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk
index b85c02c..99bcd6c 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyTestServices/Android.mk
@@ -37,9 +37,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 
 $(built_dex_intermediate): $(mainDexList)
 endif
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk
index 0f1d9c0..1c7d807 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v1/Android.mk
@@ -46,9 +46,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/framework/multidexlegacyversionedtestapp/MultiDexUpdateTest.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList)
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk
index 67ca483..b77cf31 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v2/Android.mk
@@ -46,9 +46,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/framework/multidexlegacyversionedtestapp/MultiDexUpdateTest.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList)
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk
index bf2efb1..3631626 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyVersionedTestApp_v3/Android.mk
@@ -46,9 +46,9 @@
 include $(BUILD_PACKAGE)
 
 ifndef LOCAL_JACK_ENABLED
-$(mainDexList): $(full_classes_proguard_jar) | $(HOST_OUT_EXECUTABLES)/mainDexClasses
+$(mainDexList): $(full_classes_proguard_jar) | $(MAINDEXCLASSES)
 	$(hide) mkdir -p $(dir $@)
-	$(HOST_OUT_EXECUTABLES)/mainDexClasses $< 1>$@
+	$(MAINDEXCLASSES) $< 1>$@
 	echo "com/android/framework/multidexlegacyversionedtestapp/MultiDexUpdateTest.class" >> $@
 
 $(built_dex_intermediate): $(mainDexList)
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index ab37519..51019cc 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -126,6 +126,7 @@
     <assign-permission name="android.permission.WAKE_LOCK" uid="media" />
     <assign-permission name="android.permission.UPDATE_DEVICE_STATS" uid="media" />
     <assign-permission name="android.permission.UPDATE_APP_OPS_STATS" uid="media" />
+    <assign-permission name="android.permission.GET_PROCESS_STATE_AND_OOM_SCORE" uid="media" />
 
     <assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="graphics" />
 
diff --git a/data/sounds/AllAudio.mk b/data/sounds/AllAudio.mk
index f6d8ee9..edfd380 100644
--- a/data/sounds/AllAudio.mk
+++ b/data/sounds/AllAudio.mk
@@ -228,6 +228,7 @@
     $(LOCAL_PATH)/effects/ogg/Unlock.ogg:system/media/audio/ui/Unlock.ogg \
     $(LOCAL_PATH)/effects/ogg/Trusted_48k.ogg:system/media/audio/ui/Trusted.ogg \
     $(LOCAL_PATH)/effects/ogg/VideoRecord_48k.ogg:system/media/audio/ui/VideoRecord.ogg \
+    $(LOCAL_PATH)/effects/ogg/VideoStop_48k.ogg:system/media/audio/ui/VideoStop.ogg \
     $(LOCAL_PATH)/effects/ogg/WirelessChargingStarted.ogg:system/media/audio/ui/WirelessChargingStarted.ogg \
     $(LOCAL_PATH)/effects/ogg/camera_click_48k.ogg:system/media/audio/ui/camera_click.ogg \
     $(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
diff --git a/data/sounds/AudioPackage10.mk b/data/sounds/AudioPackage10.mk
index 5a5eea6..c5222af 100644
--- a/data/sounds/AudioPackage10.mk
+++ b/data/sounds/AudioPackage10.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 10 - Mako
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -23,6 +23,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid_48k.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn_48k.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord_48k.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop_48k.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click_48k.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery_48k.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage11.mk b/data/sounds/AudioPackage11.mk
index 0f85b33..43c83b9 100644
--- a/data/sounds/AudioPackage11.mk
+++ b/data/sounds/AudioPackage11.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 11 - Razor
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -23,6 +23,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid_48k.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn_48k.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord_48k.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop_48k.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click_48k.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery_48k.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage12.mk b/data/sounds/AudioPackage12.mk
index 4251332..cd4d35b 100644
--- a/data/sounds/AudioPackage12.mk
+++ b/data/sounds/AudioPackage12.mk
@@ -13,7 +13,7 @@
 RINGTONE_FILES := Callisto Dione Ganymede Luna Oberon Phobos Sedna Titania Triton Umbriel
 EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
 	camera_focus Dock Undock Lock Unlock Trusted
-MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted
+MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted VideoStop
 
 PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
 	$(LOCAL_PATH)/alarms/ogg/$(fn).ogg:system/media/audio/alarms/$(fn).ogg)
diff --git a/data/sounds/AudioPackage12_48.mk b/data/sounds/AudioPackage12_48.mk
index 70e68d3..80758f4 100644
--- a/data/sounds/AudioPackage12_48.mk
+++ b/data/sounds/AudioPackage12_48.mk
@@ -13,7 +13,7 @@
 RINGTONE_FILES := Callisto Dione Ganymede Luna Oberon Phobos Sedna Titania Triton Umbriel
 EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
 	Lock Unlock Trusted
-MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted
+MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted VideoStop
 
 # Alarms not yet available in 48 kHz
 PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
diff --git a/data/sounds/AudioPackage13.mk b/data/sounds/AudioPackage13.mk
index cec7280..d33a4af 100644
--- a/data/sounds/AudioPackage13.mk
+++ b/data/sounds/AudioPackage13.mk
@@ -14,7 +14,7 @@
 	Umbriel
 EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
 	camera_focus Dock Undock Lock Unlock Trusted
-MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery
+MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery VideoStop
 
 PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
 	$(LOCAL_PATH)/alarms/material/ogg/$(fn).ogg:system/media/audio/alarms/$(fn).ogg)
diff --git a/data/sounds/AudioPackage13_48.mk b/data/sounds/AudioPackage13_48.mk
index d1b17c8..9c320ae 100644
--- a/data/sounds/AudioPackage13_48.mk
+++ b/data/sounds/AudioPackage13_48.mk
@@ -14,7 +14,7 @@
 	Umbriel
 EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
 	Lock Unlock Trusted
-MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery
+MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery VideoStop
 
 PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
 	$(LOCAL_PATH)/alarms/material/ogg/$(fn)_48k.ogg:system/media/audio/alarms/$(fn).ogg)
diff --git a/data/sounds/AudioPackage2.mk b/data/sounds/AudioPackage2.mk
index ba9d7e2..40319c4 100644
--- a/data/sounds/AudioPackage2.mk
+++ b/data/sounds/AudioPackage2.mk
@@ -1,11 +1,11 @@
 #
 # Audio Package 2
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
 # This is a larger package of sounds than the 1.0 release for devices
 # that have larger internal flash.
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -34,6 +34,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
 	$(LOCAL_PATH)/effects/Dock.ogg:system/media/audio/ui/Dock.ogg \
diff --git a/data/sounds/AudioPackage3.mk b/data/sounds/AudioPackage3.mk
index 5bfeb42..a05de72 100644
--- a/data/sounds/AudioPackage3.mk
+++ b/data/sounds/AudioPackage3.mk
@@ -1,11 +1,11 @@
 #
 # Audio Package 3
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
 # This is a larger package of sounds than the 1.0 release for devices
 # that have larger internal flash.
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -34,6 +34,7 @@
 	$(LOCAL_PATH)/effects/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
 	$(LOCAL_PATH)/effects/Dock.ogg:system/media/audio/ui/Dock.ogg \
diff --git a/data/sounds/AudioPackage4.mk b/data/sounds/AudioPackage4.mk
index 43dbe20..d376a2d 100644
--- a/data/sounds/AudioPackage4.mk
+++ b/data/sounds/AudioPackage4.mk
@@ -1,11 +1,11 @@
 #
 # Audio Package 4
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
 # This is a larger package of sounds than the 1.0 release for devices
 # that have larger internal flash.
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -39,6 +39,7 @@
 	$(LOCAL_PATH)/effects/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
 	$(LOCAL_PATH)/effects/Dock.ogg:system/media/audio/ui/Dock.ogg \
diff --git a/data/sounds/AudioPackage5.mk b/data/sounds/AudioPackage5.mk
index fbbb16a..72384c8 100644
--- a/data/sounds/AudioPackage5.mk
+++ b/data/sounds/AudioPackage5.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 5 - Crespo/Soju
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -20,6 +20,7 @@
 	$(LOCAL_PATH)/effects/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage6.mk b/data/sounds/AudioPackage6.mk
index c843fdc..5413704 100644
--- a/data/sounds/AudioPackage6.mk
+++ b/data/sounds/AudioPackage6.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 6 - Trygon/Stingray
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -19,6 +19,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage7.mk b/data/sounds/AudioPackage7.mk
index ce82651..e4763be 100644
--- a/data/sounds/AudioPackage7.mk
+++ b/data/sounds/AudioPackage7.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 7 - Tuna
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -21,6 +21,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid_120.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn_120.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage7alt.mk b/data/sounds/AudioPackage7alt.mk
index db468f3..30e6173 100644
--- a/data/sounds/AudioPackage7alt.mk
+++ b/data/sounds/AudioPackage7alt.mk
@@ -21,6 +21,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid_120.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn_120.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/ogg/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/ogg/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
 	$(LOCAL_PATH)/effects/ogg/Dock.ogg:system/media/audio/ui/Dock.ogg \
diff --git a/data/sounds/AudioPackage8.mk b/data/sounds/AudioPackage8.mk
index 4112c18..b38e62d 100644
--- a/data/sounds/AudioPackage8.mk
+++ b/data/sounds/AudioPackage8.mk
@@ -1,9 +1,9 @@
 #
 # Audio Package 7 - Tuna
-# 
+#
 # Include this file in a product makefile to include these audio files
 #
-# 
+#
 
 LOCAL_PATH:= frameworks/base/data/sounds
 
@@ -23,6 +23,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/AudioPackage9.mk b/data/sounds/AudioPackage9.mk
index 1b430c0..dbe1350 100644
--- a/data/sounds/AudioPackage9.mk
+++ b/data/sounds/AudioPackage9.mk
@@ -23,6 +23,7 @@
 	$(LOCAL_PATH)/effects/ogg/KeypressInvalid.ogg:system/media/audio/ui/KeypressInvalid.ogg \
 	$(LOCAL_PATH)/effects/ogg/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/material/ogg/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
 	$(LOCAL_PATH)/effects/material/ogg/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
diff --git a/data/sounds/OriginalAudio.mk b/data/sounds/OriginalAudio.mk
index e1ca24b..f683752 100644
--- a/data/sounds/OriginalAudio.mk
+++ b/data/sounds/OriginalAudio.mk
@@ -1,8 +1,8 @@
 #
 # Original audio package that shipped on G1
-# 
+#
 # This file is included from core.mk so that all devices will have these sounds
-# 
+#
 # TODO: Clean up for future releases
 #
 
@@ -32,6 +32,7 @@
 	$(LOCAL_PATH)/effects/KeypressDelete.ogg:system/media/audio/ui/KeypressDelete.ogg \
 	$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
 	$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+	$(LOCAL_PATH)/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
 	$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	$(LOCAL_PATH)/newwavelabs/BeatPlucker.ogg:system/media/audio/ringtones/BeatPlucker.ogg \
 	$(LOCAL_PATH)/newwavelabs/CaffeineSnake.ogg:system/media/audio/notifications/CaffeineSnake.ogg
diff --git a/data/sounds/effects/VideoStop.ogg b/data/sounds/effects/VideoStop.ogg
new file mode 100644
index 0000000..1450522
--- /dev/null
+++ b/data/sounds/effects/VideoStop.ogg
Binary files differ
diff --git a/data/sounds/effects/VideoStop.wav b/data/sounds/effects/VideoStop.wav
new file mode 100644
index 0000000..5809d93
--- /dev/null
+++ b/data/sounds/effects/VideoStop.wav
Binary files differ
diff --git a/data/sounds/effects/material/ogg/VideoStop.ogg b/data/sounds/effects/material/ogg/VideoStop.ogg
new file mode 100644
index 0000000..e98fabc
--- /dev/null
+++ b/data/sounds/effects/material/ogg/VideoStop.ogg
Binary files differ
diff --git a/data/sounds/effects/material/ogg/VideoStop_48k.ogg b/data/sounds/effects/material/ogg/VideoStop_48k.ogg
new file mode 100644
index 0000000..b1eb780
--- /dev/null
+++ b/data/sounds/effects/material/ogg/VideoStop_48k.ogg
Binary files differ
diff --git a/docs/html-intl/intl/es/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/es/distribute/googleplay/quality/tv.jd
index 8645858..e291e7c 100644
--- a/docs/html-intl/intl/es/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/es/distribute/googleplay/quality/tv.jd
@@ -320,7 +320,7 @@
   <td>
     <p style="margin-bottom:.5em;">
       Si la aplicación utiliza un controlador para juegos como su método de entrada principal, debe declarar el requisito
- correspondiente con la etiqueta del manifiesto <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>.
+ correspondiente con la etiqueta del manifiesto <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>.
       (<a href="{@docRoot}training/tv/games/index.html#gamepad">Obtén más información</a>)
     </p>
   </td>
diff --git a/docs/html-intl/intl/es/google/play/filters.jd b/docs/html-intl/intl/es/google/play/filters.jd
index d4890dc..03565b9 100644
--- a/docs/html-intl/intl/es/google/play/filters.jd
+++ b/docs/html-intl/intl/es/google/play/filters.jd
@@ -329,23 +329,23 @@
   <tr><th>Elemento del manifiesto</th><th>Resumen:</th></tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
+<compatible-screens>}</a></nobr></td>
     <td>
       <p>Google Play filtra la aplicación si el tamaño de pantalla del dispositivo no coincide con
- ninguna de las configuraciones de pantalla (declaradas por un elemento {@code &lt;screen&gt;}) en el elemento {@code
-&lt;compatible-screens&gt;}.</p>
+ ninguna de las configuraciones de pantalla (declaradas por un elemento {@code <screen>}) en el elemento {@code
+<compatible-screens>}.</p>
       <p class="caution"><strong>Advertencia:</strong> Normalmente, <strong>no deberías usar este elemento
  del manifiesto</strong>. El uso de este elemento puede reducir
  notablemente la base de usuarios potenciales para tu aplicación, al excluir todas las combinaciones de tamaño de pantalla
  y densidad que no indicaste. En su lugar, debes usar el elemento del manifiesto <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> (descrito anteriormente en la <a href="#table1">tabla
+<supports-screens>}</a> (descrito anteriormente en la <a href="#table1">tabla
 1</a>) para habilitar el modo de compatibilidad de pantalla para las configuraciones de pantalla que no abarcaste
  con recursos adicionales.</p>
     </td>
   </tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
+<supports-gl-texture>}</a></nobr></td>
     <td>
       <p>Google Play filtrará la aplicación a menos que uno o más de los formatos de compresión
  de texturas GL compatibles con la aplicación también sean compatibles con el dispositivo. </p>
@@ -408,16 +408,16 @@
 <ul>
   <li>Formatos de compresión de texturas OpenGL
     <p>Mediante el uso del elemento <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a>.</p>
+<supports-gl-texture>}</a>.</p>
   </li>
   <li>Tamaño de pantalla (y, opcionalmente, densidad de la pantalla)
     <p>Mediante el uso del elemento <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> o <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a>.</p>
+<supports-screens>}</a> o <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+<compatible-screens>}</a>.</p>
   </li>
   <li>Nivel de API
     <p>Mediante el uso del elemento <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk&gt;}</a>.</p>
+<uses-sdk>}</a>.</p>
   </li>
   <li>Arquitectura de CPU (ABI)
     <p>Mediante la inclusión de bibliotecas nativas creadas con el <a href="{@docRoot}tools/sdk/ndk/index.html">NDK de
diff --git a/docs/html-intl/intl/es/preview/api-overview.jd b/docs/html-intl/intl/es/preview/api-overview.jd
index 9f68613..1f3e9bf 100644
--- a/docs/html-intl/intl/es/preview/api-overview.jd
+++ b/docs/html-intl/intl/es/preview/api-overview.jd
@@ -133,8 +133,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>En Windows, posiblemente tenga que ejecutar {@code telnet 127.0.0.1 &lt;emulator-id&gt;} seguido de
-  {@code finger touch &lt;finger_id&gt;}.
+<p>En Windows, posiblemente tenga que ejecutar {@code telnet 127.0.0.1 <emulator-id>} seguido de
+  {@code finger touch <finger_id>}.
 </p>
 </li>
 </ol>
@@ -192,7 +192,7 @@
 </pre>
 
 <p>Para cada actividad que desee exponer a {@code ChooserTargetService}, agregue un elemento
-{@code &lt;meta-data&gt;} con el nombre
+{@code <meta-data>} con el nombre
 {@code "android.service.chooser.chooser_target_service"} en el manifiesto de su aplicación.
 </p>
 
diff --git a/docs/html-intl/intl/ja/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/ja/distribute/googleplay/quality/tv.jd
index 4c64184f..4c0e478 100644
--- a/docs/html-intl/intl/ja/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/ja/distribute/googleplay/quality/tv.jd
@@ -286,7 +286,7 @@
   </td>
   <td>
     <p style="margin-bottom:.5em;">
-      アプリがその主要な入力方式としてゲーム コントローラを使用する場合、<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> マニフェスト タグで適切な要件を宣言しています。(<a href="{@docRoot}training/tv/games/index.html#gamepad">こちらを参照してください</a>)
+      アプリがその主要な入力方式としてゲーム コントローラを使用する場合、<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> マニフェスト タグで適切な要件を宣言しています。(<a href="{@docRoot}training/tv/games/index.html#gamepad">こちらを参照してください</a>)
     </p>
   </td>
 </tr>
diff --git a/docs/html-intl/intl/ja/google/play/filters.jd b/docs/html-intl/intl/ja/google/play/filters.jd
index a1b9ec0..5ab6336 100644
--- a/docs/html-intl/intl/ja/google/play/filters.jd
+++ b/docs/html-intl/intl/ja/google/play/filters.jd
@@ -208,14 +208,14 @@
 <table>
   <tr><th>マニフェスト要素</th><th>概要</th></tr>
   <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code &lt;compatible-screens&gt;}</a></nobr></td>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code <compatible-screens>}</a></nobr></td>
     <td>
-      <p>Google Play はデバイス画面サイズと密度が {@code &lt;compatible-screens&gt;} の要素の画面設定({@code &lt;screen&gt;} 要素で宣言)のいずれにも適合しない場合、アプリをフィルタリングします。</p>
-      <p class="caution"><strong>警告:</strong> 通常は、<strong>このマニフェスト要素を使用すべきではありません</strong>。この要素を使用すると、指定していない画面サイズと密度のすべての組み合わせが除外されることになり、アプリの潜在的なユーザー ベースが大幅に減少する可能性があります。代わりに <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code &lt;supports-screens&gt;}</a> マニフェスト要素(<a href="#table1">表 1</a> に記載)を使用して、考慮に入れていない画面設定に対して、代替リソースを使用した画面の互換性モードを有効にすることをお勧めします。</p>
+      <p>Google Play はデバイス画面サイズと密度が {@code <compatible-screens>} の要素の画面設定({@code <screen>} 要素で宣言)のいずれにも適合しない場合、アプリをフィルタリングします。</p>
+      <p class="caution"><strong>警告:</strong> 通常は、<strong>このマニフェスト要素を使用すべきではありません</strong>。この要素を使用すると、指定していない画面サイズと密度のすべての組み合わせが除外されることになり、アプリの潜在的なユーザー ベースが大幅に減少する可能性があります。代わりに <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code <supports-screens>}</a> マニフェスト要素(<a href="#table1">表 1</a> に記載)を使用して、考慮に入れていない画面設定に対して、代替リソースを使用した画面の互換性モードを有効にすることをお勧めします。</p>
     </td>
   </tr>
   <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code &lt;supports-gl-texture&gt;}</a></nobr></td>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code <supports-gl-texture>}</a></nobr></td>
     <td>
       <p>Google Play はアプリでサポートされる 1 つ以上の GL テクスチャ圧縮フォーマットがデバイスで同様にサポートされない場合、アプリをフィルタリングします。 </p>
     </td>
@@ -249,11 +249,11 @@
 
 <p>現時点では、Google Play では各 APK が次の設定に基づいて別々のフィルタを提供する際にのみ、同じアプリの複数の APK を公開できます。</p>
 <ul>
-  <li>OpenGL テクスチャ圧縮フォーマット <p><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code &lt;supports-gl-texture&gt;}</a> 要素の使用による。</p>
+  <li>OpenGL テクスチャ圧縮フォーマット <p><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code <supports-gl-texture>}</a> 要素の使用による。</p>
   </li>
-  <li>画面サイズ(画面密度も指定可能) <p><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code &lt;supports-screens&gt;}</a>要素または<a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code &lt;compatible-screens&gt;}</a> 要素の使用による。</p>
+  <li>画面サイズ(画面密度も指定可能) <p><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code <supports-screens>}</a>要素または<a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code <compatible-screens>}</a> 要素の使用による。</p>
   </li>
-  <li>API レベル <p><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> 要素の使用による。</p>
+  <li>API レベル <p><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> 要素の使用による。</p>
   </li>
   <li>CPU アーキテクチャ(ABI) <p>特定の CPU アーキテクチャ(ARM EABI v7 または x86 など)を対象とする<a href="{@docRoot}tools/sdk/ndk/index.html"> Android NDK</a> で構築されたネイティブ ライブラリの組み込みによる。</p>
   </li>
diff --git a/docs/html-intl/intl/ja/guide/topics/fundamentals.jd b/docs/html-intl/intl/ja/guide/topics/fundamentals.jd
index cf9f7dd..d76c92e 100644
--- a/docs/html-intl/intl/ja/guide/topics/fundamentals.jd
+++ b/docs/html-intl/intl/ja/guide/topics/fundamentals.jd
@@ -329,7 +329,7 @@
 <p style="margin-left: 2em">{@code FLAG_ACTIVITY_NEW_TASK} <br/>{@code FLAG_ACTIVITY_CLEAR_TOP} <br/>{@code FLAG_ACTIVITY_RESET_TASK_IF_NEEDED} <br/>{@code FLAG_ACTIVITY_SINGLE_TOP}</p>
 
 <p>
-また、主に使用する {@code &lt;activity&gt;} 属性は以下のとおりです:
+また、主に使用する {@code <activity>} 属性は以下のとおりです:
   
 <p style="margin-left: 2em">{@code taskAffinity} <br/>{@code launchMode} <br/>{@code allowTaskReparenting} <br/>{@code clearTaskOnLaunch} <br/>{@code alwaysRetainTaskState} <br/>{@code finishOnTaskLaunch}</p>
 
@@ -341,7 +341,7 @@
 <h3 id="afftask">親和性と新しいタスク</h3>
 
 <p>
-デフォルトでは、アプリケーション内のすべてのアクティビティは相互に親和性があり、すべてのアクティビティができる限り同じタスクに属そうとします。<i></i>ただし、{@code &lt;activity&gt;} 要素の {@code taskAffinity} 属性を使用して、アクティビティごとに個別の親和性を設定することもできます。つまり、別々のアプリケーションで定義されているアクティビティで親和性を共有したり、同じアプリケーションで定義されているアクティビティに別々の親和性を割り当てたりできるということです。親和性が作用する状況は 2 つあります。1 つはアクティビティを起動する Intent オブジェクトに {@code FLAG_ACTIVITY_NEW_TASK} フラグが含まれている場合、もう 1 つはアクティビティの {@code allowTaskReparenting} 属性が "{@code true}" に設定されている場合です。 
+デフォルトでは、アプリケーション内のすべてのアクティビティは相互に親和性があり、すべてのアクティビティができる限り同じタスクに属そうとします。<i></i>ただし、{@code <activity>} 要素の {@code taskAffinity} 属性を使用して、アクティビティごとに個別の親和性を設定することもできます。つまり、別々のアプリケーションで定義されているアクティビティで親和性を共有したり、同じアプリケーションで定義されているアクティビティに別々の親和性を割り当てたりできるということです。親和性が作用する状況は 2 つあります。1 つはアクティビティを起動する Intent オブジェクトに {@code FLAG_ACTIVITY_NEW_TASK} フラグが含まれている場合、もう 1 つはアクティビティの {@code allowTaskReparenting} 属性が "{@code true}" に設定されている場合です。
 </p>
 
 <dl>
@@ -361,7 +361,7 @@
 <h3 id="lmodes">起動モード</h3>
 
 <p>
-<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">launchMode</a></code> 属性の {@code &lt;activity&gt;} 要素には、以下の 4 種類の起動モードを割り当てることができます:
+<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">launchMode</a></code> 属性の {@code <activity>} 要素には、以下の 4 種類の起動モードを割り当てることができます:
 </p>
 
 <p style="margin-left: 2em">"{@code standard}"(デフォルト モード)<br>"{@code singleTop}"<br>"{@code singleTask}"<br>"{@code singleInstance}"</p>
@@ -470,7 +470,7 @@
 </p> 
 
 <p>
-ユーザーがアクティビティに戻ることができるようにしない場合は、{@code &lt;activity&gt;} 要素の {@code finishOnTaskLaunch} を "{@code true}" に設定します。詳しくは、<a href="#clearstack">スタックのクリア</a>をご覧ください。
+ユーザーがアクティビティに戻ることができるようにしない場合は、{@code <activity>} 要素の {@code finishOnTaskLaunch} を "{@code true}" に設定します。詳しくは、<a href="#clearstack">スタックのクリア</a>をご覧ください。
 </p>
 
 
@@ -488,7 +488,7 @@
 <h3 id="procs">プロセス</h3>
 
 <p>
-コンポーネントを実行するプロセスは、マニフェスト ファイルで管理します。コンポーネントの各要素({@code &lt;activity&gt;}、{@code &lt;service&gt;}、{@code &lt;receiver&gt;}、および {@code &lt;provider&gt;})には {@code process} 属性があり、そのコンポーネントをどのプロセスで実行すべきかを指定できるようになっています。これらの属性の設定によって、それぞれのコンポーネントを専用のプロセスで実行したり、一部のコンポーネントだけでプロセスを共有したりできます。また、別々のアプリケーションのコンポーネントが、同じプロセスで実行されるように設定することもできます。この場合は、それらのアプリケーションが同じ Linux ユーザー ID を共有し、同じ認証機関によって署名されている必要があります。{@code &lt;application&gt;} 要素にも {@code process} 属性があり、すべてのコンポーネントに適用されるデフォルト値を設定できます。
+コンポーネントを実行するプロセスは、マニフェスト ファイルで管理します。コンポーネントの各要素({@code <activity>}、{@code <service>}、{@code <receiver>}、および {@code <provider>})には {@code process} 属性があり、そのコンポーネントをどのプロセスで実行すべきかを指定できるようになっています。これらの属性の設定によって、それぞれのコンポーネントを専用のプロセスで実行したり、一部のコンポーネントだけでプロセスを共有したりできます。また、別々のアプリケーションのコンポーネントが、同じプロセスで実行されるように設定することもできます。この場合は、それらのアプリケーションが同じ Linux ユーザー ID を共有し、同じ認証機関によって署名されている必要があります。{@code <application>} 要素にも {@code process} 属性があり、すべてのコンポーネントに適用されるデフォルト値を設定できます。
 </p>
 
 <p>
diff --git a/docs/html-intl/intl/ja/preview/api-overview.jd b/docs/html-intl/intl/ja/preview/api-overview.jd
index 2c0816b..33cabc3 100644
--- a/docs/html-intl/intl/ja/preview/api-overview.jd
+++ b/docs/html-intl/intl/ja/preview/api-overview.jd
@@ -133,8 +133,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>Windows では、{@code telnet 127.0.0.1 &lt;emulator-id&gt;}、
-{@code finger touch &lt;finger_id&gt;} の順に実行する必要がある場合があります。
+<p>Windows では、{@code telnet 127.0.0.1 <emulator-id>}、
+{@code finger touch <finger_id>} の順に実行する必要がある場合があります。
 </p>
 </li>
 </ol>
@@ -192,7 +192,7 @@
 </pre>
 
 <p>{@code ChooserTargetService} に公開するアクティビティごとに、 {@code "android.service.chooser.chooser_target_service"} という名前の
-{@code &lt;meta-data&gt;} 要素をアプリのマニフェストに追加します。
+{@code <meta-data>} 要素をアプリのマニフェストに追加します。
 
 </p>
 
diff --git a/docs/html-intl/intl/ja/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/ja/training/basics/activity-lifecycle/starting.jd
index 7c865a9..124c323 100644
--- a/docs/html-intl/intl/ja/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/ja/training/basics/activity-lifecycle/starting.jd
@@ -150,7 +150,7 @@
 
 <p>アプリのメインのアクティビティは、{@link
 android.content.Intent#ACTION_MAIN MAIN} アクションと {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER} カテゴリを含む <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> を使用してマニフェストで宣言する必要があります。
+<intent-filter>}</a> を使用してマニフェストで宣言する必要があります。
 次に例を示します。</p> 
 
 <pre>
diff --git a/docs/html-intl/intl/ja/training/basics/intents/filters.jd b/docs/html-intl/intl/ja/training/basics/intents/filters.jd
index 5f0d69a..1bcb266 100644
--- a/docs/html-intl/intl/ja/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/ja/training/basics/intents/filters.jd
@@ -31,7 +31,7 @@
 
 </p>
 
-<p>他のアプリからアクティビティを開始できるようにするには、対応する <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>要素のマニフェスト ファイルに <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 要素を追加する必要があります。
+<p>他のアプリからアクティビティを開始できるようにするには、対応する <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>要素のマニフェスト ファイルに <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 要素を追加する必要があります。
 </p>
 
 <p>アプリが端末にインストールされている場合、システムはインテント フィルタを識別し、インストールされているすべてのアプリでサポートされるインテントの内部カタログに情報を追加します。アプリが暗黙的インテントを使って {@link android.app.Activity#startActivity
@@ -56,13 +56,13 @@
   <dt>アクション</dt>
     <dd>実行するアクション名を表す文字列。通常、
 {@link android.content.Intent#ACTION_SEND} や {@link android.content.Intent#ACTION_VIEW} などのプラットフォームに定義された値のいずれか。
-    <p><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a> 要素を使用してインテント フィルタでこれを指定します。この要素で指定した値は、API 定数ではなく、アクションの完全な文字列名(下記の例を参照)である必要があります。
+    <p><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a> 要素を使用してインテント フィルタでこれを指定します。この要素で指定した値は、API 定数ではなく、アクションの完全な文字列名(下記の例を参照)である必要があります。
 
 </p></dd>
 
   <dt>データ</dt>
     <dd>インテントに関連するデータの詳細。
-    <p><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> 要素を使用して、インテント フィルタでこれを指定します。この要素で 1 つ以上の属性を
+    <p><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> 要素を使用して、インテント フィルタでこれを指定します。この要素で 1 つ以上の属性を
 使用して、MIME タイプのみ、URI 接頭辞のみ、URI スキームのみ、またはこれらと受け入れられるデータ タイプを示すその他の項目の組み合わせを指定することができます。
 
 </p>
@@ -76,11 +76,11 @@
 システムでサポートされているいくつかの異なるカテゴリがありますが、大抵のカテゴリはほとんど使用されません。
 しかし、すべての暗黙的インテントは、デフォルトでは
 {@link android.content.Intent#CATEGORY_DEFAULT} を使用して定義されています。
-    <p><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a>
+    <p><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>
 要素を使用して、インテント フィルタでこれを指定します。</p></dd>
 </dl>
 
-<p>インテント フィルタでは、それぞれの基準を<a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 要素内でネストした対応する XML 要素を使用して宣言することによって、アクティビティが受け入れる基準を宣言することができます。
+<p>インテント フィルタでは、それぞれの基準を<a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 要素内でネストした対応する XML 要素を使用して宣言することによって、アクティビティが受け入れる基準を宣言することができます。
 
 </p>
 
@@ -100,10 +100,10 @@
 
 <p>受信するインテントはそれぞれ 1 つのアクションと 1 つのデータ タイプのみを指定しますが、各
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> 内で <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a>、<a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> 要素の複数のインスタンスを宣言することもできます。
+<intent-filter>}</a> 内で <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
+<action>}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a>、<a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> 要素の複数のインスタンスを宣言することもできます。
 </p>
 
 <p>アクションとデータのいずれか 2 つのペアが、各自の動作において相互に排他的である場合は、別のインテント フィルタを作成して、どのデータ タイプと組み合わされたときにとのアクションが受け入れられるかを指定する必要があります。
diff --git a/docs/html-intl/intl/ja/training/tv/start/start.jd b/docs/html-intl/intl/ja/training/tv/start/start.jd
index bc99ff9..3678df9 100755
--- a/docs/html-intl/intl/ja/training/tv/start/start.jd
+++ b/docs/html-intl/intl/ja/training/tv/start/start.jd
@@ -156,7 +156,7 @@
 <h2 id="tv-libraries">TV サポート ライブラリを追加する</h3>
 
 <p>
-  Android SDK には、TV アプリ向けのサポート ライブラリが用意されています。これらのライブラリでは、TV 端末向けに使用できる API とユーザー インターフェース ウィジェットを提供しています。同ライブラリは {@code &lt;sdk&gt;/extras/android/support/} ディレクトリにあります。ライブラリとその全般的な用途の一覧を次に示します。
+  Android SDK には、TV アプリ向けのサポート ライブラリが用意されています。これらのライブラリでは、TV 端末向けに使用できる API とユーザー インターフェース ウィジェットを提供しています。同ライブラリは {@code <sdk>/extras/android/support/} ディレクトリにあります。ライブラリとその全般的な用途の一覧を次に示します。
 </p>
 
 <ul>
diff --git a/docs/html-intl/intl/ko/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/ko/distribute/googleplay/quality/tv.jd
index 83d71e9..721d63a 100644
--- a/docs/html-intl/intl/ko/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/ko/distribute/googleplay/quality/tv.jd
@@ -319,7 +319,7 @@
   </td>
   <td>
     <p style="margin-bottom:.5em;">
-      앱이 게임 컨트롤러를 기본 입력 방법으로 사용하는 경우 <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> 매니페스트 태그로 적합한 요구사항을 선언합니다.
+      앱이 게임 컨트롤러를 기본 입력 방법으로 사용하는 경우 <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> 매니페스트 태그로 적합한 요구사항을 선언합니다.
 
       (<a href="{@docRoot}training/tv/games/index.html#gamepad">방법 알아보기</a>)
     </p>
diff --git a/docs/html-intl/intl/ko/google/play/filters.jd b/docs/html-intl/intl/ko/google/play/filters.jd
index c1f73c7..42b1c77 100644
--- a/docs/html-intl/intl/ko/google/play/filters.jd
+++ b/docs/html-intl/intl/ko/google/play/filters.jd
@@ -329,23 +329,23 @@
   <tr><th>매니페스트 요소</th><th>요약</th></tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
+<compatible-screens>}</a></nobr></td>
     <td>
       <p>Google Play가 장치 화면
 크기와 밀도가 {@code
-&lt;compatible-screens&gt;} 요소에서 {@code &lt;screen&gt;} 요소가 선언한 화면 구성과 일치하지 않는 경우에 애플리케이션을 필터링합니다.</p>
+<compatible-screens>} 요소에서 {@code <screen>} 요소가 선언한 화면 구성과 일치하지 않는 경우에 애플리케이션을 필터링합니다.</p>
       <p class="caution"><strong>주의:</strong> 일반적으로 <strong>이 매니페스트 요소를 사용하면 안 됩니다</strong>.
  이 요소를 사용하면 목록에 없는 화면 크기와 밀도의 조합을 모두 제외시켜 애플리케이션의 잠재적 사용자 기반이 현저히 줄어들 수 있습니다.
 
  대신 위의 <a href="#table1">표 1</a>에 나오는 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> 매니페스트 요소를 사용하여 대체 리소스로 고려하지 않은 화면 구성에 대해 화면 호환성 모드를 활성화해야 합니다.
+<supports-screens>}</a> 매니페스트 요소를 사용하여 대체 리소스로 고려하지 않은 화면 구성에 대해 화면 호환성 모드를 활성화해야 합니다.
 
 </p>
     </td>
   </tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
+<supports-gl-texture>}</a></nobr></td>
     <td>
       <p>Google Play는 애플리케이션에서 지원되는 하나 이상의 GL 텍스처 압축 형식이 장치에서도 지원되는 경우를 제외하고 애플리케이션을 필터링합니다.
  </p>
@@ -408,16 +408,16 @@
 <ul>
   <li>OpenGL 텍스처 압축 형식
     <p><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a> 요소를 사용하여 필터링합니다.</p>
+<supports-gl-texture>}</a> 요소를 사용하여 필터링합니다.</p>
   </li>
   <li>화면 크기(및 선택적 화면 밀도)
     <p><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> 또는 <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a> 요소를 사용하여 필터링합니다.</p>
+<supports-screens>}</a> 또는 <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+<compatible-screens>}</a> 요소를 사용하여 필터링합니다.</p>
   </li>
   <li>API 레벨
     <p><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk&gt;}</a> 요소를 사용하여 필터링합니다.</p>
+<uses-sdk>}</a> 요소를 사용하여 필터링합니다.</p>
   </li>
   <li>CPU 아키텍처(ABI)
     <p>특정 CPU 아키텍처(예: ARM EABI v7 또는 x86)를 대상으로 하는 <a href="{@docRoot}tools/sdk/ndk/index.html">Android NDK</a>로 작성된 네이티브 라이브러리를 포함하여 필터링합니다.
diff --git a/docs/html-intl/intl/ko/preview/api-overview.jd b/docs/html-intl/intl/ko/preview/api-overview.jd
index aac9a44..f9308b1 100644
--- a/docs/html-intl/intl/ko/preview/api-overview.jd
+++ b/docs/html-intl/intl/ko/preview/api-overview.jd
@@ -133,7 +133,7 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>Windows에서는 {@code telnet 127.0.0.1 &lt;emulator-id&gt;}에 뒤이어 {@code finger touch &lt;finger_id&gt;}를 실행해야 할 수도 있습니다.
+<p>Windows에서는 {@code telnet 127.0.0.1 <emulator-id>}에 뒤이어 {@code finger touch <finger_id>}를 실행해야 할 수도 있습니다.
 
 </p>
 </li>
@@ -191,7 +191,7 @@
 &lt;/service&gt;
 </pre>
 
-<p>{@code ChooserTargetService}에 노출하고자 하는 액티비티마다 {@code &lt;meta-data&gt;} 요소를 하나씩 추가하고, 앱 매니페스트에 {@code "android.service.chooser.chooser_target_service"} 이름을 추가합니다.
+<p>{@code ChooserTargetService}에 노출하고자 하는 액티비티마다 {@code <meta-data>} 요소를 하나씩 추가하고, 앱 매니페스트에 {@code "android.service.chooser.chooser_target_service"} 이름을 추가합니다.
 
 
 </p>
diff --git a/docs/html-intl/intl/ko/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/ko/training/basics/activity-lifecycle/starting.jd
index 71ecf06..ef13487 100644
--- a/docs/html-intl/intl/ko/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/ko/training/basics/activity-lifecycle/starting.jd
@@ -150,7 +150,7 @@
 
 <p>앱의 메인 액티비티는 {@link
 android.content.Intent#ACTION_MAIN MAIN} 작업 및{@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER} 카테고리를 포함하는 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>와 함께
+<intent-filter>}</a>와 함께
 매니페스트 파일에 선언되어야 합니다. 예를 들면 다음과 같습니다.</p> 
 
 <pre>
diff --git a/docs/html-intl/intl/ko/training/basics/intents/filters.jd b/docs/html-intl/intl/ko/training/basics/intents/filters.jd
index 265534c..251d262 100644
--- a/docs/html-intl/intl/ko/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/ko/training/basics/intents/filters.jd
@@ -31,8 +31,8 @@
 "공유" 작업을 시작하고 이 작업을 수행하기 위해 여러분 자신의 앱을 시작할 수 있도록
 {@link android.content.Intent#ACTION_SEND} 인텐트를 지원하는 것이 좋습니다.</p>
 
-<p>다른 앱이 자신의 액티비티를 시작할 수 있도록 하기 위해서는 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
-요소에 상응하는 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 요소를 매니페스트 파일에 추가해야 합니다.</p>
+<p>다른 앱이 자신의 액티비티를 시작할 수 있도록 하기 위해서는 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
+요소에 상응하는 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 요소를 매니페스트 파일에 추가해야 합니다.</p>
 
 <p>앱이 기기에 설치되면 시스템이 인텐트
 필터를 식별한 후 설치된 모든 앱에서 지원되는 인텐트의 내부 카탈로그에 해당 정보를 추가합니다.
@@ -56,13 +56,13 @@
   <dt>작업</dt>
     <dd>수행할 작업의 이름을 지정하는 문자열입니다. 일반적으로, 플랫폼에서 정의하는 값 중
 하나입니다(예: {@link android.content.Intent#ACTION_SEND} 또는 {@link android.content.Intent#ACTION_VIEW}).
-    <p><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a> 요소를 사용하여 인텐트 필터에 지정합니다.
+    <p><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a> 요소를 사용하여 인텐트 필터에 지정합니다.
 이 요소에 지정하는 값은 API 상수 대신
 작업의 전체 문자열 이름이어야 합니다(다음 예제 참조).</p></dd>
 
   <dt>데이터</dt>
     <dd>인텐트와 관련된 데이터에 대한 설명입니다.
-    <p><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> 요소를 사용하여 인텐트 필터에 지정합니다. 이 요소에서
+    <p><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> 요소를 사용하여 인텐트 필터에 지정합니다. 이 요소에서
 하나 이상의 특성을 사용하여 MIME 유형, URI 접두사, URI 스키마, 또는
 이들의 조합 그리고 수락된 데이터 유형을 나타내는 다른 요소들을 지정할 수
 있습니다.</p>
@@ -76,12 +76,12 @@
 관련되어 있습니다. 시스템이 지원하는 카테고리는
 여러 가지가 있지만 대부분은 거의 사용되지 않습니다. 하지만 모든 암묵적인 인텐트는 기본적으로
 {@link android.content.Intent#CATEGORY_DEFAULT}로 정의됩니다.
-    <p><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a> 요소를 사용하여 인텐트 필터에
+    <p><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a> 요소를 사용하여 인텐트 필터에
 지정합니다.</p></dd>
 </dl>
 
 <p>인텐트 필터에서 액티비티가 허용하는 기준을 선언할 수 있습니다.
-이는 이러한 기준 각각을 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 요소 내에 해당 XML 요소를 중첩하여 선언하면
+이는 이러한 기준 각각을 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 요소 내에 해당 XML 요소를 중첩하여 선언하면
 가능합니다.</p>
 
 <p>예를 들어, 다음은 데이터 유형이 텍스트 또는 이미지인 경우 {@link
@@ -100,10 +100,10 @@
 
 <p>수신되는 인텐트는 각각 하나의 작업 및 하나의 데이터 유형만 지정합니다. 하지만
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> 각각에 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> 및 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a>에 대한 여러
+<intent-filter>}</a> 각각에 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
+<action>}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a> 및 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a>에 대한 여러
 인스턴스를 선언해도 문제가 되지는 않습니다.</p>
 
 <p>작업 및 데이터의 두 쌍이 상호 배타적으로
diff --git a/docs/html-intl/intl/pt-br/preview/api-overview.jd b/docs/html-intl/intl/pt-br/preview/api-overview.jd
index 33e8c1f..139fb33 100644
--- a/docs/html-intl/intl/pt-br/preview/api-overview.jd
+++ b/docs/html-intl/intl/pt-br/preview/api-overview.jd
@@ -133,8 +133,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>No Windows, talvez seja necessário executar {@code telnet 127.0.0.1 &lt;emulator-id&gt;} seguido de 
-{@code finger touch &lt;finger_id&gt;}.
+<p>No Windows, talvez seja necessário executar {@code telnet 127.0.0.1 <emulator-id>} seguido de
+{@code finger touch <finger_id>}.
 </p>
 </li>
 </ol>
@@ -192,7 +192,7 @@
 </pre>
 
 <p>Para cada atividade que quiser expor ao {@code ChooserTargetService}, adicione um elemento 
-{@code &lt;meta-data&gt;} com o nome 
+{@code <meta-data>} com o nome
 {@code "android.service.chooser.chooser_target_service"} no manifesto do aplicativo.
 </p>
 
diff --git a/docs/html-intl/intl/pt-br/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/pt-br/training/basics/activity-lifecycle/starting.jd
index 1f8f080..efe2bad 100644
--- a/docs/html-intl/intl/pt-br/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/pt-br/training/basics/activity-lifecycle/starting.jd
@@ -149,7 +149,7 @@
 na raiz do diretório do seu projeto.</p>
 
 <p>A principal atividade do aplicativo deve ser declarada no manifesto com um <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> que inclui a ação {@link
+<intent-filter>}</a> que inclui a ação {@link
 android.content.Intent#ACTION_MAIN MAIN} e categoria
 {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER}. Por exemplo:</p> 
 
diff --git a/docs/html-intl/intl/pt-br/training/basics/intents/filters.jd b/docs/html-intl/intl/pt-br/training/basics/intents/filters.jd
index 73f0b84..f3b3b12 100644
--- a/docs/html-intl/intl/pt-br/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/pt-br/training/basics/intents/filters.jd
@@ -31,8 +31,8 @@
 que ele possa responder à intenção {@link android.content.Intent#ACTION_SEND} para que os usuários consigam iniciar uma
 ação de “compartilhar” por outro aplicativo e iniciar seu aplicativo para executar a ação.</p>
 
-<p>Para permitir que outros aplicativos iniciem sua atividade, adicione um elemento <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
-em seu arquivo de manifesto para o elemento <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> correspondente.</p>
+<p>Para permitir que outros aplicativos iniciem sua atividade, adicione um elemento <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
+em seu arquivo de manifesto para o elemento <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> correspondente.</p>
 
 <p>Quando seu aplicativo é instalado em um dispositivo, o sistema identifica seu filtro de
 intenções e adiciona a informação a um catálogo interno de intenções suportado por todos os aplicativos instalados.
@@ -56,13 +56,13 @@
   <dt>Ação</dt>
     <dd>Uma cadeia de caracteres que dá nome a ação a ser executada. Geralmente, um dos valores definidos para a plataforma
 como {@link android.content.Intent#ACTION_SEND} ou {@link android.content.Intent#ACTION_VIEW}.
-    <p>Especifique-o em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a>.
+    <p>Especifique-o em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a>.
 O valor especificado neste elemento deve ser o nome completo da cadeia de caracteres para a ação e não a
 API constante (veja exemplos abaixo).</p></dd>
 
   <dt>Dados</dt>
     <dd>A descrição dos dados associados à intenção.
-    <p>Especifique-a em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a>. Através de um
+    <p>Especifique-a em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a>. Através de um
 ou mais atributos neste elemento, você pode especificar apenas o tipo MIME, apenas um prefixo de URI,
 apenas um esquema de URI ou uma combinação destes e outros elementos que indicam o tipo de dados
 aceito.</p>
@@ -76,12 +76,12 @@
 ao gesto do usuário ou localização onde foi iniciada. Há diferentes categorias
 compatíveis com o sistema, mas a maioria raramente é utilizada. No entanto, todas as intenções implícitas são definidas com
 {@link android.content.Intent#CATEGORY_DEFAULT} por padrão.
-    <p>Especifique-a em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a>
+    <p>Especifique-a em seu filtro de intenções com o elemento <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>
 .</p></dd>
 </dl>
 
 <p>Em seu filtro de intenções, declare quais critérios serão aceitos por sua atividade
-informando cada um deles com elementos XML correspondentes aninhados no elemento <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+informando cada um deles com elementos XML correspondentes aninhados no elemento <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 .</p>
 
 <p>Este é um exemplo de atividade com filtro de intenções que responde à intenção {@link
@@ -100,11 +100,11 @@
 
 <p>Cada intenção em entrada especifica apenas uma ação e um tipo de dado, mas pode-se declarar
 múltiplas instâncias dos elementos <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> e <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> em cada
+<action>}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a> e <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> em cada
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>.</p>
+<intent-filter>}</a>.</p>
 
 <p>Se dois pares de ação e dados fores mutuamente exclusivos em
 seus comportamentos, crie filtros de intenções separados para especificar quais ações são aceitáveis
diff --git a/docs/html-intl/intl/ru/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/ru/distribute/googleplay/quality/tv.jd
index 995f2e5..e478f9a 100644
--- a/docs/html-intl/intl/ru/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/ru/distribute/googleplay/quality/tv.jd
@@ -320,7 +320,7 @@
   <td>
     <p style="margin-bottom:.5em;">
       Если приложение использует игровой контроллер в качестве основного устройства ввода,
- это требование должно быть задекларировано в теге манифеста <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>.
+ это требование должно быть задекларировано в теге манифеста <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>.
       (<a href="{@docRoot}training/tv/games/index.html#gamepad">См. как это сделать</a>)
     </p>
   </td>
diff --git a/docs/html-intl/intl/ru/google/play/filters.jd b/docs/html-intl/intl/ru/google/play/filters.jd
index f9af767..0059a1a 100644
--- a/docs/html-intl/intl/ru/google/play/filters.jd
+++ b/docs/html-intl/intl/ru/google/play/filters.jd
@@ -329,23 +329,23 @@
   <tr><th>Элемент манифеста</th><th>Сводная информация</th></tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
+<compatible-screens>}</a></nobr></td>
     <td>
       <p>Google Play отфильтровывает приложение, если размер и разрешение экрана устройства
-не соответствуют какой-либо конфигурации экрана(декларируемые элементом {@code &lt;screen&gt;}) в элементе {@code
-&lt;compatible-screens&gt;}.</p>
+не соответствуют какой-либо конфигурации экрана(декларируемые элементом {@code <screen>}) в элементе {@code
+<compatible-screens>}.</p>
       <p class="caution"><strong>Внимание!</strong> В обычной практике <strong>вы не должны использовать
 этот элемент манифеста</strong>. Применение этого элемента существенно
 сокращает число потенциальных пользователей вашего приложения, исключая все комбинации размеров
 и разрешения экрана, которые не указаны в списке. Вместо этого используйте элемент манифеста <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> (описанный выше в <a href="#table1">
+<supports-screens>}</a> (описанный выше в <a href="#table1">
 таблице 1</a>), чтобы определить режим совместимости для неучтенных альтернативными ресурсами
 конфигураций экранов.</p>
     </td>
   </tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
+<supports-gl-texture>}</a></nobr></td>
     <td>
       <p>Google Play будет отфильтровывать приложение, если не окажется ни одного формата
 сжатия GL-текстуры, поддерживаемого устройством. </p>
@@ -408,16 +408,16 @@
 <ul>
   <li>Форматы сжатия текстур OpenGL
     <p>Используя элемент <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a>.</p>
+<supports-gl-texture>}</a>.</p>
   </li>
   <li>Размер экрана (а в некоторых случаях и разрешение)
     <p>Используя элемент <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> или <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a>.</p>
+<supports-screens>}</a> или <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+<compatible-screens>}</a>.</p>
   </li>
   <li>Уровень API-интерфейса
     <p>Используя элемент <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk&gt;}</a>.</p>
+<uses-sdk>}</a>.</p>
   </li>
   <li>Архитектура процессора (ABI)
     <p>Включая специфичные библиотеки, созданные на основе <a href="{@docRoot}tools/sdk/ndk/index.html">Android
diff --git a/docs/html-intl/intl/ru/preview/api-overview.jd b/docs/html-intl/intl/ru/preview/api-overview.jd
index ae30e09..aa4a057 100644
--- a/docs/html-intl/intl/ru/preview/api-overview.jd
+++ b/docs/html-intl/intl/ru/preview/api-overview.jd
@@ -133,8 +133,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>В Windows, возможно, потребуется выполнить команду {@code telnet 127.0.0.1 &lt;emulator-id&gt;}, а затем
-{@code finger touch &lt;finger_id&gt;}.
+<p>В Windows, возможно, потребуется выполнить команду {@code telnet 127.0.0.1 <emulator-id>}, а затем
+{@code finger touch <finger_id>}.
 </p>
 </li>
 </ol>
@@ -192,7 +192,7 @@
 </pre>
 
 <p>Для каждого действия, которое необходимо сделать доступным для {@code ChooserTargetService}, добавьте в манифест вашего приложения элемент
-{@code &lt;meta-data&gt;} с именем
+{@code <meta-data>} с именем
 {@code "android.service.chooser.chooser_target_service"}.
 </p>
 
diff --git a/docs/html-intl/intl/ru/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/ru/training/basics/activity-lifecycle/starting.jd
index 3a946e2..ef8be5b 100644
--- a/docs/html-intl/intl/ru/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/ru/training/basics/activity-lifecycle/starting.jd
@@ -149,7 +149,7 @@
 который находится в корневом каталоге вашего проекта.</p>
 
 <p>Основная операция приложения должна декларироваться в манифесте с помощью фильтра <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>, включающего действие {@link
+<intent-filter>}</a>, включающего действие {@link
 android.content.Intent#ACTION_MAIN MAIN} и категорию
 {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER}. Например:</p> 
 
diff --git a/docs/html-intl/intl/ru/training/basics/intents/filters.jd b/docs/html-intl/intl/ru/training/basics/intents/filters.jd
index 0f5bb31..c3cbfc9 100644
--- a/docs/html-intl/intl/ru/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/ru/training/basics/intents/filters.jd
@@ -31,8 +31,8 @@
 будет поддерживать объекты Intent (намерения) {@link android.content.Intent#ACTION_SEND}, чтобы пользователи могли
 поделиться контентом из другого приложения и запускать ваше приложение для выполнения требуемого действия.</p>
 
-<p>Чтобы разрешить другим приложениям запускать ваши операции, вам нужно добавить в ваш файл манифеста элемент <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
- для соответствующего элемента <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>.</p>
+<p>Чтобы разрешить другим приложениям запускать ваши операции, вам нужно добавить в ваш файл манифеста элемент <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
+ для соответствующего элемента <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>.</p>
 
 <p>Если ваше приложение установлено на устройстве, система идентифицирует ваши
 фильтры Intent и добавляет информацию во внутренний каталог намерений, поддерживаемый всеми установленными приложениями.
@@ -56,13 +56,13 @@
   <dt>Действие</dt>
     <dd>Строка, называющая действие, которое необходимо выполнить. Обычно это одно из определяемых платформой значений,
 например, {@link android.content.Intent#ACTION_SEND} или {@link android.content.Intent#ACTION_VIEW}.
-    <p>Это следует указать в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a>.
+    <p>Это следует указать в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a>.
 Указанное в этом элементе значение должно представлять собой полное имя строки действия, а не
 постоянное значение API-интерфейса (см. примеры ниже).</p></dd>
 
   <dt>Данные</dt>
     <dd>Описание данных, связанных с объектом Intent.
-    <p>Указывается в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a>. Используя один
+    <p>Указывается в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a>. Используя один
 или несколько атрибутов в этом элементе, вы можете указать только тип MIME, только префикс URI,
 только схему URI или из сочетание, а также другие индикаторы типа
 принимаемых данных.</p>
@@ -76,12 +76,12 @@
 с жестом пользователя или местом запуска. Система поддерживает несколько разных категорий,
 но большинство из них используется редко. Однако по умолчанию все неявные объекты Intent определяются с
 {@link android.content.Intent#CATEGORY_DEFAULT}.
-    <p>Это указывается в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a>
+    <p>Это указывается в фильтре Intent с элементом <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>
 .</p></dd>
 </dl>
 
 <p>В своем фильтре Intent вы можете декларировать критерии, принимаемые вашей операцией.
-Для этого нужно декларировать каждый из них с соответствующими элементами XML, вложенными в элемент <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+Для этого нужно декларировать каждый из них с соответствующими элементами XML, вложенными в элемент <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 .</p>
 
 <p>Рассмотрим в качестве примера операцию с фильтром Intent, обрабатывающим объект {@link
@@ -100,11 +100,11 @@
 
 <p>Каждый входящий объект Intent указывает только одно действие и только один тип данных, однако допускается декларирование нескольких
 экземпляров элементов <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> и <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> в каждом
+<action>}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a> и <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> в каждом
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>.</p>
+<intent-filter>}</a>.</p>
 
 <p>Если поведение любых двух пар действий и данных является взаимоисключающим,
 необходимо создать отдельные фильтры Intent с указанием допустимых действий
diff --git a/docs/html-intl/intl/zh-cn/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/zh-cn/distribute/googleplay/quality/tv.jd
index 5eea293..6a60945 100644
--- a/docs/html-intl/intl/zh-cn/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/zh-cn/distribute/googleplay/quality/tv.jd
@@ -320,7 +320,7 @@
   <td>
     <p style="margin-bottom:.5em;">
       如果应用使用游戏手柄作为主要输入方法,则要通过
-<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>清单文件标记来声明相应的要求。
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>清单文件标记来声明相应的要求。
       (<a href="{@docRoot}training/tv/games/index.html#gamepad">了解方法</a>)
     </p>
   </td>
diff --git a/docs/html-intl/intl/zh-cn/google/play/filters.jd b/docs/html-intl/intl/zh-cn/google/play/filters.jd
index 70f8d9b..9d68faf 100644
--- a/docs/html-intl/intl/zh-cn/google/play/filters.jd
+++ b/docs/html-intl/intl/zh-cn/google/play/filters.jd
@@ -329,23 +329,23 @@
   <tr><th>清单文件元素</th><th>摘要</th></tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
+<compatible-screens>}</a></nobr></td>
     <td>
       <p>如果设备屏幕尺寸和密度不符合
  {@code
-&lt;compatible-screens&gt;} 元素中的任何屏幕配置(由{@code &lt;screen&gt;} 元素声明),则 Google Play 会将该应用筛选掉。</p>
+<compatible-screens>} 元素中的任何屏幕配置(由{@code <screen>} 元素声明),则 Google Play 会将该应用筛选掉。</p>
       <p class="caution"><strong>注意:</strong>正常情况下,<strong>不能使用此清单文件元素</strong>。
 使用此元素可能会显著减少应用的潜在用户群,因为排除了您未列出的所有屏幕尺寸和密度组合。
 
 应当改用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> 清单文件元素(上面<a href="#table1">表
+<supports-screens>}</a> 清单文件元素(上面<a href="#table1">表
 1</a> 所述),通过替代资源为您没有考虑的屏幕配置启用屏幕兼容模式。
 </p>
     </td>
   </tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
+<supports-gl-texture>}</a></nobr></td>
     <td>
       <p>除非应用所支持的一种或多种 GL 纹理压缩格式也受到设备支持,否则 Google Play 将应用筛选掉。
  </p>
@@ -408,16 +408,16 @@
 <ul>
   <li>OpenGL 纹理压缩格式
     <p>使用 <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a> 元素。</p>
+<supports-gl-texture>}</a> 元素。</p>
   </li>
   <li>屏幕尺寸(以及可选的屏幕密度)
     <p>使用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> 或 <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a> 元素。</p>
+<supports-screens>}</a> 或 <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+<compatible-screens>}</a> 元素。</p>
   </li>
   <li>API 级别
     <p>使用 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk&gt;}</a> 元素。</p>
+<uses-sdk>}</a> 元素。</p>
   </li>
   <li>CPU 架构 (ABI)
     <p>包括针对特定 CPU 架构(例如 ARM EABI v7 或 x86)的、通过 <a href="{@docRoot}tools/sdk/ndk/index.html">Android
diff --git a/docs/html-intl/intl/zh-cn/preview/api-overview.jd b/docs/html-intl/intl/zh-cn/preview/api-overview.jd
index c64a38e..f7764cd 100644
--- a/docs/html-intl/intl/zh-cn/preview/api-overview.jd
+++ b/docs/html-intl/intl/zh-cn/preview/api-overview.jd
@@ -134,7 +134,7 @@
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
 <p>在 Windows 上,您可能需要运行带有 
-{@code finger touch &lt;finger_id&gt;} 参数的 {@code telnet 127.0.0.1 &lt;emulator-id&gt;} 命令。
+{@code finger touch <finger_id>} 参数的 {@code telnet 127.0.0.1 <emulator-id>} 命令。
 </p>
 </li>
 </ol>
@@ -193,7 +193,7 @@
 
 <p>对于您想要向 {@code ChooserTargetService} 公开的每个活动,请在您的应用清单文件中为其添加一个名为 
 {@code "android.service.chooser.chooser_target_service"} 的 
-{@code &lt;meta-data&gt;} 元素。
+{@code <meta-data>} 元素。
 </p>
 
 <pre>
diff --git a/docs/html-intl/intl/zh-cn/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/zh-cn/training/basics/activity-lifecycle/starting.jd
index 05f9728..cebd748 100644
--- a/docs/html-intl/intl/zh-cn/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/zh-cn/training/basics/activity-lifecycle/starting.jd
@@ -149,7 +149,7 @@
 </p>
 
 <p>您的应用的主Activity必须使用 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>(包括 {@link
+<intent-filter>}</a>(包括 {@link
 android.content.Intent#ACTION_MAIN MAIN} 操作和
 {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER} 类别)在宣示说明中声明。例如:</p> 
 
diff --git a/docs/html-intl/intl/zh-cn/training/basics/intents/filters.jd b/docs/html-intl/intl/zh-cn/training/basics/intents/filters.jd
index 4bcbdf9..ff5c792 100644
--- a/docs/html-intl/intl/zh-cn/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/zh-cn/training/basics/intents/filters.jd
@@ -31,8 +31,8 @@
 
 </p>
 
-<p>要允许其他应用开始您的Activity,您需要 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
-在相应元素的宣示说明文件中添加一个 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> 元素。</p>
+<p>要允许其他应用开始您的Activity,您需要 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
+在相应元素的宣示说明文件中添加一个 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> 元素。</p>
 
 <p>当您的应用安装在设备上时,系统会识别您的意向过滤器并添加信息至所有已安装应用支持的意向内部目录。当应用通过隐含意向调用 {@link android.app.Activity#startActivity
 startActivity()} 或 {@link android.app.Activity#startActivityForResult startActivityForResult()} 时,系统会找到可以响应该意向的Activity。
@@ -56,13 +56,13 @@
   <dt>操作</dt>
     <dd>对要执行的操作命名的字符串。通常是平台定义的值之一,比如
  {@link android.content.Intent#ACTION_SEND} 或 {@link android.content.Intent#ACTION_VIEW}。
-    <p>使用 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a> 元素在您的意向过滤器中指定此值。您在此元素中指定的值必须是操作的完整字符串名称,而不是 API 常数(请参阅以下示例)。
+    <p>使用 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a> 元素在您的意向过滤器中指定此值。您在此元素中指定的值必须是操作的完整字符串名称,而不是 API 常数(请参阅以下示例)。
 
 </p></dd>
 
   <dt>数据</dt>
     <dd>与意向关联的数据描述。
-    <p>用 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> 元素在您的意向过滤器中指定此内容。使用此元素中的一个或多个属性,您可以只指定 MIME 类型、URI 前缀、URI 架构或这些的组合以及其他指示所接受数据类型的项。
+    <p>用 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> 元素在您的意向过滤器中指定此内容。使用此元素中的一个或多个属性,您可以只指定 MIME 类型、URI 前缀、URI 架构或这些的组合以及其他指示所接受数据类型的项。
 
 
 </p>
@@ -76,11 +76,11 @@
 系统支持多种不同的类别,但大多数都很少使用。
 但是,所有隐含意向默认使用
 {@link android.content.Intent#CATEGORY_DEFAULT} 进行定义。
-    <p>用 <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a>
+    <p>用 <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>
  元素在您的意向过滤器中指定此内容。</p></dd>
 </dl>
 
-<p>在您的意向过滤器中,您可以通过声明嵌套在 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+<p>在您的意向过滤器中,您可以通过声明嵌套在 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 元素中的具有相应 XML 元素的各项,来声明您的Activity接受的条件。
 </p>
 
@@ -100,11 +100,11 @@
 
 <p>每个入站意向仅指定一项操作和一个数据类型,但可以在每个
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html"> {@code
-&lt;intent-filter&gt;}</a> 中声明
+<intent-filter>}</a> 中声明
  <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> 和 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> 元素的多个实例。</p>
+<action>}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a> 和 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> 元素的多个实例。</p>
 
 <p>如果任何两对操作和数据的行为相斥,您应创建单独的意向过滤器指定与哪种数据类型配对时哪些操作可接受。
 
diff --git a/docs/html-intl/intl/zh-tw/distribute/googleplay/quality/tv.jd b/docs/html-intl/intl/zh-tw/distribute/googleplay/quality/tv.jd
index 9329606..996df61 100644
--- a/docs/html-intl/intl/zh-tw/distribute/googleplay/quality/tv.jd
+++ b/docs/html-intl/intl/zh-tw/distribute/googleplay/quality/tv.jd
@@ -285,7 +285,7 @@
   </td>
   <td>
     <p style="margin-bottom:.5em;">
-      若應用程式將遊戲手把用作主要輸入方式,會使用 <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> 宣示說明標籤宣告相應的需求。(<a href="{@docRoot}training/tv/games/index.html#gamepad">進行了解</a>)
+      若應用程式將遊戲手把用作主要輸入方式,會使用 <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> 宣示說明標籤宣告相應的需求。(<a href="{@docRoot}training/tv/games/index.html#gamepad">進行了解</a>)
     </p>
   </td>
 </tr>
diff --git a/docs/html-intl/intl/zh-tw/google/play/filters.jd b/docs/html-intl/intl/zh-tw/google/play/filters.jd
index 8cfd59a..e96b9dd 100644
--- a/docs/html-intl/intl/zh-tw/google/play/filters.jd
+++ b/docs/html-intl/intl/zh-tw/google/play/filters.jd
@@ -208,14 +208,14 @@
 <table>
   <tr><th>宣示說明元素</th><th>摘要</th></tr>
   <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code &lt;compatible-screens&gt;}</a></nobr></td>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code <compatible-screens>}</a></nobr></td>
     <td>
-      <p>若裝置螢幕大小與密度不符合元素中的{@code &lt;compatible-screens&gt;}任何螢幕組態 (由 {@code &lt;screen&gt;} 元素宣告),Google Play 會對應用程式進行篩選。</p>
-      <p class="caution"><strong>注意:</strong>通常,<strong>您不應使用此宣示說明元素</strong>。若使用此元素,會將您未列出的螢幕大小與密度的所有組合排除在外,從而大幅減少您應用程式可能擁有的使用者。您應改為針對未使用替代資源說明的螢幕組態,使用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code &lt;supports-screens&gt;}</a> 宣示說明元素 (如<a href="#table1">表 1</a> 所述) 啟用螢幕相容性模式。</p>
+      <p>若裝置螢幕大小與密度不符合元素中的{@code <compatible-screens>}任何螢幕組態 (由 {@code <screen>} 元素宣告),Google Play 會對應用程式進行篩選。</p>
+      <p class="caution"><strong>注意:</strong>通常,<strong>您不應使用此宣示說明元素</strong>。若使用此元素,會將您未列出的螢幕大小與密度的所有組合排除在外,從而大幅減少您應用程式可能擁有的使用者。您應改為針對未使用替代資源說明的螢幕組態,使用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code <supports-screens>}</a> 宣示說明元素 (如<a href="#table1">表 1</a> 所述) 啟用螢幕相容性模式。</p>
     </td>
   </tr>
   <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code &lt;supports-gl-texture&gt;}</a></nobr></td>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code <supports-gl-texture>}</a></nobr></td>
     <td>
       <p>除非裝置支援應用程式所支援的一或多個 GL 材質壓縮格式,否則 Google Play 會對應用程式進行篩選。 </p>
     </td>
@@ -249,11 +249,11 @@
 
 <p>目前,只有在每個 APK 根據以下組態提供不同的篩選器時,Google Play 才允許您針對同一應用程式發行多個 APK:</p>
 <ul>
-  <li>OpenGL 材質壓縮格式 <p>透過使用 <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code &lt;supports-gl-texture&gt;}</a>元素。</p>
+  <li>OpenGL 材質壓縮格式 <p>透過使用 <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code <supports-gl-texture>}</a>元素。</p>
   </li>
-  <li>螢幕大小 (以及可選的螢幕密度) <p>透過使用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code &lt;supports-screens&gt;}</a>或<a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code &lt;compatible-screens&gt;}</a> 元素。</p>
+  <li>螢幕大小 (以及可選的螢幕密度) <p>透過使用 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code <supports-screens>}</a>或<a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code <compatible-screens>}</a> 元素。</p>
   </li>
-  <li>API 層級 <p>透過使用 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>元素。</p>
+  <li>API 層級 <p>透過使用 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>元素。</p>
   </li>
   <li>CPU 架構 (ABI) <p>透過納入使用 <a href="{@docRoot}tools/sdk/ndk/index.html">Android NDK</a> (針對諸如 ARM EABI v7 或 x86 等特定 CPU 架構) 而建置的原生資源庫。</p>
   </li>
diff --git a/docs/html-intl/intl/zh-tw/preview/api-overview.jd b/docs/html-intl/intl/zh-tw/preview/api-overview.jd
index f6c5696..a68f0cd 100644
--- a/docs/html-intl/intl/zh-tw/preview/api-overview.jd
+++ b/docs/html-intl/intl/zh-tw/preview/api-overview.jd
@@ -133,8 +133,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>在 Windows 上,您可能必須執行 {@code telnet 127.0.0.1 &lt;emulator-id&gt;},後面接著
-{@code finger touch &lt;finger_id&gt;}。
+<p>在 Windows 上,您可能必須執行 {@code telnet 127.0.0.1 <emulator-id>},後面接著
+{@code finger touch <finger_id>}。
 </p>
 </li>
 </ol>
@@ -193,7 +193,7 @@
 
 <p>針對您要向 {@code ChooserTargetService} 公開的每個活動,在您的應用程式宣示說明中,新增名稱為
 {@code "android.service.chooser.chooser_target_service"} 的
-{@code &lt;meta-data&gt;} 元素。
+{@code <meta-data>} 元素。
 </p>
 
 <pre>
diff --git a/docs/html-intl/intl/zh-tw/training/basics/activity-lifecycle/starting.jd b/docs/html-intl/intl/zh-tw/training/basics/activity-lifecycle/starting.jd
index 3453ac5..fae2fa3 100644
--- a/docs/html-intl/intl/zh-tw/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html-intl/intl/zh-tw/training/basics/activity-lifecycle/starting.jd
@@ -149,7 +149,7 @@
 </p>
 
 <p>必須在宣示說明中使用 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> (包括 {@link
+<intent-filter>}</a> (包括 {@link
 android.content.Intent#ACTION_MAIN MAIN} 行為與 {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER} 類別) 宣告您應用程式的主要應用行為顯示。
 例如:</p> 
 
diff --git a/docs/html-intl/intl/zh-tw/training/basics/intents/filters.jd b/docs/html-intl/intl/zh-tw/training/basics/intents/filters.jd
index 2088b27..6b4eebf 100644
--- a/docs/html-intl/intl/zh-tw/training/basics/intents/filters.jd
+++ b/docs/html-intl/intl/zh-tw/training/basics/intents/filters.jd
@@ -31,7 +31,7 @@
 
 </p>
 
-<p>若要允許其他應用程式啟動您的應用行為顯示,需要在您的宣示說明檔案中針對對應的 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> 元素新增 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 元素。
+<p>若要允許其他應用程式啟動您的應用行為顯示,需要在您的宣示說明檔案中針對對應的 <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> 元素新增 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 元素。
 </p>
 
 <p>若您的應用程式安裝在裝置上,系統會識別您的意圖篩選器,並將資訊新增至安裝的所有應用程式都支援的意圖內部目錄中。在應用程式使用隱含意圖呼叫 {@link android.app.Activity#startActivity
@@ -56,13 +56,13 @@
   <dt>行為</dt>
     <dd>對要執行的行為進行命名的字串。通常是平台所定義值 (例如 {@link android.content.Intent#ACTION_SEND} 或 {@link android.content.Intent#ACTION_VIEW}) 的其中之一。
 
-    <p>請在您的意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a> 元素指定此項目。在此元素中指定的值必須是行為的完整字串名稱,而非 API 常數 (請參閱以下範例)。
+    <p>請在您的意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a> 元素指定此項目。在此元素中指定的值必須是行為的完整字串名稱,而非 API 常數 (請參閱以下範例)。
 
 </p></dd>
 
   <dt>資料</dt>
     <dd>對意圖所關聯資料的描述。
-    <p>請在意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> 元素指定此項目。在此元素中使用一或多個屬性,您可以僅指定 MIME 類型、URI 首碼、URI 配置,或指定這些項目的組合,以及表示所接受資料類型的其他項目。
+    <p>請在意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> 元素指定此項目。在此元素中使用一或多個屬性,您可以僅指定 MIME 類型、URI 首碼、URI 配置,或指定這些項目的組合,以及表示所接受資料類型的其他項目。
 
 
 </p>
@@ -76,11 +76,11 @@
 系統支援多種不同的類別,但大多數類別很少使用。
 然而依預設,所有隱含意圖都與 {@link android.content.Intent#CATEGORY_DEFAULT} 一併定義。
 
-    <p>請在意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a> 元素指定此項目。
+    <p>請在意圖篩選器中使用 <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a> 元素指定此項目。
 </p></dd>
 </dl>
 
-<p>在意圖篩選器中,您可以宣告每個條件以及 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a> 元素中巢套的對應 XML 元素,以宣告應用行為顯示所接受的條件。
+<p>在意圖篩選器中,您可以宣告每個條件以及 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a> 元素中巢套的對應 XML 元素,以宣告應用行為顯示所接受的條件。
 
 </p>
 
@@ -99,10 +99,10 @@
 </pre>
 
 <p>傳入的每項意圖只會指定一項行為與一種資料類型,但是在每個 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> 中,可以宣告 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> 與 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> 元素的多個執行個體。
+<intent-filter>}</a> 中,可以宣告 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
+<action>}</a>、<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a> 與 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> 元素的多個執行個體。
 
 </p>
 
diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd
index e04940b..ff6b681 100644
--- a/docs/html/about/dashboards/index.jd
+++ b/docs/html/about/dashboards/index.jd
@@ -112,10 +112,10 @@
 
 <p>To declare which version of OpenGL ES your application requires, you should use the {@code
 android:glEsVersion} attribute of the <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element. You can also use the <a
 href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a> element to declare the GL compression formats that your application
+<supports-gl-texture>}</a> element to declare the GL compression formats that your application
 uses.</p>
 
 
diff --git a/docs/html/about/versions/android-1.6.jd b/docs/html/about/versions/android-1.6.jd
index 8e97ff6..e727f55 100644
--- a/docs/html/about/versions/android-1.6.jd
+++ b/docs/html/about/versions/android-1.6.jd
@@ -296,7 +296,7 @@
 
     <ul>
       <li>New <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code 
-      &lt;supports-screens>}</a> element lets you specify the device screen sizes that your 
+      <supports-screens>}</a> element lets you specify the device screen sizes that your
       application is designed and tested to support, where "size" is a combination
       of resolution and density. If your application is run on a device whose screen 
       size is not specified in the <code>&lt;supports-screen&gt;</code> element, the system 
@@ -331,7 +331,7 @@
     </p>
     </li>
 
-      <li>New <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a>
+      <li>New <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
         element lets an application specify hardware (or other)
         features that it requires to function normally. When an application
         specifies such features, the system allows the application to be installed only
@@ -345,7 +345,7 @@
         </ul>
       </li>
       <li>New attributes for the 
-      <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk>}</a> element:
+      <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element:
         <ul>
           <li><code>targetSdkVersion</code>: Indicates the API Level that the application is targeting. 
           It is able to run on older versions (down to minSdkVersion), but was explicitly tested to 
diff --git a/docs/html/about/versions/android-2.0-highlights.jd b/docs/html/about/versions/android-2.0-highlights.jd
index 3b23e4d..c16088a 100644
--- a/docs/html/about/versions/android-2.0-highlights.jd
+++ b/docs/html/about/versions/android-2.0-highlights.jd
@@ -159,7 +159,7 @@
       <li>Database API support, for client-side databases using SQL.</li>
       <li>Application cache support, for offline applications.</li>
       <li>Geolocation API support, to provide location information about the device.</li>
-      <li>{@code &lt;video>} tag support in fullscreen mode.</li>
+      <li>{@code <video>} tag support in fullscreen mode.</li>
     </ul>
   </li>
 </ul>
diff --git a/docs/html/about/versions/android-2.3.jd b/docs/html/about/versions/android-2.3.jd
index 4b8ef91..34fdb52 100644
--- a/docs/html/about/versions/android-2.3.jd
+++ b/docs/html/about/versions/android-2.3.jd
@@ -589,7 +589,7 @@
 <ul>
 <li>New <code>xlargeScreens</code> attribute for <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a>
+<supports-screens>}</a>
 element, to indicate whether the application supports
 extra large screen form-factors. For details, see <a
 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
diff --git a/docs/html/about/versions/android-3.0.jd b/docs/html/about/versions/android-3.0.jd
index f319fed..5184743 100644
--- a/docs/html/about/versions/android-3.0.jd
+++ b/docs/html/about/versions/android-3.0.jd
@@ -257,7 +257,7 @@
 such as from a content provider.</p>
 
 <p>The {@link android.appwidget.AppWidgetProviderInfo} class (defined in XML with an {@code
-&lt;appwidget-provider&gt;} element) also supports two new fields: {@link
+<appwidget-provider>} element) also supports two new fields: {@link
 android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} and {@link
 android.appwidget.AppWidgetProviderInfo#previewImage}. The {@link
 android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} field lets you specify the view ID of the
@@ -535,9 +535,9 @@
 
 <p>You can now enable the OpenGL renderer for your application by setting {@code
 android:hardwareAccelerated="true"} in your manifest element's <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element or for individual <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 elements.</p>
 
 <p>This flag helps applications by making them draw faster. This results in smoother animations,
@@ -683,7 +683,7 @@
 href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a>, you can register keyboard
 shortcuts by setting either the {@code android:alphabeticShortcut} or {@code
 android:numericShortcut} attribute for each <a
-href="{@docRoot}guide/topics/resources/menu-resource.html#item-element">{@code &lt;item&gt;}</a>
+href="{@docRoot}guide/topics/resources/menu-resource.html#item-element">{@code <item>}</a>
 element (or with {@link android.view.MenuItem#setShortcut setShortcut()}).</li>
 
 <li>Android 3.0 includes a new "virtual keyboard" device with the id {@link
@@ -715,9 +715,9 @@
 <li>The {@link android.R.attr#splitMotionEvents android:splitMotionEvents} attribute for view groups
 allows you to disable split touch events that occur between child views in a layout. For example:
 <pre>
-&lt;LinearLayout android:splitMotionEvents="false" ... >
+&lt;LinearLayout android:splitMotionEvents="false" ... &gt;
     ...
-&lt;/LinearLayout>
+&lt;/LinearLayout&gt;
 </pre>
 <p>This way, child views in the linear layout cannot split touch events&mdash;only one view can
 receive touch events at a time.</p>
@@ -727,14 +727,14 @@
 allows you to disable split touch events across windows, by applying it to a theme for the activity
 or entire application. For example:
 <pre>
-&lt;style name="NoSplitMotionEvents" parent="android:Theme.Holo">
-    &lt;item name="android:windowEnableSplitTouch">false&lt;/item>
+&lt;style name="NoSplitMotionEvents" parent="android:Theme.Holo"&gt;
+    &lt;item name="android:windowEnableSplitTouch">false&lt;/item&gt;
     ...
-&lt;/style>
+&lt;/style&gt;
 </pre>
 <p>When this theme is applied to an <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> or <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>,
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or <a
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>,
 only touch events within the current activity window are accepted. For example, by disabling split
 touch events across windows, the system bar cannot receive touch events at the same time as the
 activity. This does <em>not</em> affect whether views inside the activity can split touch
@@ -794,7 +794,7 @@
 capabilities of the device. For example, the following HTML provides an input for the user to
 capture a photo to upload:</p>
 <pre>
-&lt;input type="file" accept="image/*;capture=camera" />
+&lt;input type="file" accept="image/*;capture=camera" /&gt;
 </pre>
 <p>Or by excluding the {@code capture=camera} parameter, the user can choose to either capture a
 new image with the camera or select one from the device (such as from the Gallery application).</p>
@@ -850,7 +850,7 @@
 <h3>New feature constants</h3>
 
 <p>The <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> 
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 manfest element should be used to inform external entities (such as Google Play) of the set of
 hardware and software features on which your application depends. In this release, Android adds the
 following new constants that applications can declare with this element:</p>
@@ -868,14 +868,14 @@
 <em>not</em> want your application filtered from devices with an emulated touchscreen, you
 should declare {@link
 android.content.pm.PackageManager#FEATURE_FAKETOUCH "android.hardware.faketouch"} with a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element. This way, your application will be available to the greatest number of device types,
 including those that provide only an emulated touchscreen input.</p>
     <p>All devices that include a touchscreen also support {@link
 android.content.pm.PackageManager#FEATURE_FAKETOUCH "android.hardware.faketouch"}, because
 touchscreen capabilities are a superset of faketouch capabilities. Thus, unless you actually require
 a touchscreen, you should add a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element for faketouch.</p>
   </li>
 </ul>
@@ -889,14 +889,14 @@
   <li>{@link android.Manifest.permission#BIND_REMOTEVIEWS
 "android.permission.BIND_REMOTEVIEWS"}
   <p>This must be declared as a required permission in the <a
-href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service&gt;}</a> manifest
+href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> manifest
 element for an implementation of {@link android.widget.RemoteViewsService}. For example, when
 creating an App Widget that uses {@link android.widget.RemoteViewsService} to populate a
 collection view, the manifest entry may look like this:</p>
 <pre>
 &lt;service android:name=".widget.WidgetService"
     android:exported="false"
-    android:permission="android.permission.BIND_REMOTEVIEWS" />
+    android:permission="android.permission.BIND_REMOTEVIEWS" /&gt;
 </pre>
 </ul>
 
diff --git a/docs/html/about/versions/android-3.1.jd b/docs/html/about/versions/android-3.1.jd
index c22dfaa..cdcf51e 100644
--- a/docs/html/about/versions/android-3.1.jd
+++ b/docs/html/about/versions/android-3.1.jd
@@ -388,8 +388,8 @@
     android:previewImage="@drawable/preview"
     android:initialLayout="@layout/example_appwidget"
     android:configure="com.example.android.ExampleAppWidgetConfigure"
-    android:resizeMode="horizontal|vertical" >
-&lt;/appwidget-provider></pre>
+    android:resizeMode="horizontal|vertical" &gt;
+&lt;/appwidget-provider&gt;</pre>
 
 <p>For more information about Home screen widgets, see the <a
 href="{@docRoot}guide/topics/appwidgets/index.html">App Widgets</a>
@@ -809,7 +809,7 @@
 in this version of the platform. Developers declare these and other feature
 constants in <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> manifest elements.
+<uses-feature>}</a> manifest elements.
 
 <ul>
   <li>{@link android.content.pm.PackageManager#FEATURE_USB_ACCESSORY
@@ -824,7 +824,7 @@
 
 <p>Google Play filters applications based on features declared in <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> manifest elements. For more information about
+<uses-feature>}</a> manifest elements. For more information about
 declaring features in an application manifest, read <a
 href="{@docRoot}google/play/filters.html">Google Play
 Filters</a>.</p>
diff --git a/docs/html/about/versions/android-3.2.jd b/docs/html/about/versions/android-3.2.jd
index ef95337..887755c 100644
--- a/docs/html/about/versions/android-3.2.jd
+++ b/docs/html/about/versions/android-3.2.jd
@@ -481,7 +481,7 @@
 Play of required hardware and software capabilities. You declare these
 and other feature constants in <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> manifest elements.
+<uses-feature>}</a> manifest elements.
 
 <p>Google Play filters applications based on their <code>&lt;uses-feature&gt;</code> attributes, to ensure that they are available only to devices on which their requirements are met. </p>
 
diff --git a/docs/html/about/versions/android-4.0.3.jd b/docs/html/about/versions/android-4.0.3.jd
index 4c2ccb9..fef9ce1 100644
--- a/docs/html/about/versions/android-4.0.3.jd
+++ b/docs/html/about/versions/android-4.0.3.jd
@@ -297,7 +297,7 @@
 application against an Android platform that supports API level {@sdkPlatformApiLevel} or
 higher. Depending on your needs, you might also need to add an
 <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> attribute to the
-<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>
 element.</p>
 
 <p>For more information, see the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API Levels</a>
diff --git a/docs/html/about/versions/android-4.0.jd b/docs/html/about/versions/android-4.0.jd
index cc1d1c7..1b103b7 100644
--- a/docs/html/about/versions/android-4.0.jd
+++ b/docs/html/about/versions/android-4.0.jd
@@ -909,9 +909,9 @@
 
 <p>Applications with a spell checker service must declare the {@link
 android.Manifest.permission#BIND_TEXT_SERVICE} permission as required by the service.
-The service must also declare an intent filter with {@code &lt;action
+The service must also declare an intent filter with {@code <action
 android:name="android.service.textservice.SpellCheckerService" />} as the intent’s action and should
-include a {@code &lt;meta-data&gt;} element that declares configuration information for the spell
+include a {@code <meta-data>} element that declares configuration information for the spell
 checker. </p>
 
 <p>See the sample <a href="{@docRoot}resources/samples/SpellChecker/SampleSpellCheckerService/index.html">
@@ -997,12 +997,12 @@
 action. For example:</p>
 
 <pre>
-&lt;activity android:name="DataPreferences" android:label="@string/title_preferences">
-    &lt;intent-filter>
-       &lt;action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
-       &lt;category android:name="android.intent.category.DEFAULT" />
-    &lt;/intent-filter>
-&lt;/activity>
+&lt;activity android:name="DataPreferences" android:label="@string/title_preferences"&gt;
+    &lt;intent-filter&gt;
+       &lt;action android:name="android.intent.action.MANAGE_NETWORK_USAGE" /&gt;
+       &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+    &lt;/intent-filter&gt;
+&lt;/activity&gt;
 </pre>
 
 <p>This intent filter indicates to the system that this is the activity that controls your
@@ -1054,7 +1054,7 @@
 <p>Applications that manage the device restrictions can now disable the camera using {@link
 android.app.admin.DevicePolicyManager#setCameraDisabled setCameraDisabled()} and the {@link
 android.app.admin.DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} property (applied with a {@code
-&lt;disable-camera /&gt;} element in the policy configuration file).</p>
+<disable-camera />} element in the policy configuration file).</p>
 
 
 <h4>Certificate management</h4>
@@ -1120,10 +1120,10 @@
 allows you to enable “split action bar" so that more action items can appear on the screen in a
 separate bar at the bottom of the screen. To enable split action bar, add {@link
 android.R.attr#uiOptions android:uiOptions} with {@code "splitActionBarWhenNarrow"} to either your
-<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 tag or
 individual <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> tags
+<activity>}</a> tags
 in your manifest file. When enabled, the system will add an additional bar at the bottom of the
 screen for all action items when the screen is narrow (no action items will appear in the primary
 action bar).</p>
@@ -1166,7 +1166,7 @@
 
 <p>To declare an action provider for an action item, include the {@code android:actionProviderClass}
 attribute in the <a href="{@docRoot}guide/topics/resources/menu-resource.html#item-element">{@code
-&lt;item&gt;}</a> element for your activity’s options menu, with the class name of the action
+<item>}</a> element for your activity’s options menu, with the class name of the action
 provider as the value. For example:</p>
 
 <pre>
@@ -1208,7 +1208,7 @@
 <p>To declare that an action item that contains an action view be collapsible, include the {@code
 “collapseActionView"} flag in the {@code android:showAsAction} attribute for the <a
 href="{@docRoot}guide/topics/resources/menu-resource.html#item-element">{@code
-&lt;item&gt;}</a> element in the menu’s XML file.</p>
+<item>}</a> element in the menu’s XML file.</p>
 
 <p>To receive callbacks when an action view switches between expanded and collapsed, register an
 instance of {@link android.view.MenuItem.OnActionExpandListener} with the respective {@link
@@ -1560,8 +1560,8 @@
 <p>If necessary, you can manually disable hardware acceleration with the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#hwaccel">{@code hardwareAccelerated}</a>
 attribute for individual <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> elements or the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+<activity>}</a> elements or the <a
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element. You can alternatively disable hardware acceleration for individual views by calling {@link
 android.view.View#setLayerType setLayerType(LAYER_TYPE_SOFTWARE)}.</p>
 
@@ -1759,7 +1759,7 @@
 href="http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html">
 New Tools for Managing Screen Sizes</a>.</li>
       <li>New constants for <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> to
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> to
 declare landscape or portrait screen orientation requirements.</li>
       <li>The device "screen size" configuration now changes during a screen orientation
 change. If your app targets API level 13 or higher, you must handle the {@code "screenSize"}
@@ -1787,7 +1787,7 @@
 application against an Android platform that supports API level {@sdkPlatformApiLevel} or
 higher. Depending on your needs, you might also need to add an
 <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> attribute to the
-<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>
 element.</p>
 
 <p>For more information, read <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">What is API
diff --git a/docs/html/about/versions/android-4.1.jd b/docs/html/about/versions/android-4.1.jd
index f8770fa..4131c36 100644
--- a/docs/html/about/versions/android-4.1.jd
+++ b/docs/html/about/versions/android-4.1.jd
@@ -149,7 +149,7 @@
 <h3 id="Isolated">Isolated services</h3>
 
 <p>By specifying <a href="{@docRoot}guide/topics/manifest/service-element.html#isolated">{@code android:isolatedProcess="true"}</a> in the 
-<a href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service>}</a> tag, your {@link android.app.Service} will run under
+<a href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> tag, your {@link android.app.Service} will run under
 its own isolated user ID process that has no permissions of its own.</p>
 
 
@@ -196,7 +196,7 @@
 All you need to do is add the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> to each <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element in
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element in
 your manifest file. The system uses this information to open the appropriate activity when the user
 presses the Up button in the action bar (while also finishing the current activity). So if you
 declare the <a href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
@@ -287,7 +287,7 @@
 adding <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> to each <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element.</p>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element.</p>
 
 
 
@@ -889,13 +889,13 @@
 <p>Android 4.1 includes a new feature declaration for devices that are dedicated
 to displaying the user interface on a television screen: {@link
 android.content.pm.PackageManager#FEATURE_TELEVISION}. To declare that your app requires
-a television interface, declare this feature in your manifest file with the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a> element:</p>
+a television interface, declare this feature in your manifest file with the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> element:</p>
 <pre>
-&lt;manifest ... >
+&lt;manifest ... &gt;
     &lt;uses-feature android:name="android.hardware.type.television"
-                  android:required="true" />
+                  android:required="true" /&gt;
     ...
-&lt;/manifest>
+&lt;/manifest&gt;
 </pre>
 
 <p>This feature defines "television" to be a typical living room television experience: 
diff --git a/docs/html/about/versions/android-4.2.jd b/docs/html/about/versions/android-4.2.jd
index 76acb8a..f903156 100644
--- a/docs/html/about/versions/android-4.2.jd
+++ b/docs/html/about/versions/android-4.2.jd
@@ -166,18 +166,18 @@
 
 <p>To make your daydream available to the system, declare your {@link
 android.service.dreams.DreamService} with a <a
-href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service>}</a> element
+href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> element
 in your manifest file. You must then include an intent filter with the action {@code
 "android.service.dreams.DreamService"}. For example:</p>
 
 <pre>
 &lt;service android:name=".MyDream" android:exported="true"
-    android:icon="@drawable/dream_icon" android:label="@string/dream_label" >
-    &lt;intent-filter>
-        &lt;action android:name="android.service.dreams.DreamService" />
-        &lt;category android:name="android.intent.category.DEFAULT" />
-    &lt;/intent-filter>
-&lt;/service>
+    android:icon="@drawable/dream_icon" android:label="@string/dream_label" &gt;
+    &lt;intent-filter&gt;
+        &lt;action android:name="android.service.dreams.DreamService" /&gt;
+        &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+    &lt;/intent-filter&gt;
+&lt;/service&gt;
 </pre>
 
 <p>There are some other useful methods in {@link android.service.dreams.DreamService}
@@ -255,7 +255,7 @@
 secondary screens, you can apply
 a different theme by specifying the {@link
 android.R.attr#presentationTheme android:presentationTheme} attribute in the <a
-href="{@docRoot}guide/topics/resources/style-resource.html">{@code &lt;style>}</a> that you’ve
+href="{@docRoot}guide/topics/resources/style-resource.html">{@code <style>}</a> that you’ve
 applied to your application or activity.</p>
 
 <p>Keep in mind that screens connected to the user’s device often have a larger screen size and
@@ -294,8 +294,8 @@
 <pre>
 &lt;appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
     ...
-    android:widgetCategory="keyguard|home_screen">
-&lt;/appwidget-provider>
+    android:widgetCategory="keyguard|home_screen"&gt;
+&lt;/appwidget-provider&gt;
 </pre>
 
 <p>You should also specify an initial layout for your app widget when on the lock screen with
@@ -399,7 +399,7 @@
 direction, such as Arabic and Hebrew.</p>
 
 <p>To begin supporting RTL layouts in your app, set the {@link android.R.attr#supportsRtl
-android:supportsRtl} attribute to the {@code &lt;application>} element in your manifest file
+android:supportsRtl} attribute to the {@code <application>} element in your manifest file
 and set it {@code “true"}. Once you enable this, the system will enable various RTL APIs to
 display your app with RTL layouts. For instance, the action bar will show the icon and title
 on the right side and action buttons on the left, and any layouts you’ve created with the
@@ -483,7 +483,7 @@
 fragment designs on Android 1.6 and higher.</p>
 
 <p><strong>Note:</strong> You cannot inflate a layout into a fragment when that layout
-includes a {@code &lt;fragment>}. Nested fragments are only supported when added to a
+includes a {@code <fragment>}. Nested fragments are only supported when added to a
 fragment dynamically.</p>
 
 
diff --git a/docs/html/about/versions/android-4.3.jd b/docs/html/about/versions/android-4.3.jd
index 2496854..547b2f8 100644
--- a/docs/html/about/versions/android-4.3.jd
+++ b/docs/html/about/versions/android-4.3.jd
@@ -204,7 +204,7 @@
 app depends on account information that's sensitive, specify the <a
 href="{@docRoot}guide/topics/manifest/application-element.html#requiredAccountType">{@code
 android:requiredAccountType}</a> attribute in your manifest's <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application>}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element.</p>
 
 <p>If you’d like to allow restricted profiles to continue using your app even though they can’t
@@ -298,10 +298,10 @@
 
 <li><strong>Allow access to the owner’s accounts from a restricted profile.</strong>
 <p>To get access to an account from a restricted profile, you must add the <a href="{@docRoot}guide/topics/manifest/application-element.html#restrictedAccountType">{@code android:restrictedAccountType}</a> attribute to the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application></a> tag:</p>
+href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a> tag:</p>
 <pre>
 &lt;application ...
-    android:restrictedAccountType="com.example.account.type" >
+    android:restrictedAccountType="com.example.account.type" &gt;
 </pre>
 
 <p class="caution"><strong>Caution:</strong> Enabling this attribute provides your
@@ -341,10 +341,10 @@
 currently cannot add new accounts), add
 the <a href="{@docRoot}guide/topics/manifest/application-element.html#requiredAccountType">{@code
 android:requiredAccountType}</a> attribute to the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application></a> tag:</p>
+href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a> tag:</p>
 <pre>
 &lt;application ...
-    android:requiredAccountType="com.example.account.type" >
+    android:requiredAccountType="com.example.account.type" &gt;
 </pre>
 <p>For example, the Gmail app uses this attribute to disable itself for restricted profiles,
 because the owner's personal email should not be available to restricted profiles.</p>
@@ -363,10 +363,10 @@
 
 <p>Because Bluetooth LE is a hardware feature that is not available on all
 Android-powered devices, you must declare in your manifest file a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element for {@code "android.hardware.bluetooth_le"}:</p>
 <pre>
-&lt;uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
+&lt;uses-feature android:name="android.hardware.bluetooth_le" android:required="true" /&gt;
 </pre>
 
 <p>If you're already familiar with Android's Classic Bluetooth APIs, notice that using the
@@ -592,13 +592,13 @@
 
 <p>The Java interface for OpenGL ES 3.0 on Android is provided with {@link android.opengl.GLES30}.
 When using OpenGL ES 3.0, be sure that you declare it in your manifest file with the
-<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature></a>
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a>
 tag and the {@code android:glEsVersion} attribute. For example:</p>
 <pre>
-&lt;manifest>
-    &lt;uses-feature android:glEsVersion="0x00030000" />
+&lt;manifest&gt;
+    &lt;uses-feature android:glEsVersion="0x00030000" /&gt;
     ...
-&lt;/manifest>
+&lt;/manifest&gt;
 </pre>
 
 <p>And remember to specify the OpenGL ES context by calling {@link
@@ -740,7 +740,7 @@
 <p style="clear:left">To align the views based on their optical bounds, set the {@code android:layoutMode} attribute to {@code "opticalBounds"} in one of the parent layouts. For example:</p>
 
 <pre>
-&lt;LinearLayout android:layoutMode="opticalBounds" ... >
+&lt;LinearLayout android:layoutMode="opticalBounds" ... &gt;
 </pre>
 
 
@@ -818,7 +818,7 @@
 <h3 id="Orientation">Screen orientation</h3>
 
 <p>The <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 tag's <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code screenOrientation}</a>
 attribute now supports additional values to honor the user's preference for auto-rotation:</p>
@@ -1110,7 +1110,7 @@
 <h3 id="ManifestFeatures">Declarable required features</h3>
 
 <p>The following values are now supported in the <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element so you can ensure that your app is installed only on devices that provide the features
 your app needs.</p>
 
@@ -1120,7 +1120,7 @@
 include a Home screen or similar location where users can embed app widgets.
 Example:
 <pre>
-&lt;uses-feature android:name="android.software.app_widgets" android:required="true" />
+&lt;uses-feature android:name="android.software.app_widgets" android:required="true" /&gt;
 </pre>
 </dd>
 
@@ -1129,7 +1129,7 @@
 devices that support third-party Home screen apps.
 Example:
 <pre>
-&lt;uses-feature android:name="android.software.home_screen" android:required="true" />
+&lt;uses-feature android:name="android.software.home_screen" android:required="true" /&gt;
 </pre>
 </dd>
 
@@ -1139,7 +1139,7 @@
 support third-party input methods.
 Example:
 <pre>
-&lt;uses-feature android:name="android.software.input_methods" android:required="true" />
+&lt;uses-feature android:name="android.software.input_methods" android:required="true" /&gt;
 </pre>
 </dd>
 
@@ -1148,7 +1148,7 @@
 that are capable of communicating with other devices via Bluetooth Low Energy.
 Example:
 <pre>
-&lt;uses-feature android:name="android.software.bluetooth_le" android:required="true" />
+&lt;uses-feature android:name="android.software.bluetooth_le" android:required="true" /&gt;
 </pre>
 </dd>
 </dl>
@@ -1156,7 +1156,7 @@
 
 <h3 id="ManifestPermissions">User permissions</h3>
 <p>The following values are now supported in the <a
-href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code &lt;uses-permission>}</a>
+href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code <uses-permission>}</a>
 to declare the
 permissions your app requires in order to access certain APIs.</p>
 
diff --git a/docs/html/about/versions/android-4.4.jd b/docs/html/about/versions/android-4.4.jd
index 3de2acc..0d58a1d 100644
--- a/docs/html/about/versions/android-4.4.jd
+++ b/docs/html/about/versions/android-4.4.jd
@@ -257,7 +257,7 @@
 
 <p>When running on a device that includes an infrared (IR) transmitter, you can now transmit IR signals using the {@link android.hardware.ConsumerIrManager} APIs. To get an instance of {@link android.hardware.ConsumerIrManager}, call {@link android.content.Context#getSystemService getSystemService()} with {@link android.content.Context#CONSUMER_IR_SERVICE} as the argument. You can then query the device's supported IR frequencies with {@link android.hardware.ConsumerIrManager#getCarrierFrequencies()} and transmit signals by passing your desired frequency and signal pattern with {@link android.hardware.ConsumerIrManager#transmit transmit()}.</p>
 
-<p>You should always first check whether a device includes an IR transmitter by calling {@link android.hardware.ConsumerIrManager#hasIrEmitter()}, but if your app is compatible only with devices that do have one, you should include a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a> element in your manifest for {@code "android.hardware.consumerir"} ({@link android.content.pm.PackageManager#FEATURE_CONSUMER_IR}).</p>
+<p>You should always first check whether a device includes an IR transmitter by calling {@link android.hardware.ConsumerIrManager#hasIrEmitter()}, but if your app is compatible only with devices that do have one, you should include a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> element in your manifest for {@code "android.hardware.consumerir"} ({@link android.content.pm.PackageManager#FEATURE_CONSUMER_IR}).</p>
 
 
 
@@ -372,7 +372,7 @@
 
 <p>Alternatively, you don't need to create a {@link android.transition.Scene} object at all, but can instead call {@link android.transition.TransitionManager#beginDelayedTransition beginDelayedTransition()}, specifying a {@link android.view.ViewGroup} that contains the views you want to change. Then add, remove, or reconfigure the target views. After the system lays out the changes as necessary, a transition starts to animate all the affected views.</p>
 
-<p>For additional control, you can define sets of transitions that should occur between pre-defined scenes, using an XML file in your project {@code res/transition/} directory. Inside a {@code &lt;transitionManager>} element, specify one or more {@code &lt;transition>} tags that each specify a scene (a reference to a layout file) and the transition to apply when entering and/or exiting that scene. Then inflate this set of transitions using {@link android.transition.TransitionInflater#inflateTransitionManager inflateTransitionManager()}. Use the returned {@link android.transition.TransitionManager} to execute each transition with {@link android.transition.TransitionManager#transitionTo transitionTo()}, passing a {@link android.transition.Scene} that is represented by one of the {@code &lt;transition>} tags. You can also define sets of transitions programmatically with the {@link android.transition.TransitionManager} APIs.</p>
+<p>For additional control, you can define sets of transitions that should occur between pre-defined scenes, using an XML file in your project {@code res/transition/} directory. Inside a {@code <transitionManager>} element, specify one or more {@code <transition>} tags that each specify a scene (a reference to a layout file) and the transition to apply when entering and/or exiting that scene. Then inflate this set of transitions using {@link android.transition.TransitionInflater#inflateTransitionManager inflateTransitionManager()}. Use the returned {@link android.transition.TransitionManager} to execute each transition with {@link android.transition.TransitionManager#transitionTo transitionTo()}, passing a {@link android.transition.Scene} that is represented by one of the {@code <transition>} tags. You can also define sets of transitions programmatically with the {@link android.transition.TransitionManager} APIs.</p>
 
 <p>When specifying a transition, you can use several predefined types defined by subclasses of {@link android.transition.Transition}, such as {@link android.transition.Fade} and {@link android.transition.ChangeBounds}. If you don't specify a transition type, the system uses {@link android.transition.AutoTransition} by default, which automatically fades, moves, and resizes views as necessary. Additionally, you can create custom transitions by extending any of these classes to perform the animations however you'd like. A custom transition can track any property changes you'd like, and create any animation you want to based on those changes. For example, you could provide a subclass of {@link android.transition.Transition} that listens for changes to the "rotation" property of a view then animate any changes.</p>
 
@@ -531,7 +531,7 @@
 
 <h2 id="Permissions">App Permissions</h2>
 
-<p>The following are new permissions that your app must request with the <a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code &lt;uses-permission>}</a> tag to use certain new APIs:</p>
+<p>The following are new permissions that your app must request with the <a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code <uses-permission>}</a> tag to use certain new APIs:</p>
 
 <dl>
 <dt>{@link android.Manifest.permission#INSTALL_SHORTCUT}</dt>
@@ -550,7 +550,7 @@
 
 <h2 id="DeviceFeatures">Device Features</h2>
 
-<p>The following are new device features that you can declare with the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}</a> tag to declare your app requirements and enable filtering on Google Play or check for at runtime:</p>
+<p>The following are new device features that you can declare with the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag to declare your app requirements and enable filtering on Google Play or check for at runtime:</p>
 
 <dl>
 <dt>{@link android.content.pm.PackageManager#FEATURE_CONSUMER_IR}</dt>
diff --git a/docs/html/about/versions/android-5.0.jd b/docs/html/about/versions/android-5.0.jd
index 8956076..1bdd2d6 100644
--- a/docs/html/about/versions/android-5.0.jd
+++ b/docs/html/about/versions/android-5.0.jd
@@ -351,7 +351,7 @@
 <p>The Java interface for OpenGL ES 3.1 on Android is provided with
   {@link android.opengl.GLES31}. When using OpenGL ES 3.1, be sure that you
   declare it in your manifest file with the
-  <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> tag and the {@code android:glEsVersion} attribute. For example:</p>
+  <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag and the {@code android:glEsVersion} attribute. For example:</p>
 
 <pre>
 &lt;manifest&gt;
@@ -942,7 +942,7 @@
 
 <h3 id="ManifestFeatures">Declarable required features</h3>
 <p>The following values are now supported in the
-<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element, so you can ensure that your app is installed only on devices that
 provide the features your app needs.</p>
 
@@ -968,7 +968,7 @@
 <h3 id="Permissions">User permissions</h3>
 
 <p>The following permission is now supported in the
-<a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code &lt;uses-permission&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code <uses-permission>}</a>
 element to declare the permissions your app requires to access certain APIs.</p>
 
 <ul>
diff --git a/docs/html/distribute/essentials/quality/tv.jd b/docs/html/distribute/essentials/quality/tv.jd
index c7f6fcb..18c7a32 100644
--- a/docs/html/distribute/essentials/quality/tv.jd
+++ b/docs/html/distribute/essentials/quality/tv.jd
@@ -321,7 +321,7 @@
     <p style="margin-bottom:.5em;">
       If the app uses a game controller as it's primary input method, it declares the appropriate
       requirement with the <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html"
-      >{@code &lt;uses-feature>}</a> manifest tag.
+      >{@code <uses-feature>}</a> manifest tag.
       (<a href="{@docRoot}training/tv/games/index.html#gamepad">Learn how</a>)
     </p>
   </td>
diff --git a/docs/html/google/play/billing/billing_integrate.jd b/docs/html/google/play/billing/billing_integrate.jd
index eb58af4..52973a8 100644
--- a/docs/html/google/play/billing/billing_integrate.jd
+++ b/docs/html/google/play/billing/billing_integrate.jd
@@ -70,7 +70,7 @@
 <li>Select <strong>Google Play Billing Library</strong>.</li>
 <li>Click <strong>Install packages</strong> to complete the download.</li>
 </ol>
-<p>The {@code IInAppBillingService.aidl} file will be installed to {@code &lt;sdk&gt;/extras/google/play_billing/}.</p>
+<p>The {@code IInAppBillingService.aidl} file will be installed to {@code <sdk>/extras/google/play_billing/}.</p>
 
 <p>To add the AIDL to your project:</p>
 <ol>
@@ -85,7 +85,7 @@
 Application</strong> wizard to create a new project in your workspace.</li>
 	<li>In the {@code /src} directory, click <strong>File</strong> &gt;
 <strong>New</strong> &gt; <strong>Package</strong>, then create a package named {@code com.android.vending.billing}.</li>
-	<li>Copy the {@code IInAppBillingService.aidl} file from {@code &lt;sdk&gt;/extras/google/play_billing/} and paste it into the {@code src/com.android.vending.billing/}
+	<li>Copy the {@code IInAppBillingService.aidl} file from {@code <sdk>/extras/google/play_billing/} and paste it into the {@code src/com.android.vending.billing/}
 folder in your workspace.</li>
      </ol>
   </li>
diff --git a/docs/html/google/play/expansion-files.jd b/docs/html/google/play/expansion-files.jd
index 601ea48..0c514b2 100644
--- a/docs/html/google/play/expansion-files.jd
+++ b/docs/html/google/play/expansion-files.jd
@@ -131,7 +131,7 @@
   <dt>{@code main} or {@code patch}</dt>
     <dd>Specifies whether the file is the main or patch expansion file. There can be
 only one main file and one patch file for each APK.</dd>
-  <dt>{@code &lt;expansion-version&gt;}</dt>
+  <dt>{@code <expansion-version>}</dt>
     <dd>This is an integer that matches the version code of the APK with which the expansion is
 <em>first</em> associated (it matches the application's <a
 href="{@docRoot}guide/topics/manifest/manifest-element.html#vcode">{@code android:versionCode}</a>
@@ -139,7 +139,7 @@
     <p>"First" is emphasized because although the Developer Console allows you to
 re-use an uploaded expansion file with a new APK, the expansion file's name does not change&mdash;it
 retains the version applied to it when you first uploaded the file.</p></dd>
-  <dt>{@code &lt;package-name&gt;}</dt>
+  <dt>{@code <package-name>}</dt>
     <dd>Your application's Java-style package name.</dd>
 </dl>
 
@@ -162,9 +162,9 @@
 </pre>
 
 <ul>
-  <li>{@code &lt;shared-storage&gt;} is the path to the shared storage space, available from
+  <li>{@code <shared-storage>} is the path to the shared storage space, available from
 {@link android.os.Environment#getExternalStorageDirectory()}.</li>
-  <li>{@code &lt;package-name&gt;} is your application's Java-style package name, available
+  <li>{@code <package-name>} is your application's Java-style package name, available
 from {@link android.content.Context#getPackageName()}.</li>
 </ul>
 
@@ -464,7 +464,7 @@
     <ol>
       <li>Begin a new Android project.</li>
       <li>Select <strong>Create project from existing
-source</strong> and choose the library from the {@code &lt;sdk&gt;/extras/google/} directory
+source</strong> and choose the library from the {@code <sdk>/extras/google/} directory
 ({@code market_licensing/} for the License Verification Library or {@code
 market_apk_expansion/downloader_library/} for the Downloader Library).</li>
       <li>Specify a <em>Project Name</em> such as "Google Play License Library" and "Google Play
@@ -717,7 +717,7 @@
   </li>
   <li>Start the download by calling the static method {@code
 DownloaderClientMarshaller.startDownloadServiceIfRequired(Context c, PendingIntent
-notificationClient, Class&lt;?> serviceClass)}.
+notificationClient, Class<?> serviceClass)}.
     <p>The method takes the following parameters:</p>
     <ul>
       <li><code>context</code>: Your application's {@link android.content.Context}.</li>
@@ -781,7 +781,7 @@
   </li>
   <li>When the {@code startDownloadServiceIfRequired()} method returns anything <em>other
 than</em> {@code NO_DOWNLOAD_REQUIRED}, create an instance of {@code IStub} by
-calling {@code DownloaderClientMarshaller.CreateStub(IDownloaderClient client, Class&lt;?>
+calling {@code DownloaderClientMarshaller.CreateStub(IDownloaderClient client, Class<?>
 downloaderService)}. The {@code IStub} provides a binding between your activity to the downloader
 service such that your activity receives callbacks about the download progress.
     <p>In order to instantiate your {@code IStub} by calling {@code CreateStub()}, you must pass it
@@ -957,7 +957,7 @@
 depends on the type of file you've used. As discussed in the <a href="#Overview">overview</a>, your
 expansion files can be any kind of file you
 want, but are renamed using a particular <a href="#Filename">file name format</a> and are saved to
-{@code &lt;shared-storage&gt;/Android/obb/&lt;package-name&gt;/}.</p>
+{@code <shared-storage>/Android/obb/<package-name>/}.</p>
 
 <p>Regardless of how you read your files, you should always first check that the external
 storage is available for reading. There's a chance that the user has the storage mounted to a
@@ -1060,7 +1060,7 @@
 
 <p>The Google Market Apk Expansion package includes a library called the APK
 Expansion Zip Library (located in {@code
-&lt;sdk>/extras/google/google_market_apk_expansion/zip_file/}). This is an optional library that
+<sdk>/extras/google/google_market_apk_expansion/zip_file/}). This is an optional library that
 helps you read your expansion
 files when they're saved as ZIP files. Using this library allows you to easily read resources from
 your ZIP expansion files as a virtual file system.</p>
diff --git a/docs/html/google/play/filters.jd b/docs/html/google/play/filters.jd
index 1ec68c6..50cc807 100644
--- a/docs/html/google/play/filters.jd
+++ b/docs/html/google/play/filters.jd
@@ -338,24 +338,24 @@
   <tr><th>Manifest Element</th><th>Summary</th></tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
+<compatible-screens>}</a></nobr></td>
     <td>
       <p>Google Play filters the application if the device screen size and density does not match
-any of the screen configurations (declared by a {@code &lt;screen&gt;} element) in the {@code
-&lt;compatible-screens&gt;} element.</p>
+any of the screen configurations (declared by a {@code <screen>} element) in the {@code
+<compatible-screens>} element.</p>
       <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use
 this manifest element</strong>. Using this element can dramatically
 reduce the potential user base for your application, by excluding all combinations of screen size
 and density that you have not listed. You should instead use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> manifest element (described above in <a href="#table1">table
+<supports-screens>}</a> manifest element (described above in <a href="#table1">table
 1</a>) to enable screen compatibility mode for screen configurations you have not accounted for
 with alternative resources.</p>
     </td>
   </tr>
   <tr>
     <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
+<supports-gl-texture>}</a></nobr></td>
     <td>
       <p>Google Play filters the application unless one or more of the GL texture compression
 formats supported by the application are also supported by the device. </p>
@@ -419,17 +419,17 @@
   <li>OpenGL texture compression formats
     <p>By using the <a
 href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a> element.</p>
+<supports-gl-texture>}</a> element.</p>
   </li>
   <li>Screen size (and, optionally, screen density)
     <p>By using the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> or <a
+<supports-screens>}</a> or <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a> element.</p>
+<compatible-screens>}</a> element.</p>
   </li>
   <li>API level
     <p>By using the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk&gt;}</a> element.</p>
+<uses-sdk>}</a> element.</p>
   </li>
   <li>CPU Architecture (ABI)
     <p>By including native libraries built with the <a href="{@docRoot}tools/sdk/ndk/index.html">Android
diff --git a/docs/html/google/play/licensing/setting-up.jd b/docs/html/google/play/licensing/setting-up.jd
index f43e4aba..1822337 100644
--- a/docs/html/google/play/licensing/setting-up.jd
+++ b/docs/html/google/play/licensing/setting-up.jd
@@ -180,12 +180,12 @@
 
 <ol>
   <li>Launch the Android SDK Manager (available under the Eclipse <strong>Window</strong>
-menu or by executing {@code &lt;sdk>/tools/android sdk}).</li>
+menu or by executing {@code <sdk>/tools/android sdk}).</li>
   <li>Select and download <strong>Google APIs</strong> for the Android version you'd like to target
 (must be Android 2.2 or higher).</li>
   <li>When the download is complete, open the AVD Manager (available under the Eclipse
 <strong>Window</strong>
-menu or by executing {@code &lt;sdk>/tools/android avd}).</li>
+menu or by executing {@code <sdk>/tools/android avd}).</li>
   <li>Click
 <strong>New</strong> and set the configuration details for the new AVD. </li>
   <li>In the dialog that appears, assign a descriptive name to the AVD and then
diff --git a/docs/html/google/play/publishing/multiple-apks.jd b/docs/html/google/play/publishing/multiple-apks.jd
index ab08e6f..71a7ae5 100644
--- a/docs/html/google/play/publishing/multiple-apks.jd
+++ b/docs/html/google/play/publishing/multiple-apks.jd
@@ -204,7 +204,7 @@
   <li><strong>OpenGL texture compression formats</strong>
     <p>This is based on your manifest file's <a
 href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a> element(s).</p>
+<supports-gl-texture>}</a> element(s).</p>
     <p>For example, when developing a game that uses OpenGL ES, you can provide one APK for
 devices that support ATI texture compression and a separate APK for devices
 that support PowerVR compression (among many others).</p>
@@ -214,11 +214,11 @@
   <li><strong>Screen size (and, optionally, screen density)</strong>
     <p>This is based on your manifest file's <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> <em>or</em> <a
+<supports-screens>}</a> <em>or</em> <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a> element. You should never use both elements and you should use only
+<compatible-screens>}</a> element. You should never use both elements and you should use only
 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> when possible.</p>
+<supports-screens>}</a> when possible.</p>
     <p>For example, you can provide one APK that supports small and normal size screens and another
 APK that supports large and xlarge screens.</p>
 
@@ -230,7 +230,7 @@
 with a single APK.</p>
     <p class="caution"><strong>Caution:</strong> By default, all screen size attributes in the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element are "true" if you do not declare them otherwise. However,
+<supports-screens>}</a> element are "true" if you do not declare them otherwise. However,
 because the {@code android:xlargeScreens} attribute was added in Android 2.3 (API level
 9), Google Play will assume that it is "false" if your application does not set either <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
@@ -239,9 +239,9 @@
 android:targetSdkVersion}</a> to "9" or higher.</p>
     <p class="caution"><strong>Caution:</strong> You should not combine both <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> and <a
+<supports-screens>}</a> and <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a> elements in your manifest file. Using both increases the chances
+<compatible-screens>}</a> elements in your manifest file. Using both increases the chances
 that you'll introduce an error due to conflicts between them. For help deciding which to use, read
 <a href="{@docRoot}guide/practices/screens-distribution.html">Distributing to Specific Screens</a>.
 If you can't avoid using both, be aware that for any conflicts in agreement between a given size,
@@ -251,7 +251,7 @@
 
   <li><strong>Device feature sets</strong>
     <p>This is based on your manifest file's <a 
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> 
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element(s).</p>
     <p>For example, you can provide one APK for devices that support multitouch and another
 APK for devices that do not support multitouch. See 
@@ -262,7 +262,7 @@
 
   <li><strong>API level</strong>
     <p>This is based on your manifest file's <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element.
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element.
 You
 can use both the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
 android:minSdkVersion}</a> and <a
@@ -312,7 +312,7 @@
 based on other characteristics in the manifest or APK). For
 example, you cannot provide different APKs that differ purely on the <a
 href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">{@code
-&lt;uses-configuration&gt;}</a> characteristics.</p>
+<uses-configuration>}</a> characteristics.</p>
 
 
 
diff --git a/docs/html/guide/components/activities.jd b/docs/html/guide/components/activities.jd
index 5e6917b..7eeaeeb 100644
--- a/docs/html/guide/components/activities.jd
+++ b/docs/html/guide/components/activities.jd
@@ -141,9 +141,9 @@
 
 <p>You must declare your activity in the manifest file in order for it to
 be accessible to the system. To declare your activity, open your manifest file and add an <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element
 as a child of the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element. For example:</p>
 
 <pre>
@@ -166,16 +166,16 @@
 That Cannot Change</a>).</p>
 
 <p>See the <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element
 reference for more information about declaring your activity in the manifest.</p>
 
 
 <h4>Using intent filters</h4>
 
 <p>An <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> element can also specify various intent filters&mdash;using the <a
+<activity>}</a> element can also specify various intent filters&mdash;using the <a
 href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> element&mdash;in order to declare how other application components may
+<intent-filter>}</a> element&mdash;in order to declare how other application components may
 activate it.</p>
 
 <p>When you create a new application using the Android SDK tools, the stub activity
@@ -193,9 +193,9 @@
 </pre>
 
 <p>The <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a> element specifies that this is the "main" entry point to the application. The <a
+<action>}</a> element specifies that this is the "main" entry point to the application. The <a
 href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> element specifies that this activity should be listed in the
+<category>}</a> element specifies that this activity should be listed in the
 system's application launcher (to allow users to launch this activity).</p>
 
 <p>If you intend for your application to be self-contained and not allow other applications to
@@ -208,13 +208,13 @@
 other applications (and your own), then you must define additional intent filters for your
 activity. For each type of intent to which you want to respond, you must include an <a
 href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> that includes an
+<intent-filter>}</a> that includes an
 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a> element and, optionally, a <a
+<action>}</a> element and, optionally, a <a
 href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> element and/or a <a
+<category>}</a> element and/or a <a
 href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> element. These elements specify the type of intent to which your activity can
+<data>}</a> element. These elements specify the type of intent to which your activity can
 respond.</p>
 
 <p>For more information about how your activities can respond to intents, see the <a
diff --git a/docs/html/guide/components/aidl.jd b/docs/html/guide/components/aidl.jd
index 0be6e6f..e15e53f1 100644
--- a/docs/html/guide/components/aidl.jd
+++ b/docs/html/guide/components/aidl.jd
@@ -140,7 +140,7 @@
     <p>All elements in the {@link java.util.Map} must be one of the supported data types in this
 list or one of the other AIDL-generated interfaces or parcelables you've declared.  Generic maps,
 (such as those of the form
-{@code Map&lt;String,Integer&gt;} are not supported. The actual concrete class that the other side
+{@code Map<String,Integer>} are not supported. The actual concrete class that the other side
 receives is always a {@link java.util.HashMap}, although the method is generated to
 use the {@link java.util.Map} interface.</p>
   </li>
diff --git a/docs/html/guide/components/fragments.jd b/docs/html/guide/components/fragments.jd
index 0065397..3b7da87 100644
--- a/docs/html/guide/components/fragments.jd
+++ b/docs/html/guide/components/fragments.jd
@@ -68,7 +68,7 @@
 android.view.ViewGroup} inside the activity's view hierarchy and the fragment defines its own view
 layout.
 You can insert a fragment into your activity layout by declaring the fragment in the activity's
-layout file, as a {@code &lt;fragment&gt;} element, or from your application code by adding it to an
+layout file, as a {@code <fragment>} element, or from your application code by adding it to an
 existing {@link android.view.ViewGroup}. However, a fragment is not required to be a part of the
 activity layout; you may also use a fragment without its own UI as an invisible worker for the
 activity.</p>
@@ -290,13 +290,13 @@
             android:layout_height="match_parent" /&gt;
 &lt;/LinearLayout&gt;
 </pre>
-  <p>The {@code android:name} attribute in the {@code &lt;fragment&gt;} specifies the {@link
+  <p>The {@code android:name} attribute in the {@code <fragment>} specifies the {@link
 android.app.Fragment} class to instantiate in the layout.</p>
 
 <p>When the system creates this activity layout, it instantiates each fragment specified in the
 layout and calls the {@link android.app.Fragment#onCreateView onCreateView()} method for each one,
 to retrieve each fragment's layout. The system inserts the {@link android.view.View} returned by the
-fragment directly in place of the {@code &lt;fragment&gt;} element.</p>
+fragment directly in place of the {@code <fragment>} element.</p>
 
 <div class="note">
   <p><strong>Note:</strong> Each fragment requires a unique identifier that
diff --git a/docs/html/guide/components/fundamentals.jd b/docs/html/guide/components/fundamentals.jd
index fd1a7a8..1d45106 100644
--- a/docs/html/guide/components/fundamentals.jd
+++ b/docs/html/guide/components/fundamentals.jd
@@ -348,7 +348,7 @@
 intent filters that declare the capabilities of the activity so it can respond to intents
 from other apps. You can declare an intent filter for your component by
 adding an <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> element as a child of the component's declaration element.</p>
+<intent-filter>}</a> element as a child of the component's declaration element.</p>
 
 <p>For example, if you've built an email app with an activity for composing a new email, you can
 declare an intent filter to respond to "send" intents (in order to send a new email) like this:</p>
diff --git a/docs/html/guide/components/intents-common.jd b/docs/html/guide/components/intents-common.jd
index 8aa5fa9..078ff53 100644
--- a/docs/html/guide/components/intents-common.jd
+++ b/docs/html/guide/components/intents-common.jd
@@ -881,7 +881,7 @@
 <dd>{@link android.content.Intent#ACTION_VIEW}</dd>
 
 <dt><b>Data URI Scheme</b></dt>
-<dd>{@code content:&lt;URI>}</dd>
+<dd>{@code content:<URI>}</dd>
 
 <dt><b>MIME Type</b></dt>
 <dd>None. The type is inferred from contact URI.
@@ -922,7 +922,7 @@
 <dd>{@link android.content.Intent#ACTION_EDIT}</dd>
 
 <dt><b>Data URI Scheme</b></dt>
-<dd>{@code content:&lt;URI>}</dd>
+<dd>{@code content:<URI>}</dd>
 
 <dt><b>MIME Type</b></dt>
 <dd>The type is inferred from contact URI.
@@ -1497,9 +1497,9 @@
 <dt><b>Data URI Scheme</b></dt>
 <dd>
   <dl>
-    <dt>{@code file:<em>&lt;URI></em>}
-    <dt>{@code content:<em>&lt;URI></em>}
-    <dt>{@code http:<em>&lt;URL></em>}
+    <dt><code>file:<em>&lt;URI&gt;</em></code>
+    <dt><code>content:<em>&lt;URI&gt;</em></code>
+    <dt><code>http:<em>&lt;URL&gt;</em></code>
   </dl>
 </dd>
 
@@ -1830,8 +1830,8 @@
 <dt><b>Data URI Scheme</b></dt>
 <dd>
 <ul>
-  <li>{@code tel:&lt;phone-number>}</li>
-  <li>{@code voicemail:&lt;phone-number>}</li>
+  <li>{@code tel:<phone-number>}</li>
+  <li>{@code voicemail:<phone-number>}</li>
 </ul>
 </dd>
 
@@ -2042,10 +2042,10 @@
 <dt><b>Data URI Scheme</b></dt>
 <dd>
   <dl>
-    <dt>{@code sms:<em>&lt;phone_number></em>}
-    <dt>{@code smsto:<em>&lt;phone_number></em>}
-    <dt>{@code mms:<em>&lt;phone_number></em>}
-    <dt>{@code mmsto:<em>&lt;phone_number></em>}
+    <dt><code>sms:<em>&lt;phone_number&gt;</em></code>
+    <dt><code>smsto:<em>&lt;phone_number&gt;</em></code>
+    <dt><code>mms:<em>&lt;phone_number&gt;</em></code>
+    <dt><code>mmsto:<em>&lt;phone_number&gt;</em></code>
   </dl>
   <p>Each of these schemes are handled the same.
 </dd>
@@ -2158,8 +2158,8 @@
   <dd>{@link android.content.Intent#ACTION_VIEW}<dd>
 
   <dt><b>Data URI Scheme</b></dt>
-  <dd>{@code http:<em>&lt;URL></em>}<br/>
-    {@code https:<em>&lt;URL></em>}</dd>
+  <dd><code>http:<em>&lt;URL&gt;</em></code><br/>
+    <code>https:<em>&lt;URL&gt;</em></code></dd>
 
   <dt><b>MIME Type</b></dt>
   <dd>
diff --git a/docs/html/guide/components/intents-filters.jd b/docs/html/guide/components/intents-filters.jd
index 0759088..abc67f2 100644
--- a/docs/html/guide/components/intents-filters.jd
+++ b/docs/html/guide/components/intents-filters.jd
@@ -455,7 +455,7 @@
 
 <p>To advertise which implicit intents your app can receive, declare one or more intent filters for
 each of your app components with an <a href=
-"{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+"{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 element in your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest file</a>.
 Each intent filter specifies the type of intents it accepts based on the intent's action,
 data, and category. The system will deliver an implicit intent to your app component only if the
@@ -471,23 +471,23 @@
 in the {@link android.content.Intent} (such as to show the editor controls or not).</p>
 
 <p>Each intent filter is defined by an <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter>}</a>
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 element in the app's manifest file, nested in the corresponding app component (such
-as an <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a>
+as an <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element). Inside the <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter>}</a>,
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>,
 you can specify the type of intents to accept using one or more
 of these three elements:</p>
 
 <dl>
-<dt><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action>}</a></dt>
+<dt><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a></dt>
   <dd>Declares the intent action accepted, in the {@code name} attribute. The value
   must be the literal string value of an action, not the class constant.</dd>
-<dt><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a></dt>
+<dt><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a></dt>
   <dd>Declares the type of data accepted, using one or more attributes that specify various
   aspects of the data URI (<code>scheme</code>, <code>host</code>, <code>port</code>,
   <code>path</code>, etc.) and MIME type.</dd>
-<dt><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category>}</a></dt>
+<dt><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a></dt>
   <dd>Declares the intent category accepted, in the {@code name} attribute. The value
   must be the literal string value of an action, not the class constant.
 
@@ -516,9 +516,9 @@
 </pre>
 
 <p>It's okay to create a filter that includes more than one instance of
-<a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action>}</a>,
-<a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a>, or
-<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category>}</a>.
+<a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a>,
+<a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a>, or
+<a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>.
 If you do, you simply need to be certain that the component can handle any and all combinations
 of those filter elements.</p>
 
@@ -607,9 +607,9 @@
   indicates this is the main entry point and does not expect any intent data.</li>
   <li>The {@link android.content.Intent#CATEGORY_LAUNCHER} category indicates that this activity's
   icon should be placed in the system's app launcher. If the <a
-  href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element
+  href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element
   does not specify an icon with {@code icon}, then the system uses the icon from the <a
-  href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application>}</a>
+  href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
   element.</li>
 </ul>
 <p>These two must be paired together in order for the activity to appear in the app launcher.</p>
@@ -715,7 +715,7 @@
 
 <p>To specify accepted intent actions, an intent filter can declare zero or more
 <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action&gt;}</a> elements.  For example:</p>
+<action>}</a> elements.  For example:</p>
 
 <pre>
 &lt;intent-filter&gt;
@@ -739,7 +739,7 @@
 
 <p>To specify accepted intent categories, an intent filter can declare zero or more
 <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category&gt;}</a> elements.  For example:</p>
+<category>}</a> elements.  For example:</p>
 
 <pre>
 &lt;intent-filter&gt;
@@ -762,7 +762,7 @@
 android.app.Activity#startActivityForResult startActivityForResult()}.
 So if you want your activity to receive implicit intents, it must
 include a category for {@code "android.intent.category.DEFAULT"} in its intent filters (as
-shown in the previous {@code &lt;intent-filter>} example.</p>
+shown in the previous {@code <intent-filter>} example.</p>
 
 
 
@@ -770,7 +770,7 @@
 
 <p>To specify accepted intent data, an intent filter can declare zero or more
 <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data&gt;}</a> elements.  For example:</p>
+<data>}</a> elements.  For example:</p>
 
 <pre>
 &lt;intent-filter&gt;
@@ -786,7 +786,7 @@
 and {@code path} &mdash; for each part of the URI:
 </p>
 
-<p style="margin-left: 2em">{@code &lt;scheme>://&lt;host>:&lt;port>/&lt;path>}</p>
+<p style="margin-left: 2em">{@code <scheme>://<host>:<port>/<path>}</p>
 
 <p>
 For example:
@@ -799,7 +799,7 @@
 </p>
 
 <p>Each of these attributes is optional in a <a
-href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a> element,
+href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> element,
 but there are linear dependencies:</p>
 <ul>
   <li>If a scheme is not specified, the host is ignored.</li>
@@ -851,7 +851,7 @@
 Therefore, their filters can list just a data type and do not need to explicitly
 name the {@code content:} and {@code file:} schemes.
 This is a typical case.  A <a
-href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a> element
+href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> element
 like the following, for example, tells Android that the component can get image data from a content
 provider and display it:
 </p>
@@ -870,7 +870,7 @@
 <p>
 Another common configuration is filters with a scheme and a data type.  For
 example, a <a
-href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a>
+href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a>
 element like the following tells Android that
 the component can retrieve video data from the network in order to perform the action:
 </p>
diff --git a/docs/html/guide/components/processes-and-threads.jd b/docs/html/guide/components/processes-and-threads.jd
index 10a6410..7bb3c65 100644
--- a/docs/html/guide/components/processes-and-threads.jd
+++ b/docs/html/guide/components/processes-and-threads.jd
@@ -45,10 +45,10 @@
 
 <p>The manifest entry for each type of component element&mdash;<a
 href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a>, <a href="{@docRoot}guide/topics/manifest/service-element.html">{@code
-&lt;service&gt;}</a>, <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
-&lt;receiver&gt;}</a>, and <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code
-&lt;provider&gt;}</a>&mdash;supports an {@code android:process} attribute that can specify a
+<activity>}</a>, <a href="{@docRoot}guide/topics/manifest/service-element.html">{@code
+<service>}</a>, <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
+<receiver>}</a>, and <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code
+<provider>}</a>&mdash;supports an {@code android:process} attribute that can specify a
 process in which that component should run. You can set this attribute so that each component runs
 in its own process or so that some components share a process while others do not.  You can also set
 {@code android:process} so that components of different applications run in the same
@@ -56,7 +56,7 @@
 same certificates.</p>
 
 <p>The <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-&lt;application&gt;}</a> element also supports an {@code android:process} attribute, to set a
+<application>}</a> element also supports an {@code android:process} attribute, to set a
 default value that applies to all components.</p>
 
 <p>Android might decide to shut down a process at some point, when memory is low and required by
diff --git a/docs/html/guide/components/services.jd b/docs/html/guide/components/services.jd
index b8c105d..8da1694 100644
--- a/docs/html/guide/components/services.jd
+++ b/docs/html/guide/components/services.jd
@@ -189,9 +189,9 @@
 manifest file.</p>
 
 <p>To declare your service, add a <a
-href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service&gt;}</a> element
+href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> element
 as a child of the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element. For example:</p>
 
 <pre>
@@ -205,11 +205,11 @@
 </pre>
 
 <p>See the <a
-href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service&gt;}</a> element
+href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> element
 reference for more information about declaring your service in the manifest.</p>
 
 <p>There are other attributes you can include in the <a
-href="{@docRoot}guide/topics/manifest/service-element.html">{@code &lt;service&gt;}</a> element to
+href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> element to
 define properties such as permissions required to start the service and the process in
 which the service should run. The <a
 href="{@docRoot}guide/topics/manifest/service-element.html#nm">{@code android:name}</a>
diff --git a/docs/html/guide/components/tasks-and-back-stack.jd b/docs/html/guide/components/tasks-and-back-stack.jd
index aaef10e..c77b545 100644
--- a/docs/html/guide/components/tasks-and-back-stack.jd
+++ b/docs/html/guide/components/tasks-and-back-stack.jd
@@ -30,7 +30,7 @@
   <li><a href="{@docRoot}design/patterns/navigation.html">Android Design:
 Navigation</a></li>
   <li><a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;} manifest
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>} manifest
 element</a></li>
   <li><a href="{@docRoot}guide/components/recents.html">Overview Screen</a></li>
 </ol>
@@ -221,12 +221,12 @@
 activities except for the root activity when the user leaves the task.</p>
 
 <p>You can do these things and more, with attributes in the
-<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 manifest element and with flags in the intent that you pass to
 {@link android.app.Activity#startActivity startActivity()}.</p>
 
 <p>In this regard, the principal <a href="{@docRoot}guide/topics/manifest/activity-element.html">
-{@code &lt;activity&gt;}</a> attributes you can use are:</p>
+{@code <activity>}</a> attributes you can use are:</p>
 
 <ul class="nolist">
   <li><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">
@@ -295,7 +295,7 @@
 
 <p>When declaring an activity in your manifest file, you can specify how the activity should
 associate with a task using the <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element's <a href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">{@code
 launchMode}</a> attribute.</p>
 
@@ -351,7 +351,7 @@
 
 <p>As another example, the Android Browser application declares that the web browser activity should
 always open in its own task&mdash;by specifying the {@code singleTask} launch mode in the <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element.
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element.
 This means that if your application issues an
 intent to open the Android Browser, its activity is <em>not</em> placed in the same
 task as your application. Instead, either a new task starts for the Browser or, if the Browser
@@ -440,14 +440,14 @@
 
 <p>You can modify the affinity for any given activity with the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#aff">{@code taskAffinity}</a> attribute
-of the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+of the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element.</p>
 
 <p>The <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#aff">{@code taskAffinity}</a>
 attribute takes a string value, which must be unique from the default package name
 declared in the <a href="{@docRoot}guide/topics/manifest/manifest-element.html">
-{@code &lt;manifest&gt;}
+{@code <manifest>}
 </a> element, because the system uses that name to identify the default task
 affinity for the application.</p>
 
diff --git a/docs/html/guide/practices/compatibility.jd b/docs/html/guide/practices/compatibility.jd
index db1642e..1bfc99d3 100644
--- a/docs/html/guide/practices/compatibility.jd
+++ b/docs/html/guide/practices/compatibility.jd
@@ -119,7 +119,7 @@
 
 <p>If necessary, you can prevent users from installing your app when their devices don't provide a
 given feature by declaring it with a <a href=
-"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element in your app's <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest
 file</a>.</p>
 
@@ -169,7 +169,7 @@
 on this feature and make your app available to devices without Bluetooth by setting the <a href=
 "{@docRoot}guide/topics/manifest/uses-feature-element.html#required">{@code required}</a> attribute
 to {@code "false"} in the <a href=
-"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> tag.
+"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag.
 For more information about implicitly required device features, read <a href=
 "{@docRoot}guide/topics/manifest/uses-feature-element.html#permissions">Permissions that Imply
 Feature Requirements</a>.</p>
@@ -191,7 +191,7 @@
 
 <p>The API level allows you to declare the minimum version with which your app is
 compatible, using the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
-&lt;uses-sdk>}</a> manifest tag and its <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> attribute.</p>
+<uses-sdk>}</a> manifest tag and its <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> attribute.</p>
 
 <p>For example, the <a href="{@docRoot}guide/topics/providers/calendar-provider.html">Calendar
 Provider</a> APIs were added in Android 4.0 (API level 14). If your app cannot function without
diff --git a/docs/html/guide/practices/optimizing-for-3.0.jd b/docs/html/guide/practices/optimizing-for-3.0.jd
index fea54af..4f3d0f2 100644
--- a/docs/html/guide/practices/optimizing-for-3.0.jd
+++ b/docs/html/guide/practices/optimizing-for-3.0.jd
@@ -188,7 +188,7 @@
   <li><b>Apply the new "holographic" theme to your application</b>
     <ol>
       <li>Open your manifest file and update the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element to
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element to
 set <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> to {@code "11"}. For example:
@@ -383,9 +383,9 @@
 <p>Android 3.0 adds a hardware-accelerated OpenGL renderer that gives a performance boost to most 2D
 graphics operations. You can enable hardware-accelerated rendering in your application by setting
 {@code android:hardwareAccelerated="true"} in your manifest's <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element or for individual <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> elements. Hardware acceleration results in smoother animations, smoother
+<activity>}</a> elements. Hardware acceleration results in smoother animations, smoother
 scrolling, and overall better performance and response to user interaction. When enabled, be sure
 that you thoroughly test your application on a device that supports hardware acceleration.</p>
 
@@ -500,7 +500,7 @@
 not fit a smaller screen or you've explicitly designed your application only for tablets and other
 large devices. In this case, you can manage the availability of your application to smaller screens
 by using the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> manifest element.</p>
+<supports-screens>}</a> manifest element.</p>
 
 <p>For example, if you want your application to be available only to extra large
 screens, you can declare the element in your manifest like this:</p>
@@ -523,7 +523,7 @@
 
 <p class="note"><strong>Note:</strong> If you use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> element for the reverse scenario (when your application is not compatible
+<supports-screens>}</a> element for the reverse scenario (when your application is not compatible
 with <em>larger</em> screens) and set the larger screen size attributes to {@code "false"}, then
 external services such as Google Play <strong>do not</strong> apply filtering. Your application
 will still be available to larger screens, but when it runs, it will not fill the screen&mdash;the
@@ -540,22 +540,22 @@
 that each deliver different features for different screen configurations, so you don't want
 larger devices to download the version designed for smaller screens. In such a case, you can
 use the <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element to manage the distribution of your application based on the
+<compatible-screens>}</a> element to manage the distribution of your application based on the
 combination of screen size and density. External services such as
 Google Play uses this information to apply filtering to your application, so that only devices
 that have a screen configuration with which you declare compatibility can download your
 application.</p>
 
 <p>The <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element must contain one or more {@code &lt;screen&gt;} elements,
+<compatible-screens>}</a> element must contain one or more {@code <screen>} elements,
 which each specify a screen configuration with which your application is compatible, using both
 the {@code android:screenSize} and {@code android:screenDensity} attributes. Each {@code
-&lt;screen&gt;} element <strong>must include both attributes</strong> to specify an individual
+<screen>} element <strong>must include both attributes</strong> to specify an individual
 screen configuration&mdash;if either attribute is missing, then the element is invalid
 (external services such as Google Play will ignore it).</p>
 
 <p>For example, if your application is compatible with only small and normal screens, regardless
-of screen density, then you must specify eight different {@code &lt;screen&gt;} elements,
+of screen density, then you must specify eight different {@code <screen>} elements,
 because each screen size has four density configurations. You must declare each one of
 these; any combination of size and density that you do <em>not</em> specify is considered a screen
 configuration with which your application is <em>not</em> compatible. Here's what the manifest
@@ -584,17 +584,17 @@
 
 <p class="note"><strong>Note:</strong> Although you can also use the <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element for the reverse scenario (when your application is not
+<compatible-screens>}</a> element for the reverse scenario (when your application is not
 compatible with smaller screens), it's easier if you instead use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> as discussed in the previous section, because it doesn't require you
+<supports-screens>}</a> as discussed in the previous section, because it doesn't require you
 to specify each screen density your application supports.</p>
 
 <p>Remember, you should strive to make your application available to as many devices as possible by
 applying all necessary techniques for <a
 href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a>. You should
 then use the <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element to filter your application from certain devices only when you
+<compatible-screens>}</a> element to filter your application from certain devices only when you
 cannot offer compatibility on all screen configurations or you have decided to provide
 multiple versions of your application, each for a different set of screen configurations.</p>
 
@@ -650,7 +650,7 @@
 <p>In the worst-case scenario, however, you can avoid orientation changes by using the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
 android:screenOrientation}</a> attribute in the <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element. Instead of locking the orientation in landscape or portrait, however, you should
 specify a value of {@code "nosensor"}. This way, your activity uses whatever orientation the
 device specifies as its natural orientation and the screen will not rotate. You should still
@@ -676,7 +676,7 @@
 traditional phone calls or handle SMS. Some devices might also omit
 other hardware features, such as Bluetooth. If your application uses these features, then your
 manifest file probably already includes (or should include) a declaration of the feature with the <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element. Doing so prevents devices that do not declare support for the feature from downloading
 your applications. For example:</p>
 
diff --git a/docs/html/guide/practices/screen-compat-mode.jd b/docs/html/guide/practices/screen-compat-mode.jd
index e3160c39..34580ba 100644
--- a/docs/html/guide/practices/screen-compat-mode.jd
+++ b/docs/html/guide/practices/screen-compat-mode.jd
@@ -18,7 +18,7 @@
 <ol>
   <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
   <li><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a></li>
+<supports-screens>}</a></li>
 </ol>
 </div>
 </div>
@@ -123,7 +123,7 @@
 android:targetSdkVersion}</a> to {@code "10"} or lower and <strong>does not explicitly
 declare support</strong> for large screens using the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element.</li>
+<supports-screens>}</a> element.</li>
 
   <li>Your application has set either <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
@@ -131,7 +131,7 @@
 android:targetSdkVersion}</a> to {@code "11"} or higher and <strong>explicitly declares that it does
 not support</strong> large screens, using the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element.</li>
+<supports-screens>}</a> element.</li>
 </ul>
 
 <p>To completely disable the user option for screen compatibility mode and remove the icon in the
@@ -141,7 +141,7 @@
   <li><strong>Easiest:</strong>
     <p>In your manifest file, add the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element and specify the <a
+<supports-screens>}</a> element and specify the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html#xlarge">{@code
 android:xlargeScreens}</a> attribute to {@code "true"}:</p>
 <pre>
@@ -150,13 +150,13 @@
   <p>That's it. This declares that your application supports all larger screen sizes, so the
 system will always resize your layout to fit the screen. This works regardless of what values
 you've set in the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>
 attributes.</p> 
   </li>
   
   <li><strong>Easy but has other effects:</strong>
     <p>In your manifest's <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a>
 element, set <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> to {@code "11"} or higher:</p>
@@ -171,10 +171,10 @@
 Options Menu button in the system bar.</p>
   <p>If screen compatibility mode is still enabled after you change this, check your manifest's <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> and be sure that there are no attributes set {@code "false"}. The best
+<supports-screens>}</a> and be sure that there are no attributes set {@code "false"}. The best
 practice is to always explicitly declare your support for different screen sizes using the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element, so you should use this element anyway.</p>
+<supports-screens>}</a> element, so you should use this element anyway.</p>
   <p>For more information about updating your application to target Android 3.0 devices, read <a
 href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android
 3.0</a>.</p>
@@ -183,7 +183,7 @@
   <li><strong>Most control</strong> (but you must compile against Android 3.2 or higher):
     <p>In your manifest file, add the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element and specify the {@code android:compatibleWidthLimitDp}
+<supports-screens>}</a> element and specify the {@code android:compatibleWidthLimitDp}
 attribute to any value <em>higher than</em> {@code "320"}:</p>
 <pre>
 &lt;supports-screens android:compatibleWidthLimitDp="720" /&gt;
@@ -206,7 +206,7 @@
 <p>When your application is targeting Android 3.2 (API level 13) or higher, you can affect
 whether compatibility mode is enabled for certain screens by using the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> element.</p>
+<supports-screens>}</a> element.</p>
 
 <p class="note"><strong>Note:</strong> Screen compatibility mode is <strong>not</strong> a mode in
 which you should want your application to run&mdash;it causes pixelation and blurring in your UI,
@@ -227,7 +227,7 @@
 <ul>
   <li>In your manifest file, add the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element and specify the <a
+<supports-screens>}</a> element and specify the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
 android:compatibleWidthLimitDp}</a> attribute to {@code "320"}:</p>
 <pre>
diff --git a/docs/html/guide/practices/screens-distribution.jd b/docs/html/guide/practices/screens-distribution.jd
index 99eb04e..92416e0 100644
--- a/docs/html/guide/practices/screens-distribution.jd
+++ b/docs/html/guide/practices/screens-distribution.jd
@@ -58,21 +58,21 @@
 might discover that your application can't scale up well or perhaps you've decided to publish two
 versions of your application for different screen configurations. In such a case, you can use the <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element to manage the distribution of your application based on
+<compatible-screens>}</a> element to manage the distribution of your application based on
 combinations of screen size and density. External services such as Google Play use this
 information to apply filtering to your application, so that only devices that have a screen
 configuration with which you declare compatibility can download your application.</p>
 
 <p>The <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element must contain one or more {@code &lt;screen&gt;} elements. Each
-{@code &lt;screen&gt;} element specifies a screen configuration with which your application is
+<compatible-screens>}</a> element must contain one or more {@code <screen>} elements. Each
+{@code <screen>} element specifies a screen configuration with which your application is
 compatible, using both the {@code android:screenSize} and {@code android:screenDensity} attributes.
-Each {@code &lt;screen&gt;} element <strong>must include both attributes</strong> to specify an
+Each {@code <screen>} element <strong>must include both attributes</strong> to specify an
 individual screen configuration&mdash;if either attribute is missing, then the element is invalid
 (external services such as Google Play will ignore it).</p>
 
 <p>For example, if your application is compatible with only small and normal size screens,
-regardless of screen density, you must specify eight different {@code &lt;screen&gt;} elements,
+regardless of screen density, you must specify eight different {@code <screen>} elements,
 because each screen size has four density configurations. You must declare each one of
 these; any combination of size and density that you do <em>not</em> specify is considered a screen
 configuration with which your application is <em>not</em> compatible. Here's what the manifest
@@ -101,10 +101,10 @@
 
 <p class="note"><strong>Note:</strong> Although you can also use the <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> element for the reverse scenario (when your application is not
+<compatible-screens>}</a> element for the reverse scenario (when your application is not
 compatible with smaller screens), it's easier if you instead use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> as discussed in the next section, because it doesn't require you
+<supports-screens>}</a> as discussed in the next section, because it doesn't require you
 to specify each screen density your application supports.</p>
 
 
@@ -116,7 +116,7 @@
 large screen) or you need time to optimize it for smaller screens, you can prevent small-screen
 devices from downloading your app by using the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> manifest element.</p>
+<supports-screens>}</a> manifest element.</p>
 
 <p>For example, if you want your application to be available only to tablet devices, you can declare
 the element in your manifest like this:</p>
@@ -172,7 +172,7 @@
 
 <p class="caution"><strong>Caution:</strong> If you use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> element for the reverse scenario (when your application is not compatible
+<supports-screens>}</a> element for the reverse scenario (when your application is not compatible
 with <em>larger</em> screens) and set the larger screen size attributes to {@code "false"}, then
 external services such as Google Play <strong>do not</strong> apply filtering. Your application
 will still be available to larger screens, but when it runs, it will not resize to fit the screen.
@@ -181,16 +181,16 @@
 information). If you want
 to prevent your application from being downloaded on larger screens, use <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a>, as discussed in the previous section about <a
+<compatible-screens>}</a>, as discussed in the previous section about <a
 href="#FilteringHandsetApps">Declaring an App is Only for Handsets</a>.</p>
 
 <p>Remember, you should strive to make your application available to as many devices as possible by
 applying all necessary techniques for <a
 href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a>. You should
 use <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens>}</a> or <a
+<compatible-screens>}</a> or <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> only when you cannot provide compatibility on all screen configurations
+<supports-screens>}</a> only when you cannot provide compatibility on all screen configurations
 or you have decided to provide different versions of your application for different sets of screen
 configurations.</p>
 
diff --git a/docs/html/guide/practices/screens-support-1.5.jd b/docs/html/guide/practices/screens-support-1.5.jd
index ad680d9..1676674 100644
--- a/docs/html/guide/practices/screens-support-1.5.jd
+++ b/docs/html/guide/practices/screens-support-1.5.jd
@@ -38,7 +38,7 @@
 screens, using alternative resources for different screen configurations.</p>
 
 <p>If your manifest file includes the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element,
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element,
 with the <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
 attribute set to {@code "3"} or lower, and does <em>not</em> include the <a
@@ -87,7 +87,7 @@
   <li>Extend compatibility for Android 1.6 (and higher) devices by adding <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> to the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element.
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element.
 Set the value of <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> to <code>"4"</code>. This allows your application to "inherit" the
 platform's multiple screens support, even though it is technically using an earlier version of the
diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd
index b6f1c49..1335790 100644
--- a/docs/html/guide/practices/screens_support.jd
+++ b/docs/html/guide/practices/screens_support.jd
@@ -315,7 +315,7 @@
 href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a>.</p>
     <p>To declare the screen sizes your application supports, you should include the
 <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element in your manifest file.</p>
+<supports-screens>}</a> element in your manifest file.</p>
   </li>
 
   <li><strong>Provide different layouts for different screen sizes</strong>
@@ -328,7 +328,7 @@
 <code>small</code>, <code>normal</code>, <code>large</code>, and <code>xlarge</code>. For
 example, layouts for an extra-large screen should go in {@code layout-xlarge/}.</p>
     <p>Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you
-should instead use the {@code sw&lt;N&gt;dp} configuration qualifier to define the smallest
+should instead use the {@code sw<N>dp} configuration qualifier to define the smallest
 available width required by your layout resources. For example, if your multi-pane tablet layout
 requires at least 600dp of screen width, you should place it in {@code layout-sw600dp/}. Using the
 new techniques for declaring layout resources is discussed further in the section about <a
@@ -429,15 +429,15 @@
 <p>To use a configuration qualifier:</p>
 <ol>
   <li>Create a new directory in your project's {@code res/} directory and name it using the
-format: <nobr>{@code &lt;resources_name&gt;-&lt;qualifier&gt;}</nobr>
+format: <nobr>{@code <resources_name>-<qualifier>}</nobr>
     <ul>
-      <li>{@code &lt;resources_name&gt;} is the standard resource name (such as {@code drawable} or
+      <li>{@code <resources_name>} is the standard resource name (such as {@code drawable} or
 {@code layout}).</li>
-      <li>{@code &lt;qualifier&gt;} is a configuration qualifier from table 1, below, specifying the
+      <li>{@code <qualifier>} is a configuration qualifier from table 1, below, specifying the
 screen configuration for which these resources are to be used (such as {@code hdpi} or {@code
 xlarge}).</li>
     </ul>
-    <p>You can use more than one {@code &lt;qualifier&gt;} at a time&mdash;simply separate each
+    <p>You can use more than one {@code <qualifier>} at a time&mdash;simply separate each
 qualifier with a dash.</p>
   </li>
   <li>Save the appropriate configuration-specific resources in this new directory. The resource
@@ -759,7 +759,7 @@
 screen area. Specifically, the device's smallestWidth is the shortest of the screen's available
 height and width (you may also think of it as the "smallest possible width" for the screen). You can
 use this qualifier to ensure that, regardless of the screen's current orientation, your
-application's has at least {@code &lt;N&gt;} dps of width available for its UI.</p>
+application's has at least {@code <N>} dps of width available for its UI.</p>
         <p>For example, if your layout requires that its smallest dimension of screen area be at
 least 600 dp at all times, then you can use this qualifier to create the layout resources, {@code
 res/layout-sw600dp/}. The system will use these resources only when the smallest dimension of
@@ -868,8 +868,8 @@
 </pre>
 
 <p>Notice that the previous two sets of example resources use the "smallest width" qualifier, {@code
-sw&lt;N&gt;dp}, which specifies the smallest of the screen's two sides, regardless of the
-device's current orientation. Thus, using {@code sw&lt;N&gt;dp} is a simple way to specify the
+sw<N>dp}, which specifies the smallest of the screen's two sides, regardless of the
+device's current orientation. Thus, using {@code sw<N>dp} is a simple way to specify the
 overall screen size available for your layout by ignoring the screen's orientation.</p>
 
 <p>However, in some cases, what might be
@@ -883,13 +883,13 @@
 res/layout-w600dp/main_activity.xml  # Multi-pane (any screen with 600dp available width or more)
 </pre>
 
-<p>Notice that the second set is using the "available width" qualifier, {@code w&lt;N&gt;dp}. This
+<p>Notice that the second set is using the "available width" qualifier, {@code w<N>dp}. This
 way, one device may actually use both layouts, depending on the orientation of the screen (if
 the available width is at least 600dp in one orientation and less than 600dp in the other
 orientation).</p>
 
 <p>If the available height is a concern for you, then you can do the same using the {@code
-h&lt;N&gt;dp} qualifier. Or, even combine the {@code w&lt;N&gt;dp} and {@code h&lt;N&gt;dp}
+h<N>dp} qualifier. Or, even combine the {@code w<N>dp} and {@code h<N>dp}
 qualifiers if you need to be really specific.</p>
 
 
@@ -1287,7 +1287,7 @@
 
 <p>To launch the Android SDK Manager, execute the {@code
 SDK Manager.exe} from your Android SDK directory (on Windows only) or execute {@code android} from
-the {@code &lt;sdk&gt;/tools/} directory (on all platforms). Figure 6 shows the AVD
+the {@code <sdk>/tools/} directory (on all platforms). Figure 6 shows the AVD
 Manager with a selection of AVDs, for testing various screen configurations.</p>
 
 <p>Table 3 shows the various emulator skins that are available in the Android SDK, which you can use
diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd
index a63a368..85327b6 100644
--- a/docs/html/guide/practices/tablets-and-handsets.jd
+++ b/docs/html/guide/practices/tablets-and-handsets.jd
@@ -424,8 +424,8 @@
 at the top.</p>
 
 <p>To enable split action bar, simply add {@code uiOptions="splitActionBarWhenNarrow"} to your
-<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> or
-<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or
+<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 manifest element.</p>
 
 
diff --git a/docs/html/guide/topics/connectivity/bluetooth-le.jd b/docs/html/guide/topics/connectivity/bluetooth-le.jd
index 5c32e56..3d60686 100644
--- a/docs/html/guide/topics/connectivity/bluetooth-le.jd
+++ b/docs/html/guide/topics/connectivity/bluetooth-le.jd
@@ -186,7 +186,7 @@
 
 <p>Before your application can communicate over BLE, you need
 to verify that BLE is supported on the device, and if so, ensure that it is enabled.
-Note that this check is only necessary if {@code &lt;uses-feature.../&gt;}
+Note that this check is only necessary if {@code <uses-feature.../>}
 is set to false.</p>
 
 <p>If BLE is not supported, then you should gracefully disable any
diff --git a/docs/html/guide/topics/connectivity/nfc/hce.jd b/docs/html/guide/topics/connectivity/nfc/hce.jd
index 9ec1a8d..900d8ac 100644
--- a/docs/html/guide/topics/connectivity/nfc/hce.jd
+++ b/docs/html/guide/topics/connectivity/nfc/hce.jd
@@ -184,7 +184,7 @@
 
 <p>Your application can check whether a device supports HCE by checking for the
 {@link android.content.pm.PackageManager#FEATURE_NFC_HOST_CARD_EMULATION} feature. You should use the
-<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> tag in the manifest of your application to declare that your app
+<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag in the manifest of your application to declare that your app
 uses the HCE feature, and whether it is required for the app to function or not.</p>
 
 <h3 id="ServiceImplementation">Service implementation</h3>
diff --git a/docs/html/guide/topics/data/backup.jd b/docs/html/guide/topics/data/backup.jd
index 5710a47..9554835 100644
--- a/docs/html/guide/topics/data/backup.jd
+++ b/docs/html/guide/topics/data/backup.jd
@@ -160,7 +160,7 @@
 href="{@docRoot}guide/topics/manifest/application-element.html#agent">{@code
 android:backupAgent}</a> attribute in the <a
 href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-&lt;application&gt;}</a> tag.</p>
+<application>}</a> tag.</p>
 
 <p>For example:</p>
 
@@ -205,8 +205,8 @@
 <p>To get your Backup Service Key, <a
 href="http://code.google.com/android/backup/signup.html">register for Android Backup Service</a>.
 When you register, you will be provided a Backup Service Key and the appropriate {@code
-&lt;meta-data&gt;} XML code for your Android manifest file, which you must include as a child of the
-{@code &lt;application&gt;} element. For example:</p>
+<meta-data>} XML code for your Android manifest file, which you must include as a child of the
+{@code <application>} element. For example:</p>
 
 <pre>
 &lt;application android:label="MyApplication"
@@ -231,7 +231,7 @@
 your application to know what transport is used on the device. However, if you implement backup for
 your application, you should always include a Backup Service Key for Android Backup Service so
 your application can perform backup when the device uses the Android Backup Service transport. If
-the device does not use Android Backup Service, then the {@code &lt;meta-data&gt;} element with the
+the device does not use Android Backup Service, then the {@code <meta-data>} element with the
 Backup Service Key is ignored.</p>
 
 
diff --git a/docs/html/guide/topics/data/data-storage.jd b/docs/html/guide/topics/data/data-storage.jd
index 24e7f54..46db371 100644
--- a/docs/html/guide/topics/data/data-storage.jd
+++ b/docs/html/guide/topics/data/data-storage.jd
@@ -190,8 +190,8 @@
 
 <p class="note"><strong>Tip:</strong> If you want to save a static file in your application at
 compile time, save the file in your project <code>res/raw/</code> directory. You can open it with
-{@link android.content.res.Resources#openRawResource(int) openRawResource()}, passing the {@code
-R.raw.<em>&lt;filename&gt;</em>} resource ID. This method returns an {@link java.io.InputStream}
+{@link android.content.res.Resources#openRawResource(int) openRawResource()}, passing the
+<code>R.raw.<em>&lt;filename&gt;</em></code> resource ID. This method returns an {@link java.io.InputStream}
 that you can use to read the file (but you cannot write to the original file).
 </p>
 
diff --git a/docs/html/guide/topics/graphics/opengl.jd b/docs/html/guide/topics/graphics/opengl.jd
index 3e3d569..80b3c2b 100644
--- a/docs/html/guide/topics/graphics/opengl.jd
+++ b/docs/html/guide/topics/graphics/opengl.jd
@@ -242,7 +242,7 @@
   <li><strong>Texture compression requirements</strong> - If your application uses texture
 compression formats, you must declare the formats your application supports in your manifest file
 using <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a>. For more information about available texture compression
+<supports-gl-texture>}</a>. For more information about available texture compression
 formats, see <a href="#textures">Texture compression support</a>.
 
 <p>Declaring texture compression requirements in your manifest hides your application from users
@@ -250,7 +250,7 @@
 information on how Google Play filtering works for texture compressions, see the <a
 href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html#market-texture-filtering">
 Google Play and texture compression filtering</a> section of the {@code
-&lt;supports-gl-texture&gt;} documentation.</p>
+<supports-gl-texture>} documentation.</p>
   </li>
 </ul>
 
@@ -503,9 +503,9 @@
 reducing memory requirements and making more efficient use of memory bandwidth. The Android
 framework provides support for the ETC1 compression format as a standard feature, including a {@link
 android.opengl.ETC1Util} utility class and the {@code etc1tool} compression tool (located in the
-Android SDK at {@code &lt;sdk&gt;/tools/}). For an example of an Android application that uses
+Android SDK at {@code <sdk>/tools/}). For an example of an Android application that uses
 texture compression, see the {@code CompressedTextureActivity} code sample in Android SDK
-({@code &lt;sdk&gt;/samples/&lt;version&gt;/ApiDemos/src/com/example/android/apis/graphics/}).</p>
+({@code <sdk>/samples/<version>/ApiDemos/src/com/example/android/apis/graphics/}).</p>
 
 <p class="caution"><strong>Caution:</strong> The ETC1 format is supported by most Android devices,
 but it not guaranteed to be available. To check if the ETC1 format is supported on a device, call
diff --git a/docs/html/guide/topics/manifest/action-element.jd b/docs/html/guide/topics/manifest/action-element.jd
index 54ee6ae..fc6ce44 100644
--- a/docs/html/guide/topics/manifest/action-element.jd
+++ b/docs/html/guide/topics/manifest/action-element.jd
@@ -14,7 +14,7 @@
 <dt>description:</dt>
 <dd itemprop="description">Adds an action to an intent filter.
 An <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> element must contain 
-one or more {@code &lt;action&gt;} elements.  If it doesn't contain any, no
+one or more {@code <action>} elements.  If it doesn't contain any, no
 Intent objects will get through the filter.  See 
 <a href="{@docRoot}guide/components/intents-filters.html">Intents and 
 Intent Filters</a> for details on intent filters and the role of action
@@ -26,9 +26,9 @@
 <dt><a name="nm"></a>{@code android:name}</dt>
 <dd>The name of the action.  Some standard actions are defined in the
 {@link android.content.Intent#ACTION_CHOOSER Intent} class as 
-{@code ACTION_<i>string</i>} constants.  To assign one of these actions to 
+<code>ACTION_<i>string</i></code> constants.  To assign one of these actions to
 this attribute, prepend "{@code android.intent.action.}" to the 
-{@code <i>string</i>} that follows {@code ACTION_}.
+<code><i>string</i></code> that follows {@code ACTION_}.
 For example, for {@code ACTION_MAIN}, use "{@code android.intent.action.MAIN}"
 and for {@code ACTION_WEB_SEARCH}, use "{@code android.intent.action.WEB_SEARCH}".
 
diff --git a/docs/html/guide/topics/manifest/activity-alias-element.jd b/docs/html/guide/topics/manifest/activity-alias-element.jd
index 343b02e..1427b55 100644
--- a/docs/html/guide/topics/manifest/activity-alias-element.jd
+++ b/docs/html/guide/topics/manifest/activity-alias-element.jd
@@ -42,7 +42,7 @@
 </p>
 
 <p>
-With the exception of {@code targetActivity}, {@code &lt;activity-alias&gt;} 
+With the exception of {@code targetActivity}, {@code <activity-alias>}
 attributes are a subset of <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> attributes.  
 For attributes in the subset, none of the values set for the target carry over
 to the alias.  However, for attributes not in the subset, the values set for 
@@ -60,7 +60,7 @@
 The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own 
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all 
 application components, including activity aliases.  The 
-<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code &lt;activity-alias&gt;} 
+<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code <activity-alias>}
 attributes must both be "{@code true}" for the system to be able to instantiate 
 the target activity through the alias.  If either is "{@code false}", the alias 
 does not work.
diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd
index 99e64d9..fd1729c 100644
--- a/docs/html/guide/topics/manifest/activity-element.jd
+++ b/docs/html/guide/topics/manifest/activity-element.jd
@@ -64,7 +64,7 @@
 <dt>description:</dt>
 <dd itemprop="description">Declares an activity (an {@link android.app.Activity} subclass) that
 implements part of the application's visual user interface.  All activities
-must be represented by {@code &lt;activity&gt;}
+must be represented by {@code <activity>}
 elements in the manifest file.  Any that are not declared there will not be seen
 by the system and will never be run.
 
@@ -158,7 +158,7 @@
 <dt><a name="banner"></a>{@code android:banner}</dt>
 <dd>A <a href="{@docRoot}guide/topics/resources/drawable-resource.html">drawable resource</a>
 providing an extended graphical banner for its associated item. Use with the
-{@code &lt;activity&gt;} tag to supply a default banner for a specific activity, or with the
+{@code <activity>} tag to supply a default banner for a specific activity, or with the
 <a href="{@docRoot}guide/topics/manifest/application-element.html"><code>&lt;application&gt;</code></a>
 tag to supply a banner for all application activities.
 
@@ -168,7 +168,7 @@
 {@link android.content.Intent#CATEGORY_LEANBACK_LAUNCHER} intent.</p>
 
 <p>This attribute must be set as a reference to a drawable resource containing
-the image (for example {@code "&#64;drawable/banner"}). There is no default banner.
+the image (for example {@code "@drawable/banner"}). There is no default banner.
 </p>
 
 <p>
@@ -373,7 +373,7 @@
 <a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code>
 attribute that applies to all application components, including activities.  The
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
-and {@code &lt;activity&gt;} attributes must both be "{@code true}" (as they both
+and {@code <activity>} attributes must both be "{@code true}" (as they both
 are by default) for the system to be able to instantiate the activity.  If either
 is "{@code false}", it cannot be instantiated.
 </p></dd>
@@ -700,7 +700,7 @@
 <!-- api level 16 -->
 <dt><a name="parent"></a>{@code android:parentActivityName}</dt>
 <dd>The class name of the logical parent of the activity. The name here must match the class
-  name given to the corresponding {@code &lt;activity>} element's
+  name given to the corresponding {@code <activity>} element's
   <a href="#nm"><code>android:name</code></a> attribute.
 
 <p>The system reads this attribute to determine which activity should be started when
@@ -708,7 +708,7 @@
   synthesize a back stack of activities with {@link android.app.TaskStackBuilder}.</p>
 
 <p>To support API levels 4 - 16, you can also declare the parent activity with a {@code
-&lt;meta-data>} element that specifies a value for {@code "android.support.PARENT_ACTIVITY"}.
+<meta-data>} element that specifies a value for {@code "android.support.PARENT_ACTIVITY"}.
 For example:</p>
 <pre>
 &lt;activity
@@ -888,7 +888,7 @@
 {@code "sensorLandscape"}, then your application will be available only to devices that support
 landscape orientation. However, you should also explicitly declare that
 your application requires either portrait or landscape orientation with the <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element. For example, <code>&lt;uses-feature
 android:name="android.hardware.screen.portrait"/></code>. This is purely a filtering behavior
 provided by Google Play (and other services that support it) and the platform itself does not
diff --git a/docs/html/guide/topics/manifest/application-element.jd b/docs/html/guide/topics/manifest/application-element.jd
index e63ba71..5600b5c 100644
--- a/docs/html/guide/topics/manifest/application-element.jd
+++ b/docs/html/guide/topics/manifest/application-element.jd
@@ -109,7 +109,7 @@
 <dt><a name="banner"></a>{@code android:banner}</dt>
 <dd>A <a href="{@docRoot}guide/topics/resources/drawable-resource.html">drawable resource</a>
 providing an extended graphical banner for its associated item. Use with the
-{@code &lt;application&gt;} tag to supply a default banner for all application activities, or with the
+{@code <application>} tag to supply a default banner for all application activities, or with the
 <a href="{@docRoot}guide/topics/manifest/activity-element.html"><code>&lt;activity&gt;</code></a>
 tag to supply a banner for a specific activity.
 
@@ -119,7 +119,7 @@
 {@link android.content.Intent#CATEGORY_LEANBACK_LAUNCHER} intent.</p>
 
 <p>This attribute must be set as a reference to a drawable resource containing
-the image (for example {@code "&#64;drawable/banner"}). There is no default banner.
+the image (for example <code>"@drawable/banner"</code>). There is no default banner.
 </p>
 
 <p>
@@ -197,7 +197,7 @@
 
 <p>
 This attribute must be set as a reference to a drawable resource containing
-the image (for example {@code "&#64;drawable/icon"}). There is no default icon.
+the image (for example <code>"@drawable/icon"</code>). There is no default icon.
 </p></dd>
 
 <dt><a name="isGame"></a>{@code android:isGame}</dt>
@@ -252,7 +252,7 @@
 <dt><a name="logo"></a>{@code android:logo}</dt>
 <dd>A logo for the application as whole, and the default logo for activities.
 <p>This attribute must be set as a reference to a drawable resource containing
-the image (for example {@code "&#64;drawable/logo"}).  There is no default logo.</p></dd>
+the image (for example <code>"@drawable/logo"</code>).  There is no default logo.</p></dd>
 
 <dt><a name="space"></a>{@code android:manageSpaceActivity}</dt>
 <dd>The fully qualified name of an Activity subclass that the system
diff --git a/docs/html/guide/topics/manifest/category-element.jd b/docs/html/guide/topics/manifest/category-element.jd
index 563ed10..0034119 100644
--- a/docs/html/guide/topics/manifest/category-element.jd
+++ b/docs/html/guide/topics/manifest/category-element.jd
@@ -20,10 +20,10 @@
 <dd><dl class="attr">
 <dt><a name="nm"></a>{@code android:name}</dt>
 <dd>The name of the category.  Standard categories are defined in the 
-{@link android.content.Intent} class as {@code CATEGORY_<i>name</i>} 
+{@link android.content.Intent} class as <code>CATEGORY_<i>name</i></code>
 constants.  The name assigned here can be derived from those constants 
 by prefixing "{@code android.intent.category.}" to the 
-{@code <i>name</i>} that follows {@code CATEGORY_}.  For example,
+<code><i>name</i></code> that follows {@code CATEGORY_}.  For example,
 the string value for {@code CATEGORY_LAUNCHER} is 
 "{@code android.intent.category.LAUNCHER}".
 
diff --git a/docs/html/guide/topics/manifest/compatible-screens-element.jd b/docs/html/guide/topics/manifest/compatible-screens-element.jd
index de921d2..9c7f036 100644
--- a/docs/html/guide/topics/manifest/compatible-screens-element.jd
+++ b/docs/html/guide/topics/manifest/compatible-screens-element.jd
@@ -21,11 +21,11 @@
 
 <dt>description:</dt>
 <dd itemprop="description">Specifies each screen configuration with which the application is compatible. Only one instance
-of the {@code &lt;compatible-screens&gt;} element is allowed in the manifest, but it can
+of the <code>&lt;compatible-screens&gt;</code> element is allowed in the manifest, but it can
 contain multiple <code>&lt;screen&gt;</code> elements. Each <code>&lt;screen&gt;</code> element
 specifies a specific screen size-density combination with which the application is compatible.
 
-  <p>The Android system <em>does not</em> read the {@code &lt;compatible-screens&gt;} manifest
+  <p>The Android system <em>does not</em> read the {@code <compatible-screens>} manifest
 element (neither at install-time nor at runtime). This element is informational only and may be used
 by external services (such as Google Play) to better understand the application's compatibility
 with specific screen configurations and enable filtering for users. Any screen configuration that is
@@ -45,14 +45,14 @@
 
   <p>If you want to set only a minimum screen <em>size</em> for your your application, then you
 should use the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element. For example, if you want your application to be available
+<supports-screens>}</a> element. For example, if you want your application to be available
 only for <em>large</em> and <em>xlarge</em> screen devices, the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element allows you to declare that your application does not
+<supports-screens>}</a> element allows you to declare that your application does not
 support <em>small</em> and <em>normal</em> screen sizes. External services (such as Google
 Play) will filter your application accordingly. You can also use the <a
 href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> element to declare whether the system should resize your
+<supports-screens>}</a> element to declare whether the system should resize your
 application for different screen sizes.</p>
 
   <p>Also see the <a href="{@docRoot}google/play/filters.html">Filters on Google Play</a>
@@ -65,10 +65,10 @@
 <dd>
   <dl class="tag-list">
 
-    <dt id="screen">{@code &lt;screen&gt;}</dt>
+    <dt id="screen">{@code <screen>}</dt>
     <dd>Specifies a single screen configuration with which the application is compatible.
       <p>At least one instance of this element must be placed inside the {@code
-&lt;compatible-screens&gt;} element. This element <em>must include both</em> the {@code
+<compatible-screens>} element. This element <em>must include both</em> the {@code
 android:screenSize} and {@code android:screenDensity} attributes (if you do not declare both
 attributes, then the element is ignored).</p>
 
@@ -108,7 +108,7 @@
 <dt>example</dt>
 <dd>
 <p>If your application is compatible with only small and normal screens, regardless
-of screen density, then you must specify twelve different {@code &lt;screen&gt;} elements,
+of screen density, then you must specify twelve different {@code <screen>} elements,
 because each screen size has six different density configurations. You must declare each one of
 these; any combination of size and density that you do <em>not</em> specify is considered a screen
 configuration with which your application is <em>not</em> compatible. Here's what the manifest
diff --git a/docs/html/guide/topics/manifest/data-element.jd b/docs/html/guide/topics/manifest/data-element.jd
index 77f16dd..30020ad 100644
--- a/docs/html/guide/topics/manifest/data-element.jd
+++ b/docs/html/guide/topics/manifest/data-element.jd
@@ -24,7 +24,7 @@
 attributes for each of its parts:
 
 <p style="margin-left: 2em">
-{@code &lt;scheme>://&lt;host>:&lt;port>[&lt;path>|&lt;pathPrefix>|&lt;pathPattern>]}</p>
+{@code <scheme>://<host>:<port>[<path>|<pathPrefix>|<pathPattern>]}</p>
 
 <p>
 These attributes that specify the URL format are optional, but also mutually dependent:
@@ -36,7 +36,7 @@
 </ul>
 
 <p>
-All the {@code &lt;data&gt;} elements contained within the same
+All the {@code <data>} elements contained within the same
 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> element contribute to
 the same filter.  So, for example, the following filter specification,
 </p>
@@ -55,7 +55,7 @@
 &lt;/intent-filter&gt;</pre>
 
 <p>
-You can place any number of {@code &lt;data&gt;} elements inside an
+You can place any number of {@code <data>} elements inside an
 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> to give it multiple data
 options.  None of its attributes have default values.
 </p>
@@ -157,7 +157,7 @@
 The subtype can be the asterisk wildcard ({@code *}) to indicate that any
 subtype matches.
 
-<p>It's common for an intent filter to declare a {@code &lt;data>} that includes
+<p>It's common for an intent filter to declare a {@code <data>} that includes
 only the {@code android:mimeType} attribute.</p>
 
 
diff --git a/docs/html/guide/topics/manifest/grant-uri-permission-element.jd b/docs/html/guide/topics/manifest/grant-uri-permission-element.jd
index 2179359..b2d9bb7 100644
--- a/docs/html/guide/topics/manifest/grant-uri-permission-element.jd
+++ b/docs/html/guide/topics/manifest/grant-uri-permission-element.jd
@@ -26,7 +26,7 @@
 attribute is "{@code true}", permission can be granted for any the data under 
 the provider's purview.  However, if that attribute is "{@code false}", permission 
 can be granted only to data subsets that are specified by this element.  
-A provider can contain any number of {@code &lt;grant-uri-permission&gt;} elements.  
+A provider can contain any number of {@code <grant-uri-permission>} elements.
 Each one can specify only one path (only one of the three possible attributes).
 </p>
 
diff --git a/docs/html/guide/topics/manifest/manifest-intro.jd b/docs/html/guide/topics/manifest/manifest-intro.jd
index d2a9308..c8d68f5 100644
--- a/docs/html/guide/topics/manifest/manifest-intro.jd
+++ b/docs/html/guide/topics/manifest/manifest-intro.jd
@@ -279,7 +279,7 @@
 should be localized and therefore set from a resource or theme.  Resource 
 values are expressed in the following format,</p>
 
-<p style="margin-left: 2em">{@code @[<i>package</i>:]<i>type</i>:<i>name</i>}</p>
+<p style="margin-left: 2em"><code>@[<i>package</i>:]<i>type</i>:<i>name</i></code></p>
 
 <p>
 where the <i>package</i> name can be omitted if the resource is in the same package 
@@ -295,7 +295,7 @@
 rather than '{@code @}':
 </p>
 
-<p style="margin-left: 2em">{@code ?[<i>package</i>:]<i>type</i>:<i>name</i>}
+<p style="margin-left: 2em"><code>?[<i>package</i>:]<i>type</i>:<i>name</i></code>
 </p></dd>
 
 <dt><b>String values</b></dt>
diff --git a/docs/html/guide/topics/manifest/meta-data-element.jd b/docs/html/guide/topics/manifest/meta-data-element.jd
index 241153b..d3b41c3 100644
--- a/docs/html/guide/topics/manifest/meta-data-element.jd
+++ b/docs/html/guide/topics/manifest/meta-data-element.jd
@@ -20,7 +20,7 @@
 <dt>description:</dt>
 <dd itemprop="description">A name-value pair for an item of additional, arbitrary data that can
 be supplied to the parent component.  A component element can contain any 
-number of {@code &lt;meta-data&gt;} subelements.  The values from all of
+number of {@code <meta-data>} subelements.  The values from all of
 them are collected in a single {@link android.os.Bundle} object and made 
 available to the component as the 
 {@link android.content.pm.PackageItemInfo#metaData 
@@ -45,7 +45,7 @@
 
 <p>
 It is highly recommended that you avoid supplying related data as 
-multiple separate {@code &lt;meta-data&gt;} entries. Instead, if you 
+multiple separate {@code <meta-data>} entries. Instead, if you
 have complex data to associate with a component, store it as a resource and 
 use the {@code resource} attribute to inform the component of its ID.
 </p></dd>
diff --git a/docs/html/guide/topics/manifest/provider-element.jd b/docs/html/guide/topics/manifest/provider-element.jd
index f3ffd58..4b5c0c3 100644
--- a/docs/html/guide/topics/manifest/provider-element.jd
+++ b/docs/html/guide/topics/manifest/provider-element.jd
@@ -40,7 +40,7 @@
     Declares a content provider component. A content provider is a subclass of 
     {@link android.content.ContentProvider} that supplies structured access to data managed by the 
     application.  All content providers in your application must be defined in a 
-    {@code &lt;provider&gt;} element in the manifest file; otherwise, the system is unaware of them 
+    {@code <provider>} element in the manifest file; otherwise, the system is unaware of them
     and doesn't run them.
     <p>
         You only declare content providers that are part of your application. Content providers in
@@ -100,7 +100,7 @@
 The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own 
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all 
 application components, including content providers.  The 
-<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code &lt;provider&gt;} 
+<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code <provider>}
 attributes must both be "{@code true}" (as they both
 are by default) for the content provider to be enabled.  If either is 
 "{@code false}", the provider is disabled; it cannot be instantiated.
diff --git a/docs/html/guide/topics/manifest/receiver-element.jd b/docs/html/guide/topics/manifest/receiver-element.jd
index df2437e..081a191 100644
--- a/docs/html/guide/topics/manifest/receiver-element.jd
+++ b/docs/html/guide/topics/manifest/receiver-element.jd
@@ -49,7 +49,7 @@
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all 
 application components, including broadcast receivers.  The 
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and
-{@code &lt;receiver&gt;} attributes must both be "{@code true}" for 
+{@code <receiver>} attributes must both be "{@code true}" for
 the broadcast receiver to be enabled.  If either is "{@code false}", it is
 disabled; it cannot be instantiated.
 </p></dd>
diff --git a/docs/html/guide/topics/manifest/service-element.jd b/docs/html/guide/topics/manifest/service-element.jd
index e26f263..fca85f5 100644
--- a/docs/html/guide/topics/manifest/service-element.jd
+++ b/docs/html/guide/topics/manifest/service-element.jd
@@ -31,7 +31,7 @@
 applications.
 
 <p>
-All services must be represented by {@code &lt;service&gt;} elements in 
+All services must be represented by {@code <service>} elements in
 the manifest file.  Any that are not declared there will not be seen 
 by the system and will never be run.
 </p></dd>
@@ -47,7 +47,7 @@
 The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own 
 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all 
 application components, including services.  The 
-<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code &lt;service&gt;} 
+<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code <service>}
 attributes must both be "{@code true}" (as they both
 are by default) for the service to be enabled.  If either is 
 "{@code false}", the service is disabled; it cannot be instantiated.
diff --git a/docs/html/guide/topics/manifest/supports-screens-element.jd b/docs/html/guide/topics/manifest/supports-screens-element.jd
index bbeceb7..a4546fa 100644
--- a/docs/html/guide/topics/manifest/supports-screens-element.jd
+++ b/docs/html/guide/topics/manifest/supports-screens-element.jd
@@ -38,7 +38,7 @@
 when it is on a tablet compared to when running on a handset device.</p>
 
 <p>However, if your application does not work well when resized to fit different screen sizes, you
-can use the attributes of the {@code &lt;supports-screens&gt;} element to control whether your
+can use the attributes of the {@code <supports-screens>} element to control whether your
 application should be distributed to smaller screens or have its UI scaled up ("zoomed") to fit
 larger screens using the system's <a
 href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a>. When you
@@ -152,7 +152,7 @@
 not need to use this attribute. Otherwise, you should use a value for this attribute that
 matches the smallest value used by your application for the <a
 href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
-smallest screen width qualifier</a> ({@code sw&lt;N&gt;dp}).</p>
+smallest screen width qualifier</a> ({@code sw<N>dp}).</p>
 
   <p class="caution"><strong>Caution:</strong> The Android system does not pay attention to this
 attribute, so it does not affect how your application behaves at runtime. Instead, it is used
diff --git a/docs/html/guide/topics/manifest/uses-configuration-element.jd b/docs/html/guide/topics/manifest/uses-configuration-element.jd
index 15fd49c1..f551672 100644
--- a/docs/html/guide/topics/manifest/uses-configuration-element.jd
+++ b/docs/html/guide/topics/manifest/uses-configuration-element.jd
@@ -38,7 +38,7 @@
 information about how to support d-pad input in your app, read <a href=
 "{@docRoot}guide/topics/ui/accessibility/apps.html#focus-nav">Enabling Focus Navigation</a>. If
 your app absolutely cannot function without a touchscreen, then instead use the <a href=
-"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a> tag to
+"{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag to
 declare the required touchscreen type, ranging from {@code "android.hardware.faketouch"} for basic
 touch-style events to more advanced touch types such as {@code
 "android.hardware.touchscreen.multitouch.jazzhand"} for distinct input from multiple fingers.</p>
@@ -160,7 +160,7 @@
       <p class="note"><strong>Note:</strong> If some type of touch input is required for your app,
       you should instead use the
       <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
-      &lt;uses-feature>}</a> tag to declare the required touchscreen
+      <uses-feature>}</a> tag to declare the required touchscreen
       type, beginning with {@code "android.hardware.faketouch"} for basic touch-style events.</p>
    </td>
 </tr>
diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd
index 21e3057..e746a67 100644
--- a/docs/html/guide/topics/manifest/uses-feature-element.jd
+++ b/docs/html/guide/topics/manifest/uses-feature-element.jd
@@ -719,10 +719,10 @@
 android:screenOrientation}</a> with either {@code "landscape"}, {@code "reverseLandscape"}, or
 {@code "sensorLandscape"}, then your application will be available only to devices that support
 landscape orientation. As a best practice, you should still declare your requirement for this
-orientation using a {@code &lt;uses-feature&gt;} element. If you declare an orientation for your
+orientation using a {@code <uses-feature>} element. If you declare an orientation for your
 activity using <a href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
 android:screenOrientation}</a>, but don't actually <em>require</em> it, you can disable the
-requirement by declaring the orientation with a {@code &lt;uses-feature&gt;} element and include
+requirement by declaring the orientation with a {@code <uses-feature>} element and include
 {@code android:required="false"}.</p>
     <p>For backwards compatibility, any device running a platform version that supports only API
 level 12 or lower is assumed to support both landscape and portrait.</p>
@@ -780,9 +780,9 @@
   <p class="note"><strong>Note:</strong> Because applications require the {@code
 android.hardware.touchscreen} feature by default, if you want your application to be available to
 devices that provide a fake touch interface, you must also explicitly declare that a touch screen is
-<em>not</em> required by declaring {@code &lt;uses-feature
+<em>not</em> required by declaring <code>&lt;uses-feature
 android:name="android.hardware.touchscreen" <strong>android:required="false"</strong>
-/&gt;}</p></td>
+/&gt;</code></p></td>
 </tr>
 
 <tr>
diff --git a/docs/html/guide/topics/media/mediarouter.jd b/docs/html/guide/topics/media/mediarouter.jd
index e0bf889..54d52a6 100644
--- a/docs/html/guide/topics/media/mediarouter.jd
+++ b/docs/html/guide/topics/media/mediarouter.jd
@@ -95,7 +95,7 @@
   {@link android.support.v7.media.MediaRouteProvider} and distributing it as an application.
   For more information on implementing a media route provider, see the {@link
   android.support.v7.media.MediaRouteProvider} reference documentation and the v7-mediarouter
-  support library sample {@code &lt;sdk&gt;/extras/android/compatibility/v7/mediarouter}.
+  support library sample {@code <sdk>/extras/android/compatibility/v7/mediarouter}.
 </p>
 
 
@@ -540,7 +540,7 @@
   multiple media items for playback and management of the media queue. For a comprehensive sample
   implementation of these features, see {@code SampleMediaRouterActivity} and its associated
   classes in the v7 mediarouter support library sample
-  {@code &lt;sdk&gt;/extras/android/compatibility/v7/mediarouter}.
+  {@code <sdk>/extras/android/compatibility/v7/mediarouter}.
 </p>
 
 <p>
diff --git a/docs/html/guide/topics/providers/document-provider.jd b/docs/html/guide/topics/providers/document-provider.jd
index 8ea08bd..9d03616 100644
--- a/docs/html/guide/topics/providers/document-provider.jd
+++ b/docs/html/guide/topics/providers/document-provider.jd
@@ -282,7 +282,7 @@
 <li>Adding the category {@link android.content.Intent#CATEGORY_OPENABLE} to the
 intent filters the results to display only documents that can be opened, such as image files.</li>
 
-<li>The statement {@code intent.setType(&quot;image/*&quot;)} further filters to
+<li>The statement <code>intent.setType(&quot;image/*&quot;)</code> further filters to
 display only documents that have the image MIME data type.</li>
 </ul>
 
@@ -580,7 +580,7 @@
 
 <li>The {@code android:enabled} attribute set to a boolean value defined in a resource
 file. The purpose of this attribute is to disable the provider on devices running Android 4.3 or lower.
-For example, {@code android:enabled=&quot;&#64;bool/atLeastKitKat&quot;}. In
+For example, <code>android:enabled=&quot;&#64;bool/atLeastKitKat&quot;</code>. In
 addition to including this attribute in the manifest, you need to do the following:
 <ul>
 <li>In your {@code bool.xml} resources file under {@code res/values/}, add
diff --git a/docs/html/guide/topics/resources/accessing-resources.jd b/docs/html/guide/topics/resources/accessing-resources.jd
index 8f99653..b971238 100644
--- a/docs/html/guide/topics/resources/accessing-resources.jd
+++ b/docs/html/guide/topics/resources/accessing-resources.jd
@@ -9,8 +9,8 @@
   <ul>
     <li>Resources can be referenced from code using integers from {@code R.java}, such as
 {@code R.drawable.myimage}</li>
-    <li>Resources can be referenced from resources using a special XML syntax, such as {@code
-&#64;drawable/myimage}</li>
+    <li>Resources can be referenced from resources using a special XML syntax, such as
+<code>@drawable/myimage</code></li>
     <li>You can also access your app resources with methods in
 {@link android.content.res.Resources}</li>
   </ul>
@@ -129,10 +129,10 @@
 </pre>
 
 <ul>
-  <li><em>{@code &lt;package_name&gt;}</em> is the name of the package in which the resource is located (not
+  <li><em>{@code <package_name>}</em> is the name of the package in which the resource is located (not
 required when referencing resources from your own package).</li>
-  <li><em>{@code &lt;resource_type&gt;}</em> is the {@code R} subclass for the resource type.</li>
-  <li><em>{@code &lt;resource_name&gt;}</em> is either the resource filename
+  <li><em>{@code <resource_type>}</em> is the {@code R} subclass for the resource type.</li>
+  <li><em>{@code <resource_name>}</em> is either the resource filename
 without the extension or the {@code android:name} attribute value in the XML element (for simple
 values).</li>
 </ul>
@@ -210,11 +210,11 @@
 </pre>
 
 <ul>
-  <li>{@code &lt;package_name&gt;} is the name of the package in which the resource is located (not
+  <li>{@code <package_name>} is the name of the package in which the resource is located (not
 required when referencing resources from the same package)</li>
-  <li>{@code &lt;resource_type&gt;} is the
+  <li>{@code <resource_type>} is the
 {@code R} subclass for the resource type</li>
-  <li>{@code &lt;resource_name&gt;} is either the resource filename
+  <li>{@code <resource_name>} is either the resource filename
 without the extension or the {@code android:name} attribute value in the XML element (for simple
 values).</li>
 </ul>
@@ -295,7 +295,7 @@
 essentially says, "use the style that is defined by this attribute, in the current theme."</p>
 
 <p>To reference a style attribute, the name syntax is almost identical to the normal resource
-format, but instead of the at-symbol ({@code &#64;}), use a question-mark ({@code ?}), and the
+format, but instead of the at-symbol (<code>&#64;</code>), use a question-mark ({@code ?}), and the
 resource type portion is optional. For instance:</p>
 
 <pre class="classic">
diff --git a/docs/html/guide/topics/resources/color-list-resource.jd b/docs/html/guide/topics/resources/color-list-resource.jd
index b20915c..61f6665 100644
--- a/docs/html/guide/topics/resources/color-list-resource.jd
+++ b/docs/html/guide/topics/resources/color-list-resource.jd
@@ -20,7 +20,7 @@
 or niether) and, using a color state list, you can provide a different color during each state.</p>
 
 <p>You can describe the state list in an XML file. Each color is defined in an {@code
-&lt;item>} element inside a single {@code &lt;selector>} element. Each {@code &lt;item>}
+<item>} element inside a single {@code <selector>} element. Each {@code <item>}
 uses various attributes to describe the state in which it should be used.</p>
 
 <p>During each state change, the state list is traversed top to bottom and the first item that
@@ -69,7 +69,7 @@
 
   <dt id="selector-element"><code>&lt;selector&gt;</code></dt>
     <dd><strong>Required.</strong> This must be the root element. Contains one or more {@code
-&lt;item>} elements.
+<item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>xmlns:android</code></dt>
diff --git a/docs/html/guide/topics/resources/drawable-resource.jd b/docs/html/guide/topics/resources/drawable-resource.jd
index 06bd2d0..dd2c4c2 100644
--- a/docs/html/guide/topics/resources/drawable-resource.jd
+++ b/docs/html/guide/topics/resources/drawable-resource.jd
@@ -139,11 +139,11 @@
 <p>An XML bitmap is a resource defined in XML that points to a bitmap file. The effect is an alias for a
 raw bitmap file. The XML can specify additional properties for the bitmap such as dithering and tiling.</p>
 
-<p class="note"><strong>Note:</strong> You can use a {@code &lt;bitmap&gt;} element as a child of
-an {@code &lt;item&gt;} element. For
+<p class="note"><strong>Note:</strong> You can use a {@code <bitmap>} element as a child of
+an {@code <item>} element. For
 example, when creating a <a href="#StateList">state list</a> or <a href="#LayerList">layer list</a>,
 you can exclude the {@code android:drawable}
-attribute from an {@code &lt;item&gt;} element and nest a {@code &lt;bitmap&gt;} inside it
+attribute from an {@code <item>} element and nest a {@code <bitmap>} inside it
 that defines the drawable item.</p>
 
 <dl class="xml">
@@ -448,8 +448,8 @@
 that manages an array of other drawables. Each drawable in the list is drawn in the order of the
 list&mdash;the last drawable in the list is drawn on top.</p>
 
-<p>Each drawable is represented by an {@code &lt;item&gt;} element inside a single {@code
-&lt;layer-list&gt;} element.</p>
+<p>Each drawable is represented by an {@code <item>} element inside a single {@code
+<layer-list>} element.</p>
 
 <dl class="xml">
 
@@ -492,7 +492,7 @@
 
   <dt id="layerlist-element"><code>&lt;layer-list&gt;</code></dt>
     <dd><strong>Required.</strong> This must be the root element. Contains one or more {@code
-&lt;item>} elements.
+<item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>xmlns:android</code></dt>
@@ -502,7 +502,7 @@
     </dd>
   <dt id="layerlist-item-element"><code>&lt;item&gt;</code></dt>
     <dd>Defines a drawable to place in the layer drawable, in a position defined by its attributes.
-Must be a child of a <code>&lt;selector&gt;</code> element. Accepts child {@code &lt;bitmap&gt;}
+Must be a child of a <code>&lt;selector&gt;</code> element. Accepts child {@code <bitmap>}
 elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
@@ -528,15 +528,15 @@
       <p>All drawable items are scaled to fit the size of the containing View, by default. Thus,
 placing your images in a layer list at different positions might increase the size of the View and
 some images scale as appropriate. To avoid
-scaling items in the list, use a {@code &lt;bitmap&gt;} element inside the {@code
-&lt;item&gt;} element to specify the drawable and define the gravity to something that does not
-scale, such as {@code "center"}. For example, the following {@code &lt;item&gt;} defines an item
+scaling items in the list, use a {@code <bitmap>} element inside the {@code
+<item>} element to specify the drawable and define the gravity to something that does not
+scale, such as {@code "center"}. For example, the following {@code <item>} defines an item
 that scales to fit its container View:</p>
 <pre>
 &lt;item android:drawable="@drawable/image" /&gt;
 </pre>
 
-<p>To avoid scaling, the following example uses a {@code &lt;bitmap&gt;} element with centered
+<p>To avoid scaling, the following example uses a {@code <bitmap>} element with centered
 gravity:</p>
 <pre>
 &lt;item&gt;
@@ -569,7 +569,7 @@
     &lt;/item&gt;
 &lt;/layer-list&gt;
 </pre>
-<p>Notice that this example uses a nested {@code &lt;bitmap&gt;} element to define the drawable
+<p>Notice that this example uses a nested {@code <bitmap>} element to define the drawable
 resource for each item with a "center" gravity. This ensures that none of the images are scaled to
 fit the size of the container, due to resizing caused by the offset images.</p>
 
@@ -611,7 +611,7 @@
 state.</p>
 
 <p>You can describe the state list in an XML file. Each graphic is represented by an {@code
-&lt;item>} element inside a single {@code &lt;selector>} element. Each {@code &lt;item>}
+<item>} element inside a single {@code <selector>} element. Each {@code <item>}
 uses various attributes to describe the state in which it should be used as the graphic for the
 drawable.</p>
 
@@ -666,7 +666,7 @@
 
   <dt id="selector-element"><code>&lt;selector&gt;</code></dt>
     <dd><strong>Required.</strong> This must be the root element. Contains one or more {@code
-&lt;item>} elements.
+<item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>xmlns:android</code></dt>
@@ -828,7 +828,7 @@
 <dl class="tag-list">
 
   <dt id="levellist-element"><code>&lt;level-list&gt;</code></dt>
-  <dd>This must be the root element. Contains one or more {@code &lt;item&gt;} elements.
+  <dd>This must be the root element. Contains one or more {@code <item>} elements.
     <p class="caps">attributes:</p>
     <dl class="atn-list">
       <dt><code>xmlns:android</code></dt>
@@ -895,8 +895,8 @@
 <p>A {@link android.graphics.drawable.TransitionDrawable} is a drawable object
 that can cross-fade between the two drawable resources.</p>
 
-<p>Each drawable is represented by an {@code &lt;item&gt;} element inside a single {@code
-&lt;transition&gt;} element. No more than two items are supported. To transition forward, call
+<p>Each drawable is represented by an {@code <item>} element inside a single {@code
+<transition>} element. No more than two items are supported. To transition forward, call
 {@link android.graphics.drawable.TransitionDrawable#startTransition(int) startTransition()}. To
 transition backward, call {@link android.graphics.drawable.TransitionDrawable#reverseTransition(int)
 reverseTransition()}.</p>
@@ -942,7 +942,7 @@
 
   <dt id="transition-element"><code>&lt;transition&gt;</code></dt>
     <dd><strong>Required.</strong> This must be the root element. Contains one or more {@code
-&lt;item>} elements.
+<item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>xmlns:android</code></dt>
@@ -952,7 +952,7 @@
     </dd>
   <dt id="transition-item-element"><code>&lt;item&gt;</code></dt>
     <dd>Defines a drawable to use as part of the drawable transition.
-Must be a child of a <code>&lt;transition&gt;</code> element. Accepts child {@code &lt;bitmap&gt;}
+Must be a child of a <code>&lt;transition&gt;</code> element. Accepts child {@code <bitmap>}
 elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
@@ -1516,7 +1516,7 @@
                 <td>An oval shape that fits the dimensions of the containing View.</td></tr>
             <tr><td>{@code "line"}</td>
                 <td>A horizontal line that spans the width of the containing View. This
-                shape requires the {@code &lt;stroke>} element to define the width of the
+                shape requires the {@code <stroke>} element to define the width of the
                 line.</td></tr>
             <tr><td>{@code "ring"}</td>
                 <td>A ring shape.</td></tr>
diff --git a/docs/html/guide/topics/resources/layout-resource.jd b/docs/html/guide/topics/resources/layout-resource.jd
index 366ddc8..8c5708a 100644
--- a/docs/html/guide/topics/resources/layout-resource.jd
+++ b/docs/html/guide/topics/resources/layout-resource.jd
@@ -54,7 +54,7 @@
 </pre>
 <p class="note"><strong>Note:</strong> The root element can be either a
 {@link android.view.ViewGroup}, a {@link android.view.View}, or a <a
-href="#merge-element">{@code &lt;merge&gt;}</a> element, but there must be only
+href="#merge-element">{@code <merge>}</a> element, but there must be only
 one root element and it must contain the {@code xmlns:android} attribute with the {@code android}
 namespace as shown.</p>
 </dd>
diff --git a/docs/html/guide/topics/resources/more-resources.jd b/docs/html/guide/topics/resources/more-resources.jd
index b5f449a..1afbf70 100644
--- a/docs/html/guide/topics/resources/more-resources.jd
+++ b/docs/html/guide/topics/resources/more-resources.jd
@@ -34,13 +34,13 @@
 <p class="note"><strong>Note:</strong> A bool is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine bool resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;bool>} element's {@code name} will be used as the resource
+The filename is arbitrary. The {@code <bool>} element's {@code name} will be used as the resource
 ID.</dd>
 
 <dt>resource reference:</dt>
@@ -130,13 +130,13 @@
 <p class="note"><strong>Note:</strong> A color is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine color resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/colors.xml</code><br/>
-The filename is arbitrary. The {@code &lt;color>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <color>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>resource reference:</dt>
@@ -244,13 +244,13 @@
 <p class="note"><strong>Note:</strong> A dimension is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine dimension resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;dimen>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <dimen>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>resource reference:</dt>
@@ -329,7 +329,7 @@
 
 <h2 id="Id">ID</h2>
 
-<p>A unique resource ID defined in XML. Using the name you provide in the {@code &lt;item&gt;}
+<p>A unique resource ID defined in XML. Using the name you provide in the {@code <item>}
 element, the Android developer tools create a unique integer in your project's {@code
 R.java} class, which you can use as an
 identifier for an application resources (for example, a {@link android.view.View} in your UI layout)
@@ -339,7 +339,7 @@
 <p class="note"><strong>Note:</strong> An ID is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine ID resources with other simple resources in the one XML file,
-under one {@code &lt;resources&gt;} element. Also, remember that an ID resources does not reference
+under one {@code <resources>} element. Also, remember that an ID resources does not reference
 an actual resource item; it is simply a unique ID that you can attach to other resources or use
 as a unique integer in your application.</p>
 
@@ -446,13 +446,13 @@
 <p class="note"><strong>Note:</strong> An integer is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine integer resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename.xml</em></code><br/>
-The filename is arbitrary. The {@code &lt;integer>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <integer>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>resource reference:</dt>
@@ -525,14 +525,14 @@
 <p class="note"><strong>Note:</strong> An integer array is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine integer array resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;integer-array>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <integer-array>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>compiled resource datatype:</dt>
@@ -566,7 +566,7 @@
       <p>No attributes.</p>
     </dd>
   <dt id="integer-array-element"><code>&lt;integer-array&gt;</code></dt>
-    <dd>Defines an array of integers. Contains one or more child {@code &lt;item>} elements.
+    <dd>Defines an array of integers. Contains one or more child {@code <item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>android:name</code></dt>
@@ -576,7 +576,7 @@
     </dd>
   <dt id="integer-array-item-element"><code>&lt;item&gt;</code></dt>
     <dd>An integer. The value can be a reference to another
-integer resource. Must be a child of a {@code &lt;integer-array&gt;} element.
+integer resource. Must be a child of a {@code <integer-array>} element.
       <p>No attributes.</p>
     </dd>
 </dl>
@@ -620,14 +620,14 @@
 <p class="note"><strong>Note:</strong> A typed array is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine typed array resources with other simple resources in the one XML file,
-under one {@code &lt;resources&gt;} element.</p>
+under one {@code <resources>} element.</p>
 
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;array>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <array>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>compiled resource datatype:</dt>
@@ -660,7 +660,7 @@
       <p>No attributes.</p>
     </dd>
   <dt id="array-element"><code>&lt;array&gt;</code></dt>
-    <dd>Defines an array. Contains one or more child {@code &lt;item>} elements.
+    <dd>Defines an array. Contains one or more child {@code <item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>android:name</code></dt>
@@ -670,7 +670,7 @@
     </dd>
   <dt id="array-item-element"><code>&lt;item&gt;</code></dt>
     <dd>A generic resource. The value can be a reference to a resource or a simple data type.
-Must be a child of an {@code &lt;array&gt;} element.
+Must be a child of an {@code <array>} element.
       <p>No attributes.</p>
     </dd>
 </dl>
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index c179a2e..c919ed5 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -148,7 +148,7 @@
     <td><code>raw/</code></td>
     <td><p>Arbitrary files to save in their raw form. To open these resources with a raw
 {@link java.io.InputStream}, call {@link android.content.res.Resources#openRawResource(int)
-Resources.openRawResource()} with the resource ID, which is {@code R.raw.<em>filename</em>}.</p>
+Resources.openRawResource()} with the resource ID, which is <code>R.raw.<em>filename</em></code>.</p>
       <p>However, if you need access to original file names and file hierarchy, you might consider
 saving some resources in the {@code
 assets/} directory (instead of {@code res/raw/}). Files in {@code assets/} are not given a
@@ -160,9 +160,9 @@
     <td><p>XML files that contain simple values, such as strings, integers, and colors.</p>
       <p>Whereas XML resource files in other {@code res/} subdirectories define a single resource
 based on the XML filename, files in the {@code values/} directory describe multiple resources.
-For a file in this directory, each child of the {@code &lt;resources&gt;} element defines a single
-resource. For example, a {@code &lt;string&gt;} element creates an
-{@code R.string} resource and a  {@code &lt;color&gt;} element creates an {@code R.color}
+For a file in this directory, each child of the {@code <resources>} element defines a single
+resource. For example, a {@code <string>} element creates an
+{@code R.string} resource and a  {@code <color>} element creates an {@code R.color}
 resource.</p>
       <p>Because each resource is defined with its own XML element, you can name the file
 whatever you want and place different resource types in one file. However, for clarity, you might
@@ -229,15 +229,15 @@
 
 <p>To specify configuration-specific alternatives for a set of resources:</p>
 <ol>
-  <li>Create a new directory in {@code res/} named in the form {@code
-<em>&lt;resources_name&gt;</em>-<em>&lt;config_qualifier&gt;</em>}.
+  <li>Create a new directory in {@code res/} named in the form
+  <code><em>&lt;resources_name&gt;</em>-<em>&lt;config_qualifier&gt;</em></code>.
     <ul>
-      <li><em>{@code &lt;resources_name&gt;}</em> is the directory name of the corresponding default
+      <li><em>{@code <resources_name>}</em> is the directory name of the corresponding default
 resources (defined in table 1).</li>
-      <li><em>{@code &lt;qualifier&gt;}</em> is a name that specifies an individual configuration
+      <li><em>{@code <qualifier>}</em> is a name that specifies an individual configuration
 for which these resources are to be used (defined in table 2).</li>
     </ul>
-    <p>You can append more than one <em>{@code &lt;qualifier&gt;}</em>. Separate each
+    <p>You can append more than one <em>{@code <qualifier>}</em>. Separate each
 one with a dash.</p>
     <p class="caution"><strong>Caution:</strong> When appending multiple qualifiers, you must
 place them in the same order in which they are listed in table 2. If the qualifiers are ordered
@@ -384,7 +384,7 @@
 screen area. Specifically, the device's smallestWidth is the shortest of the screen's available
 height and width (you may also think of it as the "smallest possible width" for the screen). You can
 use this qualifier to ensure that, regardless of the screen's current orientation, your
-application has at least {@code &lt;N&gt;} dps of width available for its UI.</p>
+application has at least {@code <N>} dps of width available for its UI.</p>
         <p>For example, if your layout requires that its smallest dimension of screen area be at
 least 600 dp at all times, then you can use this qualifer to create the layout resources, {@code
 res/layout-sw600dp/}. The system will use these resources only when the smallest dimension of
@@ -899,13 +899,13 @@
 name other than {@code icon.png}) and put
 it in the default {@code res/drawable/} directory. Then create an {@code icon.xml} file in {@code
 res/drawable-en-rCA/} and {@code res/drawable-fr-rCA/} that refers to the {@code icon_ca.png}
-resource using the {@code &lt;bitmap&gt;} element. This allows you to store just one version of the
+resource using the {@code <bitmap>} element. This allows you to store just one version of the
 PNG file and two small XML files that point to it. (An example XML file is shown below.)</p>
 
 
 <h4>Drawable</h4>
 
-<p>To create an alias to an existing drawable, use the {@code &lt;bitmap&gt;} element.
+<p>To create an alias to an existing drawable, use the {@code <bitmap>} element.
 For example:</p>
 
 <pre>
@@ -922,8 +922,8 @@
 
 <h4>Layout</h4>
 
-<p>To create an alias to an existing layout, use the {@code &lt;include&gt;}
-element, wrapped in a {@code &lt;merge&gt;}. For example:</p>
+<p>To create an alias to an existing layout, use the {@code <include>}
+element, wrapped in a {@code <merge>}. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?>
diff --git a/docs/html/guide/topics/resources/runtime-changes.jd b/docs/html/guide/topics/resources/runtime-changes.jd
index 0e03fe0..8781d20 100644
--- a/docs/html/guide/topics/resources/runtime-changes.jd
+++ b/docs/html/guide/topics/resources/runtime-changes.jd
@@ -190,7 +190,7 @@
 configuration change and is not recommended for most applications.</p>
 
 <p>To declare that your activity handles a configuration change, edit the appropriate <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element in
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element in
 your manifest file to include the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#config">{@code
 android:configChanges}</a> attribute with a value that represents the configuration you want to
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index 743e692..9adf6de 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -28,13 +28,13 @@
 <p class="note"><strong>Note:</strong> A string is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). So, you can
 combine string resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;string>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <string>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>compiled resource datatype:</dt>
@@ -125,13 +125,13 @@
 <p class="note"><strong>Note:</strong> A string array is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine string array resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;string-array>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <string-array>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>compiled resource datatype:</dt>
@@ -164,7 +164,7 @@
       <p>No attributes.</p>
     </dd>
   <dt id="string-array-element"><code>&lt;string-array&gt;</code></dt>
-    <dd>Defines an array of strings. Contains one or more {@code &lt;item>} elements.
+    <dd>Defines an array of strings. Contains one or more {@code <item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>name</code></dt>
@@ -175,7 +175,7 @@
     </dd>
   <dt id="string-array-item-element"><code>&lt;item&gt;</code></dt>
     <dd>A string, which can include styling tags. The value can be a reference to another
-string resource. Must be a child of a {@code &lt;string-array&gt;} element. Beware that you
+string resource. Must be a child of a {@code <string-array>} element. Beware that you
 must escape apostrophes and
 quotation marks. See <a href="#FormattingAndStyling">Formatting and Styling</a>, below, for
 information about to properly style and format your strings.
@@ -252,13 +252,13 @@
 <p class="note"><strong>Note:</strong> A plurals collection is a simple resource that is
 referenced using the value provided in the {@code name} attribute (not the name of the XML
 file). As such, you can combine plurals resources with other simple resources in the one
-XML file, under one {@code &lt;resources>} element.</p>
+XML file, under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
 <dt>file location:</dt>
 <dd><code>res/values/<em>filename</em>.xml</code><br/>
-The filename is arbitrary. The {@code &lt;plurals>} element's {@code name} will be used as the
+The filename is arbitrary. The {@code <plurals>} element's {@code name} will be used as the
 resource ID.</dd>
 
 <dt>resource reference:</dt>
@@ -291,7 +291,7 @@
     </dd>
   <dt id="plurals-element"><code>&lt;plurals&gt;</code></dt>
     <dd>A collection of strings, of which, one string is provided depending on the amount of
-something. Contains one or more {@code &lt;item>} elements.
+something. Contains one or more {@code <item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>name</code></dt>
@@ -302,7 +302,7 @@
     </dd>
   <dt id="plurals-item-element"><code>&lt;item&gt;</code></dt>
     <dd>A plural or singular string. The value can be a reference to another
-string resource. Must be a child of a {@code &lt;plurals&gt;} element. Beware that you must
+string resource. Must be a child of a {@code <plurals>} element. Beware that you must
 escape apostrophes and quotation marks. See <a href="#FormattingAndStyling">Formatting and
 Styling</a>, below, for information about to properly style and format your strings.
       <p class="caps">attributes:</p>
@@ -465,9 +465,9 @@
 </pre>
 <p>Supported HTML elements include:</p>
 <ul>
-  <li>{@code &lt;b>} for <b>bold</b> text.</li>
-  <li>{@code &lt;i>} for <i>italic</i> text.</li>
-  <li>{@code &lt;u>} for <u>underline</u> text.</li>
+  <li>{@code <b>} for <b>bold</b> text.</li>
+  <li>{@code <i>} for <i>italic</i> text.</li>
+  <li>{@code <u>} for <u>underline</u> text.</li>
 </ul>
 
 <p>Sometimes you may want to create a styled text resource that is also used as a format
@@ -486,8 +486,8 @@
   &lt;string name="welcome_messages"&gt;Hello, %1$s! You have &amp;lt;b>%2$d new messages&amp;lt;/b>.&lt;/string>
 &lt;/resources&gt;
 </pre>
-<p>In this formatted string, a {@code &lt;b>} element is added. Notice that the opening bracket is
-HTML-escaped, using the {@code &amp;lt;} notation.</p>
+<p>In this formatted string, a {@code <b>} element is added. Notice that the opening bracket is
+HTML-escaped, using the {@code &lt;} notation.</p>
   </li>
   <li>Then format the string as usual, but also call {@link android.text.Html#fromHtml} to
 convert the HTML text into styled text:
diff --git a/docs/html/guide/topics/resources/style-resource.jd b/docs/html/guide/topics/resources/style-resource.jd
index f6252dba..dc3d23f 100644
--- a/docs/html/guide/topics/resources/style-resource.jd
+++ b/docs/html/guide/topics/resources/style-resource.jd
@@ -23,7 +23,7 @@
 <p class="note"><strong>Note:</strong> A style is a simple resource that is referenced
 using the value provided in the {@code name} attribute (not the name of the XML file). As
 such, you can combine style resources with other simple resources in the one XML file,
-under one {@code &lt;resources>} element.</p>
+under one {@code <resources>} element.</p>
 
 <dl class="xml">
 
@@ -61,7 +61,7 @@
       <p>No attributes.</p>
     </dd>
   <dt id="style-element"><code>&lt;style&gt;</code></dt>
-    <dd>Defines a single style. Contains {@code &lt;item&gt;} elements.
+    <dd>Defines a single style. Contains {@code <item>} elements.
       <p class="caps">attributes:</p>
       <dl class="atn-list">
         <dt><code>name</code></dt>
diff --git a/docs/html/guide/topics/search/adding-custom-suggestions.jd b/docs/html/guide/topics/search/adding-custom-suggestions.jd
index 6ebef08..a251ce1 100644
--- a/docs/html/guide/topics/search/adding-custom-suggestions.jd
+++ b/docs/html/guide/topics/search/adding-custom-suggestions.jd
@@ -128,7 +128,7 @@
 <h2 id="CustomSearchableConfiguration">Modifying the searchable configuration</h2>
 
 <p>To add support for custom suggestions, add the {@code android:searchSuggestAuthority} attribute
-to the {@code &lt;searchable&gt;} element in your searchable configuration file. For example:</p>
+to the {@code <searchable>} element in your searchable configuration file. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?&gt;
@@ -608,7 +608,7 @@
 
 <p>The only scenario in which additional work is necessary is when your content provider demands a
 read permission. In which case, you need to add a special
-{@code &lt;path-permission&gt;} element for the provider to grant Quick Search Box read access to
+{@code <path-permission>} element for the provider to grant Quick Search Box read access to
 your content provider. For example:</p>
 
 <pre>
@@ -622,7 +622,7 @@
 </pre>
 
 <p>In this example, the provider restricts read and write access to the content. The
-{@code &lt;path-permission>} element amends the restriction by granting read access to content
+{@code <path-permission>} element amends the restriction by granting read access to content
 inside the {@code "/search_suggest_query"} path prefix when the {@code
 "android.permission.GLOBAL_SEARCH"} permission exists. This grants access to Quick Search Box
 so that it may query your content provider for suggestions.</p>
diff --git a/docs/html/guide/topics/search/adding-recent-query-suggestions.jd b/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
index e1020dd..8bd180e 100644
--- a/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
+++ b/docs/html/guide/topics/search/adding-recent-query-suggestions.jd
@@ -154,7 +154,7 @@
 
 <p>To configure the system to use your suggestions provider, you need to add
 the {@code android:searchSuggestAuthority} and {@code android:searchSuggestSelection} attributes to
-the {@code &lt;searchable&gt;} element in your searchable configuration file. For example:</p>
+the {@code <searchable>} element in your searchable configuration file. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?>
diff --git a/docs/html/guide/topics/search/search-dialog.jd b/docs/html/guide/topics/search/search-dialog.jd
index fcaaed36..1af3e5d 100644
--- a/docs/html/guide/topics/search/search-dialog.jd
+++ b/docs/html/guide/topics/search/search-dialog.jd
@@ -158,7 +158,7 @@
 
 <p>The searchable configuration file must include the <a
 href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
-&lt;searchable&gt;}</a> element as the root node and specify one
+<searchable>}</a> element as the root node and specify one
 or more attributes. For example:</p>
 
 <pre>
@@ -186,7 +186,7 @@
 
 <p>The <a
 href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
-&lt;searchable&gt;}</a> element accepts several other attributes. However, you don't need
+<searchable>}</a> element accepts several other attributes. However, you don't need
 most attributes until you add features such as <a href="#SearchSuggestions">search suggestions</a>
 and <a href="#VoiceSearch">voice search</a>. For detailed information about the searchable
 configuration file, see the <a
@@ -216,15 +216,15 @@
 <p>If you don't have one already, create an {@link android.app.Activity} that will perform
 searches and present results. You don't need to implement the search functionality yet&mdash;just
 create an activity that you can declare in the manifest. Inside the manifest's <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element:</p>
 <ol>
   <li>Declare the activity to accept the {@link android.content.Intent#ACTION_SEARCH} intent, in an
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a>
+<intent-filter>}</a>
 element.</li>
   <li>Specify the searchable configuration to use, in a <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element.</li>
 </ol>
 
@@ -243,17 +243,17 @@
 &lt;/application>
 </pre>
 
-<p>The {@code &lt;meta-data&gt;} element must include the {@code android:name} attribute with a
+<p>The {@code <meta-data>} element must include the {@code android:name} attribute with a
 value of {@code "android.app.searchable"} and the {@code android:resource} attribute with a
 reference to the searchable configuration file (in this example, it
 refers to the {@code res/xml/searchable.xml} file).</p>
 
 <p class="note"><strong>Note:</strong> The <a
 href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter&gt;}</a> does not need a <a
-href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a> with the
+<intent-filter>}</a> does not need a <a
+href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a> with the
 {@code DEFAULT} value (which you usually see in <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> elements),
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> elements),
 because the system delivers the {@link android.content.Intent#ACTION_SEARCH} intent explicitly to
 your searchable activity, using its component name.</p>
 
@@ -416,10 +416,10 @@
 searchable activity to use for the search dialog in {@code OtherActivity}.</p>
 
 <p>To declare the searchable activity for an activity's search dialog,
-add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element inside the respective activity's <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element.
-The <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element.
+The <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element must include the {@code android:value} attribute that specifies the searchable activity's
 class name and the {@code android:name} attribute with a value of {@code
 "android.app.default_searchable"}.</p>
@@ -452,7 +452,7 @@
 </pre>
 
 <p>Because the {@code OtherActivity} now includes a <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element to declare which searchable activity to use for searches, the activity has enabled the
 search dialog.
 While the user is in this activity, the {@link
@@ -464,15 +464,15 @@
 by default, so you don't need to add this declaration to {@code SearchableActivity}.</p>
 
 <p>If you want every activity in your application to provide the search dialog, insert the above <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element as a child of the <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element, instead of each <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>. This
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>. This
 way, every activity inherits the value, provides the search dialog, and delivers searches to
 the same searchable activity. (If you have multiple searchable activities, you can override the
 default searchable activity by placing a different <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 declaration inside individual activities.)</p>
 
 <p>With the search dialog now enabled for your activities, your application is ready to perform
diff --git a/docs/html/guide/topics/search/searchable-config.jd b/docs/html/guide/topics/search/searchable-config.jd
index 4874bb4..e6c1a0d 100644
--- a/docs/html/guide/topics/search/searchable-config.jd
+++ b/docs/html/guide/topics/search/searchable-config.jd
@@ -72,9 +72,9 @@
       <dt><a name="label"></a><code>android:label</code></dt>
       <dd><em>String resource</em>. (Required.) The name of your application.
 It should be the same as the name applied to the {@code android:label} attribute of your <a
-href="{@docRoot}guide/topics/manifest/activity-element.html#label">{@code &lt;activity&gt;}</a> or
+href="{@docRoot}guide/topics/manifest/activity-element.html#label">{@code <activity>}</a> or
 <a href="{@docRoot}guide/topics/manifest/application-element.html#label">{@code
-&lt;application&gt;}</a> manifest element. This label is only visible to the user when you set
+<application>}</a> manifest element. This label is only visible to the user when you set
 <code>android:includeInGlobalSearch</code> to "true", in which case, this label is used to identify
 your application as a searchable item in the system's search settings.</dd>
 
@@ -136,13 +136,13 @@
     <p>If you have defined a content provider to generate search suggestions, you need to
     define additional attributes that configure communications with the content
     provider. When providing search suggestions, you need some of the following
-    {@code &lt;searchable>} attributes:</p><br/>
+    {@code <searchable>} attributes:</p><br/>
 
       <dl class="atn-list">
       <dt><a name="searchSuggestAuthority"></a><code>android:searchSuggestAuthority</code></dt>
         <dd><em>String</em>. (Required to provide search suggestions.)
         This value must match the authority string provided in the {@code android:authorities}
-attribute of the Android manifest {@code &lt;provider>} element.</dd>
+attribute of the Android manifest {@code <provider>} element.</dd>
 
       <dt><a name="searchSuggestPath"></a><code>android:searchSuggestPath</code></dt>
         <dd><em>String</em>. This path is used as a portion of the suggestions
@@ -189,7 +189,7 @@
     <h4>Quick Search Box attributes</h4>
 
     <p>To make your custom search suggestions available to Quick Search Box, you need some of the
-    following {@code &lt;searchable>} attributes:</p><br/>
+    following {@code <searchable>} attributes:</p><br/>
 
       <dl class="atn-list">
       <dt><a name="includeInGlobalSearch"></a><code>android:includeInGlobalSearch</code></dt>
@@ -219,7 +219,7 @@
     <h4>Voice search attributes</h4>
 
     <p>To enable voice search, you'll need some of the
-    following {@code &lt;searchable>} attributes:</p><br/>
+    following {@code <searchable>} attributes:</p><br/>
 
       <dl class="atn-list">
         <dt><a name="voiceSearchMode"></a><code>android:voiceSearchMode</code></dt>
diff --git a/docs/html/guide/topics/security/permissions.jd b/docs/html/guide/topics/security/permissions.jd
index cfab3c9..6158e40 100644
--- a/docs/html/guide/topics/security/permissions.jd
+++ b/docs/html/guide/topics/security/permissions.jd
@@ -452,7 +452,7 @@
     <dd>Information about how requesting some permissions will implicitly restrict your app
     to devices that include the corresponding hardware or software feature.</dd>
     <dt><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code
-    &lt;uses-permission>}</a></dt>
+    <uses-permission>}</a></dt>
     <dd>API reference for the manifest tag that declare's your app's required system permissions.
     </dd>
     <dt>{@link android.Manifest.permission}</dt>
diff --git a/docs/html/guide/topics/ui/accessibility/apps.jd b/docs/html/guide/topics/ui/accessibility/apps.jd
index da24d03..567dc5b 100644
--- a/docs/html/guide/topics/ui/accessibility/apps.jd
+++ b/docs/html/guide/topics/ui/accessibility/apps.jd
@@ -357,7 +357,7 @@
 ViewCompat.setAccessibilityDelegate()} method to implement the accessibility methods
 above. For an example of this approach, see the Android Support Library (revision 5 or higher)
 sample {@code AccessibilityDelegateSupportActivity} in
-({@code &lt;sdk&gt;/extras/android/support/v4/samples/Support4Demos/})
+({@code <sdk>/extras/android/support/v4/samples/Support4Demos/})
   </li>
 </ul>
 
@@ -536,7 +536,7 @@
 directly in your custom view class. For another example of this approach, see the Android
 <a href="{@docRoot}tools/support-library/index.html">Support Library</a> (revision 5 or higher)
 sample {@code AccessibilityDelegateSupportActivity} in
-({@code &lt;sdk&gt;/extras/android/support/v4/samples/Support4Demos/}).</p>
+({@code <sdk>/extras/android/support/v4/samples/Support4Demos/}).</p>
 
 <p class="note"><strong>Note:</strong> You may find information on implementing accessibility for
 custom views written prior to Android 4.0 that describes the use of the
diff --git a/docs/html/guide/topics/ui/accessibility/services.jd b/docs/html/guide/topics/ui/accessibility/services.jd
index d69af9f..3ccdbc4 100644
--- a/docs/html/guide/topics/ui/accessibility/services.jd
+++ b/docs/html/guide/topics/ui/accessibility/services.jd
@@ -111,7 +111,7 @@
 android.accessibilityservice.AccessibilityService#setServiceInfo setServiceInfo()} at runtime.
 However, not all configuration options are available using this method.</p>
 
-<p>Beginning with Android 4.0, you can include a {@code &lt;meta-data&gt;} element in your manifest
+<p>Beginning with Android 4.0, you can include a {@code <meta-data>} element in your manifest
 with a reference to a configuration file, which allows you to set the full range of options for
 your accessibility service, as shown in the following example:</p>
 
@@ -125,7 +125,7 @@
 </pre>
 
 <p>This meta-data element refers to an XML file that you create in your application’s resource
-directory ({@code &lt;project_dir&gt;/res/xml/accessibility_service_config.xml}). The following code
+directory ({@code <project_dir>/res/xml/accessibility_service_config.xml}). The following code
 shows example contents for the service configuration file:</p>
 
 <pre>
@@ -445,7 +445,7 @@
 
 <p>The API Demo project contains two samples which can be used as a starting point for generating
 accessibility services
-({@code &lt;sdk&gt;/samples/&lt;platform&gt;/ApiDemos/src/com/example/android/apis/accessibility}):
+({@code <sdk>/samples/<platform>/ApiDemos/src/com/example/android/apis/accessibility}):
 </p>
 
 <ul>
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index b2f98ad..c21671f 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -184,9 +184,9 @@
 <p>By default, the system uses your application icon in the action bar, as specified by the <a
 href="{@docRoot}guide/topics/manifest/application-element.html#icon">{@code icon}</a>
 attribute in the <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-&lt;application&gt;}</a> or <a
+<application>}</a> or <a
 href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> element. However, if you also specify the <a
+<activity>}</a> element. However, if you also specify the <a
 href="{@docRoot}guide/topics/manifest/application-element.html#logo">{@code logo}</a>
 attribute, then the action bar uses the logo image instead of the icon.</p>
 
@@ -249,7 +249,7 @@
 
 <p>To request that an item appear directly in the action bar
 as an action button, include {@code
-showAsAction="ifRoom"} in the {@code &lt;item&gt;} tag. For example:</p>
+showAsAction="ifRoom"} in the {@code <item>} tag. For example:</p>
 
 <pre>
 &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
@@ -269,7 +269,7 @@
 <div class="note" id="XmlAttributes">
 <p><strong>Using XML attributes from the support library</strong></p>
 Notice that the {@code showAsAction} attribute above uses a custom namespace defined in the
-{@code &lt;menu>} tag. This is necessary when using any XML attributes defined by the support
+{@code <menu>} tag. This is necessary when using any XML attributes defined by the support
 library, because these attributes do not exist in the Android framework on older devices.
 So you must use your own namespace as a prefix for all attributes defined by the support library.
 </p>
@@ -319,7 +319,7 @@
 <p>When the user presses an action, the system calls your activity's {@link
 android.app.Activity#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} method. Using the
 {@link android.view.MenuItem} passed to this method, you can identify the action by calling {@link
-android.view.MenuItem#getItemId()}. This returns the unique ID provided by the {@code &lt;item&gt;}
+android.view.MenuItem#getItemId()}. This returns the unique ID provided by the {@code <item>}
 tag's {@code id} attribute so you can perform the appropriate action. For example:</p>
 
 <pre>
@@ -373,15 +373,15 @@
 <p>To enable split action bar when using the support library, you must do two things:</p>
 <ol>
   <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to each
-<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element or to the
-<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element. This attribute is understood only by API level 14 and higher (it is ignored
 by older versions).</li>
   <li>To support older versions, add a <a
-  href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data>}</a>
+  href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
   element as a child of each
-  <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+  <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
   element that declares the same value for {@code "android.support.UI_OPTIONS"}.</li>
 </ol>
 
@@ -460,10 +460,10 @@
     <p>Beginning in Android 4.1 (API level 16), you can declare the parent with the <a href=
 "{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code parentActivityName}</a>
 attribute in the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> element.</p>
+<activity>}</a> element.</p>
     <p>To support older devices with the support library, also
 include a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
-&lt;meta-data&gt;}</a> element that specifies
+<meta-data>}</a> element that specifies
 the parent activity as the value for {@code android.support.PARENT_ACTIVITY}. For example:</p>
 <pre>
 &lt;application ... >
@@ -681,7 +681,7 @@
 and an action provider can display a submenu when pressed.</p>
 
 <p>To declare an action provider, supply the {@code actionViewClass} attribute in the
-menu {@code &lt;item>} tag with a fully-qualified class name for an
+menu {@code <item>} tag with a fully-qualified class name for an
 {@link android.support.v4.view.ActionProvider}.</p>
 
 <p>You can build your own action provider by extending the {@link
@@ -709,7 +709,7 @@
 <h3 id="ShareActionProvider">Using the ShareActionProvider</h3>
 
 <p>To add a "share" action with {@link android.support.v7.widget.ShareActionProvider},
-define the {@code actionProviderClass} for an {@code &lt;item&gt;} tag with
+define the {@code actionProviderClass} for an {@code <item>} tag with
 the {@link android.support.v7.widget.ShareActionProvider} class. For example:</p>
 
 <pre>
@@ -1489,7 +1489,7 @@
 
 
 <p class="caution"><strong>Caution:</strong> Be certain that each theme and style declares a parent
-theme in the {@code &lt;style&gt;} tag, from which it inherits all styles not explicitly declared
+theme in the {@code <style>} tag, from which it inherits all styles not explicitly declared
 by your theme. When modifying the action bar, using a parent theme is important so that you can
 simply override the action bar styles you want to change without re-implementing the styles you
 want to leave alone (such as text size or padding in action items).</p>
diff --git a/docs/html/guide/topics/ui/controls/button.jd b/docs/html/guide/topics/ui/controls/button.jd
index b52c3e9..295044f 100644
--- a/docs/html/guide/topics/ui/controls/button.jd
+++ b/docs/html/guide/topics/ui/controls/button.jd
@@ -73,7 +73,7 @@
 an on-click event.</p>
 
 <p>To define the click event handler for a button, add the {@link
-android.R.attr#onClick android:onClick} attribute to the {@code &lt;Button&gt;} element in your XML
+android.R.attr#onClick android:onClick} attribute to the {@code <Button>} element in your XML
 layout. The value for this attribute must be the name of the method you want to call in response
 to a click event. The {@link android.app.Activity} hosting the layout must then implement the
 corresponding method.</p>
@@ -140,7 +140,7 @@
 <p>You can control exactly how your controls are styled using a theme that you apply to your
 entire application. For instance, to ensure that all devices running Android 4.0 and higher use
 the Holo theme in your app, declare {@code android:theme="@android:style/Theme.Holo"} in your
-manifest's {@code &lt;application&gt;} element. Also read the blog post, <a
+manifest's {@code <application>} element. Also read the blog post, <a
 href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">Holo Everywhere</a>
 for information about using the Holo theme while supporting older devices.</p>
 
diff --git a/docs/html/guide/topics/ui/controls/spinner.jd b/docs/html/guide/topics/ui/controls/spinner.jd
index d2db7a4..3b8aaad 100644
--- a/docs/html/guide/topics/ui/controls/spinner.jd
+++ b/docs/html/guide/topics/ui/controls/spinner.jd
@@ -27,7 +27,7 @@
 <img src="{@docRoot}images/ui/spinner.png" alt="" />
 
 <p>You can add a spinner to your layout with the {@link android.widget.Spinner} object. You
-should usually do so in your XML layout with a {@code &lt;Spinner&gt;} element. For example:</p>
+should usually do so in your XML layout with a {@code <Spinner>} element. For example:</p>
 
 <pre>
 &lt;Spinner
diff --git a/docs/html/guide/topics/ui/controls/text.jd b/docs/html/guide/topics/ui/controls/text.jd
index c11dc32..f4d72b2a 100644
--- a/docs/html/guide/topics/ui/controls/text.jd
+++ b/docs/html/guide/topics/ui/controls/text.jd
@@ -36,7 +36,7 @@
 (cut, copy, paste) and data look-up via auto-completion.</p>
 
 <p>You can add a text field to you layout with the {@link android.widget.EditText} object. You
-should usually do so in your XML layout with a {@code &lt;EditText&gt;} element.</p>
+should usually do so in your XML layout with a {@code <EditText>} element.</p>
 
 <img src="{@docRoot}images/ui/edittext-noextract.png" alt="" />
 
diff --git a/docs/html/guide/topics/ui/dialogs.jd b/docs/html/guide/topics/ui/dialogs.jd
index 0c6ec84..e4469ea 100644
--- a/docs/html/guide/topics/ui/dialogs.jd
+++ b/docs/html/guide/topics/ui/dialogs.jd
@@ -484,7 +484,7 @@
 instead of using the {@link android.app.Dialog} APIs. Simply create an activity and set its theme to
 {@link android.R.style#Theme_Holo_Dialog Theme.Holo.Dialog}
 in the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> manifest element:</p>
+<activity>}</a> manifest element:</p>
 
 <pre>
 &lt;activity android:theme="&#64;android:style/Theme.Holo.Dialog" >
@@ -754,7 +754,7 @@
 <p>To show an activity as a dialog only when on large screens,
 apply the {@link android.R.style#Theme_Holo_DialogWhenLarge Theme.Holo.DialogWhenLarge}
 theme to the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity&gt;}</a> manifest element:</p>
+<activity>}</a> manifest element:</p>
 
 <pre>
 &lt;activity android:theme="&#64;android:style/Theme.Holo.DialogWhenLarge" >
diff --git a/docs/html/guide/topics/ui/menus.jd b/docs/html/guide/topics/ui/menus.jd
index dfcea52..2c6d0b2 100644
--- a/docs/html/guide/topics/ui/menus.jd
+++ b/docs/html/guide/topics/ui/menus.jd
@@ -141,7 +141,7 @@
 element may contain a nested <code>&lt;menu></code> element in order to create a submenu.</dd>
     
   <dt><code>&lt;group></code></dt>
-    <dd>An optional, invisible container for {@code &lt;item&gt;} elements. It allows you to
+    <dd>An optional, invisible container for {@code <item>} elements. It allows you to
 categorize menu items so they share properties such as active state and visibility. For more
 information, see the section about <a href="#groups">Creating Menu Groups</a>.</dd>
 </dl>
@@ -181,8 +181,8 @@
 For information about all the supported attributes, see the <a
 href="{@docRoot}guide/topics/resources/menu-resource.html">Menu Resource</a> document.</p>
 
-<p>You can add a submenu to an item in any menu (except a submenu) by adding a {@code &lt;menu&gt;}
-element as the child of an {@code &lt;item&gt;}. Submenus are useful when your application has a lot
+<p>You can add a submenu to an item in any menu (except a submenu) by adding a {@code <menu>}
+element as the child of an {@code <item>}. Submenus are useful when your application has a lot
 of functions that can be organized into topics, like items in a PC application's menu bar (File,
 Edit, View, etc.). For example:</p>
 
@@ -239,7 +239,7 @@
 the right side of the action bar (or by pressing the device <em>Menu</em> button, if available). To
 enable
 quick access to important actions, you can promote a few items to appear in the action bar by adding
-{@code android:showAsAction="ifRoom"} to the corresponding {@code &lt;item&gt;} elements (see figure
+{@code android:showAsAction="ifRoom"} to the corresponding {@code <item>} elements (see figure
 2). <p>For more information about action items and other action bar behaviors, see the <a
 href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> guide. </p>
 <p class="note"><strong>Note:</strong> Even if you're <em>not</em> developing for Android 3.0 or
@@ -260,7 +260,7 @@
 declare items for the options menu, they are combined in the UI. The activity's items appear
 first, followed by those of each fragment in the order in which each fragment is added to the
 activity. If necessary, you can re-order the menu items with the {@code android:orderInCategory}
-attribute in each {@code &lt;item&gt;} you need to move.</p>
+attribute in each {@code <item>} you need to move.</p>
 
 <p>To specify the options menu for an activity, override {@link
 android.app.Activity#onCreateOptionsMenu(Menu) onCreateOptionsMenu()} (fragments provide their
@@ -833,7 +833,7 @@
 android.view.Menu#setGroupCheckable(int,boolean,boolean) setGroupCheckable()}</li>
 </ul>
 
-<p>You can create a group by nesting {@code &lt;item&gt;} elements inside a {@code &lt;group&gt;}
+<p>You can create a group by nesting {@code <item>} elements inside a {@code <group>}
 element in your menu resource or by specifying a group ID with the {@link
 android.view.Menu#add(int,int,int,int) add()} method.</p>
 
@@ -882,8 +882,8 @@
 each time the state changes.</p>
 
 <p>You can define the checkable behavior for individual menu items using the {@code
-android:checkable} attribute in the {@code &lt;item&gt;} element, or for an entire group with
-the {@code android:checkableBehavior} attribute in the {@code &lt;group&gt;} element. For
+android:checkable} attribute in the {@code <item>} element, or for an entire group with
+the {@code android:checkableBehavior} attribute in the {@code <group>} element. For
 example, all items in this menu group are checkable with a radio button:</p>
 
 <pre>
@@ -909,7 +909,7 @@
 </dl>
 
 <p>You can apply a default checked state to an item using the {@code android:checked} attribute in
-the {@code &lt;item&gt;} element and change it in code with the {@link
+the {@code <item>} element and change it in code with the {@link
 android.view.MenuItem#setChecked(boolean) setChecked()} method.</p>
 
 <p>When a checkable item is selected, the system calls your respective item-selected callback method
diff --git a/docs/html/guide/topics/ui/settings.jd b/docs/html/guide/topics/ui/settings.jd
index 02f1255..89960bb 100644
--- a/docs/html/guide/topics/ui/settings.jd
+++ b/docs/html/guide/topics/ui/settings.jd
@@ -186,7 +186,7 @@
 generally pre-determined, although you can still modify the collection at runtime.</p>
 
 <p>Each {@link android.preference.Preference} subclass can be declared with an XML element that
-matches the class name, such as {@code &lt;CheckBoxPreference>}.</p>
+matches the class name, such as {@code <CheckBoxPreference>}.</p>
 
 <p>You must save the XML file in the {@code res/xml/} directory. Although you can name the file
 anything you want, it's traditionally named {@code preferences.xml}. You usually need only one file,
@@ -197,7 +197,7 @@
 settings, then you need separate XML files for each fragment.</p>
 
 <p>The root node for the XML file must be a {@link android.preference.PreferenceScreen
-&lt;PreferenceScreen&gt;} element. Within this element is where you add each {@link
+<PreferenceScreen>} element. Within this element is where you add each {@link
 android.preference.Preference}. Each child you add within the
 {@link android.preference.PreferenceScreen &lt;PreferenceScreen&gt;} element appears as a single
 item in the list of settings.</p>
@@ -234,7 +234,7 @@
   <p>The only instances in which this attribute is <em>not required</em> is when the preference is a
 {@link android.preference.PreferenceCategory} or {@link android.preference.PreferenceScreen}, or the
 preference specifies an {@link android.content.Intent} to invoke (with an <a
-href="#Intents">{@code &lt;intent&gt;}</a> element) or a {@link android.app.Fragment} to display (with an <a
+href="#Intents">{@code <intent>}</a> element) or a {@link android.app.Fragment} to display (with an <a
 href="{@docRoot}reference/android/preference/Preference.html#attr_android:fragment">{@code
 android:fragment}</a> attribute).</p>
   </dd>
@@ -323,7 +323,7 @@
 
 <img src="{@docRoot}images/ui/settings/settings-subscreen.png" alt="" />
 <p class="img-caption"><strong>Figure 3.</strong> Setting subscreens. The {@code
-&lt;PreferenceScreen>} element
+<PreferenceScreen>} element
 creates an item that, when selected, opens a separate list to display the nested settings.</p>
 
 <p>For example:</p>
@@ -360,8 +360,8 @@
 
 <p>In some cases, you might want a preference item to open a different activity instead of a
 settings screen, such as a web browser to view a web page. To invoke an {@link
-android.content.Intent} when the user selects a preference item, add an {@code &lt;intent&gt;}
-element as a child of the corresponding {@code &lt;Preference&gt;} element.</p>
+android.content.Intent} when the user selects a preference item, add an {@code <intent>}
+element as a child of the corresponding {@code <Preference>} element.</p>
 
 <p>For example, here's how you can use a preference item to open a web page:</p>
 
@@ -577,7 +577,7 @@
 <img src="{@docRoot}images/ui/settings/settings-headers-tablet.png" alt="" />
 <p class="img-caption"><strong>Figure 4.</strong> Two-pane layout with headers. <br/><b>1.</b> The
 headers are defined with an XML headers file. <br/><b>2.</b> Each group of settings is defined by a
-{@link android.preference.PreferenceFragment} that's specified by a {@code &lt;header>} element in
+{@link android.preference.PreferenceFragment} that's specified by a {@code <header>} element in
 the headers file.</p>
 
 <img src="{@docRoot}images/ui/settings/settings-headers-handset.png" alt="" />
@@ -588,8 +588,8 @@
 
 <h3 id="CreateHeaders" style="clear:left">Creating the headers file</h3>
 
-<p>Each group of settings in your list of headers is specified by a single {@code &lt;header>}
-element inside a root {@code &lt;preference-headers>} element. For example:</p>
+<p>Each group of settings in your list of headers is specified by a single {@code <header>}
+element inside a root {@code <preference-headers>} element. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?>
@@ -611,7 +611,7 @@
 <p>With the {@code android:fragment} attribute, each header declares an instance of {@link
 android.preference.PreferenceFragment} that should open when the user selects the header.</p>
 
-<p>The {@code &lt;extras>} element allows you to pass key-value pairs to the fragment in a {@link
+<p>The {@code <extras>} element allows you to pass key-value pairs to the fragment in a {@link
 android.os.Bundle}. The fragment can retrieve the arguments by calling {@link
 android.app.Fragment#getArguments()}. You might pass arguments to the fragment for a variety of
 reasons, but one good reason is to reuse the same subclass of {@link
@@ -619,7 +619,7 @@
 preferences XML file the fragment should load.</p>
 
 <p>For example, here's a fragment that can be reused for multiple settings groups, when each
-header defines an {@code &lt;extra>} argument with the {@code "settings"} key:</p>
+header defines an {@code <extra>} argument with the {@code "settings"} key:</p>
 
 <pre>
 public static class SettingsFragment extends PreferenceFragment {
@@ -717,7 +717,7 @@
 &lt;/PreferenceScreen>
 </pre>
 
-<p>Because support for {@code &lt;preference-headers>} was added in Android 3.0, the system calls
+<p>Because support for {@code <preference-headers>} was added in Android 3.0, the system calls
 {@link android.preference.PreferenceActivity#onBuildHeaders onBuildHeaders()} in your {@link
 android.preference.PreferenceActivity} only when running on Androd 3.0 or higher. In order to load
 the "legacy" headers file ({@code preference_headers_legacy.xml}), you must check the Android
@@ -747,7 +747,7 @@
 
 <p>The only thing left to do is handle the {@link android.content.Intent} that's passed into the
 activity to identify which preference file to load. So retrieve the intent's action and compare it
-to known action strings that you've used in the preference XML's {@code &lt;intent>} tags:</p>
+to known action strings that you've used in the preference XML's {@code <intent>} tags:</p>
 
 <pre>
 final static String ACTION_PREFS_ONE = "com.example.prefs.PREFS_ONE";
diff --git a/docs/html/guide/topics/ui/themes.jd b/docs/html/guide/topics/ui/themes.jd
index bc1c4f0..f932dbd 100644
--- a/docs/html/guide/topics/ui/themes.jd
+++ b/docs/html/guide/topics/ui/themes.jd
@@ -77,13 +77,13 @@
 directory of your project. The name of the XML file is arbitrary, but it must use the
 {@code .xml} extension and be saved in the {@code res/values/} folder.</p>
 
-<p>The root node of the XML file must be {@code &lt;resources&gt;}.</p>
+<p>The root node of the XML file must be {@code <resources>}.</p>
 
-<p>For each style you want to create, add a {@code &lt;style>} element to the file
+<p>For each style you want to create, add a {@code <style>} element to the file
 with a {@code name} that uniquely identifies the style (this attribute is required).
-Then add an {@code &lt;item>} element for each property of that style, with a
+Then add an {@code <item>} element for each property of that style, with a
 {@code name} that declares the style property and a value to go with it (this attribute
-is required). The value for the {@code &lt;item>} can
+is required). The value for the {@code <item>} can
 be a keyword string, a hex color, a reference to another resource type, or other value
 depending on the style property.
 Here's an example file with a single style:</p>
@@ -100,12 +100,12 @@
 &lt;/resources&gt;
 </pre>
 
-<p>Each child of the {@code &lt;resources>} element is converted into an application resource
-object at compile-time, which can be referenced by the value in the {@code &lt;style>} element's
+<p>Each child of the {@code <resources>} element is converted into an application resource
+object at compile-time, which can be referenced by the value in the {@code <style>} element's
 {@code name} attribute. This example style can be referenced from an XML layout as
 {@code @style/CodeFont} (as demonstrated in the introduction above).</p>
 
-<p>The <code>parent</code> attribute in the {@code &lt;style>} element is optional and
+<p>The <code>parent</code> attribute in the {@code <style>} element is optional and
 specifies the resource ID of another style from which this style should inherit
 properties. You can then override the inherited style properties if you want to.</p>
 
@@ -117,7 +117,7 @@
 
 <h3 id="Inheritance">Inheritance</h3>
 
-<p>The {@code parent} attribute in the {@code &lt;style>} element lets you specify a style
+<p>The {@code parent} attribute in the {@code <style>} element lets you specify a style
 from which your style should inherit properties.
 You can use this to inherit properties from an existing style and
 then define only the properties that you want to change or add. You can
@@ -144,7 +144,7 @@
     &lt;/style&gt;
 </pre>
 
-<p>Notice that there is no {@code parent} attribute in the {@code &lt;style&gt;} tag, but because
+<p>Notice that there is no {@code parent} attribute in the {@code <style>} tag, but because
 the {@code name} attribute begins with the {@code CodeFont} style name (which
 is a style that you have created), this style inherits all style properties from that style. This
 style then overrides the {@code android:textColor} property to make the text red. You can
@@ -170,7 +170,7 @@
 <h3 id="Properties">Style Properties</h3>
 
 <p>Now that you understand how a style is defined, you need to learn what kind
-of style properties&mdash;defined by the {@code &lt;item>} element&mdash;are available.
+of style properties&mdash;defined by the {@code <item>} element&mdash;are available.
 You're probably familiar with some already, such as {@link android.R.attr#layout_width} and
 {@link android.R.attr#textColor}. Of course, there are many more style properties you can use.</p>
 
@@ -184,7 +184,7 @@
 android:inputType}</a>, so where you might normally place the <a
 href="{@docRoot}reference/android/widget/TextView.html#attr_android:inputType">{@code
 android:inputType}</a>
-attribute in an {@code &lt;EditText>} element, like this:</p>
+attribute in an {@code <EditText>} element, like this:</p>
 <pre>
 &lt;EditText
     android:inputType="number"
@@ -226,8 +226,8 @@
 style as a theme.</p>
 
 <p class="note"><strong>Note:</strong> Don't forget to prefix the property names in each
-{@code &lt;item&gt;} element with the <code>android:</code> namespace. For example:
-{@code &lt;item name="android:inputType">}.</p>
+{@code <item>} element with the <code>android:</code> namespace. For example:
+{@code <item name="android:inputType">}.</p>
 
 
 
diff --git a/docs/html/guide/webapps/best-practices.jd b/docs/html/guide/webapps/best-practices.jd
index a13c69da..9e070c6 100644
--- a/docs/html/guide/webapps/best-practices.jd
+++ b/docs/html/guide/webapps/best-practices.jd
@@ -72,7 +72,7 @@
 
 
 <li>Use viewport meta data to properly resize your web page
-  <p>In your document {@code &lt;head&gt;}, you should provide meta data that specifies how you
+  <p>In your document {@code <head>}, you should provide meta data that specifies how you
 want the browser's viewport to render your web page. For example, your viewport meta data can
 specify the height and width for the browser's viewport, the initial web page scale and even the
 target screen density.</p>
@@ -89,7 +89,7 @@
   <p>Because mobile devices typically have a connection speed far slower than a desktop
 computer, you should make your web pages load as fast as possible. One way to speed it up is to
 avoid loading extra files such as stylesheets and script files in the {@code
-&lt;head&gt;}. Instead, provide your CSS and JavaScript directly in the &lt;head&gt; (or
+<head>}. Instead, provide your CSS and JavaScript directly in the &lt;head&gt; (or
 at the end of the &lt;body&gt;, for scripts that you don't need until the page is loaded).
 Alternatively, you should optimize the size and speed of your files by compressing them with tools
 like <a href="http://code.google.com/p/minify/">Minify</a>.</p>
diff --git a/docs/html/guide/webapps/targeting.jd b/docs/html/guide/webapps/targeting.jd
index 7e02340..4a2ea17 100644
--- a/docs/html/guide/webapps/targeting.jd
+++ b/docs/html/guide/webapps/targeting.jd
@@ -78,8 +78,8 @@
 with {@link android.webkit.WebSettings#setUseWideViewPort setUseWideViewPort()}.</p>
 
 <p>You can define properties of the viewport for your web page, such as the width and initial zoom
-level, using the {@code &lt;meta name="viewport" ...>} tag in your document
-{@code &lt;head&gt;}.</p>
+level, using the {@code <meta name="viewport" ...>} tag in your document
+{@code <head>}.</p>
 
 <p>The following syntax shows all of the
 supported viewport properties and the types of values accepted by each one:</p>
@@ -96,7 +96,7 @@
           " /&gt;
 </pre>
 
-<p>For example, the following {@code &lt;meta&gt;} tag specifies that the viewport width
+<p>For example, the following {@code <meta>} tag specifies that the viewport width
 should exactly match the device screen's width and that the ability to zoom should be disabled:</p>
 
 <pre>
diff --git a/docs/html/guide/webapps/webview.jd b/docs/html/guide/webapps/webview.jd
index 9b46b5b..f133b57 100644
--- a/docs/html/guide/webapps/webview.jd
+++ b/docs/html/guide/webapps/webview.jd
@@ -68,7 +68,7 @@
 <h2 id="AddingWebView">Adding a WebView to Your Application</h2>
 
 <p>To add a {@link android.webkit.WebView} to your Application, simply include the {@code
-&lt;WebView&gt;} element in your activity layout. For example, here's a layout file in which the
+<WebView>} element in your activity layout. For example, here's a layout file in which the
 {@link android.webkit.WebView} fills the screen:</p>
 
 <pre>
@@ -171,7 +171,7 @@
 <p class="caution"><strong>Caution:</strong> If you've set your <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a>
 to 17 or higher, <strong>you
-must add the {@code &#64;JavascriptInterface} annotation</strong> to any method that you want
+must add the <code>&#64;JavascriptInterface</code> annotation</strong> to any method that you want
 available to your JavaScript (the method must also be public). If you do not provide the
 annotation, the method is not accessible by your web page when running on Android 4.2 or
 higher.</p>
diff --git a/docs/html/ndk/downloads/revision_history.jd b/docs/html/ndk/downloads/revision_history.jd
index a32b814..95bfe7c 100644
--- a/docs/html/ndk/downloads/revision_history.jd
+++ b/docs/html/ndk/downloads/revision_history.jd
@@ -1218,7 +1218,7 @@
                 (<a href="https://android-review.googlesource.com/#/c/46821">Change 46821</a>)</li>
               <li>Modified {@code wchar.h} to not redefine {@code WCHAR_MAX} and
                 {@code WCHAR_MIN}</li>
-              <li>Fixed {@code &lt;inttypes.h&gt;} declaration for pointer-related {@code PRI} and
+              <li>Fixed {@code <inttypes.h>} declaration for pointer-related {@code PRI} and
                 {@code SCN} macros. (<a href="http://b.android.com/57218">Issue 57218</a>)</li>
               <li>Changed the {@code sys/cdefs.h} header so that {@code __WCHAR_TYPE__} is 32-bit
                 for API levels less than 9, which means that {@code wchat_t} is 32-bit for all
@@ -1367,7 +1367,7 @@
             (<a href="http://b.android.com/52909">Issue 52909</a>)</li>
           <li>Fixed a GCC 4.7 segfault.
             (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245">GCC Issue</a>)</li>
-          <li>Fixed {@code &lt;chrono&gt;} clock resolution and enabled {@code steady_clock}.
+          <li>Fixed {@code <chrono>} clock resolution and enabled {@code steady_clock}.
             (<a href="http://b.android.com/39680">Issue 39680</a>)</li>
           <li>Fixed toolchain to enable {@code _GLIBCXX_HAS_GTHREADS} for GCC 4.7 libstdc++.
             (<a href="http://b.android.com/41770">Issue 41770</a>,
@@ -1387,7 +1387,7 @@
             (<a href="https://android-review.googlesource.com/#/c/52134">Change 52134</a>)</li>
           <li>Fixed Clang 3.1 internal compiler error when using Eigen library.
             (<a href="http://b.android.com/41246">Issue 41246</a>)</li>
-          <li>Fixed Clang 3.1 internal compiler error including {@code &lt;chrono&gt;} in C++11
+          <li>Fixed Clang 3.1 internal compiler error including {@code <chrono>} in C++11
 mode.
             (<a href="http://b.android.com/39600">Issue 39600</a>)</li>
           <li>Fixed Clang 3.1 internal compiler error when generating object code for a method
@@ -1484,7 +1484,7 @@
             (<a href="http://b.android.com/52805">Issue 52805</a>)</li>
           <li>Enabled {@code FUTEX} system call in GNU libstdc++.</li>
           <li>Updated {@code ndk-build} so that it  no longer copies prebuilt static library to
-            a project's {@code obj/local/&lt;abi&gt;/} directory.
+            a project's {@code obj/local/<abi>/} directory.
             (<a href="http://b.android.com/40302">Issue 40302</a>)</li>
           <li>Removed {@code __ARM_ARCH_5*__} from ARM {@code toolchains/*/setup.mk} script.
             (<a href="http://b.android.com/21132">Issue 21132</a>)</li>
@@ -1723,8 +1723,8 @@
                 add this environment variable setting to {@code Application.mk}.</li>
               <li>For standalone builds, add {@code --llvm-version=3.1} to
                 {@code make-standalone-toolchain.sh} and replace {@code CC} and {@code CXX} in your
-                makefile with {@code &lt;tool-path&gt;/bin/clang} and
-                {@code &lt;tool-path&gt;/bin/clang++}. See {@code STANDALONE-TOOLCHAIN.html} for
+                makefile with {@code <tool-path>/bin/clang} and
+                {@code <tool-path>/bin/clang++}. See {@code STANDALONE-TOOLCHAIN.html} for
                 details.</li>
             </ul>
             <p class="note"><strong>Note:</strong> This feature is experimental. Please try it and
@@ -1915,12 +1915,12 @@
               <li>Removed unimplemented functions in {@code malloc.h}.</li>
               <li>Fixed {@code stdint.h} defintion of {@code uint64_t} for ANSI compilers.
               (<a href="http://b.android.com/1952">Issue 1952</a>)</li>
-              <li>Fixed preprocessor macros in {@code &lt;arch&gt;/include/machine/*}.</li>
+              <li>Fixed preprocessor macros in {@code <arch>/include/machine/*}.</li>
               <li>Replaced {@code link.h} for MIPS with new version supporting all platforms.</li>
               <li>Removed {@code linux-unistd.h}</li>
               <li>Move GLibc-specific macros {@code LONG_LONG_MIN}, {@code LONG_LONG_MAX} and
-              {@code ULONG_LONG_MAX} from {@code &lt;pthread.h&gt;} to {@code
-&lt;limits.h&gt;}.</li>
+              {@code ULONG_LONG_MAX} from {@code <pthread.h>} to {@code
+<limits.h>}.</li>
             </ul>
           </li>
           <li>Fixed a buffer overflow in {@code ndk-stack-parser}.</li>
@@ -2177,8 +2177,8 @@
           <li>Changed locations of binaries:
             <ul>
               <li>Moved {@code gdbserver} from
-{@code toolchain/&lt;arch-os-ver&gt;/prebuilt/gdbserver} to
-{@code prebuilt/android-&lt;arch&gt;/gdbserver/gdbserver}.</li>
+{@code toolchain/<arch-os-ver>/prebuilt/gdbserver} to
+{@code prebuilt/android-<arch>/gdbserver/gdbserver}.</li>
               <li>Renamed x86 toolchain prefix from {@code i686-android-linux-} to
 {@code i686-linux-android-}.</li>
               <li>Moved {@code sources/cxx-stl/gnu-libstdc++/include} and {@code lib} to
@@ -2262,7 +2262,7 @@
       <dd>
         <ul>
           <li>Fixed a typo in GAbi++ implementation where the result of {@code
-          dynamic_cast&lt;D&gt;(b)} of base class object {@code b} to derived class {@code D} is
+          dynamic_cast<D>(b)} of base class object {@code b} to derived class {@code D} is
           incorrectly adjusted in the opposite direction from the base class.
           (<a href="http://b.android.com/28721">Issue 28721</a>)
           </li>
diff --git a/docs/html/ndk/guides/abis.jd b/docs/html/ndk/guides/abis.jd
index f4819b2..7b1a7ad 100644
--- a/docs/html/ndk/guides/abis.jd
+++ b/docs/html/ndk/guides/abis.jd
@@ -418,8 +418,8 @@
 /lib/&lt;abi&gt;/lib&lt;name&gt;.so
 </pre>
 
-<p>Here, {@code &lt;abi&gt;} is one of the ABI names listed under <a href="#sa">Supported ABIs</a>,
-and {@code &lt;name&gt;} is the name of the library as you defined it for the {@code LOCAL_MODULE}
+<p>Here, {@code <abi>} is one of the ABI names listed under <a href="#sa">Supported ABIs</a>,
+and {@code <name>} is the name of the library as you defined it for the {@code LOCAL_MODULE}
 variable in the <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file. Since
 APK files are just zip files, it is trivial to open them and confirm that the shared native
 libraries are where they belong.</p>
@@ -488,7 +488,7 @@
 
 <p>When it finds the libraries that it's looking for, the package manager
 copies them to <code>/lib/lib&lt;name&gt;.so</code>, under the application's
-{@code data} directory ({@code data/data/&lt;package_name&gt;/lib/}).</p>
+{@code data} directory ({@code data/data/<package_name>/lib/}).</p>
 
 <p>If there is no shared-object file at all, the application builds and installs, but crashes at
 runtime.</p>
diff --git a/docs/html/ndk/guides/android_mk.jd b/docs/html/ndk/guides/android_mk.jd
index 47fefc3..1416d13 100644
--- a/docs/html/ndk/guides/android_mk.jd
+++ b/docs/html/ndk/guides/android_mk.jd
@@ -774,7 +774,7 @@
 
 <h3 id="npfm">NDK-provided function macros</h2>
 <p>This section explains GNU Make function macros that the NDK provides. Use
-{@code $(call &lt;function&gt;)} to evaluate them; they return textual information.</p>
+{@code $(call <function>)} to evaluate them; they return textual information.</p>
 
 <h4>my-dir</h4>
 
@@ -870,6 +870,6 @@
 $(call import-module,&lt;name&gt;)
 </pre>
 
-<p>In this example, the build system looks for the module tagged {@code &lt;name&gt;} in the list of
+<p>In this example, the build system looks for the module tagged {@code <name>} in the list of
 directories referenced that your {@code NDK_MODULE_PATH} environment variable references, and
 includes its {@code Android.mk} file automatically for you.</p>
\ No newline at end of file
diff --git a/docs/html/ndk/guides/application_mk.jd b/docs/html/ndk/guides/application_mk.jd
index 1294687..e669f3f 100644
--- a/docs/html/ndk/guides/application_mk.jd
+++ b/docs/html/ndk/guides/application_mk.jd
@@ -30,7 +30,7 @@
 $NDK/apps/&lt;myapp&gt;/Application.mk
 </pre>
 
-<p>Here, {@code &lt;myapp&gt;} is a short name used to describe your app to the NDK build system. It
+<p>Here, {@code <myapp>} is a short name used to describe your app to the NDK build system. It
 doesn't actually go into your generated shared libraries or your final packages.</p>
 
 <h2 id="var">Variables</h2>
@@ -39,7 +39,7 @@
 uses this information to place stripped-down versions of the generated JNI shared libraries
 into a specific location known to the APK-generating tools.</p>
 
-<p>If you place your {@code Application.mk} file under {@code $NDK/apps/&lt;myapp&gt;/}, you must
+<p>If you place your {@code Application.mk} file under {@code $NDK/apps/<myapp>/}, you must
 define this variable. If you place it under {@code $PROJECT/jni/}, it is optional.
 
 <h4>APP_OPTIM</h4>
@@ -54,7 +54,7 @@
 preventing you from inspecting them. Also, code re-ordering can make it more difficult to step
 through the code; stack traces may not be reliable.</p>
 
-<p>Declaring {@code android:debuggable} in your application manifest's {@code &lt;application&gt;}
+<p>Declaring {@code android:debuggable} in your application manifest's {@code <application>}
 tag will cause this variable to default to {@code debug} instead of {@code release}. Override this
 default value by setting {@code APP_OPTIM} to {@code release}.</p>
 
diff --git a/docs/html/ndk/guides/concepts.jd b/docs/html/ndk/guides/concepts.jd
index 0601f21..9f2b22a 100644
--- a/docs/html/ndk/guides/concepts.jd
+++ b/docs/html/ndk/guides/concepts.jd
@@ -222,10 +222,10 @@
 callbacks from blocking your main thread.</li>
 </ul>
 
-<p>The {@code &lt;ndk_root&gt;/sources/android/native_app_glue/android_native_app_glue.c} source is
+<p>The {@code <ndk_root>/sources/android/native_app_glue/android_native_app_glue.c} source is
 also available, allowing you to modify the implementation.</p>
 <p>For more information on how to use this static library, examine the native-activity sample
-application and its documentation. Further reading is also available in the comments in the {@code &lt;ndk_root&gt;/sources/android/native_app_glue/android_native_app_glue.h} file.</p>
+application and its documentation. Further reading is also available in the comments in the {@code <ndk_root>/sources/android/native_app_glue/android_native_app_glue.h} file.</p>
 
 <h3 id="na">Using the native_activity.h interface</h3>
 
@@ -277,13 +277,13 @@
 <a href="{@docRoot}ndk/reference/struct_a_native_activity.html">{@code ANativeActivity}</a>
 structure, which contains function pointers to the various callback implementations that you need
 to write.
-Set the applicable callback function pointers in {@code ANativeActivity-&gt;callbacks} to the
+Set the applicable callback function pointers in {@code ANativeActivity->callbacks} to the
 implementations of your callbacks.</li>
 
-<li>Set the {@code ANativeActivity-&gt;instance} field to the address of any instance of specific
+<li>Set the {@code ANativeActivity->instance} field to the address of any instance of specific
 data that you want to use.</li>
 <li>Implement anything else that you want your activity to do upon starting.</li>
-<li>Implement the rest of the callbacks that you set in {@code ANativeActivity-&gt;callbacks}. For
+<li>Implement the rest of the callbacks that you set in {@code ANativeActivity->callbacks}. For
 more information on when the callbacks are called, see
 <a href="{@docRoot}training/basics/activity-lifecycle/index.html">Managing the Activity
 Lifecycle</a>.
diff --git a/docs/html/ndk/guides/cpp-support.jd b/docs/html/ndk/guides/cpp-support.jd
index 0074b80..21df6af 100644
--- a/docs/html/ndk/guides/cpp-support.jd
+++ b/docs/html/ndk/guides/cpp-support.jd
@@ -188,7 +188,7 @@
 
 <h4>atomic support</h4>
 
-<p>If you include {@code &lt;atomic&gt;}, it's likely that you also need {@code libatomic}.
+<p>If you include {@code <atomic>}, it's likely that you also need {@code libatomic}.
 If you are using {@code ndk-build}, add the following line:</p>
 
 <pre>
diff --git a/docs/html/ndk/guides/cpu-features.jd b/docs/html/ndk/guides/cpu-features.jd
index b031909..3323efd 100644
--- a/docs/html/ndk/guides/cpu-features.jd
+++ b/docs/html/ndk/guides/cpu-features.jd
@@ -29,7 +29,7 @@
 </pre>
 </li>
 
-<li>In your source code, include the {@code &lt;cpu-features.h&gt;} header file.</li>
+<li>In your source code, include the {@code <cpu-features.h>} header file.</li>
 
 <li>At the end of your <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file,
 insert an instruction to import the {@code android/cpufeatures} module. For example:
diff --git a/docs/html/ndk/guides/ndk-build.jd b/docs/html/ndk/guides/ndk-build.jd
index 18ca2d8..e8f6fc5 100644
--- a/docs/html/ndk/guides/ndk-build.jd
+++ b/docs/html/ndk/guides/ndk-build.jd
@@ -77,11 +77,11 @@
   <dt>{@code NDK_HOST_32BIT=1}</dt>
   <dd>Always use the toolchain in 32-bit mode (see <a href="#6432">64-bit and 32-bit
   Toolchains</a>).</dd>
-  <dt>{@code NDK_APPLICATION_MK=&lt;file&gt;}</dt>
+  <dt>{@code NDK_APPLICATION_MK=<file>}</dt>
   <dd>Build, using a specific <code>Application.mk</code> file pointed to by the
   {@code NDK_APPLICATION_MK} variable.</dd>
-  <dt>{@code -C &lt;project&gt;}</dt>
-  <dd>Build the native code for the project path located at {@code &lt;project&gt;}. Useful if you
+  <dt>{@code -C <project>}</dt>
+  <dd>Build the native code for the project path located at {@code <project>}. Useful if you
   don't want to {@code cd} to it in your terminal.</dd>
 </dl>
 
@@ -159,8 +159,8 @@
 
 <h2 id="6432">64-Bit and 32-Bit Toolchains</h2>
 <p>Some toolchains come with both 64-bit and 32-bit versions. For example,
-directories {@code &lt;ndk&gt;/toolchain/&lt;name&gt;/prebuilt/} and
-{@code &lt;ndk&gt;/prebuilt/} may contain both {@code linux-x86} and
+directories {@code <ndk>/toolchain/<name>/prebuilt/} and
+{@code <ndk>/prebuilt/} may contain both {@code linux-x86} and
 {@code linux-x86_64} folders for Linux tools in 32-bit and 64-bit modes,
 respectively. The ndk-build script automatically chooses a 64-bit version of
 the toolchain if the host OS supports it. You can force the use of a 32-bit
@@ -182,7 +182,7 @@
 $ ndk-build
 </pre>
 
-<p>You can override other host prebuilt tools in {@code $NDK/prebuilt/&lt;OS&gt;/bin/}
+<p>You can override other host prebuilt tools in {@code $NDK/prebuilt/<OS>/bin/}
 with the following environment variables: </p>
 
 <pre class="no-pretty-print">
diff --git a/docs/html/ndk/guides/ndk-gdb.jd b/docs/html/ndk/guides/ndk-gdb.jd
index b15e67e..5e2b751 100644
--- a/docs/html/ndk/guides/ndk-gdb.jd
+++ b/docs/html/ndk/guides/ndk-gdb.jd
@@ -22,9 +22,9 @@
 
 <ul>
 <li>Build your app using the {@code ndk-build} script. The {@code ndk-gdb} script
-does not support using the legacy {@code make APP=&lt;name&gt;} method to build.</p></li>
+does not support using the legacy {@code make APP=<name>} method to build.</p></li>
 <li>Enable app debugging in your {@code AndroidManifest.xml} file by including an
-{@code &lt;application&gt;} element that sets the {@code android:debuggable} attribute to {@code
+{@code <application>} element that sets the {@code android:debuggable} attribute to {@code
 true}.</li>
 <li>Build your app to run on Android 2.2 (Android API level 8) or higher.</li>
 <li>Debug on a device or emulator running Android 2.2 or higher. For debugging purposes, the target
@@ -59,7 +59,7 @@
 <p>Next, {@code ndk-gdb} displays a normal GDB prompt.</p>
 
 <p>You interact with {@code ndk-gdb} in the same way as you would with GNU GDB. For example, you can
-use {@code b &lt;location&gt;} to set breakpoints, and {@code c} (for "continue") to
+use {@code b <location>} to set breakpoints, and {@code c} (for "continue") to
 resume execution. For a comprehensive list of commands, see the
 <a href="http://www.gnu.org/software/gdb/">GDB manual.</a></p>
 
@@ -78,7 +78,7 @@
 
 <p>By default, {@code ndk-gdb} searches for an already-running application process, and displays an
 error if it doesn't find one. You can, however, use the {@code --start} or
-{@code --launch=&lt;name&gt;} option to automatically start your activity before the debugging
+{@code --launch=<name>} option to automatically start your activity before the debugging
 session. For more information, see <a href="#opt">Options</a>.</p>
 
 
@@ -117,13 +117,13 @@
 explicitly launch the application on the target device before the debugging session.</p></td>
 
 <p>Starting {@code ndk-gdb} with this option specified launches the first launchable activity listed
-in your application manifest. Use {@code --launch=&lt;name&gt;} to start the next launchable
+in your application manifest. Use {@code --launch=<name>} to start the next launchable
 activity. To dump the list of launchable activities, run {@code --launch-list} from the command
 line.</p>
 </tr>
 
 <tr>
-<td>{@code --launch=&lt;name&gt;}</td>
+<td>{@code --launch=<name>}</td>
 <td><p>This option is similar to {@code --start}, except that it allows you to start a specific
  activity from your application. This feature is only useful if your manifest defines multiple
  launchable activities.</p></td>
@@ -136,20 +136,20 @@
 </tr>
 
 <tr>
-<td>{@code --project=&lt;path&gt;}</td>
+<td>{@code --project=<path>}</td>
 <td>This option specifies the app project directory. It is useful if you want to launch the
  script without first having to change to the project directory.</p></td>
 </tr>
 
 <tr>
-<td>{@code --port=&lt;port&gt;}</td>
+<td>{@code --port=<port>}</td>
 <td> <p>By default, {@code ndk-gdb} uses local TCP port 5039 to communicate with the app it
  is debugging on the target device. Using a different port allows you to natively debug programs
  running on different devices or emulators connected to the same host machine.</p></td>
 </tr>
 
 <tr>
-<td>{@code --adb=&lt;file&gt;}</td>
+<td>{@code --adb=<file>}</td>
 <td><p>This option specifies the <a href="{@docRoot}tools/help/adb.html">adb</a>
 tool executable. It is only necessary if you have not set your path to include that executable.</p>
 </td>
@@ -159,7 +159,7 @@
 <td>
 <li>{@code -d}</li>
 <li>{@code -e}</li>
-<li>{@code -s &lt;serial&gt;}</li></td>
+<li>{@code -s <serial>}</li></td>
 <td><p>These flags are similar to the adb commands with the same names. Set these flags if you have
 several devices or emulators connected to your host machine. Their meanings are as follows:</p>
 <dl>
@@ -167,8 +167,8 @@
    <dd>Connect to a single physical device.</dd>
    <dt>{@code -e}</dt>
    <dd>Connect to a single emulator device.</dd>
-   <dt>{@code -s &lt;serial&gt;}</dt>
-   <dd>Connect to a specific device or emulator. Here, {@code &lt;serial&gt;} is the device's name
+   <dt>{@code -s <serial>}</dt>
+   <dd>Connect to a specific device or emulator. Here, {@code <serial>} is the device's name
    as listed by the {@code adb devices} command.</dd>
 </dl>
 
@@ -178,11 +178,11 @@
 
 <tr>
 <td>
-<li>{@code --exec=&lt;file&gt;}</li>
-<li>{@code -x &lt;file&gt;}</li>
+<li>{@code --exec=<file>}</li>
+<li>{@code -x <file>}</li>
 </td>
 <td><p>This option tells {@code ndk-gdb} to run the GDB initialization commands found in
-{@code &lt;file&gt;} after connecting to the process it is debugging. This is a useful feature if
+{@code <file>} after connecting to the process it is debugging. This is a useful feature if
 you want to do something repeatedly, such as setting up a list of breakpoints, and then resuming
 execution automatically.</p></td>
 </tr>
@@ -200,7 +200,7 @@
 </tr>
 
 <tr>
-<td>{@code --gnumake-flag=&lt;flag&gt;}</td>
+<td>{@code --gnumake-flag=<flag>}</td>
 <td><p>This option is an extra flag (or flags) to pass to the
 {@code ndk-build} system when
 querying it for project information. You can use multiple instances of this option in the
diff --git a/docs/html/ndk/guides/ndk-stack.jd b/docs/html/ndk/guides/ndk-stack.jd
index 46146cb..45d433c 100644
--- a/docs/html/ndk/guides/ndk-stack.jd
+++ b/docs/html/ndk/guides/ndk-stack.jd
@@ -14,7 +14,7 @@
 <p>The {@code ndk-stack} tool allows you to filter stack traces as they appear in the
 output of <a href="{@docRoot}tools/help/logcat.html">{@code adb logcat}</a>. It also replaces any
 address inside a shared library with the corresponding
-{@code &lt;source-file&gt;:&lt;line-number&gt;} values from your source code, making issues easier
+{@code <source-file>:<line-number>} values from your source code, making issues easier
 to pinpoint.</p>
 
 <p>For example, it translates something like:</p>
@@ -57,7 +57,7 @@
 <h2>Usage</h2>
 <p>To use {@code ndk-stack}, you first need a directory containing symbolic versions of your app's
 shared libraries. If you use the NDK build system ({@code ndk-build}), these shared-library
-files reside under {@code $PROJECT_PATH/obj/local/&lt;abi&gt;}, where {@code &lt;abi&gt;} represents
+files reside under {@code $PROJECT_PATH/obj/local/<abi>}, where {@code <abi>} represents
 your device's ABI. By default, the system uses the {@code armeabi} ABI.</p>
 
 <p>There are two ways to use the tool. You can feed the logcat text as direct input to the program.
diff --git a/docs/html/ndk/guides/prebuilts.jd b/docs/html/ndk/guides/prebuilts.jd
index 52eb437..4cb1819 100644
--- a/docs/html/ndk/guides/prebuilts.jd
+++ b/docs/html/ndk/guides/prebuilts.jd
@@ -58,7 +58,7 @@
 <p>In this example, the name of the module is the same as that of the prebuilt library.</p>
 
 <p>The build system places a copy of your prebuilt shared library into {@code $PROJECT/obj/local},
-and another copy, stripped of debug information, into {@code $PROJECT/libs/&lt;abi&gt;}. Here,
+and another copy, stripped of debug information, into {@code $PROJECT/libs/<abi>}. Here,
 {@code $PROJECT} is the root directory of your project.</p>
 
 <h2 id="rp">Referencing the Prebuilt Library from Other Modules</h2>
@@ -111,7 +111,7 @@
 <h2 id="dp">Debugging Prebuilt Libraries</h2>
 <p>We recommend that you provide prebuilt shared libraries containing debug symbols. The NDK build
 system always strips the symbols from the version of the library that it installs into
-{@code $PROJECT/libs/&lt;abi&gt;/}, but you can use the debug version for debugging with
+{@code $PROJECT/libs/<abi>/}, but you can use the debug version for debugging with
 {@code ndk-gdb}.</p>
 
 <h2 id="sa">Selecting ABIs for Prebuilt Libraries</h2>
diff --git a/docs/html/ndk/guides/setup.jd b/docs/html/ndk/guides/setup.jd
index 81a33c0..8d4334e 100644
--- a/docs/html/ndk/guides/setup.jd
+++ b/docs/html/ndk/guides/setup.jd
@@ -61,7 +61,7 @@
 <p>To confirm that you have installed the NDK, set it up correctly, and properly configured Eclipse,
 follow these steps:</p>
 <ol type="1">
-<li>Import the hello-jni sample from {@code &lt;ndk&gt;/samples/}, as you would any other Android
+<li>Import the hello-jni sample from {@code <ndk>/samples/}, as you would any other Android
 project.</li>
 <li>In the <i>Project Explorer</i> pane, right-click the project name (<i>HelloJni</i>). A
 context menu appears.</li>
diff --git a/docs/html/ndk/guides/stable_apis.jd b/docs/html/ndk/guides/stable_apis.jd
index cad02ac..c38e684 100644
--- a/docs/html/ndk/guides/stable_apis.jd
+++ b/docs/html/ndk/guides/stable_apis.jd
@@ -54,7 +54,7 @@
 the C and C++ libraries, see <a href="#a3">Android API level 3</a>.</p>
 
 <p>The NDK often provides new headers and libraries for new Android releases. These files reside
-under {@code $NDK/platforms/android-&lt;level&gt;/&lt;abi&gt;/usr/include}. When the NDK does not
+under {@code $NDK/platforms/android-<level>/<abi>/usr/include}. When the NDK does not
 have a specific new group of headers and libraries for an Android API level, it means that
 an app targeting that level should use the most recently released NDK assets. For example,
 there was no new release of NDK headers or libraries for Android API levels 6 and 7. Therefore,
@@ -154,7 +154,7 @@
 
 <h4>Android-specific log support</h4>
 
-<p>{@code &lt;android/log.h&gt;} contains various definitions that an app can use to send log
+<p>{@code <android/log.h>} contains various definitions that an app can use to send log
 messages to the kernel from native code. For more information about these definitions, see the
 comments in {@code $NDK/platforms/android-3/arch-arm/usr/include/android/log.h}, where {@code $NDK}
 is the root of your NDK installation.</p>
@@ -214,7 +214,7 @@
 
 <p>Additionally, you must put a
 <a href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> tag in your manifest file to indicate the version of
+<uses-feature>}</a> tag in your manifest file to indicate the version of
 <a href="http://developer.android.com/guide/topics/graphics/opengl.html#manifest">OpenGL ES</a>
 that your application requires.</p>
 
@@ -234,7 +234,7 @@
 images and above.</p>
 
 <h4>OpenGL ES 2.0 library:</h4>
-<p>The standard OpenGL ES 2.0 headers {@code &lt;GLES2/gl2.h&gt;} and {@code &lt;GLES2/gl2ext.h&gt;}
+<p>The standard OpenGL ES 2.0 headers {@code <GLES2/gl2.h>} and {@code <GLES2/gl2ext.h>}
 contain the declarations needed for performing OpenGL ES 2.0 rendering calls from native code.
 These rendering calls provide the ability to use the GLSL language to define and use vertex and
 fragment shaders.</p>
@@ -255,9 +255,9 @@
 
 <p>Additionally, you must put a
 <a href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> tag in your manifest file to indicate which version of OpenGL ES your
+<uses-feature>}</a> tag in your manifest file to indicate which version of OpenGL ES your
 application requires. For more information about the OpenGL ES settings for
-{@code &lt;uses-feature&gt;}, see
+{@code <uses-feature>}, see
 <a href="http://developer.android.com/guide/topics/graphics/opengl.html#manifest">OpenGL ES</a>.</p>
 
 <p>The hello-gl2 sample application provies a basic example of how to use OpenGL ES 2.0 with the
@@ -296,7 +296,7 @@
 <li>Call {@code AndroidBitmap_unlockPixels()} to unlock the buffer.</li>
 </ol>
 
-<p>To use {@code jnigraphics}, include the {@code &lt;bitmap.h&gt;} header in your source code, and
+<p>To use {@code jnigraphics}, include the {@code <bitmap.h>} header in your source code, and
 link against {@code jnigraphics} by including the following line in your
 <a href="{@docRoot}ndk/guides/android_mk.html">{@code Android.mk}</a> file:</p>
 
@@ -368,19 +368,19 @@
 
 <p>This release provides the following native headers:</p>
 <ul>
-<li>{@code &lt;native_activity.h&gt;}</li>
-<li>{@code &lt;looper.h&gt;}</li>
-<li>{@code &lt;input.h&gt;}</li>
-<li>{@code &lt;keycodes.h&gt;}</li>
-<li>{@code &lt;sensor.h&gt;}</li>
-<li>{@code &lt;rect.h&gt;}</li>
-<li>{@code &lt;window.h&gt;}</li>
-<li>{@code &lt;native_window.h&gt;}</li>
-<li>{@code &lt;native_window_jni.h&gt;}</li>
-<li>{@code &lt;configuration.h&gt;}</li>
-<li>{@code &lt;asset_manager.h&gt;}</li>
-<li>{@code &lt;storage_manager.h&gt;}</li>
-<li>{@code &lt;obb.h&gt;}</li>
+<li>{@code <native_activity.h>}</li>
+<li>{@code <looper.h>}</li>
+<li>{@code <input.h>}</li>
+<li>{@code <keycodes.h>}</li>
+<li>{@code <sensor.h>}</li>
+<li>{@code <rect.h>}</li>
+<li>{@code <window.h>}</li>
+<li>{@code <native_window.h>}</li>
+<li>{@code <native_window_jni.h>}</li>
+<li>{@code <configuration.h>}</li>
+<li>{@code <asset_manager.h>}</li>
+<li>{@code <storage_manager.h>}</li>
+<li>{@code <obb.h>}</li>
 </ul>
 
 <p>For more information about these headers, see the
@@ -403,8 +403,8 @@
 
 <h4>OpenMAX AL</h4>
 <p>Android native multimedia handling is based on Khronos Group OpenMAX AL 1.0.1 API.</p>
-<p>The standard OpenMAX AL headers {@code &lt;OMXAL/OpenMAXAL.h&gt;} and
-{@code &lt;OMXAL/OpenMAXAL_Platform.h&gt;} contain the declarations necessary for performing
+<p>The standard OpenMAX AL headers {@code <OMXAL/OpenMAXAL.h>} and
+{@code <OMXAL/OpenMAXAL_Platform.h>} contain the declarations necessary for performing
 multimedia output from the native side of Android.</p>
 
 <p>The NDK distribution of OpenMAX AL also provides Android-specific extensions. For information
@@ -448,9 +448,9 @@
 
 <p>Additionally, you must put a
 <a href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> tag in your manifest file to indicate which version of OpenGL ES your
+<uses-feature>}</a> tag in your manifest file to indicate which version of OpenGL ES your
 application requires. For more information about the OpenGL ES settings for
-{@code &lt;uses-feature&gt;}, see
+{@code <uses-feature>}, see
 <a href="http://developer.android.com/guide/topics/graphics/opengl.html#manifest">OpenGL ES</a>.</p>
 
 <p>The gles3jni sample application provides a basic example of how to use OpenGL ES 3.0 with the
@@ -487,9 +487,9 @@
 
 <p>Additionally, you must put a
 <a href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html">{@code
-&lt;uses-feature&gt;}</a> tag in your manifest file to indicate which version of OpenGL ES your
+<uses-feature>}</a> tag in your manifest file to indicate which version of OpenGL ES your
 application requires. For more information about the OpenGL ES settings for
-{@code &lt;uses-feature&gt;}, see
+{@code <uses-feature>}, see
 <a href="http://developer.android.com/guide/topics/graphics/opengl.html#manifest">OpenGL ES</a>.</p>
 
 <p>The gles3jni sample application provides a basic example of how to use OpenGL ES 3.1 with the
diff --git a/docs/html/ndk/guides/standalone_toolchain.jd b/docs/html/ndk/guides/standalone_toolchain.jd
index 3b6f7f1..aec7073 100644
--- a/docs/html/ndk/guides/standalone_toolchain.jd
+++ b/docs/html/ndk/guides/standalone_toolchain.jd
@@ -43,27 +43,27 @@
   </tr>
   <tr>
     <td>ARM-based</td>
-    <td>{@code arm-linux-androideabi-&lt;gcc-version&gt;}</td>
+    <td>{@code arm-linux-androideabi-<gcc-version>}</td>
   </tr>
   <tr>
     <td>x86-based</td>
-    <td>{@code x86-&lt;gcc-version&gt;}</td>
+    <td>{@code x86-<gcc-version>}</td>
   </tr>
   <tr>
     <td>MIPS-based</td>
-    <td>{@code mipsel-linux-android-&lt;gcc-version&gt;}</td>
+    <td>{@code mipsel-linux-android-<gcc-version>}</td>
   </tr>
   <tr>
     <td>ARM64-based</td>
-    <td>{@code aarch64-linux-android-&lt;gcc-version&gt;}</td>
+    <td>{@code aarch64-linux-android-<gcc-version>}</td>
   </tr>
   <tr>
     <td>X86-64-based</td>
-    <td>{@code x86_64-&lt;gcc-version&gt;}</td>
+    <td>{@code x86_64-<gcc-version>}</td>
   </tr>
   <tr>
     <td>MIPS64-based</td>
-    <td>{@code mips64el-linux-android--&lt;gcc-version&gt;}</td>
+    <td>{@code mips64el-linux-android--<gcc-version>}</td>
   </tr>
 </table>
 
@@ -184,7 +184,7 @@
 you can install them in any location, or even move them if you need to.</p>
 
 <p>By default, the build system uses the 32-bit, ARM-based GCC 4.8 toolchain. You can specify a
-different value, however, by specifying {@code --arch=&lt;toolchain&gt;} as an option.
+different value, however, by specifying {@code --arch=<toolchain>} as an option.
 Table 3 shows the values to use for other toolchains:
 
 <p class="table-caption" id="table3">
@@ -216,8 +216,8 @@
   </tr>
 </table>
 
-<p>Alternatively, you can use the {@code --toolchain=&lt;toolchain&gt;} option. Table 4 shows the
-values you can specify for {@code &lt;toolchain&gt;}:</p>
+<p>Alternatively, you can use the {@code --toolchain=<toolchain>} option. Table 4 shows the
+values you can specify for {@code <toolchain>}:</p>
 
 <p class="table-caption" id="table4">
   <strong>Table 4.</strong> Toolchains and corresponding values, using {@code --toolchain}.</p>
@@ -296,7 +296,7 @@
 line.</p>
 
 <p class="note"><strong>Note: </strong>Instead of specifying a specific version, you can also
-use {@code &lt;version&gt;}, which defaults
+use {@code <version>}, which defaults
 to the highest available version of Clang.</p>
 
 <p>By default, the build system builds for a 32-bit host toolchain. You can specify a 64-bit
@@ -344,7 +344,7 @@
 </pre>
 
 <p>Note that if you omit the {@code -install-dir} option, the {@code make-standalone-toolchain.sh}
-shell script creates a tarball in {@code tmp/ndk/&lt;toolchain-name&gt;.tar.bz2}. This tarball makes
+shell script creates a tarball in {@code tmp/ndk/<toolchain-name>.tar.bz2}. This tarball makes
 it easy to archive, as well as to redistribute the binaries.</p>
 
 <p>This standalone toolchain provides an additional benefit, as well, in that it contains a working
@@ -354,7 +354,7 @@
 
 <h2 id="wwc">Working with Clang</h2>
 <p>You can install Clang binaries in the standalone installation by using the
-{@code --llvm-version=&lt;version&gt;} option. {@code &lt;version&gt;} is a LLVM/Clang version
+{@code --llvm-version=<version>} option. {@code <version>} is a LLVM/Clang version
 number, such as {@code 3.5} or {@code 3.6}. For example:
 
 <pre class="no-pretty-print">
@@ -368,7 +368,7 @@
 assembler, linker, headers, libraries, and C++ STL implementation.</p>
 
 <p>This operation also installs two scripts, named {@code clang} and {@code clang++}, under
-{@code &lt;install-dir&gt;/bin/@}. These scripts invoke the real {@code clang} binary with default
+{@code <install-dir>/bin/@}. These scripts invoke the real {@code clang} binary with default
 target architecture flags. In other words, they should work without any modification, and you should
 be able to use them in your own builds by just setting the {@code CC} and {@code CXX} environment
 variables to point to them.</p>
@@ -534,7 +534,7 @@
 <h3>C++ STL support</h3>
 <p>The standalone toolchain includes a copy of a C++ Standard Template Library implementation. This
 implementation is either for GNU libstdc++, STLport, or libc++, depending on what you specify for the
-{@code --stl=&lt;name&gt;} option described previously. To use this implementation of STL, you need
+{@code --stl=<name>} option described previously. To use this implementation of STL, you need
 to link your project with the proper library:</p>
 
 <ul>
diff --git a/docs/html/ndk/samples/sample_na.jd b/docs/html/ndk/samples/sample_na.jd
index a706be5..0966dd8 100644
--- a/docs/html/ndk/samples/sample_na.jd
+++ b/docs/html/ndk/samples/sample_na.jd
@@ -92,7 +92,7 @@
 {@code .so} extension. For example, the actual file name for the
 {@code log} library is {@code liblog.so}.</li>
 <li>The library resides in the following directory, NDK root:
-{@code &lt;ndk&gt;/platforms/android-&lt;sdk_version&gt;/arch-&lt;abi&gt;/usr/lib/}.</li>
+{@code <ndk>/platforms/android-<sdk_version>/arch-<abi>/usr/lib/}.</li>
 </ul>
 
 <pre class="no-pretty-print">
diff --git a/docs/html/preview/api-overview.jd b/docs/html/preview/api-overview.jd
index 55829d3..599dc1e 100644
--- a/docs/html/preview/api-overview.jd
+++ b/docs/html/preview/api-overview.jd
@@ -149,8 +149,8 @@
 <pre class="no-prettyprint">
 adb -e emu finger touch &lt;finger_id&gt;
 </pre>
-<p>On Windows, you may have to run {@code telnet 127.0.0.1 &lt;emulator-id&gt;} followed by
-  {@code finger touch &lt;finger_id&gt;}.
+<p>On Windows, you may have to run {@code telnet 127.0.0.1 <emulator-id>} followed by
+  {@code finger touch <finger_id>}.
 </p>
 </li>
 </ol>
@@ -210,7 +210,7 @@
 
 <p>For each activity that you want to expose to
 {@link android.service.chooser.ChooserTargetService}, add a
-{@code &lt;meta-data&gt;} element with the name
+{@code <meta-data>} element with the name
 {@code "android.service.chooser.chooser_target_service"} in your app manifest.
 </p>
 
diff --git a/docs/html/tools/adk/adk2.jd b/docs/html/tools/adk/adk2.jd
index d69125a..052ec48 100644
--- a/docs/html/tools/adk/adk2.jd
+++ b/docs/html/tools/adk/adk2.jd
@@ -303,7 +303,7 @@
   <li>Start the ADK 2012 IDE and choose <strong>File > Preferences</strong>.</li>
   <li>In the <strong>Preferences</strong> dialog, make a note of the <strong>Sketchbook
 location</strong> directory.</li>
-  <li>Copy the {@code &lt;adk-source-download&gt;/adk2012/board/library/ADK2} directory and its
+  <li>Copy the {@code <adk-source-download>/adk2012/board/library/ADK2} directory and its
 contents into your {@code sketchbook/libraries/} directory, so that you create a {@code
 sketchbook/libraries/ADK2} directory.</li>
   <li>Stop and restart the <strong>ADK 2012 IDE</strong>.</li>
@@ -339,7 +339,7 @@
 <ol>
   <li><a href="#src-download">Download</a> the ADK 2012 source code files.</li>
   <li>In a terminal window, navigate to {@code
-&lt;adk-source-download&gt;/adk2012/board/MakefileBasedBuild}.</li>
+<adk-source-download>/adk2012/board/MakefileBasedBuild}.</li>
   <li>Execute the following command and follow the instructions:
     <pre>$> ./setup</pre>
   </li>
diff --git a/docs/html/tools/devices/emulator.jd b/docs/html/tools/devices/emulator.jd
index 5bdd4e2..1e70562 100644
--- a/docs/html/tools/devices/emulator.jd
+++ b/docs/html/tools/devices/emulator.jd
@@ -393,7 +393,7 @@
   <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
 Hardware Accelerated Execution Manager</strong>.</li>
   <li>After the download completes, execute {@code
-&lt;sdk&gt;/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe}.</li>
+<sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe}.</li>
   <li>Follow the on-screen instructions to complete installation.</li>
   <li>After installation completes, confirm that the virtualization driver is operating correctly by
 opening a command prompt window and running the following command:
@@ -449,7 +449,7 @@
   <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
 Hardware Accelerated Execution Manager</strong>.
   <li>After the download completes, execute
-    {@code &lt;sdk&gt;/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg}.</li>
+    {@code <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg}.</li>
   <li>Double click the <strong>IntelHAXM.mpkg</strong> icon to begin installation.</li>
   <li>Follow the on-screen instructions to complete installation.</li>
   <li>After installation completes, confirm that the new kernel extension is operating correctly by
diff --git a/docs/html/tools/devices/managing-avds.jd b/docs/html/tools/devices/managing-avds.jd
index 4ca8588..fb680aa 100644
--- a/docs/html/tools/devices/managing-avds.jd
+++ b/docs/html/tools/devices/managing-avds.jd
@@ -56,7 +56,7 @@
   you have designed your app to support. For instance, you should create an AVD for each
   API level equal to and higher than the minimum version you've specified in your manifest
   <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html" style="white-space: nowrap;"
-  >{@code &lt;uses-sdk>}</a> tag.</p>
+  >{@code <uses-sdk>}</a> tag.</p>
 
   <p>To create an AVD based on an existing device definition:</p>
 
diff --git a/docs/html/tools/extras/oem-usb.jd b/docs/html/tools/extras/oem-usb.jd
index 6d449ee..eed8a5e 100644
--- a/docs/html/tools/extras/oem-usb.jd
+++ b/docs/html/tools/extras/oem-usb.jd
@@ -86,7 +86,7 @@
   <li>Select <strong>Browse my computer for driver software</strong> and click
     <strong>Next</strong>.</li>
   <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB
-Driver is located in {@code &lt;sdk&gt;\extras\google\usb_driver\}.)</li>
+Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li>
   <li>Click <strong>Next</strong> to install the driver.</li>
 </ol>
 
@@ -109,7 +109,7 @@
 <strong>Search removable media</strong>; and check <strong>Include this location in the
 search</strong>.</li>
   <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB
-Driver is located in {@code &lt;sdk&gt;\extras\google\usb_driver\}.)</li>
+Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li>
   <li>Click <strong>Next</strong> to upgrade the driver.</li>
 </ol>
 
@@ -127,7 +127,7 @@
   <li>Select <strong>I don't have the disk. Show me other options</strong>.</li>
   <li>Select <strong>Browse my computer for driver software</strong>.</li>
   <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB
-Driver is located in {@code &lt;sdk&gt;\extras\google\usb_driver\}.) As long as you specified the
+Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the
 exact location of the 
     installation package, you may leave <strong>Include subfolders</strong> checked or
   unchecked&mdash;it doesn't matter.</li>
@@ -152,7 +152,7 @@
   search for the driver
     software. Select <strong>Browse my computer for driver software</strong>.</li>
   <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB
-Driver is located in {@code &lt;sdk&gt;\extras\google\usb_driver\}.) As long as you specified the
+Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the
 exact location of the
     installation package, you may leave <strong>Include subfolders</strong> checked or
     unchecked&mdash;it doesn't matter.</li>
diff --git a/docs/html/tools/help/adb.jd b/docs/html/tools/help/adb.jd
index 2faff4f..bcd949a 100644
--- a/docs/html/tools/help/adb.jd
+++ b/docs/html/tools/help/adb.jd
@@ -36,7 +36,7 @@
   <li>A daemon, which runs as a background process on each emulator or device instance. </li>
 </ul>
 
-<p>You can find the {@code adb} tool in {@code &lt;sdk&gt;/platform-tools/}.</p>
+<p>You can find the {@code adb} tool in {@code <sdk>/platform-tools/}.</p>
 
 <p>When you start an adb client, the client first checks whether there is an adb server
 process already running. If there isn't, it starts the server process. When the server starts,
diff --git a/docs/html/tools/help/desktop-head-unit.jd b/docs/html/tools/help/desktop-head-unit.jd
index 981979c..a2b71e6 100644
--- a/docs/html/tools/help/desktop-head-unit.jd
+++ b/docs/html/tools/help/desktop-head-unit.jd
@@ -400,7 +400,7 @@
 
 <ol>
 <li>Install the Android Media Browser simulator
-({@code &lt;sdk&gt;/extras/google/simulators/media-browser-simulator.apk}) on
+({@code <sdk>/extras/google/simulators/media-browser-simulator.apk}) on
 the test device. You can do this using
 the <a href="{@docRoot}tools/help/adb.html#move">adb</a> command line tool.</li>
 <li>Enable <a href="{@docRoot}tools/device.html#developer-device-options">
@@ -417,7 +417,7 @@
 
 <ol>
 <li>Install the Android Messaging simulator
-  ({@code &lt;sdk&gt;/extras/google/simulators/messaging-simulator.apk})
+  ({@code <sdk>/extras/google/simulators/messaging-simulator.apk})
 on the test device. You can do this using the
 <a href="{@docRoot}tools/help/adb.html#move">adb</a> command line tool.</li>
 <li>Enable the simulator to read notifications posted on the system:
diff --git a/docs/html/tools/help/emulator.jd b/docs/html/tools/help/emulator.jd
index fa101e1..366b3bd 100644
--- a/docs/html/tools/help/emulator.jd
+++ b/docs/html/tools/help/emulator.jd
@@ -166,7 +166,7 @@
 </td></tr>
 <tr>
   <td><code>-data&nbsp;&lt;filepath&gt;</code></td>
-  <td>Use {@code &lt;filepath&gt;} as the working user-data disk image. </td>
+  <td>Use {@code <filepath>} as the working user-data disk image. </td>
   <td>Optionally, you can specify a path relative to the current working directory.
   If <code>-data</code> is not used, the emulator looks for a file named {@code userdata-qemu.img}
   in the storage area of the AVD being used (see <code>-avd</code>).
@@ -426,7 +426,7 @@
   <td>Enable KVM acceleration of the emulator virtual machine.</td>
   <td>This option is only effective when your system is set up to use
   <a href="{@docRoot}tools/devices/emulator.html#vm-linux">KVM-based VM acceleration</a>.
-  You can optionally specify a memory size ({@code -m &lt;size&gt;}) for the VM, which should match
+  You can optionally specify a memory size ({@code -m <size>}) for the VM, which should match
   your emulator's memory size:</p>
   {@code -qemu -m 512 -enable-kvm}<br>
   {@code -qemu -m 1024 -enable-kvm}
diff --git a/docs/html/tools/help/jobb.jd b/docs/html/tools/help/jobb.jd
index 97f0942..ae60223 100644
--- a/docs/html/tools/help/jobb.jd
+++ b/docs/html/tools/help/jobb.jd
@@ -44,31 +44,31 @@
     <th>Description</th>
   </tr>
   <tr>
-    <td>{@code -d &lt;directory&gt;}</td>
+    <td>{@code -d <directory>}</td>
     <td>Set the input directory for creating an OBB file, or the output directory when extracting
       ({@code -dump}) an existing file. When creating an OBB file, the contents of the specified
       directory and all its sub-directories are included in the OBB file system.
     </td>
   </tr>
   <tr>
-    <td>{@code -o &lt;filename&gt;}</td>
+    <td>{@code -o <filename>}</td>
     <td>Specify the filename for the OBB file. This parameter is required when
     creating an OBB and extracting (dumping) its contents.</td>
   </tr>
   <tr>
-    <td>{@code -pn &lt;package&gt;}</td>
+    <td>{@code -pn <package>}</td>
     <td>Specify the package name for the application that mounts the OBB file, which corresponds
     to the {@code package} value specified in your application's manifest. This parameter is
     required when creating an OBB file.</td>
   </tr>
   <tr>
-    <td>{@code -pv &lt;version&gt;}</td>
+    <td>{@code -pv <version>}</td>
     <td>Set the minimum version for the application that can mount the OBB file, which corresponds
     to the {@code android:versionCode} value in your application's manifest. This parameter is
     required when creating an OBB file.</td>
   </tr>
   <tr>
-    <td>{@code -k &lt;key&gt;}</td>
+    <td>{@code -k <key>}</td>
     <td>Specify a password for encrypting a new OBB file or decrypting an existing, encypted
       OBB file.</td>
   </tr>
@@ -80,13 +80,13 @@
       overlay OBB file replace files that have the same path.</td>
   </tr>
   <tr>
-    <td style="white-space: nowrap">{@code -dump &lt;filename&gt;}</td>
+    <td style="white-space: nowrap">{@code -dump <filename>}</td>
     <td><p>Extract the contents of the specified OBB file. When using this option, you must also
-      specify the output directory for the contents using the {@code -d &lt;directory&gt;}
+      specify the output directory for the contents using the {@code -d <directory>}
       parameter.</p>
 
       <p class="note"><strong>Note:</strong> When dumping an existing OBB file, you can omit the
-      {@code -d &lt;directory&gt;} parameter to get a listing of the directories inside the file,
+      {@code -d <directory>} parameter to get a listing of the directories inside the file,
       without extracting the contents.</p>
     </td>
   </tr>
diff --git a/docs/html/tools/help/lint.jd b/docs/html/tools/help/lint.jd
index 0f52689..98a5652 100644
--- a/docs/html/tools/help/lint.jd
+++ b/docs/html/tools/help/lint.jd
@@ -154,7 +154,7 @@
 <td rowspan="4">Help</td>
 <td><nobr><code>--help</code></nobr></td>
 <td>List the command-line arguments supported by the {@code lint} tool.</td>
-<td>Use {@code --help &lt;topic&gt;} to see help information for a specific topic, such as "suppress".</td>
+<td>Use {@code --help <topic>} to see help information for a specific topic, such as "suppress".</td>
 </tr>
 
 <tr>
@@ -166,7 +166,7 @@
 <tr>
 <td><nobr><code>--show</code></nobr></td>
 <td>List the ID and verbose description for issues that can be checked by {@code lint}</td>
-<td>Use {@code --show &lt;ids&gt;} to see descriptions for a specific list of {@code lint} issue IDs.</td>
+<td>Use {@code --show <ids>} to see descriptions for a specific list of {@code lint} issue IDs.</td>
 </tr>
 
 <tr>
diff --git a/docs/html/tools/help/shell.jd b/docs/html/tools/help/shell.jd
index 417c871..41bef22 100644
--- a/docs/html/tools/help/shell.jd
+++ b/docs/html/tools/help/shell.jd
@@ -72,20 +72,20 @@
 <td><code>
 start [options] &lt;INTENT>
 </code></td>
-<td>Start an {@link android.app.Activity} specified by {@code &lt;INTENT>}. <p>See the
+<td>Start an {@link android.app.Activity} specified by {@code <INTENT>}. <p>See the
 <a href="#IntentSpec">Specification for &lt;INTENT> arguments</a>.
 <p>Options are:
 <ul>
     <li>{@code -D}: Enable debugging.
     <li>{@code -W}: Wait for launch to complete.
-    <li>{@code --start-profiler &lt;FILE>}: Start profiler and send results to {@code &lt;FILE>}.
-    <li>{@code -P &lt;FILE>}: Like <code>--start-profiler</code>,
+    <li>{@code --start-profiler <FILE>}: Start profiler and send results to {@code <FILE>}.
+    <li>{@code -P <FILE>}: Like <code>--start-profiler</code>,
         but profiling stops when the app goes idle.
-    <li>{@code -R}: Repeat the activity launch {@code &lt;COUNT>} times.  Prior to each repeat,
+    <li>{@code -R}: Repeat the activity launch {@code <COUNT>} times.  Prior to each repeat,
         the top activity will be finished.
     <li>{@code -S}: Force stop the target app before starting the activity.
     <li>{@code --opengl-trace}: Enable tracing of OpenGL functions.
-    <li>{@code --user &lt;USER_ID> | current}: Specify which user to run as; if not
+    <li>{@code --user <USER_ID> | current}: Specify which user to run as; if not
         specified, then run as the current user.
 </ul>
 </td>
@@ -95,11 +95,11 @@
 <td><code>
 startservice [options] &lt;INTENT>
 </code></td>
-<td>Start the {@link android.app.Service} specified by {@code &lt;INTENT>}. <p>See the
+<td>Start the {@link android.app.Service} specified by {@code <INTENT>}. <p>See the
 <a href="#IntentSpec">Specification for &lt;INTENT> arguments</a>.
 <p>Options are:
 <ul>
-    <li>{@code --user &lt;USER_ID> | current}: Specify which user to run as; if not
+    <li>{@code --user <USER_ID> | current}: Specify which user to run as; if not
         specified, then run as the current user.
 </ul>
 </td>
@@ -109,7 +109,7 @@
 <td><code>
 force-stop &lt;PACKAGE>
 </code></td>
-<td>Force stop everything associated with {@code &lt;PACKAGE>} (the app's package name).
+<td>Force stop everything associated with {@code <PACKAGE>} (the app's package name).
 </td>
 </tr>
 
@@ -117,13 +117,13 @@
 <td><code>
 kill  [options] &lt;PACKAGE>
 </code></td>
-<td> Kill all processes associated with {@code &lt;PACKAGE>}
+<td> Kill all processes associated with {@code <PACKAGE>}
   (the app's package name).  This command kills only
   processes that are safe to kill and that will not impact the user
   experience.
   <p>Options are:
   <ul>
-      <li>{@code --user &lt;USER_ID> | all | current}: Specify user whose processes to kill;
+      <li>{@code --user <USER_ID> | all | current}: Specify user whose processes to kill;
         all users if not specified.
   </ul>
 </td>
@@ -145,7 +145,7 @@
 <a href="#IntentSpec">Specification for &lt;INTENT> arguments</a>.
 <p>Options are:
 <ul>
-    <li>{@code [--user &lt;USER_ID> | all | current]}: Specify which user to send to; if not
+    <li>{@code [--user <USER_ID> | all | current]}: Specify which user to send to; if not
         specified then send to all users.
 </ul>
 </td>
@@ -156,24 +156,24 @@
 instrument [options] &lt;COMPONENT>
 </code></td>
 <td>Start monitoring with an {@link android.app.Instrumentation} instance.
-  Typically the target {@code &lt;COMPONENT>}
-  is the form {@code &lt;TEST_PACKAGE>/&lt;RUNNER_CLASS>}.  <p>Options are:
+  Typically the target {@code <COMPONENT>}
+  is the form {@code <TEST_PACKAGE>/<RUNNER_CLASS>}.  <p>Options are:
 <ul>
     <li>{@code -r}: Print raw results (otherwise decode
-        {@code &lt;REPORT_KEY_STREAMRESULT>}).  Use with
+        {@code <REPORT_KEY_STREAMRESULT>}).  Use with
         {@code [-e perf true]} to generate raw output for performance measurements.
 
-    <li>{@code -e &lt;NAME> &lt;VALUE>}: Set argument {@code &lt;NAME>} to {@code &lt;VALUE>}.
+    <li>{@code -e <NAME> <VALUE>}: Set argument {@code <NAME>} to {@code <VALUE>}.
         For test runners a common form is {@code
-        -e &lt;testrunner_flag> &lt;value>[,&lt;value>...]}.
+        -e <testrunner_flag> <value>[,<value>...]}.
 
-    <li>{@code -p &lt;FILE>}: Write profiling data to {@code &lt;FILE>}.
+    <li>{@code -p <FILE>}: Write profiling data to {@code <FILE>}.
 
     <li>{@code -w}: Wait for instrumentation to finish before returning.  Required for
         test runners.
 
     <li>{@code --no-window-animation}: Turn off window animations while running.
-    <li>{@code --user &lt;USER_ID> | current}: Specify which user instrumentation runs in;
+    <li>{@code --user <USER_ID> | current}: Specify which user instrumentation runs in;
         current user if not specified.
 </ul>
 
@@ -184,7 +184,7 @@
 <td><code>
 profile start &lt;PROCESS> &lt;FILE>
 </code></td>
-<td>Start profiler on {@code &lt;PROCESS>}, write results to {@code &lt;FILE>}.
+<td>Start profiler on {@code <PROCESS>}, write results to {@code <FILE>}.
 </td>
 </tr>
 
@@ -192,7 +192,7 @@
 <td><code>
 profile stop &lt;PROCESS>
 </code></td>
-<td>Stop profiler on {@code &lt;PROCESS>}.
+<td>Stop profiler on {@code <PROCESS>}.
 </td>
 </tr>
 
@@ -200,9 +200,9 @@
 <td style="white-space:nowrap"><code>
 dumpheap [options] &lt;PROCESS> &lt;FILE>
 </code></td>
-<td>Dump the heap of {@code &lt;PROCESS>}, write to {@code &lt;FILE>}. <p>Options are:
+<td>Dump the heap of {@code <PROCESS>}, write to {@code <FILE>}. <p>Options are:
 <ul>
-    <li>{@code --user [&lt;USER_ID>|current]}: When supplying a process name,
+    <li>{@code --user [<USER_ID>|current]}: When supplying a process name,
         specify user of process to dump; uses current user if not specified.
     <li>{@code -n}: Dump native heap instead of managed heap.
 </ul>
@@ -213,7 +213,7 @@
 <td><code>
 set-debug-app [options] &lt;PACKAGE>
 </code></td>
-<td>Set application {@code &lt;PACKAGE>} to debug.  <p>Options are:
+<td>Set application {@code <PACKAGE>} to debug.  <p>Options are:
 <ul>
     <li>{@code -w}: Wait for debugger when application starts.
     <li>{@code --persistent}: Retain this value.
@@ -245,7 +245,7 @@
 screen-compat [on|off] &lt;PACKAGE>
 </code></td>
 <td>Control <a href="{@docRoot}guide/practices/screen-compat-mode.html">screen
-compatibility</a> mode of {@code &lt;PACKAGE>}.</p>
+compatibility</a> mode of {@code <PACKAGE>}.</p>
 </td>
 </tr>
 
@@ -300,65 +300,65 @@
 
 <div class="intents" style="display:none">
 
-<p>For activity manager commands that take a {@code &lt;INTENT>} argument, you can
+<p>For activity manager commands that take a {@code <INTENT>} argument, you can
 specify the intent with the following options:</p>
 
 <dl>
-  <dt>{@code -a &lt;ACTION>}</dt>
+  <dt>{@code -a <ACTION>}</dt>
       <dd>Specify the intent action, such as "android.intent.action.VIEW".
       You can declare this only once.
 
-  <dt>{@code -d &lt;DATA_URI>}</dt>
+  <dt>{@code -d <DATA_URI>}</dt>
       <dd>Specify the intent data URI, such as "content://contacts/people/1".
       You can declare this only once.
 
-  <dt>{@code -t &lt;MIME_TYPE>}</dt>
+  <dt>{@code -t <MIME_TYPE>}</dt>
       <dd>Specify the intent MIME type, such as "image/png".
       You can declare this only once.
 
-  <dt>{@code -c &lt;CATEGORY>}</dt>
+  <dt>{@code -c <CATEGORY>}</dt>
       <dd>Specify an intent category, such as "android.intent.category.APP_CONTACTS".
 
-  <dt>{@code -n &lt;COMPONENT>}</dt>
+  <dt>{@code -n <COMPONENT>}</dt>
       <dd>Specify the component name with package name prefix to create an explicit intent, such
       as "com.example.app/.ExampleActivity".
 
-  <dt>{@code -f &lt;FLAGS>}</dt>
+  <dt>{@code -f <FLAGS>}</dt>
       <dd>Add flags to the intent, as supported by {@link
         android.content.Intent#setFlags setFlags()}.
 
-  <dt>{@code --esn &lt;EXTRA_KEY>}</dt>
+  <dt>{@code --esn <EXTRA_KEY>}</dt>
       <dd>Add a null extra. This option is not supported for URI intents.
 
-  <dt>{@code -e|--es &lt;EXTRA_KEY> &lt;EXTRA_STRING_VALUE>}</dt>
+  <dt>{@code -e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE>}</dt>
       <dd>Add string data as a key-value pair.
 
-  <dt>{@code --ez &lt;EXTRA_KEY> &lt;EXTRA_BOOLEAN_VALUE>}</dt>
+  <dt>{@code --ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>}</dt>
       <dd>Add boolean data as a key-value pair.
 
-  <dt>{@code --ei &lt;EXTRA_KEY> &lt;EXTRA_INT_VALUE>}</dt>
+  <dt>{@code --ei <EXTRA_KEY> <EXTRA_INT_VALUE>}</dt>
       <dd>Add integer data as a key-value pair.
 
-  <dt>{@code --el &lt;EXTRA_KEY> &lt;EXTRA_LONG_VALUE>}</dt>
+  <dt>{@code --el <EXTRA_KEY> <EXTRA_LONG_VALUE>}</dt>
       <dd>Add long data as a key-value pair.
 
-  <dt>{@code --ef &lt;EXTRA_KEY> &lt;EXTRA_FLOAT_VALUE>}</dt>
+  <dt>{@code --ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE>}</dt>
       <dd>Add float data as a key-value pair.
 
-  <dt>{@code --eu &lt;EXTRA_KEY> &lt;EXTRA_URI_VALUE>}</dt>
+  <dt>{@code --eu <EXTRA_KEY> <EXTRA_URI_VALUE>}</dt>
       <dd>Add URI data as a key-value pair.
 
-  <dt>{@code --ecn &lt;EXTRA_KEY> &lt;EXTRA_COMPONENT_NAME_VALUE>}</dt>
+  <dt>{@code --ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>}</dt>
       <dd>Add a component name, which is converted and passed as
       a {@link android.content.ComponentName} object.
 
-  <dt>{@code --eia &lt;EXTRA_KEY> &lt;EXTRA_INT_VALUE>[,&lt;EXTRA_INT_VALUE...]}</dt>
+  <dt>{@code --eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]}</dt>
       <dd>Add an array of integers.
 
-  <dt>{@code --ela &lt;EXTRA_KEY> &lt;EXTRA_LONG_VALUE>[,&lt;EXTRA_LONG_VALUE...]}</dt>
+  <dt>{@code --ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]}</dt>
       <dd>Add an array of longs.
 
-  <dt>{@code --efa &lt;EXTRA_KEY> &lt;EXTRA_FLOAT_VALUE>[,&lt;EXTRA_FLOAT_VALUE...]}</dt>
+  <dt>{@code --efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]}</dt>
       <dd>Add an array of floats.
 
   <dt>{@code --grant-read-uri-permission}</dt>
@@ -430,7 +430,7 @@
   <dt>{@code --selector}</dt>
       <dd>Requires the use of {@code -d} and {@code -t} options to set the intent data and type.
 
-  <dt>{@code &lt;URI> &lt;COMPONENT> &lt;PACKAGE>}</dt>
+  <dt>{@code <URI> <COMPONENT> <PACKAGE>}</dt>
       <dd>You can directly specify a URI, package name, and component name when not qualified
       by one of the above options. When an argument is unqualified, the tool assumes the argument
       is a URI if it contains a ":" (colon); it assumes the argument is a component name if it
@@ -475,7 +475,7 @@
 list packages [options] &lt;FILTER>
 </code></td>
 <td>Prints all packages, optionally only
-  those whose package name contains the text in {@code &lt;FILTER>}.  <p>Options:
+  those whose package name contains the text in {@code <FILTER>}.  <p>Options:
 <ul>
     <li>{@code -f}: See their associated file.
     <li>{@code -d}: Filter to only show disabled packages.
@@ -484,7 +484,7 @@
     <li>{@code -3}: Filter to only show third party packages.
     <li>{@code -i}: See the installer for the packages.
     <li>{@code -u}: Also include uninstalled packages.
-    <li>{@code --user &lt;USER_ID>}: The user space to query.
+    <li>{@code --user <USER_ID>}: The user space to query.
 </ul>
 </td>
 </tr>
@@ -502,7 +502,7 @@
 list permissions [options] &lt;GROUP>
 </code></td>
 <td>Prints all known permissions, optionally only
-  those in {@code &lt;GROUP>}.  <p>Options:
+  those in {@code <GROUP>}.  <p>Options:
 <ul>
     <li>{@code -g}: Organize by group.
     <li>{@code -f}: Print all information.
@@ -520,7 +520,7 @@
 <td>List all test packages.  <p>Options:
   <ul>
     <li>{@code -f}: List the APK file for the test package.
-    <li>{@code &lt;TARGET_PACKAGE>}: List test packages for only this app.
+    <li>{@code <TARGET_PACKAGE>}: List test packages for only this app.
   </ul>
 </td>
 </tr>
@@ -553,7 +553,7 @@
 <td><code>
 path &lt;PACKAGE>
 </code></td>
-<td>Print the path to the APK of the given {@code &lt;PACKAGE>}.
+<td>Print the path to the APK of the given {@code <PACKAGE>}.
 </td>
 </tr>
 
@@ -561,12 +561,12 @@
 <td><code>
 install [options]  &lt;PATH>
 </code></td>
-<td>Installs a package (specified by {@code &lt;PATH>}) to the system.  <p>Options:
+<td>Installs a package (specified by {@code <PATH>}) to the system.  <p>Options:
   <ul>
     <li>{@code -l}: Install the package with forward lock.
     <li>{@code -r}: Reinstall an exisiting app, keeping its data.
     <li>{@code -t}: Allow test APKs to be installed.
-    <li>{@code -i &lt;INSTALLER_PACKAGE_NAME>}: Specify the installer package name.
+    <li>{@code -i <INSTALLER_PACKAGE_NAME>}: Specify the installer package name.
     <li>{@code -s}: Install package on the shared mass storage (such as sdcard).
     <li>{@code -f}: Install package on the internal system memory.
     <li>{@code -d}: Allow version code downgrade.
@@ -615,7 +615,7 @@
 </code></td>
 <td><p>Options:
   <ul>
-    <li>{@code --user &lt;USER_ID>}: The user to disable.
+    <li>{@code --user <USER_ID>}: The user to disable.
   </ul>
 </td>
 </tr>
@@ -688,7 +688,7 @@
 <td><code>
 create-user &lt;USER_NAME>
 </code></td>
-<td>Create a new user with the given {@code &lt;USER_NAME>},
+<td>Create a new user with the given {@code <USER_NAME>},
   printing the new user identifier of the user.
 </td>
 </tr>
@@ -697,7 +697,7 @@
 <td><code>
 remove-user &lt;USER_ID>
 </code></td>
-<td>Remove the user with the given {@code &lt;USER_IDENTIFIER>},
+<td>Remove the user with the given {@code <USER_IDENTIFIER>},
   deleting all data associated with that user
 </td>
 </tr>
diff --git a/docs/html/tools/help/uiautomator/index.jd b/docs/html/tools/help/uiautomator/index.jd
index 4b3c255..5eda4a3 100644
--- a/docs/html/tools/help/uiautomator/index.jd
+++ b/docs/html/tools/help/uiautomator/index.jd
@@ -46,14 +46,14 @@
 
 <tr>
 <td rowspan="7"><code>runtest</code></td>
-<td><nobr>{@code &lt;JARS&gt;}</nobr></td>
-<td><strong>Required</strong>. The {@code &lt;JARS&gt;} argument is the name of one or more JAR files that you deployed to the target device which contain your uiautomator testcases. You can list more than one JAR file by using a space as a separator.</td>
+<td><nobr>{@code <JARS>}</nobr></td>
+<td><strong>Required</strong>. The {@code <JARS>} argument is the name of one or more JAR files that you deployed to the target device which contain your uiautomator testcases. You can list more than one JAR file by using a space as a separator.</td>
 </tr>
 
 <tr>
 <td><nobr><code>-c &lt;CLASSES&gt; </code></nobr></td>
-<td><strong>Required (API 17 or lower)</strong>.The {@code &lt;CLASSES&gt;} 
-argument is a list of test classes or test methods in {@code &lt;JARS&gt;} to run. 
+<td><strong>Required (API 17 or lower)</strong>.The {@code <CLASSES>}
+argument is a list of test classes or test methods in {@code <JARS>} to run.
 <p>Each class or method must be fully 
 qualified with the package name, in one of these formats:
 <ul>
@@ -62,7 +62,7 @@
 </ul>
 You can list multiple classes or methods by using a space as a separator.</p>
 <p class="note"><strong>Note:</strong>This argument is not required for API 18 
-and higher. If not specified, all test cases in {@code &lt;JARS&gt;} will be run.
+and higher. If not specified, all test cases in {@code <JARS>} will be run.
 </p>
 </td>
 </tr>
@@ -100,7 +100,7 @@
 </table>
 
 <h2 id="api">uiautomator API</h2>
-<p>The {@code uiautomator} API is bundled in the {@code uiautomator.jar} file under the {@code &lt;android-sdk&gt;/platforms/} directory.  The API includes these key classes, interfaces, and exceptions that allow you to capture and manipulate UI components on the target app:</p>
+<p>The {@code uiautomator} API is bundled in the {@code uiautomator.jar} file under the {@code <android-sdk>/platforms/} directory.  The API includes these key classes, interfaces, and exceptions that allow you to capture and manipulate UI components on the target app:</p>
 
 <h3 id="classes">Classes</h3>
 <table>
diff --git a/docs/html/tools/help/zipalign.jd b/docs/html/tools/help/zipalign.jd
index 184cdcb..a32a3658 100644
--- a/docs/html/tools/help/zipalign.jd
+++ b/docs/html/tools/help/zipalign.jd
@@ -51,7 +51,7 @@
 
 <pre>zipalign -c -v &lt;alignment> existing.apk</pre>
 
-<p>The {@code &lt;alignment>} is an integer that defines the byte-alignment boundaries. 
+<p>The {@code <alignment>} is an integer that defines the byte-alignment boundaries.
 This must always be 4 (which provides 32-bit alignment) or else it effectively 
 does nothing.</p>
 
diff --git a/docs/html/tools/sdk/eclipse-adt.jd b/docs/html/tools/sdk/eclipse-adt.jd
index 3c12a64..5a9d9d0 100644
--- a/docs/html/tools/sdk/eclipse-adt.jd
+++ b/docs/html/tools/sdk/eclipse-adt.jd
@@ -748,7 +748,7 @@
         &gt; Rename</strong>.</li>
       <li>Updated XML Editor to improve double click handling.</li>
       <li>Added code completion improvements for custom views, theme references and class
-        references. For example, code completion in a {@code &lt;fragment android:name="" &gt;} tag
+        references. For example, code completion in a {@code <fragment android:name="" >} tag
         now suggests completion with a list of fragment classes. Similarly, code completion in the
         manifest now offers implementations suitable for the given tag.</li>
       <li>Updated the <strong>Project Import</strong> dialog so that it shows a table for all
@@ -1771,9 +1771,9 @@
     opened files as well as on device size and orientation changes to
     ensure that large layouts are always fully visible unless you
     manually zoom in.</li>
-    <li>You can drop in an {@code &lt;include&gt;} element from the palette, which will pop up
+    <li>You can drop in an {@code <include>} element from the palette, which will pop up
     a layout chooser. When you select the layout to include, it is added with an {@code
-&lt;include&gt;}. Similarly, dropping images or image buttons will pop up image
+<include>}. Similarly, dropping images or image buttons will pop up image
     resource choosers (<a
 href="http://tools.android.com/recent/includetagdropsupport">more info</a>).</li>
     <li>The configuration chooser now applies the "Render Target" and
@@ -1796,7 +1796,7 @@
 <dd>
 <ul>
   <li>Code completion has been significantly improved. It now works
-  with {@code &lt;style&gt;} elements, completes dimensional units,
+  with {@code <style>} elements, completes dimensional units,
   sorts resource paths in values based on the attribute name, and more. There are also many fixes to
 handle text replacement (<a
 href="http://tools.android.com/recent/xmlcodecompletionimprovements">more info</a>).</li>
diff --git a/docs/html/tools/sdk/tools-notes.jd b/docs/html/tools/sdk/tools-notes.jd
index da8d62cb..a43c969 100644
--- a/docs/html/tools/sdk/tools-notes.jd
+++ b/docs/html/tools/sdk/tools-notes.jd
@@ -791,7 +791,7 @@
         <li>Updated build tools to allow use of RenderScript on older versions of Android
          using new features in the
          <a href="{@docRoot}tools/support-library/features.html#v8">Support Library</a>.</li>
-        <li>Moved the Systrace tool to the {@code &gt;sdk&lt;/platform-tools/} directory. </li>
+        <li>Moved the Systrace tool to the {@code <sdk>/platform-tools/} directory. </li>
         <li>Modified <a href="{@docRoot}tools/help/gltracer.html">Tracer for OpenGL ES</a> to
           support OpenGL ES 3.0.</li>
         <li>Lint
diff --git a/docs/html/tools/support-library/features.jd b/docs/html/tools/support-library/features.jd
index 19f93e9..f03de77 100644
--- a/docs/html/tools/support-library/features.jd
+++ b/docs/html/tools/support-library/features.jd
@@ -140,7 +140,7 @@
 </p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v4/} directory. The library does not contain user
+{@code <sdk>/extras/android/support/v4/} directory. The library does not contain user
 interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
 resources</a>.</p>
@@ -167,7 +167,7 @@
 
 <p>
   After you download the Android Support Libraries, this library is located in the
-  {@code &lt;sdk&gt;/extras/android/support/multidex/} directory. The library does not contain
+  {@code <sdk>/extras/android/support/multidex/} directory. The library does not contain
   user interface resources. To include it in your application project, follow the instructions
   for
   <a href= "{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
@@ -228,7 +228,7 @@
 </ul>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v7/appcompat/} directory. The library contains user
+{@code <sdk>/extras/android/support/v7/appcompat/} directory. The library contains user
 interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with
 resources</a>.</p>
@@ -249,7 +249,7 @@
 implementations, and are used extensively in layouts for TV apps.</p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v7/cardview/} directory. The library contains user interface
+{@code <sdk>/extras/android/support/v7/cardview/} directory. The library contains user interface
 resources. To include it in your application project, follow the instructions
 for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding
 libraries with resources</a>.</p>
@@ -270,7 +270,7 @@
 For detailed information about the v7 gridlayout library APIs, see the
 {@link android.support.v7.widget android.support.v7.widget} package in the API reference.</p>
 
-<p>This library is located in the {@code &lt;sdk&gt;/extras/android/support/v7/gridlayout/}
+<p>This library is located in the {@code <sdk>/extras/android/support/v7/gridlayout/}
   directory . The library contains user
   interface resources. To include it in your application project, follow the instructions for
   <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with
@@ -333,7 +333,7 @@
 title card.</p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v7/palette/} directory. The library does not contain
+{@code <sdk>/extras/android/support/v7/palette/} directory. The library does not contain
 user interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
 resources</a>.</p>
@@ -355,7 +355,7 @@
 limited window of data items.</p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v7/recyclerview/} directory. The library contains
+{@code <sdk>/extras/android/support/v7/recyclerview/} directory. The library contains
 user interface resources. To include it in your application project, follow the instructions
 for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding
 libraries with resources</a>.</p>
@@ -384,7 +384,7 @@
 
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v7/preference} directory. For more information
+{@code <sdk>/extras/android/support/v7/preference} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -448,7 +448,7 @@
 </p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v13/} directory. The library does not contain user
+{@code <sdk>/extras/android/support/v13/} directory. The library does not contain user
 interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
 resources</a>.</p>
@@ -480,7 +480,7 @@
 </p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v14/} directory. The library does not contain user
+{@code <sdk>/extras/android/support/v14/} directory. The library does not contain user
 interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
 resources</a>.</p>
@@ -509,7 +509,7 @@
 </p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v17/} directory. The library does not contain user
+{@code <sdk>/extras/android/support/v17/} directory. The library does not contain user
 interface resources. To include it in your application project, follow the instructions for
 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without
 resources</a>.</p>
@@ -551,7 +551,7 @@
 </ul>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/v17/leanback} directory. For more information
+{@code <sdk>/extras/android/support/v17/leanback} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -572,7 +572,7 @@
 <p></p>
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/annotations} directory. For more information
+{@code <sdk>/extras/android/support/annotations} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -597,7 +597,7 @@
 
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/design} directory. For more information
+{@code <sdk>/extras/android/support/design} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -625,7 +625,7 @@
 
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/customtabs} directory. For more information
+{@code <sdk>/extras/android/support/customtabs} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -656,7 +656,7 @@
 
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/customtabs} directory. For more information
+{@code <sdk>/extras/android/support/customtabs} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
@@ -686,7 +686,7 @@
 
 
 <p>After you download the Android Support Libraries, this library is located in the
-{@code &lt;sdk&gt;/extras/android/support/customtabs} directory. For more information
+{@code <sdk>/extras/android/support/customtabs} directory. For more information
 on how to set up your project, follow the instructions in <a
 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries
 with resources</a>. </p>
diff --git a/docs/html/tools/support-library/index.jd b/docs/html/tools/support-library/index.jd
index 22ad0c9..60620e7 100644
--- a/docs/html/tools/support-library/index.jd
+++ b/docs/html/tools/support-library/index.jd
@@ -1323,7 +1323,7 @@
 <a href="{@docRoot}design/index.html">Android Design</a> guidelines for navigation. These
 additions include a way to implement the action bar's <em>Up</em> button across versions.
 For an example implementation of this pattern, see the AppNavigation sample in
-({@code <em>&lt;sdk&gt;</em>/samples/<em>&lt;platform&gt;</em>/AppNavigation}).</li>
+(<code><em>&lt;sdk&gt;</em>/samples/<em>&lt;platform&gt;</em>/AppNavigation</code>).</li>
           <li>Added {@link android.support.v4.app.NotificationCompat.Builder} to provide a
 compatibility implementation of Android 3.0's {@link android.app.Notification.Builder} helper class
 for creating standardized system notifications.</li>
diff --git a/docs/html/tools/support-library/setup.jd b/docs/html/tools/support-library/setup.jd
index 8112071..a39e4b0 100644
--- a/docs/html/tools/support-library/setup.jd
+++ b/docs/html/tools/support-library/setup.jd
@@ -72,7 +72,7 @@
 
 <p>After downloading, the tool installs the Support Library files to your existing Android SDK
   directory. The library files are located in the following subdirectory of your SDK:
-  {@code &lt;sdk&gt;/extras/android/support/} directory.</p>
+  {@code <sdk>/extras/android/support/} directory.</p>
 
 
 <h2 id="choosing">Choosing Support Libraries</h2>
@@ -115,7 +115,7 @@
       using the <a href="#download">SDK Manager</a>.</li>
     <li>Create a {@code libs/} directory in the root of your application project.</li>
     <li>Copy the JAR file from your Android SDK installation directory (e.g.,
-      {@code &lt;sdk&gt;/extras/android/support/v4/android-support-v4.jar}) into your
+      {@code <sdk>/extras/android/support/v4/android-support-v4.jar}) into your
       application's project {@code libs/} directory.
     <li>Right click the JAR file and select <strong>Build Path &gt; Add to Build Path</strong>.
       </li>
@@ -333,9 +333,9 @@
 SDK installation directory, as listed below:</p>
 
 <ul>
-  <li>4v Samples: {@code &lt;sdk&gt;/extras/android/support/samples/Support4Demos/}</li>
-  <li>7v Samples: {@code &lt;sdk&gt;/extras/android/support/samples/Support7Demos/}</li>
-  <li>13v Samples: {@code &lt;sdk&gt;/extras/android/support/samples/Support13Demos/}</li>
-  <li>App Navigation: {@code &lt;sdk&gt;/extras/android/support/samples/SupportAppNavigation/}</li>
+  <li>4v Samples: {@code <sdk>/extras/android/support/samples/Support4Demos/}</li>
+  <li>7v Samples: {@code <sdk>/extras/android/support/samples/Support7Demos/}</li>
+  <li>13v Samples: {@code <sdk>/extras/android/support/samples/Support13Demos/}</li>
+  <li>App Navigation: {@code <sdk>/extras/android/support/samples/SupportAppNavigation/}</li>
 </ul>
 
diff --git a/docs/html/tools/testing-support-library/index.jd b/docs/html/tools/testing-support-library/index.jd
index 44f5631..97c2dcf 100644
--- a/docs/html/tools/testing-support-library/index.jd
+++ b/docs/html/tools/testing-support-library/index.jd
@@ -127,7 +127,7 @@
     4.10) tests. However, you should avoid mixing JUnit 3 and and JUnit 4 test code in the same
     package, as this might cause unexpected results. If you are creating an instrumented JUnit 4
     test class to run on a device or emulator, your test class must be prefixed with the
-    {@code &#64;RunWith(AndroidJUnit4.class)} annotation.
+    {@code @RunWith(AndroidJUnit4.class)} annotation.
   </p>
 
   <p>The following code snippet shows how you might write an instrumented JUnit 4 test to validate
@@ -193,14 +193,14 @@
   </p>
 
   <ul>
-    <li><a href="{@docRoot}reference/android/support/test/filters/RequiresDevice.html">{@code &#64;RequiresDevice}</a>:
+    <li><a href="{@docRoot}reference/android/support/test/filters/RequiresDevice.html">{@code @RequiresDevice}</a>:
     Specifies that the test should run only on physical devices, not on emulators.
     </li>
 
-    <li><a href="{@docRoot}reference/android/support/test/filters/SdkSuppress.html">{@code &#64;SdkSupress}</a>:
+    <li><a href="{@docRoot}reference/android/support/test/filters/SdkSuppress.html">{@code @SdkSupress}</a>:
     Suppresses the test from running on a lower Android API level than the given level. For
     example, to suppress tests on all API levels lower than 18 from running, use the annotation
-    {@code &#64;SDKSupress(minSdkVersion=18)}.
+    {@code @SDKSupress(minSdkVersion=18)}.
     </li>
 
     <li>{@link android.test.suitebuilder.annotation.SmallTest &#64;SmallTest},
@@ -440,7 +440,7 @@
   </p>
 
   <p>
-    The {@code uiautomatorviewer} tool is located in the {@code &lt;android-sdk&gt;/tools/}
+    The {@code uiautomatorviewer} tool is located in the {@code <android-sdk>/tools/}
     directory.
   </p>
 
@@ -570,7 +570,7 @@
   <p>
     After downloading, the tool installs the Support Repository files to your existing Android
     SDK directory. The library files are located in the following subdirectory of your SDK:
-    {@code &lt;sdk&gt;/extras/android/m2repository} directory.
+    {@code <sdk>/extras/android/m2repository} directory.
   </p>
 
   <p>
diff --git a/docs/html/tools/testing/testing_ui.jd b/docs/html/tools/testing/testing_ui.jd
index 4318a21..3f4bf7a 100644
--- a/docs/html/tools/testing/testing_ui.jd
+++ b/docs/html/tools/testing/testing_ui.jd
@@ -96,7 +96,7 @@
 <p>To analyze the UI components of the application that you want to test:</p>
 <ol>
 <li>Connect your Android device to your development machine.</li>
-<li>Open a terminal window and navigate to {@code &lt;android-sdk&gt;/tools/}.</li>
+<li>Open a terminal window and navigate to {@code <android-sdk>/tools/}.</li>
 <LI>Run the tool with this command:<pre>$ uiautomatorviewer</pre></LI>
 <li><p>To capture a screen for analysis, click the <strong>Device Screenshot</strong> button in the GUI of the {@code uiautomatorviewer} tool.</p>
 <p class="note"><strong>Note: </strong>If you have more than one device connected, specify the device for screen capture by setting the {@code ANDROID_SERIAL} environment variable:  
@@ -158,7 +158,7 @@
   </ol>
 </li>
 </ol>
-<p>If you did not configure Eclipse as your development environment, make sure that the {@code uiautomator.jar} and {@code android.jar} files from the {@code &lt;android-sdk&gt;/platforms/&lt;sdk&gt;} directory are in your Java class path.</p>
+<p>If you did not configure Eclipse as your development environment, make sure that the {@code uiautomator.jar} and {@code android.jar} files from the {@code <android-sdk>/platforms/<sdk>} directory are in your Java class path.</p>
 <p>Once you have completed these prerequisite tasks, you're almost ready to start creating your {@code uiautomator} tests. </li>
 
 <h2 id="creating">Creating uiautomator Tests</h2>
@@ -169,7 +169,7 @@
 <p>The first thing your test case should do is access the device that contains the target app. It’s also good practice to start the test from the Home screen of the device. From the Home screen (or some other starting location you’ve chosen in the target app), you can use the classes provided by the {@code uiautomator} API to simulate user actions and to test specific UI components. For an example of how to put together a {@code uiautomator} test case, see the <a href="#sample">sample test case</a>.</p>
 
 <h3 id="classes">uiautomator API</h3>
-<p>The {@code uiautomator} API is bundled in the {@code uiautomator.jar} file under the {@code &lt;android-sdk&gt;/platforms/} directory.  The API includes these key classes that allow you to capture and manipulate UI components on the target app:</p>
+<p>The {@code uiautomator} API is bundled in the {@code uiautomator.jar} file under the {@code <android-sdk>/platforms/} directory.  The API includes these key classes that allow you to capture and manipulate UI components on the target app:</p>
 <dl>
 <DT><a href="{@docRoot}tools/help/uiautomator/UiDevice.html">{@code UiDevice}</a></DT>
 <dd><p>Represents the device state.  In your tests, you can call methods on the <a href="{@docRoot}tools/help/uiautomator/UiDevice.html">{@code UiDevice}</a> instance to check for the state of various properties, such as current orientation or display size. Your tests also can use the <a href="{@docRoot}tools/help/uiautomator/UiDevice.html">{@code UiDevice}</a> instance to perform device level actions, such as forcing the device into a specific rotation, pressing the d-pad hardware button, or pressing the Home and Menu buttons.</p>
@@ -323,7 +323,7 @@
 <ol>
 <li>Create the required build configuration files to build the output JAR. To generate the build configuration files, open a terminal and run the following command:
 <pre>&lt;android-sdk&gt;/tools/android create uitest-project -n &lt;name&gt; -t 1 -p &lt;path&gt;</pre>
-The {@code &lt;name&gt;} is the name of the project that contains your {@code uiautomator} test source files, and the {@code &lt;path&gt;} is the path to the corresponding project directory. 
+The {@code <name>} is the name of the project that contains your {@code uiautomator} test source files, and the {@code <path>} is the path to the corresponding project directory.
 </li>
 <LI>From the command line, set the {@code ANDROID_HOME} variable: 
 <ul>
diff --git a/docs/html/training/activity-testing/activity-basic-testing.jd b/docs/html/training/activity-testing/activity-basic-testing.jd
index 016289d..6f39bcd 100644
--- a/docs/html/training/activity-testing/activity-basic-testing.jd
+++ b/docs/html/training/activity-testing/activity-basic-testing.jd
@@ -55,13 +55,13 @@
    <li>In the Package Explorer, right-click on the {@code /src} directory for
 your test project and select <strong>New &gt; Package</strong>.</li>
    <li>Set the <strong>Name</strong> field to
-{@code &lt;your_app_package_name&gt;.tests} (for example,
+{@code <your_app_package_name>.tests} (for example,
 {@code com.example.android.testingfun.tests}) and click
 <strong>Finish</strong>.</li>
    <li>Right-click on the test package you created, and select
 <strong>New &gt; Class</strong>.</li>
     <li>Set the <strong>Name</strong> field to
-{@code &lt;your_app_activity_name&gt;Test} (for example,
+{@code <your_app_activity_name>Test} (for example,
 {@code MyFirstTestActivityTest}) and click <strong>Finish</strong>.</li>
 </ol>
 
diff --git a/docs/html/training/activity-testing/activity-ui-testing.jd b/docs/html/training/activity-testing/activity-ui-testing.jd
index 644f3ca..a47ccf3 100644
--- a/docs/html/training/activity-testing/activity-ui-testing.jd
+++ b/docs/html/training/activity-testing/activity-ui-testing.jd
@@ -137,7 +137,7 @@
 object, then call assertion methods to verify that the
 {@link android.widget.Button} object's width and height attributes match the
 expected values.</p>
-<p>The {@code &#64;MediumTest} annotation specifies how the test is categorized,
+<p>The {@code @MediumTest} annotation specifies how the test is categorized,
 relative to its absolute execution time. To learn more about using test size
 annotations, see <a href="#annotations">Apply Test Annotations</a>.</p>
 
@@ -185,7 +185,7 @@
 <p class="caution"><strong>Caution: </strong>The {@link android.test.TouchUtils}
 methods are designed to send events to the UI thread safely from the test thread.
 You should not run {@link android.test.TouchUtils} directly in the UI thread or
-any test method annotated with {@code &#64;UIThread}. Doing so might
+any test method annotated with {@code @UIThread}. Doing so might
 raise the {@code WrongThreadException}.</p>
 
 <h2 id="annotations">Apply Test Annotations</h2>
@@ -202,8 +202,8 @@
 <dd>Marks a test that should run as part of the large tests.</dd>
 </dl>
 <p>Typically, a short running test that take only a few milliseconds should be
-marked as a {@code &#64;SmallTest}. Longer running tests (100 milliseconds or
-more) are usually marked as {@code &#64;MediumTest}s or {@code &#64;LargeTest}s,
+marked as a {@code @SmallTest}. Longer running tests (100 milliseconds or
+more) are usually marked as {@code @MediumTest}s or {@code @LargeTest}s,
 depending on whether the test accesses resources on the local system only or
 remote resources over a network. For guidance on using test size annotations,
 see this <a href="https://plus.sandbox.google.com/+AndroidDevelopers/posts/TPy1EeSaSg8">Android Tools Protip</a>.</p>
diff --git a/docs/html/training/app-indexing/deep-linking.jd b/docs/html/training/app-indexing/deep-linking.jd
index 2679937..fc67b26 100644
--- a/docs/html/training/app-indexing/deep-linking.jd
+++ b/docs/html/training/app-indexing/deep-linking.jd
@@ -32,13 +32,13 @@
 <p>To create a deep link to your app content, add an intent filter that
   contains these elements and attribute values in your manifest:</p>
 <dl>
-<dt><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action&gt;}</a></dt>
+<dt><a href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a></dt>
 <dd>Specify the {@link android.content.Intent#ACTION_VIEW} intent action so
   that the intent filter can be reached from Google Search.</dd>
-<dt><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a></dt>
-<dd>Add one or more <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> tags, where each tag represents a URI format that resolves to the activity. At minimum, the <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data&gt;}</a> tag must include the <a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">{@code android:scheme}</a> attribute.
+<dt><a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a></dt>
+<dd>Add one or more <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> tags, where each tag represents a URI format that resolves to the activity. At minimum, the <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> tag must include the <a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">{@code android:scheme}</a> attribute.
 <p>You can add additional attributes to further refine the type of URI that the activity accepts. For example, you might have multiple activities that accept similar URIs, but which differ simply based on the path name. In this case, use the <a href="{@docRoot}guide/topics/manifest/data-element.html#path">{@code android:path}</a> attribute or its variants ({@code pathPattern} or {@code pathPrefix}) to differentiate which activity the system should open for different URI paths.</p></dd>
-<dt><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a></dt>
+<dt><a href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a></dt>
 <dd>Include the {@link android.content.Intent#CATEGORY_BROWSABLE BROWSABLE}
 category. The {@link android.content.Intent#CATEGORY_BROWSABLE BROWSABLE}
 category is required in order for the intent filter to be accessible from a web
diff --git a/docs/html/training/app-indexing/enabling-app-indexing.jd b/docs/html/training/app-indexing/enabling-app-indexing.jd
index f0339d6..d483795 100644
--- a/docs/html/training/app-indexing/enabling-app-indexing.jd
+++ b/docs/html/training/app-indexing/enabling-app-indexing.jd
@@ -28,7 +28,7 @@
 By opting in, you can allow Googlebot to crawl the content in the APK
 through the Google Play Store to index the app content. To indicate which app
 content you’d like Google to index, simply add link elements either to
-your existing <a href="https://support.google.com/webmasters/answer/156184?hl=en" class="external-link" target="_blank">Sitemap</a> file or in the {@code &lt;head&gt;} element of each web
+your existing <a href="https://support.google.com/webmasters/answer/156184?hl=en" class="external-link" target="_blank">Sitemap</a> file or in the {@code <head>} element of each web
 page in your site, in the same way as you would for web pages.</p>
 
 <p>The deep links that you share with Google Search must take this URI
@@ -49,10 +49,10 @@
 <h2 id="sitemap">Add Deep Links in Your Sitemap</h2>
 <p>To annotate the deep link for Google Search app indexing in your
 <a href="https://support.google.com/webmasters/answer/156184?hl=en" class="external-link" target="_blank">Sitemap</a>, use the
-{@code &lt;xhtml:link&gt;} tag and specify the deep link as an alternate URI.</p>
+{@code <xhtml:link>} tag and specify the deep link as an alternate URI.</p>
 <p>For example, the following XML snippet shows how you might specify a link to
-your web page by using the {@code &lt;loc&gt;} tag, and a corresponding deep
-link to your Android app by using the {@code &lt;xhtml:link&gt;} tag.</p>
+your web page by using the {@code <loc>} tag, and a corresponding deep
+link to your Android app by using the {@code <xhtml:link>} tag.</p>
 <pre>
 &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
 &lt;urlset
@@ -70,8 +70,8 @@
 <h2 id="webpages">Add Deep Links in Your Web Pages</h2>
 <p>Instead of specifying the deep links for Google Search app indexing in your
 Sitemap file, you can annotate the deep links in the HTML markup of your web
-pages. You can do this in the {@code &lt;head&gt;} section for each web
-page by adding a {@code &lt;link&gt;} tag and specifying the deep link as an
+pages. You can do this in the {@code <head>} section for each web
+page by adding a {@code <link>} tag and specifying the deep link as an
 alternate URI.</p>
 <p>For example, the following HTML snippet shows how you might specify the
 corresponding deep link in a web page that has the URL
diff --git a/docs/html/training/articles/memory.jd b/docs/html/training/articles/memory.jd
index f15af68..de7af58 100644
--- a/docs/html/training/articles/memory.jd
+++ b/docs/html/training/articles/memory.jd
@@ -319,7 +319,7 @@
 <p>In very special situations, you can request a larger heap size by setting the <a
 href="{@docRoot}guide/topics/manifest/application-element.html#largeHeap">{@code largeHeap}</a>
 attribute to "true" in the manifest <a
-href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 tag. If you do so, you can call {@link
 android.app.ActivityManager#getLargeMemoryClass()} to get an estimate of the large heap size.</p>
 
diff --git a/docs/html/training/articles/security-tips.jd b/docs/html/training/articles/security-tips.jd
index 3215a0e..a3b7529 100644
--- a/docs/html/training/articles/security-tips.jd
+++ b/docs/html/training/articles/security-tips.jd
@@ -197,7 +197,7 @@
 on the internal storage.</p>
 
 <p>In addition to requesting permissions, your application can use the <a
-href="{@docRoot}guide/topics/manifest/permission-element.html">{@code &lt;permissions>}</a>
+href="{@docRoot}guide/topics/manifest/permission-element.html">{@code <permissions>}</a>
 to protect IPC that is security sensitive and will be exposed to other
 applications, such as a {@link android.content.ContentProvider}.
 In general, we recommend using access controls
@@ -537,7 +537,7 @@
 If your IPC mechanism is not intended for use by other applications, set the
 {@code android:exported} attribute to {@code "false"} in the component's manifest element,
 such as for the <a
-href="{@docRoot}guide/topics/manifest/service-element.html#exported">{@code &lt;service&gt;}</a>
+href="{@docRoot}guide/topics/manifest/service-element.html#exported">{@code <service>}</a>
 element.  This is useful for applications that consist of multiple processes
 within the same UID, or if you decide late in development that you do not
 actually want to expose functionality as IPC but you don’t want to rewrite
@@ -545,7 +545,7 @@
 
 <p>If your IPC is intended to be accessible to other applications, you can
 apply a security policy by using the <a
-href="{@docRoot}guide/topics/manifest/permission-element.html">{@code &lt;permission>}</a>
+href="{@docRoot}guide/topics/manifest/permission-element.html">{@code <permission>}</a>
 element. If IPC is between your own separate apps that are signed with the same key,
 it is preferable to use {@code "signature"} level permission in the <a
 href="{@docRoot}guide/topics/manifest/permission-element.html#plevel">{@code
diff --git a/docs/html/training/auto/start/index.jd b/docs/html/training/auto/start/index.jd
index 6c6f188..0fdcb2a 100644
--- a/docs/html/training/auto/start/index.jd
+++ b/docs/html/training/auto/start/index.jd
@@ -98,8 +98,8 @@
    &lt;uses name="media" /&gt;
 &lt;/automotiveApp&gt;
 </pre>
-<p>The {@code &lt;uses&gt;} element declares the Auto capability your app
-intends to use. Multiple {@code &lt;uses&gt;} tags can be added if your
+<p>The {@code <uses>} element declares the Auto capability your app
+intends to use. Multiple {@code <uses>} tags can be added if your
 application uses multiple car capabilities. The {@code name} attribute indicates
 the specific capability your app uses. The values supported are:</p>
 <ul>
@@ -115,7 +115,7 @@
 <p>In your app’s manifest ({@code AndroidManifest.xml}), provide a reference to
 the Auto XML configuration file you created in the previous section. Add a
 {@code "com.google.android.gms.car.application"} metadata entry under the
-<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
 element that references your Auto XML configuration file. Omit the {@code .xml}
 file extension when specifying the configuration filename.</p>
 <p>The following code snippet shows how to include this reference in your
diff --git a/docs/html/training/basics/actionbar/adding-buttons.jd b/docs/html/training/basics/actionbar/adding-buttons.jd
index 40d0bd1..caee729 100644
--- a/docs/html/training/basics/actionbar/adding-buttons.jd
+++ b/docs/html/training/basics/actionbar/adding-buttons.jd
@@ -45,7 +45,7 @@
 actions to the action bar, create a new XML file in your project's
 {@code res/menu/} directory.</p>
 
-<p>Add an {@code &lt;item>} element for each item you want to include in the action bar.
+<p>Add an {@code <item>} element for each item you want to include in the action bar.
 For example:</p>
 
 <p class="code-caption">res/menu/main_activity_actions.xml</p>
@@ -77,9 +77,9 @@
 overflow, but it's good practice to explicitly declare your design intentions for each action.)
 
 <p>The {@code icon} attribute requires a resource ID for an
-image. The name that follows {@code &#64;drawable/} must be the name of a bitmap image you've
+image. The name that follows {@code @drawable/} must be the name of a bitmap image you've
 saved in your project's {@code res/drawable/} directory. For example,
-{@code "&#64;drawable/ic_action_search"} refers to {@code ic_action_search.png}.
+{@code "@drawable/ic_action_search"} refers to {@code ic_action_search.png}.
 Likewise, the {@code title} attribute uses a string resource that's defined by an XML
 file in your project's {@code res/values/} directory, as discussed in <a
 href="{@docRoot}training/basics/firstapp/building-ui.html#Strings">Building a Simple User
@@ -139,7 +139,7 @@
 onOptionsItemSelected()} callback method. In your implementation of this method,
 call {@link android.view.MenuItem#getItemId getItemId()} on the given {@link android.view.MenuItem} to
 determine which item was pressed&mdash;the returned ID matches the value you declared in the
-corresponding {@code &lt;item>} element's {@code android:id} attribute.</p>
+corresponding {@code <item>} element's {@code android:id} attribute.</p>
 
 <pre>
 &#64;Override
diff --git a/docs/html/training/basics/actionbar/setting-up.jd b/docs/html/training/basics/actionbar/setting-up.jd
index bccbd04..2cd4140 100644
--- a/docs/html/training/basics/actionbar/setting-up.jd
+++ b/docs/html/training/basics/actionbar/setting-up.jd
@@ -90,8 +90,8 @@
   </li>
   <li>In your manifest file, update either the <a
   href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-  &lt;application>}</a> element or individual
-  <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;activity>}</a>
+  <application>}</a> element or individual
+  <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <activity>}</a>
   elements to use one of the {@link android.support.v7.appcompat.R.style#Theme_AppCompat
   Theme.AppCompat} themes. For example:
   <pre>&lt;activity android:theme="@style/Theme.AppCompat.Light" ... ></pre>
diff --git a/docs/html/training/basics/actionbar/styling.jd b/docs/html/training/basics/actionbar/styling.jd
index 7c63952..b658423 100644
--- a/docs/html/training/basics/actionbar/styling.jd
+++ b/docs/html/training/basics/actionbar/styling.jd
@@ -75,8 +75,8 @@
 <p>You can apply these themes to your entire app or to individual activities by
 declaring them in your manifest file with the {@code android:theme} attribute
 for the <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-&lt;application>}</a> element or individual
-<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;activity>}</a>
+<application>}</a> element or individual
+<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <activity>}</a>
 elements.</p>
 
 <p>For example:</p>
diff --git a/docs/html/training/basics/activity-lifecycle/starting.jd b/docs/html/training/basics/activity-lifecycle/starting.jd
index 2501f38..5b238b8 100644
--- a/docs/html/training/basics/activity-lifecycle/starting.jd
+++ b/docs/html/training/basics/activity-lifecycle/starting.jd
@@ -152,7 +152,7 @@
 
 <p>The main activity for your app must be declared in the manifest with an <a
 href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter>}</a> that includes the {@link
+<intent-filter>}</a> that includes the {@link
 android.content.Intent#ACTION_MAIN MAIN} action and
 {@link android.content.Intent#CATEGORY_LAUNCHER LAUNCHER} category. For example:</p> 
 
diff --git a/docs/html/training/basics/firstapp/starting-activity.jd b/docs/html/training/basics/firstapp/starting-activity.jd
index 7aad894..4f43ea0 100644
--- a/docs/html/training/basics/firstapp/starting-activity.jd
+++ b/docs/html/training/basics/firstapp/starting-activity.jd
@@ -383,7 +383,7 @@
 
 <li>In your manifest file, <code>AndroidManifest.xml</code>, within the <code>Application</code>
 element, add the
-<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element
+<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element
 for your {@code DisplayMessageActivity} class, as follows:
 
 <pre>
@@ -412,7 +412,7 @@
 older versions of Android by using the
 <a href="{@docRoot}tools/support-library/index.html">Support Library</a> and adding
 the <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
-&lt;meta-data>}</a> element as shown here.</p>
+<meta-data>}</a> element as shown here.</p>
 
 <p class="note"><strong>Note:</strong> Your Android SDK should already include
 the latest Android Support Library, which you installed during the
diff --git a/docs/html/training/basics/fragments/fragment-ui.jd b/docs/html/training/basics/fragments/fragment-ui.jd
index 1061c15..c0bd0a4 100644
--- a/docs/html/training/basics/fragments/fragment-ui.jd
+++ b/docs/html/training/basics/fragments/fragment-ui.jd
@@ -55,7 +55,7 @@
 <h2 id="AddAtRuntime">Add a Fragment to an Activity at Runtime</h2> 
 
 <p>Rather than defining the fragments for an activity in the layout file&mdash;as shown in the
-<a href="creating.html">previous lesson</a> with the {@code &lt;fragment>} element&mdash;you can add
+<a href="creating.html">previous lesson</a> with the {@code <fragment>} element&mdash;you can add
 a fragment to the activity during the activity runtime. This is necessary
 if you plan to change fragments during the life of the activity.</p>
 
@@ -140,7 +140,7 @@
 </pre>
 
 <p>Because the fragment has been added to the {@link android.widget.FrameLayout} container at
-runtime&mdash;instead of defining it in the activity's layout with a {@code &lt;fragment>}
+runtime&mdash;instead of defining it in the activity's layout with a {@code <fragment>}
 element&mdash;the activity can remove the fragment and replace it with a different one.</p>
 
 
diff --git a/docs/html/training/basics/intents/filters.jd b/docs/html/training/basics/intents/filters.jd
index 221e31b..0a6d401 100644
--- a/docs/html/training/basics/intents/filters.jd
+++ b/docs/html/training/basics/intents/filters.jd
@@ -32,9 +32,9 @@
 "share" action from another app and launch your app to perform the action.</p>
 
 <p>To allow other apps to start your activity, you need to add an <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter>}</a>
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 element in your manifest file for the corresponding <a
-href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a> element.</p>
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element.</p>
 
 <p>When your app is installed on a device, the system identifies your intent
 filters and adds the information to an internal catalog of intents supported by all installed apps.
@@ -59,14 +59,14 @@
     <dd>A string naming the action to perform. Usually one of the platform-defined values such
 as {@link android.content.Intent#ACTION_SEND} or {@link android.content.Intent#ACTION_VIEW}.
     <p>Specify this in your intent filter with the <a
-href="{@docRoot}guide/topics/manifest/action-element.html">{@code &lt;action>}</a> element.
+href="{@docRoot}guide/topics/manifest/action-element.html">{@code <action>}</a> element.
 The value you specify in this element must be the full string name for the action, instead of the
 API constant (see the examples below).</p></dd>
 
   <dt>Data</dt>
     <dd>A description of the data associated with the intent.
     <p>Specify this in your intent filter with the <a
-href="{@docRoot}guide/topics/manifest/data-element.html">{@code &lt;data>}</a> element. Using one
+href="{@docRoot}guide/topics/manifest/data-element.html">{@code <data>}</a> element. Using one
 or more attributes in this element, you can specify just the MIME type, just a URI prefix,
 just a URI scheme, or a combination of these and others that indicate the data type
 accepted.</p>
@@ -81,13 +81,13 @@
 supported by the system, but most are rarely used. However, all implicit intents are defined with
 {@link android.content.Intent#CATEGORY_DEFAULT} by default.
     <p>Specify this in your intent filter with the <a
-href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category>}</a>
+href="{@docRoot}guide/topics/manifest/category-element.html">{@code <category>}</a>
 element.</p></dd>
 </dl>
 
 <p>In your intent filter, you can declare which criteria your activity accepts
 by declaring each of them with corresponding XML elements nested in the <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter>}</a>
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code <intent-filter>}</a>
 element.</p>
 
 <p>For example, here's an activity with an intent filter that handles the {@link
@@ -106,11 +106,11 @@
 
 <p>Each incoming intent specifies only one action and one data type, but it's OK to declare multiple
 instances of the <a href="{@docRoot}guide/topics/manifest/action-element.html">{@code
-&lt;action>}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
-&lt;category>}</a>, and <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
-&lt;data>}</a> elements in each
+<action>}</a>, <a href="{@docRoot}guide/topics/manifest/category-element.html">{@code
+<category>}</a>, and <a href="{@docRoot}guide/topics/manifest/data-element.html">{@code
+<data>}</a> elements in each
 <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
-&lt;intent-filter>}</a>.</p>
+<intent-filter>}</a>.</p>
 
 <p>If any two pairs of action and data are mutually exclusive in
 their behaviors, you should create separate intent filters to specify which actions are acceptable
diff --git a/docs/html/training/basics/network-ops/managing.jd b/docs/html/training/basics/network-ops/managing.jd
index 990b8cb..a645b3f 100644
--- a/docs/html/training/basics/network-ops/managing.jd
+++ b/docs/html/training/basics/network-ops/managing.jd
@@ -398,12 +398,12 @@
 {@link android.app.Activity#onCreate(android.os.Bundle) onCreate()}, 
 and it unregisters it in 
 {@link android.app.Activity#onDestroy onDestroy()}. This is more lightweight 
-than declaring a {@code &lt;receiver&gt;} in the manifest. When you declare a 
-{@code &lt;receiver&gt;} in the manifest, it can wake up your app at any time, 
+than declaring a {@code <receiver>} in the manifest. When you declare a
+{@code <receiver>} in the manifest, it can wake up your app at any time,
 even if you haven't run it for weeks. By registering and unregistering 
 {@code NetworkReceiver} within the main activity, you ensure that the app won't 
 be woken up after the user leaves the app. 
-If you do declare a {@code &lt;receiver&gt;} in the manifest and you know exactly 
+If you do declare a {@code <receiver>} in the manifest and you know exactly
 where you need it, you can use 
 {@link android.content.pm.PackageManager#setComponentEnabledSetting setComponentEnabledSetting()}
 to enable and disable it as appropriate.</p>
diff --git a/docs/html/training/basics/supporting-devices/languages.jd b/docs/html/training/basics/supporting-devices/languages.jd
index 098b556..e1bf657 100644
--- a/docs/html/training/basics/supporting-devices/languages.jd
+++ b/docs/html/training/basics/supporting-devices/languages.jd
@@ -106,10 +106,10 @@
 <h2 id="UseString">Use the String Resources</h2>
 
 <p>You can reference your string resources in your source code and other XML files using the
-resource name defined by the {@code &lt;string>} element's {@code name} attribute.</p>
+resource name defined by the {@code <string>} element's {@code name} attribute.</p>
 
 <p>In your source code, you can refer to a string resource with the syntax {@code
-R.string.&lt;string_name>}. There are a variety of methods that accept a string resource this
+R.string.<string_name>}. There are a variety of methods that accept a string resource this
 way.</p>
   
 <p>For example:</p>
@@ -123,8 +123,8 @@
 textView.setText(R.string.hello_world);
 </pre>
 
-<p>In other XML files, you can refer to a string resource with the syntax {@code
-&#64;string/&lt;string_name>} whenever the XML attribute accepts a string value.</p>
+<p>In other XML files, you can refer to a string resource with the syntax
+<code>@string/&lt;string_name&gt;</code> whenever the XML attribute accepts a string value.</p>
 
 <p>For example:</p>
 
diff --git a/docs/html/training/basics/supporting-devices/platforms.jd b/docs/html/training/basics/supporting-devices/platforms.jd
index 9890c98..eecb356 100644
--- a/docs/html/training/basics/supporting-devices/platforms.jd
+++ b/docs/html/training/basics/supporting-devices/platforms.jd
@@ -52,7 +52,7 @@
 describes details about your app and 
 identifies which versions of Android it supports.   Specifically, the <code>minSdkVersion</code> 
 and <code>targetSdkVersion</code> attributes for the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk}</a> element
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> element
 identify the lowest API level with which your app is compatible and the highest API level against
 which you’ve designed and tested your app.</p>
 
@@ -128,7 +128,7 @@
 <p>To apply a theme to your entire app (all activities), add the <code>android:theme</code>
 attribute 
 to the <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code
-&lt;application>}</a> element:</p>
+<application>}</a> element:</p>
 
 <pre>&lt;application android:theme="@style/CustomTheme"></pre>
 
diff --git a/docs/html/training/camera/photobasics.jd b/docs/html/training/camera/photobasics.jd
index 188b5cc..efac5483 100644
--- a/docs/html/training/camera/photobasics.jd
+++ b/docs/html/training/camera/photobasics.jd
@@ -58,7 +58,7 @@
 its visibility on Google Play to devices that have a camera.  To advertise
 that your application depends on having a camera, put a <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html"> {@code
-&lt;uses-feature&gt;}</a> tag in your manifest file:</p>
+<uses-feature>}</a> tag in your manifest file:</p>
 
 <pre style="clear:right">
 &lt;manifest ... >
diff --git a/docs/html/training/camera/videobasics.jd b/docs/html/training/camera/videobasics.jd
index 135d4a1..6da239a 100644
--- a/docs/html/training/camera/videobasics.jd
+++ b/docs/html/training/camera/videobasics.jd
@@ -52,7 +52,7 @@
 <h2 id="TaskManifest">Request Camera Permission</h2>
 
 <p>To advertise that your application depends on having a camera, put a
-{@code &lt;uses-feature&gt;} tag in the manifest file:</p>
+{@code <uses-feature>} tag in the manifest file:</p>
 
 <pre style="clear:right">
 &lt;manifest ... >
diff --git a/docs/html/training/custom-views/create-view.jd b/docs/html/training/custom-views/create-view.jd
index 11be85f..a476bbe 100644
--- a/docs/html/training/custom-views/create-view.jd
+++ b/docs/html/training/custom-views/create-view.jd
@@ -84,7 +84,7 @@
 
 <ul>
     <li>Define custom attributes for your view in a {@code
-        &lt;declare-styleable&gt;
+        <declare-styleable>
         } resource element
     </li>
     <li>Specify values for the attributes in your XML layout</li>
@@ -97,7 +97,7 @@
     retrieving and applying the values at runtime.</p>
 
 <p>To define custom attributes, add {@code
-    &lt;declare-styleable&gt;
+    <declare-styleable>
     } resources to your project. It's customary to put these resources into a {@code
     res/values/attrs.xml} file. Here's
     an example of an {@code attrs.xml} file:
@@ -179,7 +179,7 @@
 
         <p>The Android resource compiler does a lot of work for you to make calling {@link
             android.content.res.Resources.Theme#obtainStyledAttributes obtainStyledAttributes()}
-            easier. For each {@code &lt;declare-styleable&gt;}
+            easier. For each {@code <declare-styleable>}
             resource in the res directory, the generated R.java defines both an array of attribute
             ids and a set of
             constants that define the index for each attribute in the array. You use the predefined
diff --git a/docs/html/training/displaying-bitmaps/manage-memory.jd b/docs/html/training/displaying-bitmaps/manage-memory.jd
index 5a5c2cd..b7c72bc 100644
--- a/docs/html/training/displaying-bitmaps/manage-memory.jd
+++ b/docs/html/training/displaying-bitmaps/manage-memory.jd
@@ -78,7 +78,7 @@
 {@link android.graphics.Bitmap#recycle recycle()} only when you are sure that the
 bitmap is no longer being used. If you call {@link android.graphics.Bitmap#recycle recycle()}
 and later attempt to draw the bitmap, you will get the error:
-{@code &quot;Canvas: trying to use a recycled bitmap&quot;}.</p>
+<code>&quot;Canvas: trying to use a recycled bitmap&quot;</code>.</p>
 
 <p>The following code snippet gives an example of calling
 {@link android.graphics.Bitmap#recycle recycle()}. It uses reference counting
diff --git a/docs/html/training/gestures/detector.jd b/docs/html/training/gestures/detector.jd
index a8e0fdb..97f039c 100644
--- a/docs/html/training/gestures/detector.jd
+++ b/docs/html/training/gestures/detector.jd
@@ -186,7 +186,7 @@
 
 
 <p>In the following snippet, a return value of {@code true} from the individual 
-{@code on<em>&lt;TouchEvent&gt;</em>} methods indicates that you
+<code>on<em>&lt;TouchEvent&gt;</em></code> methods indicates that you
 have handled the touch event. A return value of {@code false} passes events down
 through the view stack until the touch has been successfully handled.</p>
 
@@ -286,7 +286,7 @@
 <p>
 {@link
 android.view.GestureDetector.SimpleOnGestureListener} provides an implementation
-for all of the {@code on<em>&lt;TouchEvent&gt;</em>} methods by returning {@code false}
+for all of the <code>on<em>&lt;TouchEvent&gt;</em></code> methods by returning {@code false}
 for all of them. Thus you can override only the methods you care about.
 For
 example, the snippet below creates a class that extends {@link
diff --git a/docs/html/training/gestures/movement.jd b/docs/html/training/gestures/movement.jd
index 136b37a..ed4928e 100644
--- a/docs/html/training/gestures/movement.jd
+++ b/docs/html/training/gestures/movement.jd
@@ -73,8 +73,8 @@
 <li>History. You can find the size of a gesture's history by calling the {@link
 android.view.MotionEvent} method {@link android.view.MotionEvent#getHistorySize
 getHistorySize()}. You can then obtain the positions, sizes, time, and pressures
-of each of the historical events by using the motion event's {@code
-getHistorical<em>&lt;Value&gt;</em>} methods. History is useful when rendering a trail of the user's finger, 
+of each of the historical events by using the motion event's
+<code>getHistorical<em>&lt;Value&gt;</em></code> methods. History is useful when rendering a trail of the user's finger,
 such as for touch drawing. See the {@link android.view.MotionEvent} reference for
 details.</li>
 
diff --git a/docs/html/training/id-auth/custom_auth.jd b/docs/html/training/id-auth/custom_auth.jd
index 0509c6e..def9b51 100644
--- a/docs/html/training/id-auth/custom_auth.jd
+++ b/docs/html/training/id-auth/custom_auth.jd
@@ -148,7 +148,7 @@
 href="http://developer.android.com/resources/samples/SampleSyncAdapter/index.html">
 SampleSyncAdapter</a> contains a good example of an authenticator service.</p>
 
-<p>Don't forget to add a {@code &lt;service&gt;} tag to your manifest file
+<p>Don't forget to add a {@code <service>} tag to your manifest file
 and add an intent filter for the AccountAuthenticator intent and declare the account
 authenticator:</p>
 
diff --git a/docs/html/training/id-auth/identify.jd b/docs/html/training/id-auth/identify.jd
index 2b31bdd..db9ab3a 100644
--- a/docs/html/training/id-auth/identify.jd
+++ b/docs/html/training/id-auth/identify.jd
@@ -83,7 +83,7 @@
 <p>In order to get a list of accounts on the device, your app needs the {@link
 android.Manifest.permission#GET_ACCOUNTS}
 permission. Add a <a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code
-&lt;uses-permission&gt;}</a> tag in your manifest file to request
+<uses-permission>}</a> tag in your manifest file to request
 this permission:</p>
 
 <pre>
diff --git a/docs/html/training/implementing-navigation/ancestral.jd b/docs/html/training/implementing-navigation/ancestral.jd
index 8aa0fd6..29e1710 100644
--- a/docs/html/training/implementing-navigation/ancestral.jd
+++ b/docs/html/training/implementing-navigation/ancestral.jd
@@ -65,14 +65,14 @@
 activity by specifying the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute
-in the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity>}</a>
+in the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a>
 element.</p>
 
 <p>If your app supports Android 4.0 and lower, include the
 <a href="{@docRoot}tools/support-library/index.html">Support Library</a> with your app and
-add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data>}</a>
+add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element inside the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity>}</a>. Then specify the parent activity as the value
+<activity>}</a>. Then specify the parent activity as the value
 for {@code android.support.PARENT_ACTIVITY}, matching the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute.</p>
@@ -140,14 +140,14 @@
 <ul>
     <li>If the parent activity has launch mode <a
     href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">{@code
-    &lt;singleTop>}</a>, or the <code>up</code> intent contains {@link
+    <singleTop>}</a>, or the <code>up</code> intent contains {@link
     android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}, the parent activity is
     brought to the top of the stack, and receives the intent through its
     {@link android.app.Activity#onNewIntent onNewIntent()} method.</li>
 
     <li>If the parent activity has launch mode <a
     href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">{@code
-    &lt;standard>}</a>, and the <code>up</code> intent does not contain
+    <standard>}</a>, and the <code>up</code> intent does not contain
     {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}, the parent activity
     is popped off the stack, and a new instance of that activity is created on
     top of the stack to receive the intent.</li>
@@ -226,5 +226,5 @@
 you must declare the logical parent of each activity in your manifest file, using the
 <a href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute (and corresponding <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data>}</a> element)
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a> element)
 as described above.</p>
diff --git a/docs/html/training/implementing-navigation/lateral.jd b/docs/html/training/implementing-navigation/lateral.jd
index 9c83479..01ef599 100644
--- a/docs/html/training/implementing-navigation/lateral.jd
+++ b/docs/html/training/implementing-navigation/lateral.jd
@@ -62,7 +62,7 @@
 a separate page (a separate tab) in the layout.</p>
 
 <p>To set up your layout with {@link android.support.v4.view.ViewPager}, add a
-{@code &lt;ViewPager>} element to your XML layout. For example, if each page in the swipe view
+{@code <ViewPager>} element to your XML layout. For example, if each page in the swipe view
 should consume the entire layout, then your layout looks like this:</p>
 
 <pre>
diff --git a/docs/html/training/implementing-navigation/temporal.jd b/docs/html/training/implementing-navigation/temporal.jd
index e736648..cbe1333 100644
--- a/docs/html/training/implementing-navigation/temporal.jd
+++ b/docs/html/training/implementing-navigation/temporal.jd
@@ -80,15 +80,15 @@
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute
 in the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity>}</a> element. This allows the system to facilitate navigation patterns
+<activity>}</a> element. This allows the system to facilitate navigation patterns
 because it can determine the logical <em>Back</em> or <em>Up</em> navigation path with this
 information.</p>
 
 <p>If your app supports Android 4.0 and lower, include the
 <a href="{@docRoot}tools/support-library/index.html">Support Library</a> with your app and
-add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data>}</a>
+add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a>
 element inside the <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code
-&lt;activity>}</a>. Then specify the parent activity as the value
+<activity>}</a>. Then specify the parent activity as the value
 for {@code android.support.PARENT_ACTIVITY}, matching the <a
 href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute.</p>
@@ -165,7 +165,7 @@
 you must declare the logical parent of each activity in your manifest file, using the
 <a href="{@docRoot}guide/topics/manifest/activity-element.html#parent">{@code
 android:parentActivityName}</a> attribute (and corresponding <a
-href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data>}</a> element)
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a> element)
 as described above.</p>
 
 
diff --git a/docs/html/training/improving-layouts/loading-ondemand.jd b/docs/html/training/improving-layouts/loading-ondemand.jd
index 9abd8fa..770157f 100644
--- a/docs/html/training/improving-layouts/loading-ondemand.jd
+++ b/docs/html/training/improving-layouts/loading-ondemand.jd
@@ -81,7 +81,7 @@
 android.view.ViewStub} layout is visible/inflated.)</p>
 
 <p class="note"><strong>Note:</strong> One drawback of {@link android.view.ViewStub} is that it
-doesn’t currently support the {@code &lt;merge/&gt;} tag in the layouts to be inflated.</p>
+doesn’t currently support the {@code <merge>} tag in the layouts to be inflated.</p>
 
 
 
diff --git a/docs/html/training/improving-layouts/optimizing-layout.jd b/docs/html/training/improving-layouts/optimizing-layout.jd
index 003e7a2..e0baedf 100644
--- a/docs/html/training/improving-layouts/optimizing-layout.jd
+++ b/docs/html/training/improving-layouts/optimizing-layout.jd
@@ -71,7 +71,7 @@
 <p class="img-caption"><strong>Figure 1.</strong> Conceptual layout for an item in a {@link
 android.widget.ListView}.</p>
 
-<p>The {@code hierarchyviewer} tool is available in  {@code &lt;sdk&gt;/tools/}. When opened,
+<p>The {@code hierarchyviewer} tool is available in  {@code <sdk>/tools/}. When opened,
 the Hierarchy Viewer shows a list of available devices and its running components. Click
 <strong>Load View Hierarchy</strong> to view the layout hierarchy of the selected component. For
 example, figure 2 shows the layout for the list item illustrated by figure 1.</p>
diff --git a/docs/html/training/improving-layouts/reusing-layouts.jd b/docs/html/training/improving-layouts/reusing-layouts.jd
index 87431d3..7b0185d 100644
--- a/docs/html/training/improving-layouts/reusing-layouts.jd
+++ b/docs/html/training/improving-layouts/reusing-layouts.jd
@@ -37,7 +37,7 @@
 
 <p>Although Android offers a variety of widgets to provide small and re-usable interactive elements,
 you might also need to re-use larger components that require a special layout. To efficiently
-re-use complete layouts, you can use the {@code &lt;include/&gt;} and {@code &lt;merge/&gt;} tags
+re-use complete layouts, you can use the {@code <include/>} and {@code <merge/>} tags
 to embed another layout inside the current layout.</p>
 
 <p>Reusing layouts is particularly powerful as it allows you create reusable complex layouts. For
@@ -73,7 +73,7 @@
 <h2 id="Include">Use the &lt;include&gt; Tag</h2>
 
 <p>Inside the layout to which you want to add the re-usable component, add the {@code
-&lt;include/&gt;} tag. For example, here's a layout from the
+<include/>} tag. For example, here's a layout from the
 G-Kenya codelab that includes the title bar from above:</p>
 
 <p>Here's the layout file:</p>
@@ -99,7 +99,7 @@
 </pre>
 
 <p>You can also override all the layout parameters (any {@code android:layout_*} attributes) of the
-included layout's root view by specifying them in the {@code &lt;include/&gt;} tag. For
+included layout's root view by specifying them in the {@code <include/>} tag. For
 example:</p>
 
 <pre>
@@ -117,7 +117,7 @@
 
 <h2 id="Merge">Use the &lt;merge&gt; Tag</h2>
 
-<p>The {@code &lt;merge />} tag helps eliminate redundant view groups in your view hierarchy
+<p>The {@code <merge />} tag helps eliminate redundant view groups in your view hierarchy
 when including one layout within another. For example, if your main layout is a vertical {@link
 android.widget.LinearLayout} in which two consecutive views can be
 re-used in multiple layouts, then the re-usable layout in which you place the two views requires its
@@ -127,7 +127,7 @@
 serves no real purpose other than to slow down your UI performance.</p>
 
 <p>To avoid including such a redundant view group, you can instead use the
-{@code &lt;merge&gt;} element as the root view for the re-usable layout. For example:</p>
+{@code <merge>} element as the root view for the re-usable layout. For example:</p>
 
 <pre>
 &lt;merge xmlns:android="http://schemas.android.com/apk/res/android">
@@ -145,7 +145,7 @@
 &lt;/merge>
 </pre>
 
-<p>Now, when you include this layout in another layout (using the {@code &lt;include/&gt;} tag), the
-system ignores the {@code &lt;merge&gt;} element and places the two buttons directly in the
-layout, in place of the {@code &lt;include/&gt;} tag.</p>
+<p>Now, when you include this layout in another layout (using the {@code <include/>} tag), the
+system ignores the {@code <merge>} element and places the two buttons directly in the
+layout, in place of the {@code <include/>} tag.</p>
 
diff --git a/docs/html/training/in-app-billing/preparing-iab-app.jd b/docs/html/training/in-app-billing/preparing-iab-app.jd
index 17cd0d51..42bc947 100644
--- a/docs/html/training/in-app-billing/preparing-iab-app.jd
+++ b/docs/html/training/in-app-billing/preparing-iab-app.jd
@@ -41,7 +41,7 @@
 <li>Select <strong>Google Play Billing Library</strong>.</li>
 <li>Click <strong>Install packages</strong> to complete the download.</li>
 </ol>
-<p>The sample files will be installed to {@code &lt;sdk&gt;/extras/google/play_billing/}.</p>
+<p>The sample files will be installed to {@code <sdk>/extras/google/play_billing/}.</p>
 
 <h2 id="AddToDevConsole">Add Your Application to the Developer Console</h2>
 <p>The Google Play Developer Console is where you publish your In-app Billing application and  manage the various digital goods that are available for purchase from your application. When you create a new application entry in the Developer Console, it automatically generates a public license key for your application. You will need this key to establish a trusted connection from your application to the Google Play servers. You only need to generate this key once per application, and don’t need to repeat these steps when you update the APK file for your application.</p>
diff --git a/docs/html/training/keyboard-input/visibility.jd b/docs/html/training/keyboard-input/visibility.jd
index 5dc6fc260..258884a 100644
--- a/docs/html/training/keyboard-input/visibility.jd
+++ b/docs/html/training/keyboard-input/visibility.jd
Binary files differ
diff --git a/docs/html/training/location/display-address.jd b/docs/html/training/location/display-address.jd
index 516f14f..8606629 100644
--- a/docs/html/training/location/display-address.jd
+++ b/docs/html/training/location/display-address.jd
@@ -131,7 +131,7 @@
 &lt;/manifest&gt;
 </pre>
 
-<p class="note"><strong>Note:</strong> The {@code &lt;service&gt;} element in
+<p class="note"><strong>Note:</strong> The {@code <service>} element in
   the manifest doesn't need to include an intent filter, because your main
   activity creates an explicit intent by specifying the name of the class to use
   for the intent.</p>
diff --git a/docs/html/training/scheduling/alarms.jd b/docs/html/training/scheduling/alarms.jd
index 8373d95..b332cb7 100644
--- a/docs/html/training/scheduling/alarms.jd
+++ b/docs/html/training/scheduling/alarms.jd
@@ -348,7 +348,7 @@
 
 
 <p>Notice that in the manifest, the boot receiver is set to
-{@code android:enabled=&quot;false&quot;}. This means that the receiver will not be called
+<code>android:enabled=&quot;false&quot;</code>. This means that the receiver will not be called
 unless the application explicitly enables it. This prevents the boot receiver from being
 called unnecessarily. You can enable a receiver (for example, if the user sets an alarm)
 as follows:</p>
diff --git a/docs/html/training/testing/ui-testing/uiautomator-testing.jd b/docs/html/training/testing/ui-testing/uiautomator-testing.jd
index a0050a8..d0defd8 100644
--- a/docs/html/training/testing/ui-testing/uiautomator-testing.jd
+++ b/docs/html/training/testing/ui-testing/uiautomator-testing.jd
@@ -119,7 +119,7 @@
 <ol>
   <li>Launch the target app on a physical device.</li>
   <li>Connect the device to your development machine.</li>
-  <li>Open a terminal window and navigate to the {@code &lt;android-sdk&gt;/tools/} directory.</li>
+  <li>Open a terminal window and navigate to the {@code <android-sdk>/tools/} directory.</li>
   <li>Run the tool with this command:
 <pre>$ uiautomatorviewer</pre>
   </li>
diff --git a/docs/html/training/testing/unit-testing/instrumented-unit-tests.jd b/docs/html/training/testing/unit-testing/instrumented-unit-tests.jd
index 81921f8..9906d8c 100644
--- a/docs/html/training/testing/unit-testing/instrumented-unit-tests.jd
+++ b/docs/html/training/testing/unit-testing/instrumented-unit-tests.jd
@@ -91,7 +91,7 @@
 creating JUnit 4 test classes and using JUnit 4 assertions and annotations, see
 <a href="local-unit-tests.html#build">Create a Local Unit Test Class</a>.
 </p>
-<p>To create an instrumented JUnit 4 test class, add the {@code &#64;RunWith(AndroidJUnit4.class)}
+<p>To create an instrumented JUnit 4 test class, add the {@code @RunWith(AndroidJUnit4.class)}
 annotation at the beginning of your test class definition. You also need to specify the
 <a href="{@docRoot}reference/android/support/test/runner/AndroidJUnitRunner.html">
 {@code AndroidJUnitRunner}</a> class
@@ -168,8 +168,8 @@
 class="external-link">{@code RunWith}</a> and
 <a href="http://junit.sourceforge.net/javadoc/org/junit/runners/Suite.html"
 class="external-link">{@code Suite}</a> classes. In your test suite, add the
-{@code &#64;RunWith(Suite.class)} and the {@code &#64;Suite.SuitClasses()} annotations. In
-the {@code &#64;Suite.SuiteClasses()} annotation, list the individual test classes or test
+{@code @RunWith(Suite.class)} and the {@code @Suite.SuitClasses()} annotations. In
+the {@code @Suite.SuiteClasses()} annotation, list the individual test classes or test
 suites as arguments.
 </p>
 
@@ -245,6 +245,6 @@
 </pre>
 
 <p>You can find the generated HTML test result reports in the
-{@code &lt;path_to_your_project&gt;/app/build/outputs/reports/androidTests/connected/} directory,
+{@code <path_to_your_project>/app/build/outputs/reports/androidTests/connected/} directory,
 and the corresponding XML files in the
-{@code &lt;path_to_your_project&gt;/app/build/outputs/androidTest-results/connected/} directory.</p>
\ No newline at end of file
+{@code <path_to_your_project>/app/build/outputs/androidTest-results/connected/} directory.</p>
\ No newline at end of file
diff --git a/docs/html/training/testing/unit-testing/local-unit-tests.jd b/docs/html/training/testing/unit-testing/local-unit-tests.jd
index 421709b..8221a6d 100644
--- a/docs/html/training/testing/unit-testing/local-unit-tests.jd
+++ b/docs/html/training/testing/unit-testing/local-unit-tests.jd
@@ -89,7 +89,7 @@
 {@code junit.extensions} package.</p>
 
 <p>To create a basic JUnit 4 test class, create a Java class that contains one or more test methods.
-A test method begins with the {@code &#64;Test} annotation and contains the code to exercise
+A test method begins with the {@code @Test} annotation and contains the code to exercise
 and verify a single functionality in the component that you want to test.</p>
 
 <p>The following example shows how you might implement a local unit test class. The test method
@@ -125,32 +125,32 @@
 
 <ul>
 <li>
-{@code &#64;Before}: Use this annotation to specify a block of code with test setup operations. This
-code block will be invoked before each test. You can have multiple {@code &#64;Before} methods but
+{@code @Before}: Use this annotation to specify a block of code with test setup operations. This
+code block will be invoked before each test. You can have multiple {@code @Before} methods but
 the order which these methods are called is not fixed.
 </li>
 <li>
-{@code &#64;After}: This annotation specifies a block of code with test tear-down operations. This
-code block will be called after every test method. You can define multiple {@code &#64;After}
+{@code @After}: This annotation specifies a block of code with test tear-down operations. This
+code block will be called after every test method. You can define multiple {@code @After}
 operations in your test code. Use this annotation to release any resources from memory.
 </li>
 <li>
-{@code &#64;Test}: Use this annotation to mark a test method. A single test class can contain
+{@code @Test}: Use this annotation to mark a test method. A single test class can contain
 multiple test methods, each prefixed with this annotation.
 </li>
 <li>
-{@code &#64;BeforeClass}: Use this annotation to specify static methods to be invoked only once per
+{@code @BeforeClass}: Use this annotation to specify static methods to be invoked only once per
 test class. This testing step is useful for expensive operations such as connecting to a database.
 </li>
 <li>
-{@code &#64;AfterClass}: Use this annotation to specify static methods to be invoked only after all
+{@code @AfterClass}: Use this annotation to specify static methods to be invoked only after all
 tests in the class have been run. This testing step is useful for releasing any resources allocated
-in the {@code &#64;BeforeClass} block.
+in the {@code @BeforeClass} block.
 </li>
 <li>
-{@code &#64;Test(timeout=&lt;milliseconds&gt;)}: Specifies a timeout period for the test. If the
+{@code @Test(timeout=<milliseconds>)}: Specifies a timeout period for the test. If the
 test starts but does not complete within the given timeout period, it automatically fails. You must
-specify the timeout period in milliseconds, for example: {@code &#64;Test(timeout=5000)}.
+specify the timeout period in milliseconds, for example: {@code @Test(timeout=5000)}.
 </li>
 </ul>
 
@@ -179,11 +179,11 @@
 <a href="#setup">Set Up Your Testing Environment</a>.
 </li>
 <li>At the beginning of your unit test class definition, add the
-{@code &#64;RunWith(MockitoJUnitRunner.class)} annotation. This annotation tells the Mockito test
+{@code @RunWith(MockitoJUnitRunner.class)} annotation. This annotation tells the Mockito test
 runner to validate that your usage of the framework is correct and simplifies the initialization of
 your mock objects.
 </li>
-<li>To create a mock object for an Android dependency, add the {@code &#64;Mock} annotation before
+<li>To create a mock object for an Android dependency, add the {@code @Mock} annotation before
 the field declaration.</li>
 <li>To stub the behavior of the dependency, you can specify a condition and return
 value when the condition is met by using the {@code when()} and {@code thenReturn()} methods.
@@ -298,5 +298,5 @@
 
 <p>If there are failing tests, the command will display links to HTML reports (one per build
 variant). You can find the generated HTML test result reports in the
-{@code &lt;path_to_your_project&gt;/app/build/reports/tests/} directory, and the corresponding XML
-files in the {@code &lt;path_to_your_project&gt;/app/build/test-results/} directory.</p>
\ No newline at end of file
+{@code <path_to_your_project>/app/build/reports/tests/} directory, and the corresponding XML
+files in the {@code <path_to_your_project>/app/build/test-results/} directory.</p>
\ No newline at end of file
diff --git a/docs/html/training/tv/discovery/searchable.jd b/docs/html/training/tv/discovery/searchable.jd
index 4ca7abb..bbcb56e 100644
--- a/docs/html/training/tv/discovery/searchable.jd
+++ b/docs/html/training/tv/discovery/searchable.jd
@@ -238,7 +238,7 @@
 
 <p>In your manifest file, the content provider receives special treatment. Rather than getting
 tagged as an activity, it is described as a
-<a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code &lt;provider&gt;}</a>. The
+<a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code <provider>}</a>. The
 provider includes the {@code android:searchSuggestAuthority} attribute to tell the system the
 namespace of your content provider. Also, you must set its {@code android:exported} attribute to
 {@code "true"} so that the Android global search can use the results returned from it.</p>
@@ -257,7 +257,7 @@
 {@code android:searchSuggestAuthority}</a> attribute to tell the system the namespace of your
 content provider. This must match the string value you specify in the
 <a href="{@docRoot}guide/topics/manifest/provider-element.html#auth">{@code android:authorities}</a>
-attribute of the <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code &lt;provider&gt;}
+attribute of the <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code <provider>}
 </a> element in your {@code AndroidManifest.xml} file.</p>
 
 The <a href="{@docRoot}guide/topics/search/searchable-config.html">{@code searchable.xml}</a> file
@@ -339,7 +339,7 @@
 <a href="{@docRoot}guide/topics/search/searchable-config.html">{@code searchable.xml}</a> file.
 To <a href="{@docRoot}guide/topics/search/search-dialog.html">use the global search dialog</a>,
 the manifest must describe which activity should receive search queries. The manifest must also
-describe the <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code &lt;provider&gt;}
+describe the <a href="{@docRoot}guide/topics/manifest/provider-element.html">{@code <provider>}
 </a>element, exactly as it is described in the <a href="{@docRoot}guide/topics/search/searchable-config.html">
 {@code searchable.xml}</a> file.</p>
 
diff --git a/docs/html/training/tv/start/start.jd b/docs/html/training/tv/start/start.jd
index e55e202..4d04ad6 100644
--- a/docs/html/training/tv/start/start.jd
+++ b/docs/html/training/tv/start/start.jd
@@ -233,7 +233,7 @@
 <p>
   The Android SDK includes support libraries that are intended for use with TV apps. These
   libraries provide APIs and user interface widgets for use on TV devices. The libraries are
-  located in the {@code &lt;sdk&gt;/extras/android/support/} directory. Here is a list of the
+  located in the {@code <sdk>/extras/android/support/} directory. Here is a list of the
   libraries and their general purpose:
 </p>
 
diff --git a/docs/html/training/volley/request-custom.jd b/docs/html/training/volley/request-custom.jd
index 7b669b9..c62c254 100644
--- a/docs/html/training/volley/request-custom.jd
+++ b/docs/html/training/volley/request-custom.jd
@@ -36,12 +36,12 @@
 
 <ul>
 
-<li>Extend the {@code Request&lt;T&gt;} class, where
-{@code &lt;T&gt;} represents the type of parsed response
+<li>Extend the {@code Request<T>} class, where
+{@code <T>} represents the type of parsed response
 the request expects. So if your parsed response is a string, for example,
-create your custom request by extending {@code Request&lt;String&gt;}. See the Volley
+create your custom request by extending {@code Request<String>}. See the Volley
 toolbox classes {@code StringRequest} and {@code ImageRequest} for examples of
-extending {@code Request&lt;T&gt;}.</li>
+extending {@code Request<T>}.</li>
 
 <li>Implement the abstract methods {@code parseNetworkResponse()}
 and {@code deliverResponse()}, described in more detail below.</li>
@@ -74,7 +74,7 @@
 <ul>
 <li>{@code parseNetworkResponse()} takes as its parameter a {@code NetworkResponse}, which
 contains the response payload as a byte[], HTTP status code, and response headers.</li>
-<li>Your implementation must return a {@code Response&lt;T&gt;}, which contains your typed
+<li>Your implementation must return a {@code Response<T>}, which contains your typed
 response object and cache metadata or an error, such as in the case of a parse failure.</li>
 </ul>
 
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 95ae72e..5acc1a3 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -484,7 +484,7 @@
      *
      * @param bounds    The maximum size the offscreen bitmap needs to be
      *                  (in local coordinates)
-     * @param alpha     The alpha to apply to the offscreen when when it is
+     * @param alpha     The alpha to apply to the offscreen when it is
                         drawn during restore()
      * @param saveFlags see _SAVE_FLAG constants, generally {@link #ALL_SAVE_FLAG} is recommended
      *                  for performance reasons.
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java
index 6bf3afd..0fd1741 100644
--- a/graphics/java/android/graphics/drawable/AnimationDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java
@@ -40,8 +40,8 @@
  * animation.
  * <p>
  * An AnimationDrawable defined in XML consists of a single
- * {@code &lt;animation-list&gt;} element and a series of nested
- * {@code &lt;item&gt;} tags. Each item defines a frame of the animation. See
+ * {@code <animation-list>} element and a series of nested
+ * {@code <item>} tags. Each item defines a frame of the animation. See
  * the example below.
  * <p>
  * spin_animation.xml file in res/drawable/ folder:
diff --git a/graphics/java/android/graphics/drawable/RippleBackground.java b/graphics/java/android/graphics/drawable/RippleBackground.java
index f9474ef..d313aa5 100644
--- a/graphics/java/android/graphics/drawable/RippleBackground.java
+++ b/graphics/java/android/graphics/drawable/RippleBackground.java
@@ -139,6 +139,7 @@
         exit.setInterpolator(LINEAR_INTERPOLATOR);
         exit.setDuration(OPACITY_EXIT_DURATION);
         exit.setStartDelay(fastEnterDuration);
+        exit.setStartValue(targetAlpha);
         set.add(exit);
 
         // Linear "fast" enter based on current opacity.
diff --git a/graphics/java/android/graphics/drawable/ScaleDrawable.java b/graphics/java/android/graphics/drawable/ScaleDrawable.java
index f87c19a..330266f 100644
--- a/graphics/java/android/graphics/drawable/ScaleDrawable.java
+++ b/graphics/java/android/graphics/drawable/ScaleDrawable.java
@@ -50,7 +50,7 @@
  * {@code android.R.styleable#ScaleDrawable_scaleHeight scaleHeight}. At run
  * time, the level may be set via {@link #setLevel(int)}.
  * <p>
- * A scale drawable may be defined in an XML file with the {@code &lt;scale>}
+ * A scale drawable may be defined in an XML file with the {@code <scale>}
  * element. For more information, see the guide to
  * <a href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable
  * Resources</a>.
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index 5b2594d..40fb0d3 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -457,9 +457,9 @@
      * KeyFactory keyFactory =
      *     KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
      * KeyInfo keyInfo = keyFactory.getKeySpec(key, KeyInfo.class);
-     * if (keyInfo.isInsideSecureHardware()) &#123;
+     * if (keyInfo.isInsideSecureHardware()) {
      *     // The key is bound to the secure hardware of this Android
-     * &#125;}</pre>
+     * }}</pre>
      */
     @Deprecated
     public static boolean isBoundKeyAlgorithm(
diff --git a/keystore/java/android/security/keystore/KeyInfo.java b/keystore/java/android/security/keystore/KeyInfo.java
index 785ec15..7cf4b04 100644
--- a/keystore/java/android/security/keystore/KeyInfo.java
+++ b/keystore/java/android/security/keystore/KeyInfo.java
@@ -38,32 +38,30 @@
  * <p><h3>Example: Symmetric Key</h3>
  * The following example illustrates how to obtain a {@code KeyInfo} describing the provided Android
  * Keystore {@link SecretKey}.
- * <pre> {@code
+ * <pre>{@code
  * SecretKey key = ...; // Android Keystore key
  *
  * SecretKeyFactory factory = SecretKeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
  * KeyInfo keyInfo;
- * try &#123;
+ * try {
  *     keyInfo = (KeyInfo) factory.getKeySpec(key, KeyInfo.class);
- * &#125; catch (InvalidKeySpecException e) &#123;
+ * } catch (InvalidKeySpecException e) {
  *     // Not an Android KeyStore key.
- * &#125;
- * }</pre>
+ * }}</pre>
  *
  * <p><h3>Example: Private Key</h3>
  * The following example illustrates how to obtain a {@code KeyInfo} describing the provided
  * Android KeyStore {@link PrivateKey}.
- * <pre> {@code
+ * <pre>{@code
  * PrivateKey key = ...; // Android KeyStore key
  *
  * KeyFactory factory = KeyFactory.getInstance(key.getAlgorithm(), "AndroidKeyStore");
  * KeyInfo keyInfo;
- * try &#123;
+ * try {
  *     keyInfo = factory.getKeySpec(key, KeyInfo.class);
- * &#125; catch (InvalidKeySpecException e) &#123;
+ * } catch (InvalidKeySpecException e) {
  *     // Not an Android KeyStore key.
- * &#125;
- * }</pre>
+ * }}</pre>
  */
 public class KeyInfo implements KeySpec {
     private final String mKeystoreAlias;
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index fc4916c..d98497b 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -30,7 +30,6 @@
     utils/StringUtils.cpp \
     utils/TestWindowContext.cpp \
     utils/VectorDrawableUtils.cpp \
-    utils/TestUtils.cpp \
     AmbientShadow.cpp \
     AnimationContext.cpp \
     Animator.cpp \
@@ -90,6 +89,9 @@
     VectorDrawablePath.cpp \
     protos/hwui.proto
 
+hwui_test_common_src_files := \
+    tests/common/TestUtils.cpp
+
 hwui_cflags := \
     -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \
     -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" \
@@ -180,8 +182,8 @@
         -DHWUI_NULL_GPU
 LOCAL_SRC_FILES := \
         $(hwui_src_files) \
-        tests/nullegl.cpp \
-        tests/nullgles.cpp
+        tests/common/nullegl.cpp \
+        tests/common/nullgles.cpp
 LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include)
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(hwui_c_includes) $(call hwui_proto_include)
 
@@ -215,28 +217,29 @@
         -DHWUI_NULL_GPU
 
 LOCAL_SRC_FILES += \
-    unit_tests/CanvasStateTests.cpp \
-    unit_tests/ClipAreaTests.cpp \
-    unit_tests/DamageAccumulatorTests.cpp \
-    unit_tests/DeviceInfoTests.cpp \
-    unit_tests/FatVectorTests.cpp \
-    unit_tests/LayerUpdateQueueTests.cpp \
-    unit_tests/LinearAllocatorTests.cpp \
-    unit_tests/VectorDrawableTests.cpp \
-    unit_tests/OffscreenBufferPoolTests.cpp \
-    unit_tests/StringUtilsTests.cpp
+    $(hwui_test_common_src_files) \
+    tests/unit/CanvasStateTests.cpp \
+    tests/unit/ClipAreaTests.cpp \
+    tests/unit/DamageAccumulatorTests.cpp \
+    tests/unit/DeviceInfoTests.cpp \
+    tests/unit/FatVectorTests.cpp \
+    tests/unit/LayerUpdateQueueTests.cpp \
+    tests/unit/LinearAllocatorTests.cpp \
+    tests/unit/VectorDrawableTests.cpp \
+    tests/unit/OffscreenBufferPoolTests.cpp \
+    tests/unit/StringUtilsTests.cpp
 
 ifeq (true, $(HWUI_NEW_OPS))
     LOCAL_SRC_FILES += \
-        unit_tests/BakedOpStateTests.cpp \
-        unit_tests/RecordingCanvasTests.cpp \
-        unit_tests/OpReordererTests.cpp
+        tests/unit/BakedOpStateTests.cpp \
+        tests/unit/RecordingCanvasTests.cpp \
+        tests/unit/OpReordererTests.cpp
 endif
 
 include $(BUILD_NATIVE_TEST)
 
 # ------------------------
-# test app
+# Macro-bench app
 # ------------------------
 
 include $(CLEAR_VARS)
@@ -255,11 +258,12 @@
 LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static
 
 LOCAL_SRC_FILES += \
-    tests/TestContext.cpp \
-    tests/TestSceneRunner.cpp \
-    tests/main.cpp
+    $(hwui_test_common_src_files) \
+    tests/macrobench/TestContext.cpp \
+    tests/macrobench/TestSceneRunner.cpp \
+    tests/macrobench/main.cpp
 
-LOCAL_SRC_FILES += $(call all-cpp-files-under, tests/scenes)
+LOCAL_SRC_FILES += $(call all-cpp-files-under, tests/common/scenes)
 
 include $(BUILD_EXECUTABLE)
 
@@ -285,14 +289,15 @@
 LOCAL_STATIC_LIBRARIES := libbenchmark libbase
 
 LOCAL_SRC_FILES += \
-    microbench/DisplayListCanvasBench.cpp \
-    microbench/LinearAllocatorBench.cpp \
-    microbench/PathParserBench.cpp \
-    microbench/ShadowBench.cpp
+    $(hwui_test_common_src_files) \
+    tests/microbench/DisplayListCanvasBench.cpp \
+    tests/microbench/LinearAllocatorBench.cpp \
+    tests/microbench/PathParserBench.cpp \
+    tests/microbench/ShadowBench.cpp
 
 ifeq (true, $(HWUI_NEW_OPS))
     LOCAL_SRC_FILES += \
-        microbench/OpReordererBench.cpp
+        tests/microbench/OpReordererBench.cpp
 endif
 
 include $(BUILD_EXECUTABLE)
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index bd11d0a..e7cc464 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1383,7 +1383,10 @@
     friend class TestUtils;
 public:
     DrawRenderNodeOp(RenderNode* renderNode, const mat4& transformFromParent, bool clipIsSimple)
-            : DrawBoundedOp(0, 0, renderNode->getWidth(), renderNode->getHeight(), nullptr)
+            : DrawBoundedOp(0, 0,
+                    renderNode->stagingProperties().getWidth(),
+                    renderNode->stagingProperties().getHeight(),
+                    nullptr)
             , renderNode(renderNode)
             , mRecordedWithPotentialStencilClip(!clipIsSimple || !transformFromParent.isSimple())
             , localMatrix(transformFromParent)
diff --git a/libs/hwui/FrameInfoVisualizer.cpp b/libs/hwui/FrameInfoVisualizer.cpp
index b416615..b7dd3b7 100644
--- a/libs/hwui/FrameInfoVisualizer.cpp
+++ b/libs/hwui/FrameInfoVisualizer.cpp
@@ -16,6 +16,7 @@
 #include "FrameInfoVisualizer.h"
 
 #include "OpenGLRenderer.h"
+#include "utils/Color.h"
 
 #include <cutils/compiler.h>
 #include <array>
@@ -27,19 +28,19 @@
 #define PROFILE_DRAW_THRESHOLD_STROKE_WIDTH 2
 #define PROFILE_DRAW_DP_PER_MS 7
 
+namespace android {
+namespace uirenderer {
+
 // Must be NUM_ELEMENTS in size
-static const SkColor THRESHOLD_COLOR = 0xff5faa4d;
-static const SkColor BAR_FAST_ALPHA = 0x8F000000;
-static const SkColor BAR_JANKY_ALPHA = 0xDF000000;
+static const SkColor THRESHOLD_COLOR = Color::Green_500;
+static const SkColor BAR_FAST_MASK = 0x8FFFFFFF;
+static const SkColor BAR_JANKY_MASK = 0xDFFFFFFF;
 
 // We could get this from TimeLord and use the actual frame interval, but
 // this is good enough
 #define FRAME_THRESHOLD 16
 #define FRAME_THRESHOLD_NS 16000000
 
-namespace android {
-namespace uirenderer {
-
 struct BarSegment {
     FrameInfoIndex start;
     FrameInfoIndex end;
@@ -47,13 +48,13 @@
 };
 
 static const std::array<BarSegment,7> Bar {{
-    { FrameInfoIndex::IntendedVsync, FrameInfoIndex::HandleInputStart, 0x00796B },
-    { FrameInfoIndex::HandleInputStart, FrameInfoIndex::PerformTraversalsStart, 0x388E3C },
-    { FrameInfoIndex::PerformTraversalsStart, FrameInfoIndex::DrawStart, 0x689F38},
-    { FrameInfoIndex::DrawStart, FrameInfoIndex::SyncStart, 0x2196F3},
-    { FrameInfoIndex::SyncStart, FrameInfoIndex::IssueDrawCommandsStart, 0x4FC3F7},
-    { FrameInfoIndex::IssueDrawCommandsStart, FrameInfoIndex::SwapBuffers, 0xF44336},
-    { FrameInfoIndex::SwapBuffers, FrameInfoIndex::FrameCompleted, 0xFF9800},
+    { FrameInfoIndex::IntendedVsync, FrameInfoIndex::HandleInputStart, Color::Teal_700 },
+    { FrameInfoIndex::HandleInputStart, FrameInfoIndex::PerformTraversalsStart, Color::Green_700 },
+    { FrameInfoIndex::PerformTraversalsStart, FrameInfoIndex::DrawStart, Color::LightGreen_700 },
+    { FrameInfoIndex::DrawStart, FrameInfoIndex::SyncStart, Color::Blue_500 },
+    { FrameInfoIndex::SyncStart, FrameInfoIndex::IssueDrawCommandsStart, Color::LightBlue_300 },
+    { FrameInfoIndex::IssueDrawCommandsStart, FrameInfoIndex::SwapBuffers, Color::Red_500},
+    { FrameInfoIndex::SwapBuffers, FrameInfoIndex::FrameCompleted, Color::Orange_500},
 }};
 
 static int dpToPx(int dp, float density) {
@@ -197,9 +198,9 @@
     SkPaint paint;
     for (size_t i = 0; i < Bar.size(); i++) {
         nextBarSegment(Bar[i].start, Bar[i].end);
-        paint.setColor(Bar[i].color | BAR_FAST_ALPHA);
+        paint.setColor(Bar[i].color & BAR_FAST_MASK);
         canvas->drawRects(mFastRects.get(), mNumFastRects * 4, &paint);
-        paint.setColor(Bar[i].color | BAR_JANKY_ALPHA);
+        paint.setColor(Bar[i].color & BAR_JANKY_MASK);
         canvas->drawRects(mJankyRects.get(), mNumJankyRects * 4, &paint);
     }
 }
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 61fa384..69c686e 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -435,8 +435,9 @@
             refPaint(paint), refBitmap(*bitmap)));
 }
 void RecordingCanvas::drawRenderNode(RenderNode* renderNode) {
+    auto&& stagingProps = renderNode->stagingProperties();
     RenderNodeOp* op = new (alloc()) RenderNodeOp(
-            Rect(0, 0, renderNode->getWidth(), renderNode->getHeight()), // are these safe? they're theoretically dynamic
+            Rect(stagingProps.getWidth(), stagingProps.getHeight()),
             *(mState.currentSnapshot()->transform),
             mState.getRenderTargetClipBounds(),
             renderNode);
diff --git a/libs/hwui/tests/TestScene.h b/libs/hwui/tests/common/TestScene.h
similarity index 100%
rename from libs/hwui/tests/TestScene.h
rename to libs/hwui/tests/common/TestScene.h
diff --git a/libs/hwui/utils/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp
similarity index 100%
rename from libs/hwui/utils/TestUtils.cpp
rename to libs/hwui/tests/common/TestUtils.cpp
diff --git a/libs/hwui/utils/TestUtils.h b/libs/hwui/tests/common/TestUtils.h
similarity index 100%
rename from libs/hwui/utils/TestUtils.h
rename to libs/hwui/tests/common/TestUtils.h
diff --git a/libs/hwui/tests/nullegl.cpp b/libs/hwui/tests/common/nullegl.cpp
similarity index 100%
rename from libs/hwui/tests/nullegl.cpp
rename to libs/hwui/tests/common/nullegl.cpp
diff --git a/libs/hwui/tests/nullgles.cpp b/libs/hwui/tests/common/nullgles.cpp
similarity index 100%
rename from libs/hwui/tests/nullgles.cpp
rename to libs/hwui/tests/common/nullgles.cpp
diff --git a/libs/hwui/tests/scenes/HwLayerAnimation.cpp b/libs/hwui/tests/common/scenes/HwLayerAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/HwLayerAnimation.cpp
rename to libs/hwui/tests/common/scenes/HwLayerAnimation.cpp
diff --git a/libs/hwui/tests/common/scenes/ListViewAnimation.cpp b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp
new file mode 100644
index 0000000..27adb12
--- /dev/null
+++ b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSceneBase.h"
+#include "utils/Color.h"
+
+#include <cstdio>
+
+class ListViewAnimation;
+
+static Benchmark _ListView(BenchmarkInfo{
+    "listview",
+    "A mock ListView of scrolling content. Doesn't re-bind/re-record views as they are recycled, so"
+    "won't upload much content (either glyphs, or bitmaps).",
+    simpleCreateScene<ListViewAnimation>
+});
+
+class ListViewAnimation : public TestScene {
+public:
+    int cardHeight;
+    int cardSpacing;
+    int cardWidth;
+    int cardLeft;
+    sp<RenderNode> listView;
+    std::vector< sp<RenderNode> > cards;
+    void createContent(int width, int height, TestCanvas& canvas) override {
+        srand(0);
+        cardHeight = dp(60);
+        cardSpacing = dp(16);
+        cardWidth = std::min((height - cardSpacing * 2), (int)dp(300));
+        cardLeft = (width - cardWidth) / 2;
+
+        for (int y = 0; y < height + (cardHeight + cardSpacing - 1); y += (cardHeight + cardSpacing)) {
+            cards.push_back(createCard(cards.size(), y));
+        }
+        listView = TestUtils::createNode(0, 0, width, height,
+                [this](RenderProperties& props, TestCanvas& canvas) {
+            for (size_t ci = 0; ci < cards.size(); ci++) {
+                canvas.drawRenderNode(cards[ci].get());
+            }
+        });
+
+        canvas.drawColor(Color::Grey_500, SkXfermode::kSrcOver_Mode);
+        canvas.drawRenderNode(listView.get());
+    }
+
+    void doFrame(int frameNr) override {
+        int scrollPx = dp(frameNr) * 3;
+        int cardIndexOffset = scrollPx / (cardSpacing + cardHeight);
+        int pxOffset = -(scrollPx % (cardSpacing + cardHeight));
+
+        TestCanvas canvas(cardWidth, cardHeight);
+        for (size_t ci = 0; ci < cards.size(); ci++) {
+            // update card position
+            auto card = cards[(ci + cardIndexOffset) % cards.size()];
+            int top = ((int)ci) * (cardSpacing + cardHeight) + pxOffset;
+            card->mutateStagingProperties().setLeftTopRightBottom(
+                    cardLeft, top, cardLeft + cardWidth, top + cardHeight);
+            card->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y);
+
+            // draw it to parent DisplayList
+            canvas.drawRenderNode(cards[ci].get());
+        }
+        listView->setStagingDisplayList(canvas.finishRecording());
+    }
+private:
+    SkBitmap createRandomCharIcon() {
+        int size = cardHeight - (dp(10) * 2);
+        SkBitmap bitmap = TestUtils::createSkBitmap(size, size);
+        SkCanvas canvas(bitmap);
+        canvas.clear(0);
+
+        SkPaint paint;
+        paint.setAntiAlias(true);
+        SkColor randomColor = BrightColors[rand() % BrightColorsCount];
+        paint.setColor(randomColor);
+        canvas.drawCircle(size / 2, size / 2, size / 2, paint);
+
+        bool bgDark = SkColorGetR(randomColor) + SkColorGetG(randomColor) + SkColorGetB(randomColor)
+                < 128 * 3;
+        paint.setColor(bgDark ? Color::White : Color::Grey_700);
+        paint.setTextAlign(SkPaint::kCenter_Align);
+        paint.setTextSize(size / 2);
+        char charToShow = 'A' + (rand() % 26);
+        canvas.drawText(&charToShow, 1, size / 2, /*approximate centering*/ size * 0.7, paint);
+        return bitmap;
+    }
+
+    static SkBitmap createBoxBitmap(bool filled) {
+        int size = dp(20);
+        int stroke = dp(2);
+        SkBitmap bitmap = TestUtils::createSkBitmap(size, size);
+        SkCanvas canvas(bitmap);
+        canvas.clear(Color::Transparent);
+
+        SkPaint paint;
+        paint.setAntiAlias(true);
+        paint.setColor(filled ? Color::Yellow_500 : Color::Grey_700);
+        paint.setStyle(filled ? SkPaint::kStrokeAndFill_Style : SkPaint::kStroke_Style);
+        paint.setStrokeWidth(stroke);
+        canvas.drawRect(SkRect::MakeLTRB(stroke, stroke, size - stroke, size - stroke), paint);
+        return bitmap;
+    }
+
+    sp<RenderNode> createCard(int cardId, int top) {
+        return TestUtils::createNode(cardLeft, top, cardLeft + cardWidth, top + cardHeight,
+                [this, cardId](RenderProperties& props, TestCanvas& canvas) {
+            static SkBitmap filledBox = createBoxBitmap(true);
+            static SkBitmap strokedBox = createBoxBitmap(false);
+
+            props.mutableOutline().setRoundRect(0, 0, cardWidth, cardHeight, dp(6), 1);
+            props.mutableOutline().setShouldClip(true);
+            canvas.drawColor(Color::White, SkXfermode::kSrcOver_Mode);
+
+            SkPaint textPaint;
+            textPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+            textPaint.setColor(rand() % 2 ? Color::Black : Color::Grey_500);
+            textPaint.setTextSize(dp(20));
+            textPaint.setAntiAlias(true);
+            char buf[256];
+            snprintf(buf, sizeof(buf), "This card is #%d", cardId);
+            TestUtils::drawTextToCanvas(&canvas, buf, textPaint, cardHeight, dp(25));
+            textPaint.setTextSize(dp(15));
+            TestUtils::drawTextToCanvas(&canvas, "This is some more text on the card", textPaint,
+                    cardHeight, dp(45));
+
+            canvas.drawBitmap(createRandomCharIcon(), dp(10), dp(10), nullptr);
+
+            const SkBitmap& boxBitmap = rand() % 2 ? filledBox : strokedBox;
+            canvas.drawBitmap(boxBitmap, cardWidth - dp(10) - boxBitmap.width(), dp(10), nullptr);
+        });
+    }
+};
diff --git a/libs/hwui/tests/scenes/OvalAnimation.cpp b/libs/hwui/tests/common/scenes/OvalAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/OvalAnimation.cpp
rename to libs/hwui/tests/common/scenes/OvalAnimation.cpp
diff --git a/libs/hwui/tests/scenes/PartialDamageAnimation.cpp b/libs/hwui/tests/common/scenes/PartialDamageAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/PartialDamageAnimation.cpp
rename to libs/hwui/tests/common/scenes/PartialDamageAnimation.cpp
diff --git a/libs/hwui/tests/scenes/RecentsAnimation.cpp b/libs/hwui/tests/common/scenes/RecentsAnimation.cpp
similarity index 88%
rename from libs/hwui/tests/scenes/RecentsAnimation.cpp
rename to libs/hwui/tests/common/scenes/RecentsAnimation.cpp
index 1e38d84..5d4ef96 100644
--- a/libs/hwui/tests/scenes/RecentsAnimation.cpp
+++ b/libs/hwui/tests/common/scenes/RecentsAnimation.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "TestSceneBase.h"
+#include "utils/Color.h"
 
 class RecentsAnimation;
 
@@ -29,16 +30,16 @@
 public:
     void createContent(int width, int height, TestCanvas& renderer) override {
         static SkColor COLORS[] = {
-                0xFFF44336,
-                0xFF9C27B0,
-                0xFF2196F3,
-                0xFF4CAF50,
+                Color::Red_500,
+                Color::Purple_500,
+                Color::Blue_500,
+                Color::Green_500,
         };
 
         thumbnailSize = std::min(std::min(width, height) / 2, 720);
         int cardsize = std::min(width, height) - dp(64);
 
-        renderer.drawColor(0xFFFFFFFF, SkXfermode::kSrcOver_Mode);
+        renderer.drawColor(Color::White, SkXfermode::kSrcOver_Mode);
         renderer.insertReorderBarrier(true);
 
         int x = dp(32);
@@ -63,7 +64,7 @@
             mCards[ci]->setPropertyFieldsDirty(RenderNode::Y);
         }
         mThumbnail.eraseColor(TestUtils::interpolateColor(
-                curFrame / 150.0f, 0xFF4CAF50, 0xFFFF5722));
+                curFrame / 150.0f, Color::Green_500, Color::DeepOrange_500));
     }
 
 private:
@@ -75,7 +76,7 @@
             props.mutableOutline().setRoundRect(0, 0, width, height, dp(10), 1);
             props.mutableOutline().setShouldClip(true);
 
-            canvas.drawColor(0xFFEEEEEE, SkXfermode::kSrcOver_Mode);
+            canvas.drawColor(Color::Grey_200, SkXfermode::kSrcOver_Mode);
             canvas.drawBitmap(thumb, 0, 0, thumb.width(), thumb.height(),
                     0, 0, width, height, nullptr);
         });
diff --git a/libs/hwui/tests/scenes/RectGridAnimation.cpp b/libs/hwui/tests/common/scenes/RectGridAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/RectGridAnimation.cpp
rename to libs/hwui/tests/common/scenes/RectGridAnimation.cpp
diff --git a/libs/hwui/tests/scenes/SaveLayerAnimation.cpp b/libs/hwui/tests/common/scenes/SaveLayerAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/SaveLayerAnimation.cpp
rename to libs/hwui/tests/common/scenes/SaveLayerAnimation.cpp
diff --git a/libs/hwui/tests/scenes/ShadowGrid2Animation.cpp b/libs/hwui/tests/common/scenes/ShadowGrid2Animation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/ShadowGrid2Animation.cpp
rename to libs/hwui/tests/common/scenes/ShadowGrid2Animation.cpp
diff --git a/libs/hwui/tests/scenes/ShadowGridAnimation.cpp b/libs/hwui/tests/common/scenes/ShadowGridAnimation.cpp
similarity index 100%
rename from libs/hwui/tests/scenes/ShadowGridAnimation.cpp
rename to libs/hwui/tests/common/scenes/ShadowGridAnimation.cpp
diff --git a/libs/hwui/tests/scenes/TestSceneBase.h b/libs/hwui/tests/common/scenes/TestSceneBase.h
similarity index 86%
rename from libs/hwui/tests/scenes/TestSceneBase.h
rename to libs/hwui/tests/common/scenes/TestSceneBase.h
index a208509..8a24149 100644
--- a/libs/hwui/tests/scenes/TestSceneBase.h
+++ b/libs/hwui/tests/common/scenes/TestSceneBase.h
@@ -19,10 +19,10 @@
 #include "DisplayListCanvas.h"
 #include "RecordingCanvas.h"
 #include "RenderNode.h"
-#include "tests/Benchmark.h"
-#include "tests/TestContext.h"
-#include "tests/TestScene.h"
-#include "utils/TestUtils.h"
+#include "tests/macrobench/Benchmark.h"
+#include "tests/macrobench/TestContext.h"
+#include "tests/common/TestScene.h"
+#include "tests/common/TestUtils.h"
 
 #include <functional>
 
diff --git a/libs/hwui/tests/Benchmark.h b/libs/hwui/tests/macrobench/Benchmark.h
similarity index 97%
rename from libs/hwui/tests/Benchmark.h
rename to libs/hwui/tests/macrobench/Benchmark.h
index 3f87d7f..aad8eb3 100644
--- a/libs/hwui/tests/Benchmark.h
+++ b/libs/hwui/tests/macrobench/Benchmark.h
@@ -16,7 +16,7 @@
 #ifndef TESTS_BENCHMARK_H
 #define TESTS_BENCHMARK_H
 
-#include "TestScene.h"
+#include "tests/common/TestScene.h"
 
 #include <string>
 #include <vector>
diff --git a/libs/hwui/tests/TestContext.cpp b/libs/hwui/tests/macrobench/TestContext.cpp
similarity index 100%
rename from libs/hwui/tests/TestContext.cpp
rename to libs/hwui/tests/macrobench/TestContext.cpp
diff --git a/libs/hwui/tests/TestContext.h b/libs/hwui/tests/macrobench/TestContext.h
similarity index 100%
rename from libs/hwui/tests/TestContext.h
rename to libs/hwui/tests/macrobench/TestContext.h
diff --git a/libs/hwui/tests/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
similarity index 98%
rename from libs/hwui/tests/TestSceneRunner.cpp
rename to libs/hwui/tests/macrobench/TestSceneRunner.cpp
index 0376e10..1e1c6a1 100644
--- a/libs/hwui/tests/TestSceneRunner.cpp
+++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
@@ -18,7 +18,7 @@
 #include "Benchmark.h"
 #include "RenderNode.h"
 #include "TestContext.h"
-#include "scenes/TestSceneBase.h"
+#include "tests/common/scenes/TestSceneBase.h"
 #include "renderthread/RenderProxy.h"
 #include "renderthread/RenderTask.h"
 
diff --git a/libs/hwui/tests/how_to_run.txt b/libs/hwui/tests/macrobench/how_to_run.txt
similarity index 100%
rename from libs/hwui/tests/how_to_run.txt
rename to libs/hwui/tests/macrobench/how_to_run.txt
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/macrobench/main.cpp
similarity index 100%
rename from libs/hwui/tests/main.cpp
rename to libs/hwui/tests/macrobench/main.cpp
diff --git a/libs/hwui/microbench/DisplayListCanvasBench.cpp b/libs/hwui/tests/microbench/DisplayListCanvasBench.cpp
similarity index 98%
rename from libs/hwui/microbench/DisplayListCanvasBench.cpp
rename to libs/hwui/tests/microbench/DisplayListCanvasBench.cpp
index 4be1f99..2e59eb4 100644
--- a/libs/hwui/microbench/DisplayListCanvasBench.cpp
+++ b/libs/hwui/tests/microbench/DisplayListCanvasBench.cpp
@@ -22,8 +22,8 @@
 #else
 #include "DisplayListCanvas.h"
 #endif
-#include "microbench/MicroBench.h"
-#include "utils/TestUtils.h"
+#include "tests/common/TestUtils.h"
+#include "tests/microbench/MicroBench.h"
 
 using namespace android;
 using namespace android::uirenderer;
diff --git a/libs/hwui/microbench/LinearAllocatorBench.cpp b/libs/hwui/tests/microbench/LinearAllocatorBench.cpp
similarity index 97%
rename from libs/hwui/microbench/LinearAllocatorBench.cpp
rename to libs/hwui/tests/microbench/LinearAllocatorBench.cpp
index 75f57cb..28513e4 100644
--- a/libs/hwui/microbench/LinearAllocatorBench.cpp
+++ b/libs/hwui/tests/microbench/LinearAllocatorBench.cpp
@@ -16,8 +16,8 @@
 
 #include <benchmark/Benchmark.h>
 
+#include "tests/microbench/MicroBench.h"
 #include "utils/LinearAllocator.h"
-#include "microbench/MicroBench.h"
 
 #include <vector>
 
diff --git a/libs/hwui/microbench/MicroBench.h b/libs/hwui/tests/microbench/MicroBench.h
similarity index 100%
rename from libs/hwui/microbench/MicroBench.h
rename to libs/hwui/tests/microbench/MicroBench.h
diff --git a/libs/hwui/microbench/OpReordererBench.cpp b/libs/hwui/tests/microbench/OpReordererBench.cpp
similarity index 98%
rename from libs/hwui/microbench/OpReordererBench.cpp
rename to libs/hwui/tests/microbench/OpReordererBench.cpp
index 53b64c3..406bfcc 100644
--- a/libs/hwui/microbench/OpReordererBench.cpp
+++ b/libs/hwui/tests/microbench/OpReordererBench.cpp
@@ -23,7 +23,7 @@
 #include "OpReorderer.h"
 #include "RecordedOp.h"
 #include "RecordingCanvas.h"
-#include "utils/TestUtils.h"
+#include "tests/common/TestUtils.h"
 #include "Vector.h"
 #include "microbench/MicroBench.h"
 
diff --git a/libs/hwui/microbench/PathParserBench.cpp b/libs/hwui/tests/microbench/PathParserBench.cpp
similarity index 100%
rename from libs/hwui/microbench/PathParserBench.cpp
rename to libs/hwui/tests/microbench/PathParserBench.cpp
diff --git a/libs/hwui/microbench/ShadowBench.cpp b/libs/hwui/tests/microbench/ShadowBench.cpp
similarity index 98%
rename from libs/hwui/microbench/ShadowBench.cpp
rename to libs/hwui/tests/microbench/ShadowBench.cpp
index 1b0f5ea..98ec4d9 100644
--- a/libs/hwui/microbench/ShadowBench.cpp
+++ b/libs/hwui/tests/microbench/ShadowBench.cpp
@@ -21,7 +21,7 @@
 #include "Vector.h"
 #include "VertexBuffer.h"
 #include "TessellationCache.h"
-#include "microbench/MicroBench.h"
+#include "tests/microbench/MicroBench.h"
 
 #include <SkPath.h>
 
diff --git a/libs/hwui/microbench/how_to_run.txt b/libs/hwui/tests/microbench/how_to_run.txt
similarity index 100%
rename from libs/hwui/microbench/how_to_run.txt
rename to libs/hwui/tests/microbench/how_to_run.txt
diff --git a/libs/hwui/unit_tests/BakedOpStateTests.cpp b/libs/hwui/tests/unit/BakedOpStateTests.cpp
similarity index 98%
rename from libs/hwui/unit_tests/BakedOpStateTests.cpp
rename to libs/hwui/tests/unit/BakedOpStateTests.cpp
index 7ad2f9b..de14abf 100644
--- a/libs/hwui/unit_tests/BakedOpStateTests.cpp
+++ b/libs/hwui/tests/unit/BakedOpStateTests.cpp
@@ -18,7 +18,7 @@
 
 #include <BakedOpState.h>
 #include <RecordedOp.h>
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 namespace android {
 namespace uirenderer {
diff --git a/libs/hwui/unit_tests/CanvasStateTests.cpp b/libs/hwui/tests/unit/CanvasStateTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/CanvasStateTests.cpp
rename to libs/hwui/tests/unit/CanvasStateTests.cpp
diff --git a/libs/hwui/unit_tests/ClipAreaTests.cpp b/libs/hwui/tests/unit/ClipAreaTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/ClipAreaTests.cpp
rename to libs/hwui/tests/unit/ClipAreaTests.cpp
diff --git a/libs/hwui/unit_tests/DamageAccumulatorTests.cpp b/libs/hwui/tests/unit/DamageAccumulatorTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/DamageAccumulatorTests.cpp
rename to libs/hwui/tests/unit/DamageAccumulatorTests.cpp
diff --git a/libs/hwui/unit_tests/DeviceInfoTests.cpp b/libs/hwui/tests/unit/DeviceInfoTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/DeviceInfoTests.cpp
rename to libs/hwui/tests/unit/DeviceInfoTests.cpp
diff --git a/libs/hwui/unit_tests/FatVectorTests.cpp b/libs/hwui/tests/unit/FatVectorTests.cpp
similarity index 98%
rename from libs/hwui/unit_tests/FatVectorTests.cpp
rename to libs/hwui/tests/unit/FatVectorTests.cpp
index c6ccf4d..64b0ba1 100644
--- a/libs/hwui/unit_tests/FatVectorTests.cpp
+++ b/libs/hwui/tests/unit/FatVectorTests.cpp
@@ -17,7 +17,7 @@
 #include <gtest/gtest.h>
 #include <utils/FatVector.h>
 
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 using namespace android;
 using namespace android::uirenderer;
diff --git a/libs/hwui/unit_tests/LayerUpdateQueueTests.cpp b/libs/hwui/tests/unit/LayerUpdateQueueTests.cpp
similarity index 98%
rename from libs/hwui/unit_tests/LayerUpdateQueueTests.cpp
rename to libs/hwui/tests/unit/LayerUpdateQueueTests.cpp
index cc15cc6..8b0e91c 100644
--- a/libs/hwui/unit_tests/LayerUpdateQueueTests.cpp
+++ b/libs/hwui/tests/unit/LayerUpdateQueueTests.cpp
@@ -19,7 +19,7 @@
 #include <LayerUpdateQueue.h>
 #include <RenderNode.h>
 
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 namespace android {
 namespace uirenderer {
diff --git a/libs/hwui/unit_tests/LinearAllocatorTests.cpp b/libs/hwui/tests/unit/LinearAllocatorTests.cpp
similarity index 98%
rename from libs/hwui/unit_tests/LinearAllocatorTests.cpp
rename to libs/hwui/tests/unit/LinearAllocatorTests.cpp
index 0591db6..78d65dd 100644
--- a/libs/hwui/unit_tests/LinearAllocatorTests.cpp
+++ b/libs/hwui/tests/unit/LinearAllocatorTests.cpp
@@ -17,7 +17,7 @@
 #include <gtest/gtest.h>
 #include <utils/LinearAllocator.h>
 
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 using namespace android;
 using namespace android::uirenderer;
diff --git a/libs/hwui/unit_tests/OffscreenBufferPoolTests.cpp b/libs/hwui/tests/unit/OffscreenBufferPoolTests.cpp
similarity index 98%
rename from libs/hwui/unit_tests/OffscreenBufferPoolTests.cpp
rename to libs/hwui/tests/unit/OffscreenBufferPoolTests.cpp
index de86aed..2187654 100644
--- a/libs/hwui/unit_tests/OffscreenBufferPoolTests.cpp
+++ b/libs/hwui/tests/unit/OffscreenBufferPoolTests.cpp
@@ -17,7 +17,7 @@
 #include <gtest/gtest.h>
 #include <renderstate/OffscreenBufferPool.h>
 
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 using namespace android;
 using namespace android::uirenderer;
diff --git a/libs/hwui/unit_tests/OpReordererTests.cpp b/libs/hwui/tests/unit/OpReordererTests.cpp
similarity index 99%
rename from libs/hwui/unit_tests/OpReordererTests.cpp
rename to libs/hwui/tests/unit/OpReordererTests.cpp
index 2ce1d0a..98a430a 100644
--- a/libs/hwui/unit_tests/OpReordererTests.cpp
+++ b/libs/hwui/tests/unit/OpReordererTests.cpp
@@ -21,7 +21,7 @@
 #include <OpReorderer.h>
 #include <RecordedOp.h>
 #include <RecordingCanvas.h>
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 #include <unordered_map>
 
diff --git a/libs/hwui/unit_tests/RecordingCanvasTests.cpp b/libs/hwui/tests/unit/RecordingCanvasTests.cpp
similarity index 99%
rename from libs/hwui/unit_tests/RecordingCanvasTests.cpp
rename to libs/hwui/tests/unit/RecordingCanvasTests.cpp
index 81f0851..2449ce8 100644
--- a/libs/hwui/unit_tests/RecordingCanvasTests.cpp
+++ b/libs/hwui/tests/unit/RecordingCanvasTests.cpp
@@ -18,7 +18,7 @@
 
 #include <RecordedOp.h>
 #include <RecordingCanvas.h>
-#include <utils/TestUtils.h>
+#include <tests/common/TestUtils.h>
 
 namespace android {
 namespace uirenderer {
diff --git a/libs/hwui/unit_tests/StringUtilsTests.cpp b/libs/hwui/tests/unit/StringUtilsTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/StringUtilsTests.cpp
rename to libs/hwui/tests/unit/StringUtilsTests.cpp
diff --git a/libs/hwui/unit_tests/VectorDrawableTests.cpp b/libs/hwui/tests/unit/VectorDrawableTests.cpp
similarity index 100%
rename from libs/hwui/unit_tests/VectorDrawableTests.cpp
rename to libs/hwui/tests/unit/VectorDrawableTests.cpp
diff --git a/libs/hwui/unit_tests/how_to_run.txt b/libs/hwui/tests/unit/how_to_run.txt
similarity index 100%
rename from libs/hwui/unit_tests/how_to_run.txt
rename to libs/hwui/tests/unit/how_to_run.txt
diff --git a/libs/hwui/utils/Color.h b/libs/hwui/utils/Color.h
new file mode 100644
index 0000000..b5157f4
--- /dev/null
+++ b/libs/hwui/utils/Color.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+#ifndef COLOR_H
+#define COLOR_H
+
+#include <SkColor.h>
+
+namespace android {
+namespace uirenderer {
+    namespace Color {
+        enum Color {
+            Red_500 = 0xFFF44336,
+            Pink_500 = 0xFFE91E63,
+            Purple_500 = 0xFF9C27B0,
+            DeepPurple_500 = 0xFF673AB7,
+            Indigo_500 = 0xFF3F51B5,
+            Blue_500 = 0xFF2196F3,
+            LightBlue_300 = 0xFF4FC3F7,
+            LightBlue_500 = 0xFF03A9F4,
+            Cyan_500 = 0xFF00BCD4,
+            Teal_500 = 0xFF009688,
+            Teal_700 = 0xFF00796B,
+            Green_500 = 0xFF4CAF50,
+            Green_700 = 0xFF388E3C,
+            LightGreen_500 = 0xFF8BC34A,
+            LightGreen_700 = 0xFF689F38,
+            Lime_500 = 0xFFCDDC39,
+            Yellow_500 = 0xFFFFEB3B,
+            Amber_500 = 0xFFFFC107,
+            Orange_500 = 0xFFFF9800,
+            DeepOrange_500 = 0xFFFF5722,
+            Brown_500 = 0xFF795548,
+            Grey_200 = 0xFFEEEEEE,
+            Grey_500 = 0xFF9E9E9E,
+            Grey_700 = 0xFF616161,
+            BlueGrey_500 = 0xFF607D8B,
+            Transparent = 0x00000000,
+            Black = 0xFF000000,
+            White = 0xFFFFFFFF,
+        };
+    }
+
+    static_assert(Color::White == SK_ColorWHITE, "color format has changed");
+    static_assert(Color::Black == SK_ColorBLACK, "color format has changed");
+
+    // Array of bright (500 intensity) colors for synthetic content
+    static const Color::Color BrightColors[] = {
+        Color::Red_500,
+        Color::Pink_500,
+        Color::Purple_500,
+        Color::DeepPurple_500,
+        Color::Indigo_500,
+        Color::Blue_500,
+        Color::LightBlue_500,
+        Color::Cyan_500,
+        Color::Teal_500,
+        Color::Green_500,
+        Color::LightGreen_500,
+        Color::Lime_500,
+        Color::Yellow_500,
+        Color::Amber_500,
+        Color::Orange_500,
+        Color::DeepOrange_500,
+        Color::Brown_500,
+        Color::Grey_500,
+        Color::BlueGrey_500,
+    };
+    static constexpr int BrightColorsCount = sizeof(BrightColors) / sizeof(Color::Color);
+
+} /* namespace uirenderer */
+} /* namespace android */
+
+#endif /* TEST_UTILS_H */
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index bd6af78..6a1167a 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -91,7 +91,14 @@
 
     mLocked.buttonState = 0;
 
+    mPolicy->loadPointerIcon(&mLocked.pointerIcon);
+
     loadResources();
+
+    if (mLocked.pointerIcon.isValid()) {
+        mLocked.pointerIconChanged = true;
+        updatePointerLocked();
+    }
 }
 
 PointerController::~PointerController() {
@@ -325,6 +332,23 @@
     }
 }
 
+void PointerController::reloadPointerResources() {
+    AutoMutex _l(mLock);
+
+    loadResources();
+
+    if (mLocked.presentation == PRESENTATION_POINTER) {
+        mLocked.additionalMouseResources.clear();
+        mLocked.animationResources.clear();
+        mPolicy->loadPointerIcon(&mLocked.pointerIcon);
+        mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources,
+                                              &mLocked.animationResources);
+    }
+
+    mLocked.presentationChanged = true;
+    updatePointerLocked();
+}
+
 void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_t orientation) {
     AutoMutex _l(mLock);
 
@@ -415,15 +439,6 @@
     }
 }
 
-void PointerController::setPointerIcon(const SpriteIcon& icon) {
-    AutoMutex _l(mLock);
-
-    mLocked.pointerIcon = icon.copy();
-    mLocked.pointerIconChanged = true;
-
-    updatePointerLocked();
-}
-
 void PointerController::handleMessage(const Message& message) {
     switch (message.what) {
     case MSG_INACTIVITY_TIMEOUT:
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index b6c01d2..4fd2d85 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -62,6 +62,7 @@
     virtual ~PointerControllerPolicyInterface() { }
 
 public:
+    virtual void loadPointerIcon(SpriteIcon* icon) = 0;
     virtual void loadPointerResources(PointerResources* outResources) = 0;
     virtual void loadAdditionalMouseResources(std::map<int32_t, SpriteIcon>* outResources,
             std::map<int32_t, PointerAnimation>* outAnimationResources) = 0;
@@ -105,8 +106,8 @@
 
     void updatePointerShape(int32_t iconId);
     void setDisplayViewport(int32_t width, int32_t height, int32_t orientation);
-    void setPointerIcon(const SpriteIcon& icon);
     void setInactivityTimeout(InactivityTimeout inactivityTimeout);
+    void reloadPointerResources();
 
 private:
     static const size_t MAX_RECYCLED_SPRITES = 12;
diff --git a/media/java/android/media/MediaMetadataEditor.java b/media/java/android/media/MediaMetadataEditor.java
index 566b93f..877c872 100644
--- a/media/java/android/media/MediaMetadataEditor.java
+++ b/media/java/android/media/MediaMetadataEditor.java
@@ -73,7 +73,8 @@
 
     /**
      * Applies all of the metadata changes that have been set since the MediaMetadataEditor instance
-     * was created or since {@link #clear()} was called.
+     * was created or since {@link #clear()} was called. Subclasses should synchronize on
+     * {@code this} for thread safety.
      */
     public abstract void apply();
 
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 1c2c940..f5b7a2e 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -36,6 +36,7 @@
 import android.os.PowerManager;
 import android.os.RemoteException;
 import android.os.ServiceManager;
+import android.os.SystemProperties;
 import android.provider.Settings;
 import android.system.ErrnoException;
 import android.system.OsConstants;
@@ -1260,6 +1261,13 @@
      */
     public void setWakeMode(Context context, int mode) {
         boolean washeld = false;
+
+        /* Disable persistant wakelocks in media player based on property */
+        if (SystemProperties.getBoolean("audio.offload.ignore_setawake", false) == true) {
+            Log.w(TAG, "IGNORING setWakeMode " + mode);
+            return;
+        }
+
         if (mWakeLock != null) {
             if (mWakeLock.isHeld()) {
                 washeld = true;
diff --git a/media/java/android/media/browse/MediaBrowser.java b/media/java/android/media/browse/MediaBrowser.java
index 41b8ab2..be9fb47 100644
--- a/media/java/android/media/browse/MediaBrowser.java
+++ b/media/java/android/media/browse/MediaBrowser.java
@@ -240,7 +240,7 @@
     /**
      * Gets the root id.
      * <p>
-     * Note that the root id may become invalid or change when when the
+     * Note that the root id may become invalid or change when the
      * browser is disconnected.
      * </p>
      *
@@ -270,7 +270,7 @@
     /**
      * Gets the media session token associated with the media browser.
      * <p>
-     * Note that the session token may become invalid or change when when the
+     * Note that the session token may become invalid or change when the
      * browser is disconnected.
      * </p>
      *
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 090be88..70d651f 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -187,6 +187,17 @@
     return mDecodeThread != NULL;
 }
 
+sp<Sample> SoundPool::findSample(int sampleID)
+{
+    Mutex::Autolock lock(&mLock);
+    return findSample_l(sampleID);
+}
+
+sp<Sample> SoundPool::findSample_l(int sampleID)
+{
+    return mSamples.valueFor(sampleID);
+}
+
 SoundChannel* SoundPool::findChannel(int channelID)
 {
     for (int i = 0; i < mMaxChannels; ++i) {
@@ -211,18 +222,21 @@
 {
     ALOGV("load: fd=%d, offset=%" PRId64 ", length=%" PRId64 ", priority=%d",
             fd, offset, length, priority);
-    Mutex::Autolock lock(&mLock);
-    sp<Sample> sample = new Sample(++mNextSampleID, fd, offset, length);
-    mSamples.add(sample->sampleID(), sample);
-    doLoad(sample);
-    return sample->sampleID();
-}
-
-void SoundPool::doLoad(sp<Sample>& sample)
-{
-    ALOGV("doLoad: loading sample sampleID=%d", sample->sampleID());
-    sample->startLoad();
-    mDecodeThread->loadSample(sample->sampleID());
+    int sampleID;
+    {
+        Mutex::Autolock lock(&mLock);
+        sampleID = ++mNextSampleID;
+        sp<Sample> sample = new Sample(sampleID, fd, offset, length);
+        mSamples.add(sampleID, sample);
+        sample->startLoad();
+    }
+    // mDecodeThread->loadSample() must be called outside of mLock.
+    // mDecodeThread->loadSample() may block on mDecodeThread message queue space;
+    // the message queue emptying may block on SoundPool::findSample().
+    //
+    // It theoretically possible that sample loads might decode out-of-order.
+    mDecodeThread->loadSample(sampleID);
+    return sampleID;
 }
 
 bool SoundPool::unload(int sampleID)
@@ -237,7 +251,6 @@
 {
     ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
             sampleID, leftVolume, rightVolume, priority, loop, rate);
-    sp<Sample> sample;
     SoundChannel* channel;
     int channelID;
 
@@ -247,7 +260,7 @@
         return 0;
     }
     // is sample ready?
-    sample = findSample(sampleID);
+    sp<Sample> sample(findSample_l(sampleID));
     if ((sample == 0) || (sample->state() != Sample::READY)) {
         ALOGW("  sample %d not READY", sampleID);
         return 0;
diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h
index 4aacf53..98d2fa2 100644
--- a/media/jni/soundpool/SoundPool.h
+++ b/media/jni/soundpool/SoundPool.h
@@ -180,6 +180,7 @@
 
     // called from SoundPoolThread
     void sampleLoaded(int sampleID);
+    sp<Sample> findSample(int sampleID);
 
     // called from AudioTrack thread
     void done_l(SoundChannel* channel);
@@ -191,8 +192,7 @@
 private:
     SoundPool() {} // no default constructor
     bool startThreads();
-    void doLoad(sp<Sample>& sample);
-    sp<Sample> findSample(int sampleID) { return mSamples.valueFor(sampleID); }
+    sp<Sample> findSample_l(int sampleID);
     SoundChannel* findChannel (int channelID);
     SoundChannel* findNextChannel (int channelID);
     SoundChannel* allocateChannel_l(int priority, int sampleID);
diff --git a/packages/DocumentsUI/AndroidManifest.xml b/packages/DocumentsUI/AndroidManifest.xml
index 595928a..60f5d60 100644
--- a/packages/DocumentsUI/AndroidManifest.xml
+++ b/packages/DocumentsUI/AndroidManifest.xml
@@ -39,7 +39,7 @@
         </activity>
 
         <activity
-            android:name=".ManageRootActivity"
+            android:name=".DownloadsActivity"
             android:theme="@style/DocumentsFullScreenTheme"
             android:icon="@drawable/ic_doc_text">
             <intent-filter>
diff --git a/packages/DocumentsUI/res/values/config.xml b/packages/DocumentsUI/res/values/config.xml
index ad419aa..ff28e15 100644
--- a/packages/DocumentsUI/res/values/config.xml
+++ b/packages/DocumentsUI/res/values/config.xml
@@ -15,6 +15,9 @@
 -->
 
 <resources>
+    <!-- Allow Advanced Devices default value to be customised -->
+    <bool name="config_defaultAdvancedDevices">false</bool>
+
     <bool name="productivity_device">true</bool>
     <!-- Intentionally unset. Vendors should set this in an overlay. -->
     <string name="trusted_quick_viewer_package"></string>
diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
index 91ac033..abb08f5 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
@@ -260,8 +260,7 @@
         } else if (id == R.id.menu_settings) {
             final RootInfo root = getCurrentRoot();
             final Intent intent = new Intent(DocumentsContract.ACTION_DOCUMENT_ROOT_SETTINGS);
-            intent.setDataAndType(DocumentsContract.buildRootUri(root.authority, root.rootId),
-                    DocumentsContract.Root.MIME_TYPE_ITEM);
+            intent.setDataAndType(root.getUri(), DocumentsContract.Root.MIME_TYPE_ITEM);
             startActivity(intent);
             return true;
         }
diff --git a/packages/DocumentsUI/src/com/android/documentsui/CopyService.java b/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
index 55e2f44..b99c806 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/CopyService.java
@@ -39,13 +39,15 @@
 import android.os.SystemClock;
 import android.provider.DocumentsContract;
 import android.provider.DocumentsContract.Document;
+import android.support.annotation.Nullable;
+import android.support.annotation.VisibleForTesting;
 import android.support.design.widget.Snackbar;
 import android.text.format.DateUtils;
 import android.util.Log;
-import android.widget.Toast;
 
 import com.android.documentsui.model.DocumentInfo;
 import com.android.documentsui.model.DocumentStack;
+import com.android.documentsui.model.RootInfo;
 
 import libcore.io.IoUtils;
 
@@ -72,6 +74,12 @@
     // TODO: Move it to a shared file when more operations are implemented.
     public static final int FAILURE_COPY = 1;
 
+    // Parameters of the copy job. Requests to an IntentService are serialized so this code only
+    // needs to deal with one job at a time.
+    // NOTE: This must be declared by concrete type as the concrete type
+    // is required by putParcelableArrayListExtra.
+    private final ArrayList<DocumentInfo> mFailedFiles = new ArrayList<>();
+
     private PowerManager mPowerManager;
 
     private NotificationManager mNotificationManager;
@@ -80,9 +88,6 @@
     // Jobs are serialized but a job ID is used, to avoid mixing up cancellation requests.
     private String mJobId;
     private volatile boolean mIsCancelled;
-    // Parameters of the copy job. Requests to an IntentService are serialized so this code only
-    // needs to deal with one job at a time.
-    private final ArrayList<DocumentInfo> mFailedFiles;
     private long mBatchSize;
     private long mBytesCopied;
     private long mStartTime;
@@ -97,10 +102,11 @@
     private ContentProviderClient mSrcClient;
     private ContentProviderClient mDstClient;
 
+    // For testing only.
+    @Nullable private TestOnlyListener mJobFinishedListener;
+
     public CopyService() {
         super("CopyService");
-
-        mFailedFiles = new ArrayList<DocumentInfo>();
     }
 
     /**
@@ -115,7 +121,11 @@
         final Resources res = activity.getResources();
         final Intent copyIntent = new Intent(activity, CopyService.class);
         copyIntent.putParcelableArrayListExtra(
-                EXTRA_SRC_LIST, new ArrayList<DocumentInfo>(srcDocs));
+                EXTRA_SRC_LIST,
+                // Don't create a copy unless absolutely necessary :)
+                srcDocs instanceof ArrayList
+                    ? (ArrayList<DocumentInfo>) srcDocs
+                    : new ArrayList<DocumentInfo>(srcDocs));
         copyIntent.putExtra(Shared.EXTRA_STACK, (Parcelable) dstStack);
         copyIntent.putExtra(EXTRA_TRANSFER_MODE, mode);
 
@@ -198,6 +208,11 @@
                         .setAutoCancel(true);
                 mNotificationManager.notify(mJobId, 0, errorBuilder.build());
             }
+
+            if (mJobFinishedListener != null) {
+                mJobFinishedListener.onFinished(mFailedFiles);
+            }
+
             if (DEBUG) Log.d(TAG, "Done cleaning up");
         }
     }
@@ -269,6 +284,26 @@
     }
 
     /**
+     * Sets a callback to be run when the next run job is finished.
+     * This is test ONLY instrumentation. The alternative is for us to add
+     * broadcast intents SOLELY for the purpose of testing.
+     * @param listener
+     */
+    @VisibleForTesting
+    void addFinishedListener(TestOnlyListener listener) {
+        this.mJobFinishedListener = listener;
+
+    }
+
+    /**
+     * Only used for testing. Is that obvious enough?
+     */
+    @VisibleForTesting
+    interface TestOnlyListener {
+        void onFinished(List<DocumentInfo> failed);
+    }
+
+    /**
      * Calculates the cumulative size of all the documents in the list. Directories are recursed
      * into and totaled up.
      *
@@ -279,7 +314,7 @@
     private long calculateFileSizes(List<DocumentInfo> srcs) throws RemoteException {
         long result = 0;
         for (DocumentInfo src : srcs) {
-            if (Document.MIME_TYPE_DIR.equals(src.mimeType)) {
+            if (src.isDirectory()) {
                 // Directories need to be recursed into.
                 result += calculateFileSizesHelper(src.derivedUri);
             } else {
@@ -412,8 +447,21 @@
      */
     private void copy(DocumentInfo srcInfo, DocumentInfo dstDirInfo, int mode)
             throws RemoteException {
-        if (DEBUG) Log.d(TAG, "Copying " + srcInfo.displayName + " (" + srcInfo.derivedUri + ")" +
-            " to " + dstDirInfo.displayName + " (" + dstDirInfo.derivedUri + ")");
+
+        String opDesc = mode == TRANSFER_MODE_COPY ? "copy" : "move";
+
+        // Guard unsupported recursive operation.
+        if (dstDirInfo.equals(srcInfo) || isDescendentOf(srcInfo, dstDirInfo)) {
+            if (DEBUG) Log.d(TAG,
+                    "Skipping recursive " + opDesc + " of directory " + dstDirInfo.derivedUri);
+            mFailedFiles.add(srcInfo);
+            return;
+        }
+
+        if (DEBUG) Log.d(TAG,
+                "Performing " + opDesc + " of " + srcInfo.displayName
+                + " (" + srcInfo.derivedUri + ")" + " to " + dstDirInfo.displayName
+                + " (" + dstDirInfo.derivedUri + ")");
 
         // When copying within the same provider, try to use optimized copying and moving.
         // If not supported, then fallback to byte-by-byte copy/move.
@@ -450,7 +498,7 @@
             return;
         }
 
-        if (Document.MIME_TYPE_DIR.equals(srcInfo.mimeType)) {
+        if (srcInfo.isDirectory()) {
             copyDirectoryHelper(srcInfo.derivedUri, dstUri, mode);
         } else {
             copyFileHelper(srcInfo.derivedUri, dstUri, mode);
@@ -458,6 +506,17 @@
     }
 
     /**
+     * Returns true if {@code doc} is a descendant of {@code parentDoc}.
+     */
+    boolean isDescendentOf(DocumentInfo doc, DocumentInfo parentDoc) throws RemoteException {
+        if (parentDoc.isDirectory() && doc.authority.equals(parentDoc.authority)) {
+            return DocumentsContract.isChildDocument(
+                    mDstClient, doc.derivedUri, parentDoc.derivedUri);
+        }
+        return false;
+    }
+
+    /**
      * Handles recursion into a directory and copying its contents. Note that in linux terms, this
      * does the equivalent of "cp src/* dst", not "cp -r src dst".
      *
diff --git a/packages/DocumentsUI/src/com/android/documentsui/CreateDirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/CreateDirectoryFragment.java
index c6425a6..f3c3f2f 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/CreateDirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/CreateDirectoryFragment.java
@@ -32,6 +32,7 @@
 import android.os.Bundle;
 import android.provider.DocumentsContract;
 import android.provider.DocumentsContract.Document;
+import android.support.annotation.Nullable;
 import android.support.design.widget.Snackbar;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -83,8 +84,10 @@
         editText.setOnEditorActionListener(
                 new OnEditorActionListener() {
                     @Override
-                    public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
-                        if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER
+                    public boolean onEditorAction(
+                            TextView view, int actionId, @Nullable KeyEvent event) {
+                        if (event != null
+                                && event.getKeyCode() == KeyEvent.KEYCODE_ENTER
                                 && event.hasNoModifiers()) {
                             createDirectory(editText.getText().toString());
                             dialog.dismiss();
diff --git a/packages/DocumentsUI/src/com/android/documentsui/ManageRootActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
similarity index 95%
rename from packages/DocumentsUI/src/com/android/documentsui/ManageRootActivity.java
rename to packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
index 3045fa8..f224343 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/ManageRootActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DownloadsActivity.java
@@ -50,8 +50,11 @@
 import java.util.Arrays;
 import java.util.List;
 
-public class ManageRootActivity extends BaseActivity {
-    private static final String TAG = "ManageRootsActivity";
+// Let's face it. MANAGE_ROOT is used almost exclusively
+// for downloads, and is specialized for this purpose.
+// So it is now thusly christened.
+public class DownloadsActivity extends BaseActivity {
+    private static final String TAG = "DownloadsActivity";
 
     private Toolbar mToolbar;
     private Spinner mToolbarStack;
@@ -59,7 +62,7 @@
     private ItemSelectedListener mStackListener;
     private BaseAdapter mStackAdapter;
 
-    public ManageRootActivity() {
+    public DownloadsActivity() {
         super(R.layout.manage_roots_activity, TAG);
     }
 
@@ -250,7 +253,7 @@
         finish();
     }
 
-    public static ManageRootActivity get(Fragment fragment) {
-        return (ManageRootActivity) fragment.getActivity();
+    public static DownloadsActivity get(Fragment fragment) {
+        return (DownloadsActivity) fragment.getActivity();
     }
 }
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java b/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java
index 120f610..23074f0 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java
@@ -37,7 +37,6 @@
         implements DialogInterface.OnClickListener {
     private static final String TAG = "FailureDialogFragment";
 
-    private int mFailure;
     private int mTransferMode;
     private ArrayList<DocumentInfo> mFailedSrcList;
 
@@ -75,7 +74,6 @@
     public Dialog onCreateDialog(Bundle inState) {
         super.onCreate(inState);
 
-        mFailure = getArguments().getInt(CopyService.EXTRA_FAILURE);
         mTransferMode = getArguments().getInt(CopyService.EXTRA_TRANSFER_MODE);
         mFailedSrcList = getArguments().getParcelableArrayList(CopyService.EXTRA_SRC_LIST);
 
diff --git a/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java b/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java
index e6c5ae2..113e9d7 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java
@@ -24,8 +24,10 @@
     private static final String KEY_FILE_SIZE = "fileSize";
 
     public static boolean getDisplayAdvancedDevices(Context context) {
+        boolean defaultAdvanced = context.getResources()
+                .getBoolean(R.bool.config_defaultAdvancedDevices);
         return PreferenceManager.getDefaultSharedPreferences(context)
-                .getBoolean(KEY_ADVANCED_DEVICES, false);
+                .getBoolean(KEY_ADVANCED_DEVICES, defaultAdvanced);
     }
 
     public static boolean getDisplayFileSize(Context context) {
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
index b0421b0..be3013b 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -741,45 +741,45 @@
 
             Selection selection = mSelectionManager.getSelection(new Selection());
 
-            final int id = item.getItemId();
-            if (id == R.id.menu_open) {
-                openDocuments(selection);
-                mode.finish();
-                return true;
+            switch (item.getItemId()) {
+                case R.id.menu_open:
+                    openDocuments(selection);
+                    mode.finish();
+                    return true;
 
-            } else if (id == R.id.menu_share) {
-                shareDocuments(selection);
-                mode.finish();
-                return true;
+                case R.id.menu_share:
+                    shareDocuments(selection);
+                    mode.finish();
+                    return true;
 
-            } else if (id == R.id.menu_delete) {
-                // Exit selection mode first, so we avoid deselecting deleted documents.
-                mode.finish();
-                deleteDocuments(selection);
-                return true;
+                case R.id.menu_delete:
+                    // Exit selection mode first, so we avoid deselecting deleted documents.
+                    mode.finish();
+                    deleteDocuments(selection);
+                    return true;
 
-            } else if (id == R.id.menu_copy_to) {
-                transferDocuments(selection, CopyService.TRANSFER_MODE_COPY);
-                mode.finish();
-                return true;
+                case R.id.menu_copy_to:
+                    transferDocuments(selection, CopyService.TRANSFER_MODE_COPY);
+                    mode.finish();
+                    return true;
 
-            } else if (id == R.id.menu_move_to) {
-                // Exit selection mode first, so we avoid deselecting deleted documents.
-                mode.finish();
-                transferDocuments(selection, CopyService.TRANSFER_MODE_MOVE);
-                return true;
+                case R.id.menu_move_to:
+                    // Exit selection mode first, so we avoid deselecting deleted documents.
+                    mode.finish();
+                    transferDocuments(selection, CopyService.TRANSFER_MODE_MOVE);
+                    return true;
 
-            } else if (id == R.id.menu_copy_to_clipboard) {
-                copySelectionToClipboard(selection);
-                mode.finish();
-                return true;
+                case R.id.menu_copy_to_clipboard:
+                    copySelectionToClipboard(selection);
+                    return true;
 
-            } else if (id == R.id.menu_select_all) {
-                selectAllFiles();
-                return true;
+                case R.id.menu_select_all:
+                    selectAllFiles();
+                    return true;
 
-            } else {
-                return false;
+                default:
+                    if (DEBUG) Log.d(TAG, "Unhandled menu item selected: " + item);
+                    return false;
             }
         }
     }
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java
index 38d3805..ef6d2c9 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java
@@ -176,7 +176,6 @@
             final MenuItem moveTo = menu.findItem(R.id.menu_move_to);
 
             open.setVisible(false);
-            share.setVisible(false);
             delete.setVisible(canDelete);
             copyTo.setVisible(true);
             copyTo.setEnabled(true);
diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/DocumentInfo.java b/packages/DocumentsUI/src/com/android/documentsui/model/DocumentInfo.java
index cc981e1e..dfdc705 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/model/DocumentInfo.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/model/DocumentInfo.java
@@ -25,6 +25,7 @@
 import android.provider.DocumentsContract;
 import android.provider.DocumentsContract.Document;
 import android.provider.DocumentsProvider;
+import android.support.annotation.VisibleForTesting;
 import android.text.TextUtils;
 
 import com.android.documentsui.DocumentsApplication;
@@ -204,13 +205,18 @@
         }
     }
 
-    private void deriveFields() {
+    @VisibleForTesting
+    void deriveFields() {
         derivedUri = DocumentsContract.buildDocumentUri(authority, documentId);
     }
 
     @Override
     public String toString() {
-        return "Document{docId=" + documentId + ", name=" + displayName + "}";
+        return "Document{"
+                + "docId=" + documentId
+                + ", name=" + displayName
+                + ", isDirectory=" + isDirectory()
+                + "}";
     }
 
     public boolean isCreateSupported() {
@@ -237,6 +243,22 @@
         return (flags & Document.FLAG_DIR_HIDE_GRID_TITLES) != 0;
     }
 
+    public int hashCode() {
+        return derivedUri.hashCode() + mimeType.hashCode();
+    }
+
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        } else if (!(other instanceof DocumentInfo)) {
+            return false;
+        }
+
+        DocumentInfo that = (DocumentInfo) other;
+        // Uri + mime type should be totally unique.
+        return derivedUri.equals(that.derivedUri) && mimeType.equals(that.mimeType);
+    }
+
     public static String getCursorString(Cursor cursor, String columnName) {
         final int index = cursor.getColumnIndex(columnName);
         return (index != -1) ? cursor.getString(index) : null;
diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
index ae5644d..4caa891 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
@@ -23,8 +23,10 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.graphics.drawable.Drawable;
+import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.provider.DocumentsContract;
 import android.provider.DocumentsContract.Root;
 import android.text.TextUtils;
 
@@ -195,6 +197,10 @@
         }
     }
 
+    public Uri getUri() {
+        return DocumentsContract.buildRootUri(authority, rootId);
+    }
+
     public boolean isRecents() {
         return authority == null && rootId == null;
     }
@@ -238,11 +244,6 @@
                 || derivedType == TYPE_RECENTS || derivedType == TYPE_DOWNLOADS;
     }
 
-    @Override
-    public String toString() {
-        return "Root{authority=" + authority + ", rootId=" + rootId + ", title=" + title + "}";
-    }
-
     public Drawable loadIcon(Context context) {
         if (derivedIcon != 0) {
             return context.getDrawable(derivedIcon);
@@ -283,6 +284,11 @@
         return Objects.hash(authority, rootId);
     }
 
+    @Override
+    public String toString() {
+        return "Root{authority=" + authority + ", rootId=" + rootId + ", title=" + title + "}";
+    }
+
     public String getDirectoryString() {
         return !TextUtils.isEmpty(summary) ? summary : title;
     }
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/CopyTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/CopyServiceTest.java
similarity index 85%
rename from packages/DocumentsUI/tests/src/com/android/documentsui/CopyTest.java
rename to packages/DocumentsUI/tests/src/com/android/documentsui/CopyServiceTest.java
index 369ab7d..079d599 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/CopyTest.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/CopyServiceTest.java
@@ -28,12 +28,10 @@
 import android.os.Parcelable;
 import android.os.RemoteException;
 import android.provider.DocumentsContract;
-import android.provider.DocumentsContract.Document;
 import android.test.MoreAsserts;
 import android.test.ServiceTestCase;
 import android.test.mock.MockContentResolver;
 import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Log;
 
 import com.android.documentsui.model.DocumentInfo;
@@ -48,6 +46,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -55,9 +54,9 @@
 import java.util.concurrent.TimeoutException;
 
 @MediumTest
-public class CopyTest extends ServiceTestCase<CopyService> {
+public class CopyServiceTest extends ServiceTestCase<CopyService> {
 
-    public CopyTest() {
+    public CopyServiceTest() {
         super(CopyService.class);
     }
 
@@ -72,11 +71,13 @@
     private DocumentsProviderHelper mDocHelper;
     private StubProvider mStorage;
     private Context mSystemContext;
+    private CopyJobListener mListener;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
+        mListener = new CopyJobListener();
         setupTestContext();
         mClient = mResolver.acquireContentProviderClient(AUTHORITY);
 
@@ -84,6 +85,8 @@
         mStorage.clearCacheAndBuildRoots();
 
         mDocHelper = new DocumentsProviderHelper(AUTHORITY, mClient);
+
+        assertDestFileCount(0);
     }
 
     @Override
@@ -97,15 +100,13 @@
         Uri testFile = mStorage.createFile(SRC_ROOT, srcPath, "text/plain",
                 "The five boxing wizards jump quickly".getBytes());
 
-        assertDstFileCountEquals(0);
-
         startService(createCopyIntent(Lists.newArrayList(testFile)));
 
         // 2 operations: file creation, then writing data.
         mResolver.waitForChanges(2);
 
         // Verify that one file was copied; check file contents.
-        assertDstFileCountEquals(1);
+        assertDestFileCount(1);
         assertCopied(srcPath);
     }
 
@@ -114,8 +115,6 @@
         String testContent = "The five boxing wizards jump quickly";
         Uri testFile = mStorage.createFile(SRC_ROOT, srcPath, "text/plain", testContent.getBytes());
 
-        assertDstFileCountEquals(0);
-
         Intent moveIntent = createCopyIntent(Lists.newArrayList(testFile));
         moveIntent.putExtra(CopyService.EXTRA_TRANSFER_MODE, CopyService.TRANSFER_MODE_MOVE);
         startService(moveIntent);
@@ -124,7 +123,7 @@
         mResolver.waitForChanges(3);
 
         // Verify that one file was moved; check file contents.
-        assertDstFileCountEquals(1);
+        assertDestFileCount(1);
         assertDoesNotExist(SRC_ROOT, srcPath);
 
         byte[] dstContent = readFile(DST_ROOT, srcPath);
@@ -147,15 +146,13 @@
                 mStorage.createFile(SRC_ROOT, srcPaths[1], "text/plain", testContent[1].getBytes()),
                 mStorage.createFile(SRC_ROOT, srcPaths[2], "text/plain", testContent[2].getBytes()));
 
-        assertDstFileCountEquals(0);
-
         // Copy all the test files.
         startService(createCopyIntent(testFiles));
 
         // 3 file creations, 3 file writes.
         mResolver.waitForChanges(6);
 
-        assertDstFileCountEquals(3);
+        assertDestFileCount(3);
         for (String path : srcPaths) {
             assertCopied(path);
         }
@@ -163,29 +160,54 @@
 
     public void testCopyEmptyDir() throws Exception {
         String srcPath = "/emptyDir";
-        Uri testDir = mStorage.createFile(SRC_ROOT, srcPath, DocumentsContract.Document.MIME_TYPE_DIR,
-                null);
-
-        assertDstFileCountEquals(0);
+        Uri testDir = createTestDirectory(srcPath);
 
         startService(createCopyIntent(Lists.newArrayList(testDir)));
 
         // Just 1 operation: Directory creation.
         mResolver.waitForChanges(1);
 
-        assertDstFileCountEquals(1);
+        assertDestFileCount(1);
 
         // Verify that the dst exists and is a directory.
         File dst = mStorage.getFile(DST_ROOT, srcPath);
         assertTrue(dst.isDirectory());
     }
 
+    public void testNoCopyDirToSelf() throws Exception {
+        Uri testDir = createTestDirectory("/someDir");
+
+        Intent intent = createCopyIntent(Lists.newArrayList(testDir), testDir);
+        startService(intent);
+
+        getService().addFinishedListener(mListener);
+
+        mListener.waitForFinished();
+        mListener.assertFailedCount(1);
+        mListener.assertFileFailed("someDir");
+
+        assertDestFileCount(0);
+    }
+
+    public void testNoCopyDirToDescendent() throws Exception {
+        Uri testDir = createTestDirectory("/someDir");
+        Uri descDir = createTestDirectory("/someDir/theDescendent");
+
+        Intent intent = createCopyIntent(Lists.newArrayList(testDir), descDir);
+        startService(intent);
+
+        getService().addFinishedListener(mListener);
+
+        mListener.waitForFinished();
+        mListener.assertFailedCount(1);
+        mListener.assertFileFailed("someDir");
+
+        assertDestFileCount(0);
+    }
+
     public void testMoveEmptyDir() throws Exception {
         String srcPath = "/emptyDir";
-        Uri testDir = mStorage.createFile(SRC_ROOT, srcPath, DocumentsContract.Document.MIME_TYPE_DIR,
-                null);
-
-        assertDstFileCountEquals(0);
+        Uri testDir = createTestDirectory(srcPath);
 
         Intent moveIntent = createCopyIntent(Lists.newArrayList(testDir));
         moveIntent.putExtra(CopyService.EXTRA_TRANSFER_MODE, CopyService.TRANSFER_MODE_MOVE);
@@ -194,7 +216,7 @@
         // 2 operations: Directory creation, and removal of the original.
         mResolver.waitForChanges(2);
 
-        assertDstFileCountEquals(1);
+        assertDestFileCount(1);
 
         // Verify that the dst exists and is a directory.
         File dst = mStorage.getFile(DST_ROOT, srcPath);
@@ -217,8 +239,7 @@
                 srcDir + "/test2.txt"
         };
         // Create test dir; put some files in it.
-        Uri testDir = mStorage.createFile(SRC_ROOT, srcDir, DocumentsContract.Document.MIME_TYPE_DIR,
-                null);
+        Uri testDir = createTestDirectory(srcDir);
         mStorage.createFile(SRC_ROOT, srcFiles[0], "text/plain", testContent[0].getBytes());
         mStorage.createFile(SRC_ROOT, srcFiles[1], "text/plain", testContent[1].getBytes());
         mStorage.createFile(SRC_ROOT, srcFiles[2], "text/plain", testContent[2].getBytes());
@@ -252,8 +273,6 @@
         Uri testFile = mStorage.createFile(SRC_ROOT, srcPath, "text/plain",
                 "The five boxing wizards jump quickly".getBytes());
 
-        assertDstFileCountEquals(0);
-
         mStorage.simulateReadErrorsForFile(testFile);
 
         startService(createCopyIntent(Lists.newArrayList(testFile)));
@@ -262,7 +281,7 @@
         mResolver.waitForChanges(3);
 
         // Verify that the failed copy was cleaned up.
-        assertDstFileCountEquals(0);
+        assertDestFileCount(0);
     }
 
     public void testMoveFileWithReadErrors() throws Exception {
@@ -270,8 +289,6 @@
         Uri testFile = mStorage.createFile(SRC_ROOT, srcPath, "text/plain",
                 "The five boxing wizards jump quickly".getBytes());
 
-        assertDstFileCountEquals(0);
-
         mStorage.simulateReadErrorsForFile(testFile);
 
         Intent moveIntent = createCopyIntent(Lists.newArrayList(testFile));
@@ -288,7 +305,7 @@
             return;
         } finally {
             // Verify that the failed copy was cleaned up, and the src file wasn't removed.
-            assertDstFileCountEquals(0);
+            assertDestFileCount(0);
             assertExists(SRC_ROOT, srcPath);
         }
         // The asserts above didn't fail, but the CopyService did something unexpected.
@@ -308,8 +325,7 @@
                 srcDir + "/test2.txt"
         };
         // Create test dir; put some files in it.
-        Uri testDir = mStorage.createFile(SRC_ROOT, srcDir, DocumentsContract.Document.MIME_TYPE_DIR,
-                null);
+        Uri testDir = createTestDirectory(srcDir);
         mStorage.createFile(SRC_ROOT, srcFiles[0], "text/plain", testContent[0].getBytes());
         Uri errFile = mStorage
                 .createFile(SRC_ROOT, srcFiles[1], "text/plain", testContent[1].getBytes());
@@ -346,33 +362,37 @@
         assertExists(SRC_ROOT, srcFiles[1]);
     }
 
-    /**
-     * Copies the given files to a pre-determined destination.
-     *
-     * @throws FileNotFoundException
-     */
+    private Uri createTestDirectory(String dir) throws IOException {
+        return mStorage.createFile(
+                SRC_ROOT, dir, DocumentsContract.Document.MIME_TYPE_DIR, null);
+    }
+
     private Intent createCopyIntent(List<Uri> srcs) throws Exception {
+        RootInfo root = mDocHelper.getRoot(DST_ROOT);
+        final Uri dst = DocumentsContract.buildDocumentUri(AUTHORITY, root.documentId);
+
+        return createCopyIntent(srcs, dst);
+    }
+
+    private Intent createCopyIntent(List<Uri> srcs, Uri dst) throws Exception {
         final ArrayList<DocumentInfo> srcDocs = Lists.newArrayList();
         for (Uri src : srcs) {
             srcDocs.add(DocumentInfo.fromUri(mResolver, src));
         }
 
-        RootInfo root = mDocHelper.getRoot(DST_ROOT);
-        final Uri dst = DocumentsContract.buildDocumentUri(AUTHORITY, root.documentId);
         DocumentStack stack = new DocumentStack();
         stack.push(DocumentInfo.fromUri(mResolver, dst));
         final Intent copyIntent = new Intent(mContext, CopyService.class);
         copyIntent.putParcelableArrayListExtra(CopyService.EXTRA_SRC_LIST, srcDocs);
         copyIntent.putExtra(Shared.EXTRA_STACK, (Parcelable) stack);
 
-        // startService(copyIntent);
         return copyIntent;
     }
 
     /**
      * Returns a count of the files in the given directory.
      */
-    private void assertDstFileCountEquals(int expected) throws RemoteException {
+    private void assertDestFileCount(int expected) throws RemoteException {
         RootInfo dest = mDocHelper.getRoot(DST_ROOT);
         final Uri queryUri = DocumentsContract.buildChildDocumentsUri(AUTHORITY,
                 dest.documentId);
@@ -449,6 +469,34 @@
         mResolver.addProvider(AUTHORITY, mStorage);
     }
 
+    private final class CopyJobListener implements CopyService.TestOnlyListener {
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        final List<DocumentInfo> failedDocs = new ArrayList<>();
+        @Override
+        public void onFinished(List<DocumentInfo> failed) {
+            failedDocs.addAll(failed);
+            latch.countDown();
+        }
+
+        public void assertFileFailed(String expectedName) {
+            for (DocumentInfo failed : failedDocs) {
+                if (expectedName.equals(failed.displayName)) {
+                    return;
+                }
+            }
+            fail("Couldn't find failed file: " + expectedName);
+        }
+
+        public void waitForFinished() throws InterruptedException {
+            latch.await(500, TimeUnit.MILLISECONDS);
+        }
+
+        public void assertFailedCount(int expected) {
+            assertEquals(expected, failedDocs.size());
+        }
+    }
+
     /**
      * A test resolver that enables this test suite to listen for notifications that mark when copy
      * operations are done.
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/DownloadsActivityUiTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/DownloadsActivityUiTest.java
new file mode 100644
index 0000000..737a8b6
--- /dev/null
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/DownloadsActivityUiTest.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.documentsui;
+
+import static com.android.documentsui.StubProvider.DEFAULT_AUTHORITY;
+import static com.android.documentsui.StubProvider.ROOT_0_ID;
+
+import android.app.Instrumentation;
+import android.content.ContentProviderClient;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.RemoteException;
+import android.provider.DocumentsContract;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.Configurator;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.Until;
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.util.Log;
+import android.view.MotionEvent;
+
+import com.android.documentsui.model.RootInfo;
+
+@LargeTest
+public class DownloadsActivityUiTest extends InstrumentationTestCase {
+
+    private static final int TIMEOUT = 5000;
+    private static final String TAG = "DownloadsActivityUiTest";
+    private static final String TARGET_PKG = "com.android.documentsui";
+    private static final String LAUNCHER_PKG = "com.android.launcher";
+
+    private UiBot mBot;
+    private UiDevice mDevice;
+    private Context mContext;
+    private ContentResolver mResolver;
+    private DocumentsProviderHelper mDocsHelper;
+    private ContentProviderClient mClient;
+    private RootInfo mRoot;
+
+    public void setUp() throws Exception {
+        // Initialize UiDevice instance.
+        Instrumentation instrumentation = getInstrumentation();
+
+        mDevice = UiDevice.getInstance(instrumentation);
+
+        Configurator.getInstance().setToolType(MotionEvent.TOOL_TYPE_MOUSE);
+
+        // Start from the home screen.
+        mDevice.pressHome();
+        mDevice.wait(Until.hasObject(By.pkg(LAUNCHER_PKG).depth(0)), TIMEOUT);
+
+        // NOTE: Must be the "target" context, else security checks in content provider will fail.
+        mContext = instrumentation.getTargetContext();
+        mResolver = mContext.getContentResolver();
+
+        mClient = mResolver.acquireUnstableContentProviderClient(DEFAULT_AUTHORITY);
+        mDocsHelper = new DocumentsProviderHelper(DEFAULT_AUTHORITY, mClient);
+
+        mRoot = mDocsHelper.getRoot(ROOT_0_ID);
+
+        // Open the Downloads activity on our stub provider root.
+        Intent intent = new Intent(DocumentsContract.ACTION_MANAGE_ROOT);
+        intent.setDataAndType(mRoot.getUri(), DocumentsContract.Root.MIME_TYPE_ITEM);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+        mContext.startActivity(intent);
+
+        // Wait for the app to appear.
+        mDevice.wait(Until.hasObject(By.pkg(TARGET_PKG).depth(0)), TIMEOUT);
+        mDevice.waitForIdle();
+
+        mBot = new UiBot(mDevice, TIMEOUT);
+
+        resetStorage();  // Just in case a test failed and tearDown didn't happen.
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        // Need to kill off the task we started.
+        super.tearDown();
+        Log.d(TAG, "Resetting storage from setUp");
+        resetStorage();
+        mClient.release();
+    }
+
+    private void resetStorage() throws RemoteException {
+        mClient.call("clear", null, null);
+        // TODO: Would be nice to have an event to wait on here.
+        mDevice.waitForIdle();
+    }
+
+    private void initTestFiles() throws RemoteException {
+        mDocsHelper.createDocument(mRoot, "text/plain", "file0.log");
+        mDocsHelper.createDocument(mRoot, "image/png", "file1.png");
+        mDocsHelper.createDocument(mRoot, "text/csv", "file2.csv");
+    }
+
+    public void testWindowTitle() throws Exception {
+        initTestFiles();
+
+        mBot.assertWindowTitle(ROOT_0_ID);
+    }
+
+    public void testFilesListed() throws Exception {
+        initTestFiles();
+
+        mBot.assertHasDocuments("file0.log", "file1.png", "file2.csv");
+    }
+
+    public void testFilesList_LiveUpdate() throws Exception {
+        initTestFiles();
+
+        mDocsHelper.createDocument(mRoot, "yummers/sandwich", "Ham & Cheese.sandwich");
+        mBot.assertHasDocuments("file0.log", "file1.png", "file2.csv", "Ham & Cheese.sandwich");
+    }
+
+    public void testDeleteDocument() throws Exception {
+        initTestFiles();
+
+        mBot.clickDocument("file1.png");
+        mDevice.waitForIdle();
+        mBot.menuDelete().click();
+
+        mBot.waitForDeleteSnackbar();
+        assertFalse(mBot.hasDocuments("file1.png"));
+
+        mBot.waitForDeleteSnackbarGone();
+        assertFalse(mBot.hasDocuments("file1.png"));
+    }
+
+    public void testSupportsShare() throws Exception {
+        initTestFiles();
+
+        mBot.clickDocument("file1.png");
+        mDevice.waitForIdle();
+        assertNotNull(mBot.menuShare());
+    }
+}
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/StubProvider.java b/packages/DocumentsUI/tests/src/com/android/documentsui/StubProvider.java
index 2d42ddc..7a75503 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/StubProvider.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/StubProvider.java
@@ -226,6 +226,12 @@
     }
 
     @Override
+    public Cursor queryChildDocumentsForManage(String parentDocumentId, String[] projection,
+            String sortOrder) throws FileNotFoundException {
+        return queryChildDocuments(parentDocumentId, projection, sortOrder);
+    }
+
+    @Override
     public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder)
             throws FileNotFoundException {
         final StubDocument parentDocument = mStorage.get(parentDocumentId);
@@ -531,6 +537,16 @@
             this.rootInfo = rootInfo;
             mStorage.put(this.documentId, this);
         }
+        @Override
+        public String toString() {
+            return "StubDocument{"
+                    + "path:" + file.getPath()
+                    + ", mimeType:" + mimeType
+                    + ", rootInfo:" + rootInfo
+                    + ", documentId:" + documentId
+                    + ", parentId:" + parentId
+                    + "}";
+        }
     }
 
     private static String getDocumentIdForFile(File file) {
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/UiBot.java b/packages/DocumentsUI/tests/src/com/android/documentsui/UiBot.java
index ecad061..68cdf12 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/UiBot.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/UiBot.java
@@ -179,6 +179,10 @@
         return find(By.res("com.android.documentsui:id/menu_delete"));
     }
 
+    UiObject2 menuShare() {
+        return find(By.res("com.android.documentsui:id/menu_share"));
+    }
+
     private UiObject2 find(BySelector selector) {
         mDevice.wait(Until.findObject(selector), mTimeout);
         return mDevice.findObject(selector);
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/model/DocumentInfoTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/model/DocumentInfoTest.java
new file mode 100644
index 0000000..a6aba7b
--- /dev/null
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/model/DocumentInfoTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.documentsui.model;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+@SmallTest
+public class DocumentInfoTest extends AndroidTestCase {
+
+    public void testEquals() throws Exception {
+        DocumentInfo doc = createDocInfo("authority.a", "doc.1", "text/plain");
+        assertEquals(doc, doc);
+    }
+
+    public void testNotEquals_differentAuthority() throws Exception {
+        DocumentInfo docA = createDocInfo("authority.a", "doc.1", "text/plain");
+        DocumentInfo docB = createDocInfo("authority.b", "doc.1", "text/plain");
+        assertFalse(docA.equals(docB));
+    }
+
+    public void testNotEquals_differentDocId() throws Exception {
+        DocumentInfo docA = createDocInfo("authority.a", "doc.1", "text/plain");
+        DocumentInfo docB = createDocInfo("authority.a", "doc.2", "text/plain");
+        assertFalse(docA.equals(docB));
+    }
+
+    public void testNotEquals_differentMimetype() throws Exception {
+        DocumentInfo docA = createDocInfo("authority.a", "doc.1", "text/plain");
+        DocumentInfo docB = createDocInfo("authority.a", "doc.1", "image/png");
+        assertFalse(docA.equals(docB));
+    }
+
+    private DocumentInfo createDocInfo(String authority, String docId, String mimeType) {
+        DocumentInfo doc = new DocumentInfo();
+        doc.authority = authority;
+        doc.documentId = docId;
+        doc.mimeType = mimeType;
+        doc.deriveFields();
+        return doc;
+    }
+}
diff --git a/packages/ExternalStorageProvider/res/values-uz-rUZ/strings.xml b/packages/ExternalStorageProvider/res/values-uz-rUZ/strings.xml
index d1a956bf..069e137 100644
--- a/packages/ExternalStorageProvider/res/values-uz-rUZ/strings.xml
+++ b/packages/ExternalStorageProvider/res/values-uz-rUZ/strings.xml
@@ -18,5 +18,5 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="7123375275748530234">"Tashqi xotira"</string>
     <string name="root_internal_storage" msgid="827844243068584127">"Ichki xotira"</string>
-    <string name="root_home" msgid="7931555396767513359">"Shaxsiy"</string>
+    <string name="root_home" msgid="7931555396767513359">"Mening fayllarim"</string>
 </resources>
diff --git a/packages/Keyguard/res/values/config.xml b/packages/Keyguard/res/values/config.xml
index b398ab2..bde6ed5 100644
--- a/packages/Keyguard/res/values/config.xml
+++ b/packages/Keyguard/res/values/config.xml
@@ -23,9 +23,9 @@
     <!-- Allow the menu hard key to be disabled in LockScreen on some devices [DO NOT TRANSLATE] -->
     <bool name="config_disableMenuKeyInLockScreen">false</bool>
 
-    <!-- Threshold in micro amperes below which a charger is rated as "slow" -->
-    <integer name="config_chargingSlowlyThreshold">1000000</integer>
+    <!-- Threshold in micro watts below which a charger is rated as "slow"; 1A @ 5V -->
+    <integer name="config_chargingSlowlyThreshold">5000000</integer>
 
-    <!-- Threshold in micro amperes above which a charger is rated as "fast" -->
-    <integer name="config_chargingFastThreshold">1500000</integer>
+    <!-- Threshold in micro watts above which a charger is rated as "fast"; 1.5A @ 5V  -->
+    <integer name="config_chargingFastThreshold">7500000</integer>
 </resources>
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 3d78028..8102c34 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -75,6 +75,7 @@
 import static android.os.BatteryManager.EXTRA_HEALTH;
 import static android.os.BatteryManager.EXTRA_LEVEL;
 import static android.os.BatteryManager.EXTRA_MAX_CHARGING_CURRENT;
+import static android.os.BatteryManager.EXTRA_MAX_CHARGING_VOLTAGE;
 import static android.os.BatteryManager.EXTRA_PLUGGED;
 import static android.os.BatteryManager.EXTRA_STATUS;
 
@@ -155,6 +156,8 @@
      */
     private static final int FINGERPRINT_STATE_CANCELLING_RESTARTING = 3;
 
+    private static final int DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT = 5000000;
+
     private static KeyguardUpdateMonitor sInstance;
 
     private final Context mContext;
@@ -617,10 +620,25 @@
                 final int plugged = intent.getIntExtra(EXTRA_PLUGGED, 0);
                 final int level = intent.getIntExtra(EXTRA_LEVEL, 0);
                 final int health = intent.getIntExtra(EXTRA_HEALTH, BATTERY_HEALTH_UNKNOWN);
-                final int maxChargingCurrent = intent.getIntExtra(EXTRA_MAX_CHARGING_CURRENT, -1);
+
+                final int maxChargingMicroAmp = intent.getIntExtra(EXTRA_MAX_CHARGING_CURRENT, -1);
+                int maxChargingMicroVolt = intent.getIntExtra(EXTRA_MAX_CHARGING_VOLTAGE, -1);
+                final int maxChargingMicroWatt;
+
+                if (maxChargingMicroVolt <= 0) {
+                    maxChargingMicroVolt = DEFAULT_CHARGING_VOLTAGE_MICRO_VOLT;
+                }
+                if (maxChargingMicroAmp > 0) {
+                    // Calculating muW = muA * muV / (10^6 mu^2 / mu); splitting up the divisor
+                    // to maintain precision equally on both factors.
+                    maxChargingMicroWatt = (maxChargingMicroAmp / 1000)
+                            * (maxChargingMicroVolt / 1000);
+                } else {
+                    maxChargingMicroWatt = -1;
+                }
                 final Message msg = mHandler.obtainMessage(
                         MSG_BATTERY_UPDATE, new BatteryStatus(status, level, plugged, health,
-                        maxChargingCurrent));
+                                maxChargingMicroWatt));
                 mHandler.sendMessage(msg);
             } else if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) {
                 SimData args = SimData.fromIntent(intent);
@@ -806,13 +824,14 @@
         public final int level;
         public final int plugged;
         public final int health;
-        public final int maxChargingCurrent;
-        public BatteryStatus(int status, int level, int plugged, int health, int maxChargingCurrent) {
+        public final int maxChargingWattage;
+        public BatteryStatus(int status, int level, int plugged, int health,
+                int maxChargingWattage) {
             this.status = status;
             this.level = level;
             this.plugged = plugged;
             this.health = health;
-            this.maxChargingCurrent = maxChargingCurrent;
+            this.maxChargingWattage = maxChargingWattage;
         }
 
         /**
@@ -844,9 +863,9 @@
         }
 
         public final int getChargingSpeed(int slowThreshold, int fastThreshold) {
-            return maxChargingCurrent <= 0 ? CHARGING_UNKNOWN :
-                    maxChargingCurrent < slowThreshold ? CHARGING_SLOWLY :
-                    maxChargingCurrent > fastThreshold ? CHARGING_FAST :
+            return maxChargingWattage <= 0 ? CHARGING_UNKNOWN :
+                    maxChargingWattage < slowThreshold ? CHARGING_SLOWLY :
+                    maxChargingWattage > fastThreshold ? CHARGING_FAST :
                     CHARGING_REGULAR;
         }
     }
@@ -1422,7 +1441,7 @@
         }
 
         // change in charging current while plugged in
-        if (nowPluggedIn && current.maxChargingCurrent != old.maxChargingCurrent) {
+        if (nowPluggedIn && current.maxChargingWattage != old.maxChargingWattage) {
             return true;
         }
 
diff --git a/packages/MtpDocumentsProvider/res/drawable-hdpi/ic_root_mtp.png b/packages/MtpDocumentsProvider/res/drawable-hdpi/ic_root_mtp.png
new file mode 100644
index 0000000..7691433
--- /dev/null
+++ b/packages/MtpDocumentsProvider/res/drawable-hdpi/ic_root_mtp.png
Binary files differ
diff --git a/packages/MtpDocumentsProvider/res/drawable-mdpi/ic_root_mtp.png b/packages/MtpDocumentsProvider/res/drawable-mdpi/ic_root_mtp.png
new file mode 100644
index 0000000..1cf7b3a
--- /dev/null
+++ b/packages/MtpDocumentsProvider/res/drawable-mdpi/ic_root_mtp.png
Binary files differ
diff --git a/packages/MtpDocumentsProvider/res/drawable-xhdpi/ic_root_mtp.png b/packages/MtpDocumentsProvider/res/drawable-xhdpi/ic_root_mtp.png
new file mode 100644
index 0000000..27e3542
--- /dev/null
+++ b/packages/MtpDocumentsProvider/res/drawable-xhdpi/ic_root_mtp.png
Binary files differ
diff --git a/packages/MtpDocumentsProvider/res/drawable-xxhdpi/ic_root_mtp.png b/packages/MtpDocumentsProvider/res/drawable-xxhdpi/ic_root_mtp.png
new file mode 100644
index 0000000..3df2578b
--- /dev/null
+++ b/packages/MtpDocumentsProvider/res/drawable-xxhdpi/ic_root_mtp.png
Binary files differ
diff --git a/packages/MtpDocumentsProvider/res/drawable-xxxhdpi/ic_root_mtp.png b/packages/MtpDocumentsProvider/res/drawable-xxxhdpi/ic_root_mtp.png
new file mode 100644
index 0000000..fd2b795
--- /dev/null
+++ b/packages/MtpDocumentsProvider/res/drawable-xxxhdpi/ic_root_mtp.png
Binary files differ
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
index 4afffea..51c0281 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
@@ -22,6 +22,7 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.database.DatabaseUtils;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.database.sqlite.SQLiteQueryBuilder;
@@ -34,6 +35,7 @@
 
 import com.android.internal.annotations.VisibleForTesting;
 
+import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.Objects;
 
@@ -305,6 +307,32 @@
         }
     }
 
+    /**
+     * Returns the set of device ID stored in the database.
+     */
+    int[] getDeviceIds() {
+        final Cursor cursor = mDatabase.query(
+                true,
+                TABLE_DOCUMENTS,
+                strings(COLUMN_DEVICE_ID),
+                null,
+                null,
+                null,
+                null,
+                null,
+                null);
+        try {
+            final int[] ids = new int[cursor.getCount()];
+            for (int i = 0; i < ids.length; i++) {
+                cursor.moveToNext();
+                ids[i] = cursor.getInt(0);
+            }
+            return ids;
+        } finally {
+            cursor.close();
+        }
+    }
+
     private boolean deleteDocumentsAndRoots(String selection, String[] args) {
         mDatabase.beginTransaction();
         try {
@@ -351,6 +379,11 @@
         }
     }
 
+    @VisibleForTesting
+    static void deleteDatabase(Context context) {
+        context.deleteDatabase(DATABASE_NAME);
+    }
+
     /**
      * Gets {@link ContentValues} for the given root.
      * @param values {@link ContentValues} that receives values.
@@ -368,7 +401,7 @@
         values.put(Document.COLUMN_DISPLAY_NAME, root.getRootName(resources));
         values.putNull(Document.COLUMN_SUMMARY);
         values.putNull(Document.COLUMN_LAST_MODIFIED);
-        values.putNull(Document.COLUMN_ICON);
+        values.put(Document.COLUMN_ICON, R.drawable.ic_root_mtp);
         values.put(Document.COLUMN_FLAGS, 0);
         values.put(Document.COLUMN_SIZE,
                 (int) Math.min(root.mMaxCapacity - root.mFreeSpace, Integer.MAX_VALUE));
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabaseConstants.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabaseConstants.java
index b0286aa..0ead2d5 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabaseConstants.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabaseConstants.java
@@ -24,7 +24,7 @@
  */
 class MtpDatabaseConstants {
     static final int DATABASE_VERSION = 1;
-    static final String DATABASE_NAME = null;
+    static final String DATABASE_NAME = "database";
 
     static final int FLAG_DATABASE_IN_MEMORY = 1;
     static final int FLAG_DATABASE_IN_FILE = 0;
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
index 743f583..9511e15 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
@@ -20,7 +20,6 @@
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Resources;
 import android.database.Cursor;
-import android.database.MatrixCursor;
 import android.graphics.Point;
 import android.media.MediaFile;
 import android.mtp.MtpConstants;
@@ -58,11 +57,13 @@
             Document.COLUMN_FLAGS, Document.COLUMN_SIZE,
     };
 
+    private final Object mDeviceListLock = new Object();
+
     private static MtpDocumentsProvider sSingleton;
 
     private MtpManager mMtpManager;
     private ContentResolver mResolver;
-    @GuardedBy("mDeviceToolkits")
+    @GuardedBy("mDeviceListLock")
     private Map<Integer, DeviceToolkit> mDeviceToolkits;
     private RootScanner mRootScanner;
     private Resources mResources;
@@ -84,6 +85,7 @@
         mDeviceToolkits = new HashMap<Integer, DeviceToolkit>();
         mDatabase = new MtpDatabase(getContext(), MtpDatabaseConstants.FLAG_DATABASE_IN_FILE);
         mRootScanner = new RootScanner(mResolver, mResources, mMtpManager, mDatabase);
+        resume();
         return true;
     }
 
@@ -99,6 +101,7 @@
         mDeviceToolkits = new HashMap<Integer, DeviceToolkit>();
         mDatabase = database;
         mRootScanner = new RootScanner(mResolver, mResources, mMtpManager, mDatabase);
+        resume();
     }
 
     @Override
@@ -196,7 +199,7 @@
 
     @Override
     public void onTrimMemory(int level) {
-        synchronized (mDeviceToolkits) {
+        synchronized (mDeviceListLock) {
             for (final DeviceToolkit toolkit : mDeviceToolkits.values()) {
                 toolkit.mDocumentLoader.clearCompletedTasks();
             }
@@ -234,47 +237,26 @@
     }
 
     void openDevice(int deviceId) throws IOException {
-        synchronized (mDeviceToolkits) {
+        synchronized (mDeviceListLock) {
             mMtpManager.openDevice(deviceId);
-            mDeviceToolkits.put(deviceId, new DeviceToolkit(mMtpManager, mResolver, mDatabase));
+            mDeviceToolkits.put(
+                    deviceId, new DeviceToolkit(mMtpManager, mResolver, mDatabase));
         }
         mRootScanner.resume();
     }
 
     void closeDevice(int deviceId) throws IOException, InterruptedException {
-        // TODO: Flush the device before closing (if not closed externally).
-        synchronized (mDeviceToolkits) {
-            getDeviceToolkit(deviceId).mDocumentLoader.clearTasks();
-            mDeviceToolkits.remove(deviceId);
+        synchronized (mDeviceListLock) {
+            closeDeviceInternal(deviceId);
             mDatabase.removeDeviceRows(deviceId);
-            mMtpManager.closeDevice(deviceId);
         }
         mRootScanner.notifyChange();
-        if (!hasOpenedDevices()) {
-            mRootScanner.pause();
-        }
-    }
-
-    synchronized void closeAllDevices() throws InterruptedException {
-        boolean closed = false;
-        for (int deviceId : mMtpManager.getOpenedDeviceIds()) {
-            try {
-                mDatabase.removeDeviceRows(deviceId);
-                mMtpManager.closeDevice(deviceId);
-                getDeviceToolkit(deviceId).mDocumentLoader.clearTasks();
-                closed = true;
-            } catch (IOException d) {
-                Log.d(TAG, "Failed to close the MTP device: " + deviceId);
-            }
-        }
-        if (closed) {
-            mRootScanner.notifyChange();
-            mRootScanner.pause();
-        }
     }
 
     boolean hasOpenedDevices() {
-        return mMtpManager.getOpenedDeviceIds().length != 0;
+        synchronized (mDeviceListLock) {
+            return mMtpManager.getOpenedDeviceIds().length != 0;
+        }
     }
 
     /**
@@ -282,14 +264,18 @@
      */
     @Override
     public void shutdown() {
-        try {
-            closeAllDevices();
-        } catch (InterruptedException e) {
-            // It should fail unit tests by throwing runtime exception.
-            throw new RuntimeException(e.getMessage());
-        } finally {
-            mDatabase.close();
-            super.shutdown();
+        synchronized (mDeviceListLock) {
+            try {
+                for (final int id : mMtpManager.getOpenedDeviceIds()) {
+                    closeDeviceInternal(id);
+                }
+            } catch (InterruptedException|IOException e) {
+                // It should fail unit tests by throwing runtime exception.
+                throw new RuntimeException(e);
+            } finally {
+                mDatabase.close();
+                super.shutdown();
+            }
         }
     }
 
@@ -300,8 +286,35 @@
                 false);
     }
 
+    /**
+     * Reopens MTP devices based on database state.
+     */
+    private void resume() {
+        synchronized (mDeviceListLock) {
+            mDatabase.getMapper().clearMapping();
+            final int[] ids = mDatabase.getDeviceIds();
+            for (final int id : ids) {
+                try {
+                    openDevice(id);
+                } catch (IOException exception) {
+                    mDatabase.removeDeviceRows(id);
+                }
+            }
+        }
+    }
+
+    private void closeDeviceInternal(int deviceId) throws IOException, InterruptedException {
+        // TODO: Flush the device before closing (if not closed externally).
+        getDeviceToolkit(deviceId).mDocumentLoader.clearTasks();
+        mDeviceToolkits.remove(deviceId);
+        mMtpManager.closeDevice(deviceId);
+        if (!hasOpenedDevices()) {
+            mRootScanner.pause();
+        }
+    }
+
     private DeviceToolkit getDeviceToolkit(int deviceId) throws FileNotFoundException {
-        synchronized (mDeviceToolkits) {
+        synchronized (mDeviceListLock) {
             final DeviceToolkit toolkit = mDeviceToolkits.get(deviceId);
             if (toolkit == null) {
                 throw new FileNotFoundException();
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsService.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsService.java
index 723dc14..9b3c20f 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsService.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsService.java
@@ -55,22 +55,20 @@
 
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
-        if (intent == null) {
-            // If intent is null, the service was restarted.
-            // TODO: Recover opened devices here.
-            return START_STICKY;
-        }
-        if (intent.getAction().equals(ACTION_OPEN_DEVICE)) {
-            final UsbDevice device = intent.<UsbDevice>getParcelableExtra(EXTRA_DEVICE);
-            try {
-                final MtpDocumentsProvider provider = MtpDocumentsProvider.getInstance();
-                provider.openDevice(device.getDeviceId());
-                return START_STICKY;
-            } catch (IOException error) {
-                Log.e(MtpDocumentsProvider.TAG, error.getMessage());
+        // If intent is null, the service was restarted.
+        if (intent != null) {
+            if (intent.getAction().equals(ACTION_OPEN_DEVICE)) {
+                final UsbDevice device = intent.<UsbDevice>getParcelableExtra(EXTRA_DEVICE);
+                try {
+                    final MtpDocumentsProvider provider = MtpDocumentsProvider.getInstance();
+                    provider.openDevice(device.getDeviceId());
+                    return START_STICKY;
+                } catch (IOException error) {
+                    Log.e(MtpDocumentsProvider.TAG, error.getMessage());
+                }
+            } else {
+                Log.e(MtpDocumentsProvider.TAG, "Received unknown intent action.");
             }
-        } else {
-            Log.w(MtpDocumentsProvider.TAG, "Received unknown intent action.");
         }
         stopSelfIfNeeded();
         return Service.START_NOT_STICKY;
@@ -78,14 +76,8 @@
 
     @Override
     public void onDestroy() {
-        final MtpDocumentsProvider provider = MtpDocumentsProvider.getInstance();
         unregisterReceiver(mReceiver);
         mReceiver = null;
-        try {
-            provider.closeAllDevices();
-        } catch (InterruptedException e) {
-            Log.e(MtpDocumentsProvider.TAG, e.getMessage());
-        }
         super.onDestroy();
     }
 
diff --git a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java
index 714936d..cd52f31 100644
--- a/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java
+++ b/packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java
@@ -32,6 +32,7 @@
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.ArrayList;
 
 /**
  * The model wrapping android.mtp API.
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
index 6d9193d..67b0672 100644
--- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
@@ -80,7 +80,7 @@
             assertEquals("displayName", "Device Storage", cursor.getString(5));
             assertTrue("summary", cursor.isNull(6));
             assertTrue("lastModified", cursor.isNull(7));
-            assertTrue("icon", cursor.isNull(8));
+            assertEquals("icon", R.drawable.ic_root_mtp, cursor.getInt(8));
             assertEquals("flag", 0, cursor.getInt(9));
             assertEquals("size", 1000, cursor.getInt(10));
 
@@ -111,7 +111,7 @@
             cursor.moveToNext();
             assertEquals(1, cursor.getInt(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            assertTrue(cursor.isNull(2));
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device Storage", cursor.getString(3));
             assertTrue(cursor.isNull(4));
             assertEquals(1, cursor.getInt(5));
@@ -121,7 +121,7 @@
             cursor.moveToNext();
             assertEquals(2, cursor.getInt(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            assertTrue(cursor.isNull(2));
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device Storage", cursor.getString(3));
             assertTrue(cursor.isNull(4));
             assertEquals(2, cursor.getInt(5));
@@ -131,7 +131,7 @@
             cursor.moveToNext();
             assertEquals(3, cursor.getInt(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            assertTrue(cursor.isNull(2));
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device /@#%&<>Storage", cursor.getString(3));
             assertTrue(cursor.isNull(4));
             assertEquals(3, cursor.getInt(5));
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java
index 7a53a90..dc6f79e 100644
--- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDocumentsProviderTest.java
@@ -23,6 +23,7 @@
 import android.provider.DocumentsContract.Root;
 import android.provider.DocumentsContract;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.SmallTest;
 
 import java.io.FileNotFoundException;
@@ -45,17 +46,16 @@
     public void setUp() throws IOException {
         mResolver = new TestContentResolver();
         mMtpManager = new TestMtpManager(getContext());
-        mProvider = new MtpDocumentsProvider();
-        mDatabase = new MtpDatabase(getContext(), MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
-        mProvider.onCreateForTesting(mResources, mMtpManager, mResolver, mDatabase);
     }
 
     @Override
     public void tearDown() {
         mProvider.shutdown();
+        MtpDatabase.deleteDatabase(getContext());
     }
 
     public void testOpenAndCloseDevice() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mMtpManager.setRoots(0, new MtpRoot[] {
                 new MtpRoot(
@@ -76,6 +76,7 @@
     }
 
     public void testOpenAndCloseErrorDevice() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         try {
             mProvider.openDevice(1);
             fail();
@@ -107,6 +108,7 @@
     }
 
     public void testQueryRoots() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mMtpManager.addValidDevice(1);
         mMtpManager.setRoots(0, new MtpRoot[] {
@@ -138,8 +140,7 @@
             cursor.moveToNext();
             assertEquals("1", cursor.getString(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            // TODO: Add storage icon for MTP devices.
-            assertTrue(cursor.isNull(2) /* icon */);
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device A Storage A", cursor.getString(3));
             assertEquals("1", cursor.getString(4));
             assertEquals(1024, cursor.getInt(5));
@@ -154,8 +155,7 @@
             cursor.moveToNext();
             assertEquals("2", cursor.getString(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            // TODO: Add storage icon for MTP devices.
-            assertTrue(cursor.isNull(2) /* icon */);
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device B Storage B", cursor.getString(3));
             assertEquals("2", cursor.getString(4));
             assertEquals(2048, cursor.getInt(5));
@@ -163,6 +163,7 @@
     }
 
     public void testQueryRoots_error() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mMtpManager.addValidDevice(1);
         // Not set roots for device 0 so that MtpManagerMock#getRoots throws IOException.
@@ -186,8 +187,7 @@
             cursor.moveToNext();
             assertEquals("1", cursor.getString(0));
             assertEquals(Root.FLAG_SUPPORTS_IS_CHILD | Root.FLAG_SUPPORTS_CREATE, cursor.getInt(1));
-            // TODO: Add storage icon for MTP devices.
-            assertTrue(cursor.isNull(2) /* icon */);
+            assertEquals(R.drawable.ic_root_mtp, cursor.getInt(2));
             assertEquals("Device B Storage B", cursor.getString(3));
             assertEquals("1", cursor.getString(4));
             assertEquals(2048, cursor.getInt(5));
@@ -195,6 +195,7 @@
     }
 
     public void testQueryDocument() throws IOException, InterruptedException, TimeoutException {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
 
@@ -234,6 +235,7 @@
 
     public void testQueryDocument_directory()
             throws IOException, InterruptedException, TimeoutException {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
 
@@ -271,6 +273,7 @@
 
     public void testQueryDocument_forRoot()
             throws IOException, InterruptedException, TimeoutException {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
 
@@ -297,6 +300,7 @@
     }
 
     public void testQueryChildDocuments() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
 
@@ -332,6 +336,7 @@
     }
 
     public void testQueryChildDocuments_cursorError() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
         try {
@@ -343,6 +348,7 @@
     }
 
     public void testQueryChildDocuments_documentError() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
         setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 1000, 1000, "") });
@@ -356,6 +362,7 @@
     }
 
     public void testDeleteDocument() throws IOException, InterruptedException, TimeoutException {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
         setupRoots(0, new MtpRoot[] {
@@ -377,6 +384,7 @@
 
     public void testDeleteDocument_error()
             throws IOException, InterruptedException, TimeoutException {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
         mMtpManager.addValidDevice(0);
         mProvider.openDevice(0);
         setupRoots(0, new MtpRoot[] {
@@ -400,6 +408,40 @@
                         MtpDocumentsProvider.AUTHORITY, "1")));
     }
 
+    @MediumTest
+    public void testPauseAndResume() throws Exception {
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_FILE);
+        mMtpManager.addValidDevice(0);
+        mProvider.openDevice(0);
+        setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 0, 0, "")});
+
+        {
+            final Cursor cursor = mProvider.queryRoots(
+                    strings(DocumentsContract.Root.COLUMN_ROOT_ID));
+            cursor.moveToNext();
+            assertEquals(1, cursor.getInt(0));
+        }
+
+        mProvider.shutdown();
+        setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_FILE);
+
+        {
+            // We can still fetch roots after relaunching the provider.
+            final Cursor cursor = mProvider.queryRoots(
+                    strings(DocumentsContract.Root.COLUMN_ROOT_ID));
+            assertEquals(1, cursor.getCount());
+            cursor.moveToNext();
+            assertEquals(1, cursor.getInt(0));
+            assertEquals(1, mMtpManager.getOpenedDeviceIds().length);
+        }
+    }
+
+    private void setupProvider(int flag) {
+        mDatabase = new MtpDatabase(getContext(), flag);
+        mProvider = new MtpDocumentsProvider();
+        mProvider.onCreateForTesting(mResources, mMtpManager, mResolver, mDatabase);
+    }
+
     private String[] getStrings(Cursor cursor) {
         try {
             final String[] results = new String[cursor.getCount()];
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
index 5547771..ed617e7 100644
--- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
@@ -16,26 +16,21 @@
 
 package com.android.mtp;
 
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
 import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
 import android.hardware.usb.UsbDevice;
-import android.hardware.usb.UsbDeviceConnection;
 import android.hardware.usb.UsbManager;
 import android.os.CancellationSignal;
 import android.os.OperationCanceledException;
 import android.test.InstrumentationTestCase;
 
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
 
 @RealDeviceTest
 public class MtpManagerTest extends InstrumentationTestCase {
-    private static final String ACTION_USB_PERMISSION =
-            "com.android.mtp.USB_PERMISSION";
+
     private static final int TIMEOUT_MS = 1000;
     UsbManager mUsbManager;
     MtpManager mManager;
@@ -45,10 +40,8 @@
     @Override
     public void setUp() throws Exception {
         mUsbManager = getContext().getSystemService(UsbManager.class);
-        mUsbDevice = findDevice();
         mManager = new MtpManager(getContext());
-        mManager.openDevice(mUsbDevice.getDeviceId());
-        waitForStorages(mManager, mUsbDevice.getDeviceId());
+        mUsbDevice = TestUtil.setupMtpDevice(getInstrumentation(), mUsbManager, mManager);
     }
 
     @Override
@@ -56,88 +49,30 @@
         mManager.closeDevice(mUsbDevice.getDeviceId());
     }
 
+    @Override
+    public TestResultInstrumentation getInstrumentation() {
+        return (TestResultInstrumentation) super.getInstrumentation();
+    }
+
     public void testCancelEvent() throws Exception {
         final CancellationSignal signal = new CancellationSignal();
-        final Thread thread = new Thread() {
-            @Override
-            public void run() {
-                try {
-                    mManager.readEvent(mUsbDevice.getDeviceId(), signal);
-                } catch (OperationCanceledException | IOException e) {
-                    show(e.getMessage());
-                }
-            }
-        };
+        final FutureTask<Boolean> future = new FutureTask<Boolean>(
+                new Callable<Boolean>() {
+                    @Override
+                    public Boolean call() throws IOException {
+                        try {
+                            mManager.readEvent(mUsbDevice.getDeviceId(), signal);
+                            return false;
+                        } catch (OperationCanceledException exception) {
+                            return true;
+                        }
+                    }
+                });
+        final Thread thread = new Thread(future);
         thread.start();
         Thread.sleep(TIMEOUT_MS);
         signal.cancel();
-        thread.join(TIMEOUT_MS);
-    }
-
-    private void requestPermission(UsbDevice device) throws InterruptedException {
-        if (mUsbManager.hasPermission(device)) {
-            return;
-        }
-        final CountDownLatch latch = new CountDownLatch(1);
-        final BroadcastReceiver receiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                latch.countDown();
-                getInstrumentation().getTargetContext().unregisterReceiver(this);
-            }
-        };
-        getInstrumentation().getTargetContext().registerReceiver(
-                receiver, new IntentFilter(ACTION_USB_PERMISSION));
-        mUsbManager.requestPermission(device, PendingIntent.getBroadcast(
-                getInstrumentation().getTargetContext(),
-                0 /* requstCode */,
-                new Intent(ACTION_USB_PERMISSION),
-                0 /* flags */));
-        latch.await();
-        assertTrue(mUsbManager.hasPermission(device));
-    }
-
-    private UsbDevice findDevice() throws InterruptedException {
-        while (true) {
-            final HashMap<String,UsbDevice> devices = mUsbManager.getDeviceList();
-            if (devices.size() == 0) {
-                show("Wait for devices.");
-                Thread.sleep(1000);
-                continue;
-            }
-            final UsbDevice device = devices.values().iterator().next();
-            requestPermission(device);
-            final UsbDeviceConnection connection = mUsbManager.openDevice(device);
-            if (connection == null) {
-                fail("Cannot open USB connection.");
-            }
-            for (int i = 0; i < device.getInterfaceCount(); i++) {
-                // Since the test runs real environment, we need to call claim interface with
-                // force = true to rob interfaces from other applications.
-                connection.claimInterface(device.getInterface(i), true);
-                connection.releaseInterface(device.getInterface(i));
-            }
-            connection.close();
-            return device;
-        }
-    }
-
-    private void waitForStorages(MtpManager manager, int deviceId) throws Exception {
-        while (true) {
-            if (manager.getRoots(deviceId).length == 0) {
-                show("Wait for storages.");
-                Thread.sleep(1000);
-                continue;
-            }
-            return;
-        }
-    }
-
-    private void show(String message) {
-        if (!(getInstrumentation() instanceof TestResultInstrumentation)) {
-            return;
-        }
-        ((TestResultInstrumentation) getInstrumentation()).show(message);
+        assertTrue(future.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
     }
 
     private Context getContext() {
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java
index 0fb0f34..4e4cf78 100644
--- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.android.mtp;
 
 import android.os.Bundle;
@@ -7,6 +23,10 @@
 import junit.framework.Test;
 import junit.framework.TestListener;
 
+/**
+ * Instrumentation that can show the test result in the TestResultActivity.
+ * It's useful when it runs testcases with a real USB device and could not use USB port for ADB.
+ */
 public class TestResultInstrumentation extends InstrumentationTestRunner implements TestListener {
     private boolean mHasError = false;
 
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java
new file mode 100644
index 0000000..f910321
--- /dev/null
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.mtp;
+
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.hardware.usb.UsbDevice;
+import android.hardware.usb.UsbDeviceConnection;
+import android.hardware.usb.UsbManager;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.concurrent.CountDownLatch;
+import junit.framework.Assert;
+
+/**
+ * Static utility methods for testing.
+ */
+final class TestUtil {
+    private static final String ACTION_USB_PERMISSION =
+            "com.android.mtp.USB_PERMISSION";
+
+    private TestUtil() {}
+
+    /**
+     * Requests permission for a MTP device and returns the first MTP device that has at least one
+     * storage.
+     */
+    static UsbDevice setupMtpDevice(
+            TestResultInstrumentation instrumentation,
+            UsbManager usbManager,
+            MtpManager manager) throws InterruptedException, IOException {
+        for (int i = 0; i < 2; i++) {
+            final UsbDevice device = findMtpDevice(instrumentation, usbManager);
+            manager.openDevice(device.getDeviceId());
+            try {
+                waitForStorages(instrumentation, manager, device.getDeviceId());
+                return device;
+            } catch (IOException exp) {
+                // When the MTP device is Android, and it changes the USB device type from
+                // "Charging" to "MTP", the device ID will be updated. We need to find a device
+                // again.
+                continue;
+            }
+        }
+        throw new IOException("Failed to obtain MTP devices");
+    }
+
+    private static UsbDevice findMtpDevice(
+            TestResultInstrumentation instrumentation,
+            UsbManager usbManager) throws InterruptedException {
+        while (true) {
+            final HashMap<String,UsbDevice> devices = usbManager.getDeviceList();
+            if (devices.size() == 0) {
+                instrumentation.show("Wait for devices.");
+                Thread.sleep(1000);
+                continue;
+            }
+            final UsbDevice device = devices.values().iterator().next();
+            requestPermission(instrumentation, usbManager, device);
+            final UsbDeviceConnection connection = usbManager.openDevice(device);
+            if (connection == null) {
+                Assert.fail("Cannot open USB connection.");
+                return null;
+            }
+            for (int i = 0; i < device.getInterfaceCount(); i++) {
+                // Since the test runs real environment, we need to call claim interface with
+                // force = true to rob interfaces from other applications.
+                connection.claimInterface(device.getInterface(i), true);
+                connection.releaseInterface(device.getInterface(i));
+            }
+            connection.close();
+            return device;
+        }
+    }
+
+    private static void requestPermission(
+            final TestResultInstrumentation instrumentation,
+            UsbManager usbManager,
+            UsbDevice device) throws InterruptedException {
+        if (usbManager.hasPermission(device)) {
+            return;
+        }
+        final CountDownLatch latch = new CountDownLatch(1);
+        final BroadcastReceiver receiver = new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                latch.countDown();
+                instrumentation.getTargetContext().unregisterReceiver(this);
+            }
+        };
+        instrumentation.getTargetContext().registerReceiver(
+                receiver, new IntentFilter(ACTION_USB_PERMISSION));
+        usbManager.requestPermission(device, PendingIntent.getBroadcast(
+                instrumentation.getTargetContext(),
+                0 /* requstCode */,
+                new Intent(ACTION_USB_PERMISSION),
+                0 /* flags */));
+        latch.await();
+        Assert.assertTrue(usbManager.hasPermission(device));
+    }
+
+    private static void waitForStorages(
+            TestResultInstrumentation instrumentation,
+            MtpManager manager,
+            int deviceId) throws IOException, InterruptedException {
+        while (true) {
+            if (manager.getRoots(deviceId).length == 0) {
+                instrumentation.show("Wait for storages.");
+                Thread.sleep(1000);
+                continue;
+            }
+            return;
+        }
+    }
+}
diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java b/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java
index f006ccb..82fd512 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/model/NotificationController.java
@@ -16,6 +16,8 @@
 
 package com.android.printspooler.model;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.Notification;
 import android.app.Notification.Action;
 import android.app.Notification.InboxStyle;
@@ -129,68 +131,69 @@
                 mContext.getString(R.string.cancel), createCancelIntent(printJob)).build();
     }
 
-    private void createPrintingNotification(PrintJobInfo printJob) {
+    /**
+     * Create a notification for a print job.
+     *
+     * @param printJob the job the notification is for
+     * @param firstAction the first action shown in the notification
+     * @param secondAction the second action shown in the notification
+     */
+    private void createNotification(@NonNull PrintJobInfo printJob, @Nullable Action firstAction,
+            @Nullable Action secondAction) {
         Notification.Builder builder = new Notification.Builder(mContext)
                 .setContentIntent(createContentIntent(printJob.getId()))
                 .setSmallIcon(computeNotificationIcon(printJob))
                 .setContentTitle(computeNotificationTitle(printJob))
-                .addAction(createCancelAction(printJob))
-                .setContentText(printJob.getPrinterName())
                 .setWhen(System.currentTimeMillis())
                 .setOngoing(true)
                 .setShowWhen(true)
                 .setColor(mContext.getColor(
                         com.android.internal.R.color.system_notification_accent_color));
+
+        if (firstAction != null) {
+            builder.addAction(firstAction);
+        }
+
+        if (secondAction != null) {
+            builder.addAction(secondAction);
+        }
+
+        if (printJob.getState() == PrintJobInfo.STATE_STARTED) {
+            float progress = printJob.getProgress();
+            if (progress >= 0) {
+                builder.setProgress(Integer.MAX_VALUE, (int)(Integer.MAX_VALUE * progress),
+                        false);
+            }
+        }
+
+        CharSequence status = printJob.getStatus();
+        if (status != null) {
+            builder.setContentText(status);
+        } else {
+            builder.setContentText(printJob.getPrinterName());
+        }
+
         mNotificationManager.notify(0, builder.build());
     }
 
+    private void createPrintingNotification(PrintJobInfo printJob) {
+        createNotification(printJob, createCancelAction(printJob), null);
+    }
+
     private void createFailedNotification(PrintJobInfo printJob) {
         Action.Builder restartActionBuilder = new Action.Builder(
                 Icon.createWithResource(mContext, R.drawable.ic_restart),
                 mContext.getString(R.string.restart), createRestartIntent(printJob.getId()));
 
-        Notification.Builder builder = new Notification.Builder(mContext)
-                .setContentIntent(createContentIntent(printJob.getId()))
-                .setSmallIcon(computeNotificationIcon(printJob))
-                .setContentTitle(computeNotificationTitle(printJob))
-                .addAction(createCancelAction(printJob))
-                .addAction(restartActionBuilder.build())
-                .setContentText(printJob.getPrinterName())
-                .setWhen(System.currentTimeMillis())
-                .setOngoing(true)
-                .setShowWhen(true)
-                .setColor(mContext.getColor(
-                        com.android.internal.R.color.system_notification_accent_color));
-        mNotificationManager.notify(0, builder.build());
+        createNotification(printJob, createCancelAction(printJob), restartActionBuilder.build());
     }
 
     private void createBlockedNotification(PrintJobInfo printJob) {
-        Notification.Builder builder = new Notification.Builder(mContext)
-                .setContentIntent(createContentIntent(printJob.getId()))
-                .setSmallIcon(computeNotificationIcon(printJob))
-                .setContentTitle(computeNotificationTitle(printJob))
-                .addAction(createCancelAction(printJob))
-                .setContentText(printJob.getPrinterName())
-                .setWhen(System.currentTimeMillis())
-                .setOngoing(true)
-                .setShowWhen(true)
-                .setColor(mContext.getColor(
-                        com.android.internal.R.color.system_notification_accent_color));
-           mNotificationManager.notify(0, builder.build());
+        createNotification(printJob, createCancelAction(printJob), null);
     }
 
     private void createCancellingNotification(PrintJobInfo printJob) {
-        Notification.Builder builder = new Notification.Builder(mContext)
-                .setContentIntent(createContentIntent(printJob.getId()))
-                .setSmallIcon(computeNotificationIcon(printJob))
-                .setContentTitle(computeNotificationTitle(printJob))
-                .setContentText(printJob.getPrinterName())
-                .setWhen(System.currentTimeMillis())
-                .setOngoing(true)
-                .setShowWhen(true)
-                .setColor(mContext.getColor(
-                        com.android.internal.R.color.system_notification_accent_color));
-        mNotificationManager.notify(0, builder.build());
+        createNotification(printJob, null, null);
     }
 
     private void createStackedNotification(List<PrintJobInfo> printJobs) {
diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerService.java b/packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerService.java
index 7adcfec..90eef83 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerService.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/model/PrintSpoolerService.java
@@ -16,6 +16,9 @@
 
 package com.android.printspooler.model;
 
+import android.annotation.FloatRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.Service;
 import android.content.ComponentName;
 import android.content.Context;
@@ -497,7 +500,7 @@
                 success = true;
 
                 printJob.setState(state);
-                printJob.setStateReason(error);
+                printJob.setStatus(error);
                 printJob.setCancelling(false);
 
                 if (DEBUG_PRINT_JOB_LIFECYCLE) {
@@ -547,6 +550,35 @@
         return success;
     }
 
+    /**
+     * Set the progress for a print job.
+     *
+     * @param printJobId ID of the print job to update
+     * @param progress the new progress
+     */
+    public void setProgress(@NonNull PrintJobId printJobId,
+            @FloatRange(from=0.0, to=1.0) float progress) {
+        synchronized (mLock) {
+            getPrintJobInfo(printJobId, PrintManager.APP_ID_ANY).setProgress(progress);
+
+            mNotificationController.onUpdateNotifications(mPrintJobs);
+        }
+    }
+
+   /**
+    * Set the status for a print job.
+    *
+    * @param printJobId ID of the print job to update
+    * @param status the new status
+    */
+   public void setStatus(@NonNull PrintJobId printJobId, @Nullable CharSequence status) {
+       synchronized (mLock) {
+           getPrintJobInfo(printJobId, PrintManager.APP_ID_ANY).setStatus(status);
+
+           mNotificationController.onUpdateNotifications(mPrintJobs);
+       }
+   }
+
     public boolean hasActivePrintJobsLocked() {
         final int printJobCount = mPrintJobs.size();
         for (int i = 0; i < printJobCount; i++) {
@@ -693,6 +725,8 @@
         private static final String ATTR_COPIES = "copies";
         private static final String ATTR_PRINTER_NAME = "printerName";
         private static final String ATTR_STATE_REASON = "stateReason";
+        private static final String ATTR_STATUS = "status";
+        private static final String ATTR_PROGRESS = "progress";
         private static final String ATTR_CANCELLING = "cancelling";
 
         private static final String TAG_ADVANCED_OPTIONS = "advancedOptions";
@@ -801,13 +835,19 @@
                     if (!TextUtils.isEmpty(printerName)) {
                         serializer.attribute(null, ATTR_PRINTER_NAME, printerName);
                     }
-                    String stateReason = printJob.getStateReason();
-                    if (!TextUtils.isEmpty(stateReason)) {
-                        serializer.attribute(null, ATTR_STATE_REASON, stateReason);
-                    }
                     serializer.attribute(null, ATTR_CANCELLING, String.valueOf(
                             printJob.isCancelling()));
 
+                    float progress = printJob.getProgress();
+                    if (progress != Float.NaN) {
+                        serializer.attribute(null, ATTR_PROGRESS, String.valueOf(progress));
+                    }
+
+                    CharSequence status = printJob.getStatus();
+                    if (!TextUtils.isEmpty(status)) {
+                        serializer.attribute(null, ATTR_STATUS, status.toString());
+                    }
+
                     PrinterId printerId = printJob.getPrinterId();
                     if (printerId != null) {
                         serializer.startTag(null, TAG_PRINTER_ID);
@@ -1025,8 +1065,25 @@
             printJob.setCopies(Integer.parseInt(copies));
             String printerName = parser.getAttributeValue(null, ATTR_PRINTER_NAME);
             printJob.setPrinterName(printerName);
+
+            String progressString = parser.getAttributeValue(null, ATTR_PROGRESS);
+            if (progressString != null) {
+                float progress = Float.parseFloat(progressString);
+
+                if (progress != -1) {
+                    printJob.setProgress(progress);
+                }
+            }
+
+            CharSequence status = parser.getAttributeValue(null, ATTR_STATUS);
+            printJob.setStatus(status);
+
+            // stateReason is deprecated, but might be used by old print jobs
             String stateReason = parser.getAttributeValue(null, ATTR_STATE_REASON);
-            printJob.setStateReason(stateReason);
+            if (stateReason != null) {
+                printJob.setStatus(stateReason);
+            }
+
             String cancelling = parser.getAttributeValue(null, ATTR_CANCELLING);
             printJob.setCancelling(!TextUtils.isEmpty(cancelling)
                     ? Boolean.parseBoolean(cancelling) : false);
@@ -1323,6 +1380,18 @@
                     .removeApprovedService(serviceToRemove);
         }
 
+        @Override
+        public void setProgress(@NonNull PrintJobId printJobId,
+                @FloatRange(from=0.0, to=1.0) float progress) throws RemoteException {
+            PrintSpoolerService.this.setProgress(printJobId, progress);
+        }
+
+        @Override
+        public void setStatus(@NonNull PrintJobId printJobId,
+                @Nullable CharSequence status) throws RemoteException {
+            PrintSpoolerService.this.setStatus(printJobId, status);
+        }
+
         public PrintSpoolerService getService() {
             return PrintSpoolerService.this;
         }
diff --git a/packages/SettingsLib/res/values-pl/strings.xml b/packages/SettingsLib/res/values-pl/strings.xml
index 8fa5abf..98a171e 100644
--- a/packages/SettingsLib/res/values-pl/strings.xml
+++ b/packages/SettingsLib/res/values-pl/strings.xml
@@ -72,7 +72,7 @@
     <string name="bluetooth_pairing_accept" msgid="6163520056536604875">"Sparuj"</string>
     <string name="bluetooth_pairing_accept_all_caps" msgid="6061699265220789149">"SPARUJ"</string>
     <string name="bluetooth_pairing_decline" msgid="4185420413578948140">"Anuluj"</string>
-    <string name="bluetooth_pairing_will_share_phonebook" msgid="4982239145676394429">"Parowanie spowoduje przyznanie dostępu do historii połączeń i Twoich kontaktów w trakcie połączenia."</string>
+    <string name="bluetooth_pairing_will_share_phonebook" msgid="4982239145676394429">"Sparowanie powoduje przyznanie dostępu do historii połączeń i Twoich kontaktów w trakcie połączenia."</string>
     <string name="bluetooth_pairing_error_message" msgid="3748157733635947087">"Nie można sparować z urządzeniem <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="bluetooth_pairing_pin_error_message" msgid="8337234855188925274">"Nie można sparować z urządzeniem <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ze względu na błędny kod PIN lub klucz."</string>
     <string name="bluetooth_pairing_device_down_error_message" msgid="7870998403045801381">"Nie można skomunikować się z urządzeniem <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
diff --git a/packages/SettingsLib/res/values-th/strings.xml b/packages/SettingsLib/res/values-th/strings.xml
index 029962e..c3c287c 100644
--- a/packages/SettingsLib/res/values-th/strings.xml
+++ b/packages/SettingsLib/res/values-th/strings.xml
@@ -38,7 +38,7 @@
     <string name="bluetooth_disconnecting" msgid="8913264760027764974">"กำลังตัดการเชื่อมต่อ..."</string>
     <string name="bluetooth_connecting" msgid="8555009514614320497">"กำลังเชื่อมต่อ…"</string>
     <string name="bluetooth_connected" msgid="6038755206916626419">"เชื่อมต่อแล้ว"</string>
-    <string name="bluetooth_pairing" msgid="1426882272690346242">"กำลังกำหนดค่าอุปกรณ์ให้ตรงกัน..."</string>
+    <string name="bluetooth_pairing" msgid="1426882272690346242">"กำลังจับคู่อุปกรณ์..."</string>
     <string name="bluetooth_connected_no_headset" msgid="2866994875046035609">"เชื่อมต่อแล้ว (ยกเว้นเสียงโทรศัพท์)"</string>
     <string name="bluetooth_connected_no_a2dp" msgid="4576188601581440337">"เชื่อมต่อแล้ว (ยกเว้นเสียงสื่อ)"</string>
     <string name="bluetooth_connected_no_map" msgid="6504436917057479986">"เชื่อมต่อแล้ว (ไม่มีการเข้าถึงข้อความ)"</string>
@@ -69,14 +69,14 @@
     <string name="bluetooth_headset_profile_summary_use_for" msgid="8705753622443862627">"ใช้สำหรับระบบเสียงของโทรศัพท์"</string>
     <string name="bluetooth_opp_profile_summary_use_for" msgid="1255674547144769756">"ใช้สำหรับการโอนไฟล์"</string>
     <string name="bluetooth_hid_profile_summary_use_for" msgid="232727040453645139">"ใช้สำหรับการป้อนข้อมูล"</string>
-    <string name="bluetooth_pairing_accept" msgid="6163520056536604875">"กำหนดค่าอุปกรณ์ให้ตรงกัน"</string>
+    <string name="bluetooth_pairing_accept" msgid="6163520056536604875">"จับคู่อุปกรณ์"</string>
     <string name="bluetooth_pairing_accept_all_caps" msgid="6061699265220789149">"จับคู่อุปกรณ์"</string>
     <string name="bluetooth_pairing_decline" msgid="4185420413578948140">"ยกเลิก"</string>
     <string name="bluetooth_pairing_will_share_phonebook" msgid="4982239145676394429">"การจับคู่อุปกรณ์จะให้สิทธิ์การเข้าถึงที่อยู่ติดต่อและประวัติการโทรเมื่อเชื่อมต่อแล้ว"</string>
     <string name="bluetooth_pairing_error_message" msgid="3748157733635947087">"ไม่สามารถจับคู่กับ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="bluetooth_pairing_pin_error_message" msgid="8337234855188925274">"ไม่สามารถจับคู่กับ <xliff:g id="DEVICE_NAME">%1$s</xliff:g> ได้เพราะ PIN หรือรหัสผ่านไม่ถูกต้อง"</string>
     <string name="bluetooth_pairing_device_down_error_message" msgid="7870998403045801381">"ไม่สามารถเชื่อมต่อกับ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
-    <string name="bluetooth_pairing_rejected_error_message" msgid="1648157108520832454">"การกำหนดค่าอุปกรณ์ให้ตรงกันถูกปฏิเสธโดย <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <string name="bluetooth_pairing_rejected_error_message" msgid="1648157108520832454">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ปฏิเสธการจับคู่อุปกรณ์"</string>
     <string name="accessibility_wifi_off" msgid="1166761729660614716">"Wi-Fi ปิดอยู่"</string>
     <string name="accessibility_no_wifi" msgid="8834610636137374508">"ไม่ได้เชื่อมต่อ Wi-Fi"</string>
     <string name="accessibility_wifi_one_bar" msgid="4869376278894301820">"สัญญาณ Wi-Fi 1 ขีด"</string>
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index c9a5f8f..e6fe447 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -116,7 +116,7 @@
 
     final HandlerThread mThread;
     final BackgroundHandler mBackgroundHandler;
-    final MainHandler mMainHandler = new MainHandler();
+    final MainHandler mMainHandler = new MainHandler(Looper.getMainLooper());
 
     private ApplicationsState(Application app) {
         mContext = app;
@@ -687,6 +687,10 @@
         static final int MSG_LAUNCHER_INFO_CHANGED = 7;
         static final int MSG_LOAD_ENTRIES_COMPLETE = 8;
 
+        public MainHandler(Looper looper) {
+            super(looper);
+        }
+
         @Override
         public void handleMessage(Message msg) {
             rebuildActiveSessions();
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardTile.java b/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardTile.java
index 6fef134..347e9f7 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardTile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardTile.java
@@ -74,6 +74,11 @@
      */
     public int priority;
 
+    /**
+     * The metaData from the activity that defines this tile.
+     */
+    public Bundle metaData;
+
     public DashboardTile() {
         // Empty
     }
@@ -107,6 +112,7 @@
         dest.writeBundle(extras);
         dest.writeString(category);
         dest.writeInt(priority);
+        dest.writeBundle(metaData);
     }
 
     public void readFromParcel(Parcel in) {
@@ -125,6 +131,7 @@
         extras = in.readBundle();
         category = in.readString();
         priority = in.readInt();
+        metaData = in.readBundle();
     }
 
     DashboardTile(Parcel in) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
index 6102bef..102e47a 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerActivity.java
@@ -18,9 +18,15 @@
 import android.annotation.LayoutRes;
 import android.annotation.Nullable;
 import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.res.TypedArray;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.support.v4.widget.DrawerLayout;
+import android.util.Log;
 import android.util.Pair;
 import android.view.Gravity;
 import android.view.LayoutInflater;
@@ -33,21 +39,30 @@
 import android.widget.Toolbar;
 import com.android.settingslib.R;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
 public class SettingsDrawerActivity extends Activity {
 
+    protected static final boolean DEBUG_TIMING = false;
+    private static final String TAG = "SettingsDrawerActivity";
+
+    private static List<DashboardCategory> sDashboardCategories;
+    private static HashMap<Pair<String, String>, DashboardTile> sTileCache;
+
+    private final PackageReceiver mPackageReceiver = new PackageReceiver();
+    private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
+
     private SettingsDrawerAdapter mDrawerAdapter;
-    // Hold on to a cache of tiles to avoid loading the info multiple times.
-    private final HashMap<Pair<String, String>, DashboardTile> mTileCache = new HashMap<>();
-    private List<DashboardCategory> mDashboardCategories;
     private DrawerLayout mDrawerLayout;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        long startTime = System.currentTimeMillis();
+
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         super.setContentView(R.layout.settings_with_drawer);
         mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
@@ -62,6 +77,7 @@
             mDrawerLayout = null;
             return;
         }
+        getDashboardCategories();
         setActionBar(toolbar);
         mDrawerAdapter = new SettingsDrawerAdapter(this);
         ListView listView = (ListView) findViewById(R.id.left_drawer);
@@ -72,6 +88,8 @@
                 onTileClicked(mDrawerAdapter.getTile(position));
             };
         });
+        if (DEBUG_TIMING) Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime)
+                + " ms");
     }
 
     @Override
@@ -88,7 +106,33 @@
     protected void onResume() {
         super.onResume();
 
-        updateDrawer();
+        if (mDrawerLayout != null) {
+            final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
+            filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
+            filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
+            filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
+            filter.addDataScheme("package");
+            registerReceiver(mPackageReceiver, filter);
+
+            new CategoriesUpdater().execute();
+        }
+    }
+
+    @Override
+    protected void onPause() {
+        if (mDrawerLayout != null) {
+            unregisterReceiver(mPackageReceiver);
+        }
+
+        super.onPause();
+    }
+
+    public void addCategoryListener(CategoryListener listener) {
+        mCategoryListeners.add(listener);
+    }
+
+    public void remCategoryListener(CategoryListener listener) {
+        mCategoryListeners.remove(listener);
     }
 
     public void openDrawer() {
@@ -134,15 +178,27 @@
         }
     }
 
-    public List<DashboardCategory> getDashboardCategories(boolean force) {
-        if (force) {
-            mDashboardCategories = TileUtils.getCategories(this, mTileCache);
+    public List<DashboardCategory> getDashboardCategories() {
+        if (sDashboardCategories == null) {
+            sTileCache = new HashMap<>();
+            sDashboardCategories = TileUtils.getCategories(this, sTileCache);
         }
-        return mDashboardCategories;
+        return sDashboardCategories;
+    }
+
+    protected void onCategoriesChanged() {
+        updateDrawer();
+        final int N = mCategoryListeners.size();
+        for (int i = 0; i < N; i++) {
+            mCategoryListeners.get(i).onCategoriesChanged();
+        }
     }
 
     public boolean openTile(DashboardTile tile) {
         closeDrawer();
+        if (tile == null) {
+            return false;
+        }
         int numUserHandles = tile.userHandle.size();
         if (numUserHandles > 1) {
             ProfileSelectDialog.show(getFragmentManager(), tile);
@@ -164,4 +220,28 @@
     public void onProfileTileOpen() {
         finish();
     }
+
+    public interface CategoryListener {
+        void onCategoriesChanged();
+    }
+
+    private class CategoriesUpdater extends AsyncTask<Void, Void, List<DashboardCategory>> {
+        @Override
+        protected List<DashboardCategory> doInBackground(Void... params) {
+            return TileUtils.getCategories(SettingsDrawerActivity.this, sTileCache);
+        }
+
+        @Override
+        protected void onPostExecute(List<DashboardCategory> dashboardCategories) {
+            sDashboardCategories = dashboardCategories;
+            onCategoriesChanged();
+        }
+    }
+
+    private class PackageReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            new CategoriesUpdater().execute();
+        }
+    }
 }
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerAdapter.java b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerAdapter.java
index fef716c..24c6ae8 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerAdapter.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/SettingsDrawerAdapter.java
@@ -38,7 +38,7 @@
     }
 
     void updateCategories() {
-        List<DashboardCategory> categories = mActivity.getDashboardCategories(true);
+        List<DashboardCategory> categories = mActivity.getDashboardCategories();
         mItems.clear();
         for (int i = 0; i < categories.size(); i++) {
             Item category = new Item();
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
index 18e8d31..6b36680 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
@@ -14,6 +14,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.res.Resources;
@@ -35,6 +36,7 @@
 public class TileUtils {
 
     private static final boolean DEBUG = false;
+    private static final boolean DEBUG_TIMING = true;
 
     private static final String LOG_TAG = "TileUtils";
 
@@ -105,12 +107,9 @@
 
     private static final String SETTING_PKG = "com.android.settings";
 
-    public static List<DashboardCategory> getCategories(Context context) {
-        return getCategories(context, new HashMap<Pair<String, String>, DashboardTile>());
-    }
-
     public static List<DashboardCategory> getCategories(Context context,
             HashMap<Pair<String, String>, DashboardTile> cache) {
+        final long startTime = System.currentTimeMillis();
         ArrayList<DashboardTile> tiles = new ArrayList<>();
         UserManager userManager = UserManager.get(context);
         for (UserHandle user : userManager.getUserProfiles()) {
@@ -143,6 +142,8 @@
             Collections.sort(category.tiles, TILE_COMPARATOR);
         }
         Collections.sort(categories, CATEGORY_COMPARATOR);
+        if (DEBUG_TIMING) Log.d(LOG_TAG, "getCategories took "
+                + (System.currentTimeMillis() - startTime) + " ms");
         return categories;
     }
 
@@ -207,7 +208,9 @@
                         activityInfo.packageName, activityInfo.name);
                 tile.category = categoryKey;
                 tile.priority = requireSettings ? resolved.priority : 0;
-                updateTileData(context, tile);
+                tile.metaData = activityInfo.metaData;
+                updateTileData(context, tile, activityInfo, activityInfo.applicationInfo,
+                        pm);
                 if (DEBUG) Log.d(LOG_TAG, "Adding tile " + tile.title);
 
                 addedCache.put(key, tile);
@@ -231,64 +234,52 @@
         return null;
     }
 
-    private static boolean updateTileData(Context context, DashboardTile tile) {
-        Intent intent = tile.intent;
-        if (intent != null) {
-            // Find the activity that is in the system image
-            PackageManager pm = context.getPackageManager();
-            List<ResolveInfo> list = tile.userHandle.size() != 0
-                    ? pm.queryIntentActivitiesAsUser(intent, PackageManager.GET_META_DATA,
-                            tile.userHandle.get(0).getIdentifier())
-                    : pm.queryIntentActivities(intent, PackageManager.GET_META_DATA);
-            int listSize = list.size();
-            for (int i = 0; i < listSize; i++) {
-                ResolveInfo resolveInfo = list.get(i);
-                if (resolveInfo.activityInfo.applicationInfo.isSystemApp()) {
-                    int icon = 0;
-                    CharSequence title = null;
-                    String summary = null;
+    private static boolean updateTileData(Context context, DashboardTile tile,
+            ActivityInfo activityInfo, ApplicationInfo applicationInfo, PackageManager pm) {
+        if (applicationInfo.isSystemApp()) {
+            int icon = 0;
+            CharSequence title = null;
+            String summary = null;
 
-                    // Get the activity's meta-data
-                    try {
-                        Resources res = pm.getResourcesForApplication(
-                                resolveInfo.activityInfo.packageName);
-                        Bundle metaData = resolveInfo.activityInfo.metaData;
+            // Get the activity's meta-data
+            try {
+                Resources res = pm.getResourcesForApplication(
+                        applicationInfo.packageName);
+                Bundle metaData = activityInfo.metaData;
 
-                        if (res != null && metaData != null) {
-                            if (metaData.containsKey(META_DATA_PREFERENCE_ICON)) {
-                                icon = metaData.getInt(META_DATA_PREFERENCE_ICON);
-                            }
-                            if (metaData.containsKey(META_DATA_PREFERENCE_TITLE)) {
-                                title = metaData.getString(META_DATA_PREFERENCE_TITLE);
-                            }
-                            if (metaData.containsKey(META_DATA_PREFERENCE_SUMMARY)) {
-                                summary = metaData.getString(META_DATA_PREFERENCE_SUMMARY);
-                            }
-                        }
-                    } catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
-                        if (DEBUG) Log.d(LOG_TAG, "Couldn't find info", e);
+                if (res != null && metaData != null) {
+                    if (metaData.containsKey(META_DATA_PREFERENCE_ICON)) {
+                        icon = metaData.getInt(META_DATA_PREFERENCE_ICON);
                     }
-
-                    // Set the preference title to the activity's label if no
-                    // meta-data is found
-                    if (TextUtils.isEmpty(title)) {
-                        title = resolveInfo.loadLabel(pm).toString();
+                    if (metaData.containsKey(META_DATA_PREFERENCE_TITLE)) {
+                        title = metaData.getString(META_DATA_PREFERENCE_TITLE);
                     }
-                    if (icon == 0) {
-                        icon = resolveInfo.activityInfo.icon;
+                    if (metaData.containsKey(META_DATA_PREFERENCE_SUMMARY)) {
+                        summary = metaData.getString(META_DATA_PREFERENCE_SUMMARY);
                     }
-
-                    // Set icon, title and summary for the preference
-                    tile.icon = Icon.createWithResource(resolveInfo.activityInfo.packageName, icon);
-                    tile.title = title;
-                    tile.summary = summary;
-                    // Replace the intent with this specific activity
-                    tile.intent = new Intent().setClassName(resolveInfo.activityInfo.packageName,
-                            resolveInfo.activityInfo.name);
-
-                    return true;
                 }
+            } catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
+                if (DEBUG) Log.d(LOG_TAG, "Couldn't find info", e);
             }
+
+            // Set the preference title to the activity's label if no
+            // meta-data is found
+            if (TextUtils.isEmpty(title)) {
+                title = activityInfo.loadLabel(pm).toString();
+            }
+            if (icon == 0) {
+                icon = activityInfo.icon;
+            }
+
+            // Set icon, title and summary for the preference
+            tile.icon = Icon.createWithResource(activityInfo.packageName, icon);
+            tile.title = title;
+            tile.summary = summary;
+            // Replace the intent with this specific activity
+            tile.intent = new Intent().setClassName(activityInfo.packageName,
+                    activityInfo.name);
+
+            return true;
         }
 
         return false;
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index e28b2e5..2b1c66d 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -19,8 +19,12 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
 import android.net.NetworkInfo.DetailedState;
+import android.net.NetworkRequest;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiInfo;
@@ -62,6 +66,9 @@
     private final Context mContext;
     private final WifiManager mWifiManager;
     private final IntentFilter mFilter;
+    private final ConnectivityManager mConnectivityManager;
+    private final NetworkRequest mNetworkRequest;
+    private WifiTrackerNetworkCallback mNetworkCallback;
 
     private final AtomicBoolean mConnected = new AtomicBoolean(false);
     private final WifiListener mListener;
@@ -104,13 +111,15 @@
     public WifiTracker(Context context, WifiListener wifiListener, Looper workerLooper,
             boolean includeSaved, boolean includeScans, boolean includePasspoints) {
         this(context, wifiListener, workerLooper, includeSaved, includeScans, includePasspoints,
-                (WifiManager) context.getSystemService(Context.WIFI_SERVICE), Looper.myLooper());
+                context.getSystemService(WifiManager.class),
+                context.getSystemService(ConnectivityManager.class), Looper.myLooper());
     }
 
     @VisibleForTesting
     WifiTracker(Context context, WifiListener wifiListener, Looper workerLooper,
             boolean includeSaved, boolean includeScans, boolean includePasspoints,
-            WifiManager wifiManager, Looper currentLooper) {
+            WifiManager wifiManager, ConnectivityManager connectivityManager,
+            Looper currentLooper) {
         if (!includeSaved && !includeScans) {
             throw new IllegalArgumentException("Must include either saved or scans");
         }
@@ -127,6 +136,7 @@
         mIncludeScans = includeScans;
         mIncludePasspoints = includePasspoints;
         mListener = wifiListener;
+        mConnectivityManager = connectivityManager;
 
         // check if verbose logging has been turned on or off
         sVerboseLogging = mWifiManager.getVerboseLoggingLevel();
@@ -139,7 +149,11 @@
         mFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
         mFilter.addAction(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
         mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
-        mFilter.addAction(WifiManager.RSSI_CHANGED_ACTION);
+
+        mNetworkRequest = new NetworkRequest.Builder()
+                .clearCapabilities()
+                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
+                .build();
     }
 
     /**
@@ -192,6 +206,9 @@
         resumeScanning();
         if (!mRegistered) {
             mContext.registerReceiver(mReceiver, mFilter);
+            // NetworkCallback objects cannot be reused. http://b/20701525 .
+            mNetworkCallback = new WifiTrackerNetworkCallback();
+            mConnectivityManager.registerNetworkCallback(mNetworkRequest, mNetworkCallback);
             mRegistered = true;
         }
     }
@@ -207,6 +224,7 @@
             mWorkHandler.removeMessages(WorkHandler.MSG_UPDATE_ACCESS_POINTS);
             mWorkHandler.removeMessages(WorkHandler.MSG_UPDATE_NETWORK_INFO);
             mContext.unregisterReceiver(mReceiver);
+            mConnectivityManager.unregisterNetworkCallback(mNetworkCallback);
             mRegistered = false;
         }
         pauseScanning();
@@ -461,12 +479,12 @@
             mMainHandler.sendEmptyMessage(MainHandler.MSG_RESUME_SCANNING);
         }
 
-        mLastInfo = mWifiManager.getConnectionInfo();
         if (networkInfo != null) {
             mLastNetworkInfo = networkInfo;
         }
 
         WifiConfiguration connectionConfig = null;
+        mLastInfo = mWifiManager.getConnectionInfo();
         if (mLastInfo != null) {
             connectionConfig = getWifiConfigurationForNetworkId(mLastInfo.getNetworkId());
         }
@@ -532,12 +550,21 @@
                 mWorkHandler.sendEmptyMessage(WorkHandler.MSG_UPDATE_ACCESS_POINTS);
                 mWorkHandler.obtainMessage(WorkHandler.MSG_UPDATE_NETWORK_INFO, info)
                         .sendToTarget();
-            } else if (WifiManager.RSSI_CHANGED_ACTION.equals(action)) {
-                mWorkHandler.sendEmptyMessage(WorkHandler.MSG_UPDATE_NETWORK_INFO);
             }
         }
     };
 
+    private final class WifiTrackerNetworkCallback extends ConnectivityManager.NetworkCallback {
+        public void onCapabilitiesChanged(Network network, NetworkCapabilities nc) {
+            if (network.equals(mWifiManager.getCurrentNetwork())) {
+                // We don't send a NetworkInfo object along with this message, because even if we
+                // fetch one from ConnectivityManager, it might be older than the most recent
+                // NetworkInfo message we got via a WIFI_STATE_CHANGED broadcast.
+                mWorkHandler.sendEmptyMessage(WorkHandler.MSG_UPDATE_NETWORK_INFO);
+            }
+        }
+    }
+
     private final class MainHandler extends Handler {
         private static final int MSG_CONNECTED_CHANGED = 0;
         private static final int MSG_WIFI_STATE_CHANGED = 1;
diff --git a/packages/SettingsProvider/res/values-it/strings.xml b/packages/SettingsProvider/res/values-it/strings.xml
index 40735cc..ba1431d 100644
--- a/packages/SettingsProvider/res/values-it/strings.xml
+++ b/packages/SettingsProvider/res/values-it/strings.xml
@@ -19,5 +19,5 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4567566098528588863">"Archiviazione impostazioni"</string>
+    <string name="app_label" msgid="4567566098528588863">"Memoria impostazioni"</string>
 </resources>
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index bf3982d..25346ac 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -144,6 +144,7 @@
             android:name=".BugreportReceiver"
             android:permission="android.permission.DUMP">
             <intent-filter>
+                <action android:name="android.intent.action.BUGREPORT_STARTED" />
                 <action android:name="android.intent.action.BUGREPORT_FINISHED" />
             </intent-filter>
         </receiver>
diff --git a/packages/Shell/res/values-af/strings.xml b/packages/Shell/res/values-af/strings.xml
index d1998bd..8430bf0 100644
--- a/packages/Shell/res/values-af/strings.xml
+++ b/packages/Shell/res/values-af/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Tuisskerm"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Besig met foutverslag"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Foutverslag vasgevang"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Swiep na links om jou foutverslag te deel"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Raak om jou foutverslag te deel"</string>
diff --git a/packages/Shell/res/values-am/strings.xml b/packages/Shell/res/values-am/strings.xml
index 6f905a9..9400f37 100644
--- a/packages/Shell/res/values-am/strings.xml
+++ b/packages/Shell/res/values-am/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ቀፎ"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"የሳንካ ሪፓርት በሂደት ላይ"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"የሳንካ ሪፖርት ተይዟል"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"የሳንካ ሪፖርትዎን ለማጋራት ወደ ግራ ያንሸራትቱ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"የሳንካ ሪፖርትዎን ለማጋራት ይንክኩ"</string>
diff --git a/packages/Shell/res/values-ar/strings.xml b/packages/Shell/res/values-ar/strings.xml
index 76100b5..2161a76 100644
--- a/packages/Shell/res/values-ar/strings.xml
+++ b/packages/Shell/res/values-ar/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"تقرير الخطأ قيد التقدم"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"تم الحصول على تقرير الأخطاء"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"مرر بسرعة لليمين لمشاركة تقرير الخطأ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"المس لمشاركة تقرير الأخطاء"</string>
diff --git a/packages/Shell/res/values-az-rAZ/strings.xml b/packages/Shell/res/values-az-rAZ/strings.xml
index d8176f5..76ee4bf 100644
--- a/packages/Shell/res/values-az-rAZ/strings.xml
+++ b/packages/Shell/res/values-az-rAZ/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Baq hesabatı davam edir"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Baq raport alındı"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Baq raportunu paylaşmaq üçün sola sürüşdürün"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Xətanı şikayətini paylaşmaq üçün toxunun"</string>
diff --git a/packages/Shell/res/values-bg/strings.xml b/packages/Shell/res/values-bg/strings.xml
index fc2dad0..bbfae69 100644
--- a/packages/Shell/res/values-bg/strings.xml
+++ b/packages/Shell/res/values-bg/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Команден ред"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Отчетът за програмни грешки е записан"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Прекарайте пръст наляво, за да споделите сигнала си за програмна грешка"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Докоснете, за да споделите отчета си за програмни грешки"</string>
diff --git a/packages/Shell/res/values-bn-rBD/strings.xml b/packages/Shell/res/values-bn-rBD/strings.xml
index 5aa3e9d..5ca5835 100644
--- a/packages/Shell/res/values-bn-rBD/strings.xml
+++ b/packages/Shell/res/values-bn-rBD/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"শেল"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ত্রুটির প্রতিবেদন করা হচ্ছে"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ত্রুটির প্রতিবেদন নেওয়া হয়েছে"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"আপনার বাগ রিপোর্ট শেয়ার করতে বামে সোয়াইপ করুন"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"আপনার ত্রুটির প্রতিবেদন ভাগ করতে স্পর্শ করুন"</string>
diff --git a/packages/Shell/res/values-ca/strings.xml b/packages/Shell/res/values-ca/strings.xml
index bef1a67..1e6ec53 100644
--- a/packages/Shell/res/values-ca/strings.xml
+++ b/packages/Shell/res/values-ca/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Protecció"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Informe d\'errors en curs"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"S\'ha registrat l\'informe d\'error"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Llisca cap a l\'esquerra per compartir l\'informe d\'errors."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toca aquí per compartir el teu informe d\'error."</string>
diff --git a/packages/Shell/res/values-cs/strings.xml b/packages/Shell/res/values-cs/strings.xml
index 46c8f4e..336c21f 100644
--- a/packages/Shell/res/values-cs/strings.xml
+++ b/packages/Shell/res/values-cs/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Probíhá zpracování zprávy o chybě"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Bylo vytvořeno chybové hlášení"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Chcete-li hlášení chyby sdílet, přejeďte doleva."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Chybové hlášení můžete sdílet klepnutím."</string>
diff --git a/packages/Shell/res/values-da/strings.xml b/packages/Shell/res/values-da/strings.xml
index 7a87b9b..6f65894 100644
--- a/packages/Shell/res/values-da/strings.xml
+++ b/packages/Shell/res/values-da/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Fejlrapporten er under udførelse"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Fejlrapporten er registreret"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Stryg til venstre for at dele din fejlrapport"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Tryk for at dele din fejlrapport"</string>
diff --git a/packages/Shell/res/values-de/strings.xml b/packages/Shell/res/values-de/strings.xml
index 7a25c4d..03c6166 100644
--- a/packages/Shell/res/values-de/strings.xml
+++ b/packages/Shell/res/values-de/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Fehlerbericht in Bearbeitung"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Fehlerbericht erfasst"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Wischen Sie nach links, um Ihren Fehlerbericht zu teilen."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Tippen, um Fehlerbericht zu teilen"</string>
diff --git a/packages/Shell/res/values-el/strings.xml b/packages/Shell/res/values-el/strings.xml
index 02e37f7..ceec189 100644
--- a/packages/Shell/res/values-el/strings.xml
+++ b/packages/Shell/res/values-el/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Κέλυφος"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Αναφορά σφάλματος σε εξέλιξη"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Η λήψη της αναφοράς ήταν επιτυχής"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Σύρετε προς τα αριστερά για κοινή χρήση της αναφοράς σφαλμάτων"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Αγγίξτε για να μοιραστείτε τη αναφορά σφαλμάτων"</string>
diff --git a/packages/Shell/res/values-en-rAU/strings.xml b/packages/Shell/res/values-en-rAU/strings.xml
index 1b55115..99c9f4f 100644
--- a/packages/Shell/res/values-en-rAU/strings.xml
+++ b/packages/Shell/res/values-en-rAU/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Bug report in progress"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Bug report captured"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Swipe left to share your bug report"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Touch to share your bug report"</string>
diff --git a/packages/Shell/res/values-en-rGB/strings.xml b/packages/Shell/res/values-en-rGB/strings.xml
index 1b55115..99c9f4f 100644
--- a/packages/Shell/res/values-en-rGB/strings.xml
+++ b/packages/Shell/res/values-en-rGB/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Bug report in progress"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Bug report captured"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Swipe left to share your bug report"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Touch to share your bug report"</string>
diff --git a/packages/Shell/res/values-en-rIN/strings.xml b/packages/Shell/res/values-en-rIN/strings.xml
index 1b55115..99c9f4f 100644
--- a/packages/Shell/res/values-en-rIN/strings.xml
+++ b/packages/Shell/res/values-en-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Bug report in progress"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Bug report captured"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Swipe left to share your bug report"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Touch to share your bug report"</string>
diff --git a/packages/Shell/res/values-es-rUS/strings.xml b/packages/Shell/res/values-es-rUS/strings.xml
index 1937349..263459e 100644
--- a/packages/Shell/res/values-es-rUS/strings.xml
+++ b/packages/Shell/res/values-es-rUS/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Informe de errores en progreso"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Informe de errores capturado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Desliza el dedo hacia la izquierda para compartir el informe de errores."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toca para compartir tu informe de errores."</string>
diff --git a/packages/Shell/res/values-es/strings.xml b/packages/Shell/res/values-es/strings.xml
index 002bea9..3b37d40 100644
--- a/packages/Shell/res/values-es/strings.xml
+++ b/packages/Shell/res/values-es/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Informe de errores en curso"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Informe de error registrado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Desliza el dedo hacia la izquierda para compartir el informe de error"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toca para compartir tu informe de error"</string>
diff --git a/packages/Shell/res/values-et-rEE/strings.xml b/packages/Shell/res/values-et-rEE/strings.xml
index a16875c..652de64 100644
--- a/packages/Shell/res/values-et-rEE/strings.xml
+++ b/packages/Shell/res/values-et-rEE/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Kest"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Veaaruande töötlemine on pooleli"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Veaaruanne jäädvustati"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Veaaruande jagamiseks pühkige vasakule"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Veaaruande jagamiseks puudutage"</string>
diff --git a/packages/Shell/res/values-eu-rES/strings.xml b/packages/Shell/res/values-eu-rES/strings.xml
index e7f1766..3234786 100644
--- a/packages/Shell/res/values-eu-rES/strings.xml
+++ b/packages/Shell/res/values-eu-rES/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell-interfazea"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Abian da akatsen txostena egiteko prozesua"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Akatsen txostena jaso da"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Programa-akatsen txostena partekatzeko, pasatu hatza ezkerrera"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Akatsen txostena partekatzeko, ukitu"</string>
diff --git a/packages/Shell/res/values-fa/strings.xml b/packages/Shell/res/values-fa/strings.xml
index 9138b28..ff58c25 100644
--- a/packages/Shell/res/values-fa/strings.xml
+++ b/packages/Shell/res/values-fa/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"گزارش اشکال در حال انجام است"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"گزارش اشکال دریافت شد"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"برای اشتراک‌گذاری گزارش اشکال، به تندی آن را به چپ بکشید"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"جهت اشتراک‌گذاری گزارش اشکال خود لمس کنید"</string>
diff --git a/packages/Shell/res/values-fi/strings.xml b/packages/Shell/res/values-fi/strings.xml
index 079433d..df6851c 100644
--- a/packages/Shell/res/values-fi/strings.xml
+++ b/packages/Shell/res/values-fi/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Komentotulkki"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Virheraportti käynnissä"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Virheraportti tallennettu"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Jaa virheraportti pyyhkäisemällä vasemmalle"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Jaa virheraportti koskettamalla tätä"</string>
diff --git a/packages/Shell/res/values-fr-rCA/strings.xml b/packages/Shell/res/values-fr-rCA/strings.xml
index 4ead085..5f58164 100644
--- a/packages/Shell/res/values-fr-rCA/strings.xml
+++ b/packages/Shell/res/values-fr-rCA/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Création du rapport de bogue en cours..."</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Rapport de bogue enregistré"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Faites glisser le doigt vers la gauche pour partager votre rapport de bogue."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Appuyer ici pour partager votre rapport de bogue"</string>
diff --git a/packages/Shell/res/values-fr/strings.xml b/packages/Shell/res/values-fr/strings.xml
index 14c1d3b..9562c6c 100644
--- a/packages/Shell/res/values-fr/strings.xml
+++ b/packages/Shell/res/values-fr/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Rapport de bug en cours"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Rapport de bug enregistré"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Faites glisser le doigt vers la gauche pour partager votre rapport d\'erreur."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Appuyez ici pour partager le rapport de bug"</string>
diff --git a/packages/Shell/res/values-gl-rES/strings.xml b/packages/Shell/res/values-gl-rES/strings.xml
index 61b0335..1f8da5d 100644
--- a/packages/Shell/res/values-gl-rES/strings.xml
+++ b/packages/Shell/res/values-gl-rES/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Informe de erro en curso"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Informe de erros rexistrado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Pasa o dedo á esquerda para compartir o teu informe de erros"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toca aquí para compartir o teu informe de erros"</string>
diff --git a/packages/Shell/res/values-gu-rIN/strings.xml b/packages/Shell/res/values-gu-rIN/strings.xml
index 746ac45..7a94dd7 100644
--- a/packages/Shell/res/values-gu-rIN/strings.xml
+++ b/packages/Shell/res/values-gu-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"શેલ"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"બગ રિપોર્ટ ચાલુ છે"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"બગ રિપોર્ટ કેપ્ચર કરી"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"તમારી બગ રિપોર્ટ શેર કરવા માટે ડાબે સ્વાઇપ કરો"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"તમારી બગ રિપોર્ટ શેર કરવા માટે ટચ કરો"</string>
diff --git a/packages/Shell/res/values-hi/strings.xml b/packages/Shell/res/values-hi/strings.xml
index 97db607..273b484 100644
--- a/packages/Shell/res/values-hi/strings.xml
+++ b/packages/Shell/res/values-hi/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"शेल"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"बग रिपोर्ट प्रगति में है"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"बग रिपोर्ट कैप्चर कर ली गई"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"अपनी बग रिपोर्ट साझा करने के लिए बाएं स्वाइप करें"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"अपनी बग रिपोर्ट साझा करने के लिए स्पर्श करें"</string>
diff --git a/packages/Shell/res/values-hr/strings.xml b/packages/Shell/res/values-hr/strings.xml
index b1fad84..3836edb 100644
--- a/packages/Shell/res/values-hr/strings.xml
+++ b/packages/Shell/res/values-hr/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Ljuska"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Izvješće o programskoj pogrešci u tijeku"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Prijava programske pogreške snimljena je"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Prijeđite prstom ulijevo da biste poslali izvješće o programskim pogreškama"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Dodirnite za dijeljenje prijave programske pogreške"</string>
diff --git a/packages/Shell/res/values-hu/strings.xml b/packages/Shell/res/values-hu/strings.xml
index 7dae6c1..9191e02 100644
--- a/packages/Shell/res/values-hu/strings.xml
+++ b/packages/Shell/res/values-hu/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Héj"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Hibajelentés folyamatban"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Programhiba-jelentés rögzítve"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Húzza ujját balra a hibajelentés megosztásához"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Érintse meg a programhiba-jelentés megosztásához"</string>
diff --git a/packages/Shell/res/values-hy-rAM/strings.xml b/packages/Shell/res/values-hy-rAM/strings.xml
index 149b677..bfa9b04 100644
--- a/packages/Shell/res/values-hy-rAM/strings.xml
+++ b/packages/Shell/res/values-hy-rAM/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Խեցի"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Վրիպակի զեկույց է ստացվել"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Սահեցրեք ձախ՝ սխալի հաշվետվությունը համօգտագործելու համար"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Հպեք` ձեր վրիպակի մասին զեկույցը տարածելու համար"</string>
diff --git a/packages/Shell/res/values-in/strings.xml b/packages/Shell/res/values-in/strings.xml
index 534badc..9a13d8b 100644
--- a/packages/Shell/res/values-in/strings.xml
+++ b/packages/Shell/res/values-in/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Kerangka"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Laporan bug sedang berlangsung"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Laporan bug tercatat"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Gesek ke kiri untuk membagikan laporan bug Anda"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Sentuh untuk membagikan laporan bug Anda"</string>
diff --git a/packages/Shell/res/values-is-rIS/strings.xml b/packages/Shell/res/values-is-rIS/strings.xml
index ce742f6..4304c8e 100644
--- a/packages/Shell/res/values-is-rIS/strings.xml
+++ b/packages/Shell/res/values-is-rIS/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Skipanalína"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Verið er að útbúa villutilkynningu"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Villutilkynning útbúin"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Strjúktu til vinstri til að deila villuskýrslunni"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Snertu til að deila villutilkynningunni"</string>
diff --git a/packages/Shell/res/values-it/strings.xml b/packages/Shell/res/values-it/strings.xml
index 38e360f..63d39d0 100644
--- a/packages/Shell/res/values-it/strings.xml
+++ b/packages/Shell/res/values-it/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Segnalazione di bug in corso"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Segnalazione di bug acquisita"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Scorri verso sinistra per condividere il rapporto sui bug"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Tocca per condividere la segnalazione di bug"</string>
diff --git a/packages/Shell/res/values-iw/strings.xml b/packages/Shell/res/values-iw/strings.xml
index ab9aecf..94a167f 100644
--- a/packages/Shell/res/values-iw/strings.xml
+++ b/packages/Shell/res/values-iw/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"מעטפת"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"הדוח על הבאג מתבצע כעת"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"דוח הבאגים צולם"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"החלק שמאלה כדי לשתף את דוח הבאגים"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"גע כדי לשתף את דוח הבאגים שלך"</string>
diff --git a/packages/Shell/res/values-ja/strings.xml b/packages/Shell/res/values-ja/strings.xml
index 619ee4f..77adb37 100644
--- a/packages/Shell/res/values-ja/strings.xml
+++ b/packages/Shell/res/values-ja/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"シェル"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"バグレポートを処理しています"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"バグレポートが記録されました"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"バグレポートを共有するには左にスワイプ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"バグレポートを共有するにはタップします"</string>
diff --git a/packages/Shell/res/values-ka-rGE/strings.xml b/packages/Shell/res/values-ka-rGE/strings.xml
index f98045f..2521d3e 100644
--- a/packages/Shell/res/values-ka-rGE/strings.xml
+++ b/packages/Shell/res/values-ka-rGE/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"გარეკანი"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ანგარიში ხარვეზების შესახებ შექმნილია"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"გაასრიალეთ მარცხნივ თქვენი ხარვეზის შეტყობინების გასაზიარებლად"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"შეეხეთ თქვენი ხარვეზების ანგარიშის გასაზიარებლად"</string>
diff --git a/packages/Shell/res/values-kk-rKZ/strings.xml b/packages/Shell/res/values-kk-rKZ/strings.xml
index a24f2cc..5ce7815a 100644
--- a/packages/Shell/res/values-kk-rKZ/strings.xml
+++ b/packages/Shell/res/values-kk-rKZ/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Қабыршық"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Вирус туралы баянат қабылданды"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Қате туралы есепті бөлісу үшін солға жанаңыз"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Бөліс үшін, вирус туралы баянатты түртіңіз."</string>
diff --git a/packages/Shell/res/values-km-rKH/strings.xml b/packages/Shell/res/values-km-rKH/strings.xml
index 2439248..2814a73 100644
--- a/packages/Shell/res/values-km-rKH/strings.xml
+++ b/packages/Shell/res/values-km-rKH/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"សែល"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"កំពុងដំណើរការរបាយការណ៍កំហុស"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"បាន​ចាប់​យក​របាយការណ៍​កំហុស"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"អូស​ទៅ​ឆ្វេង​​ ដើម្បី​ចែក​រំលែក​របាយការណ៍​កំហុស​របស់​អ្នក"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"ប៉ះ​ ដើម្បី​ចែក​រំលែក​របាយការណ៍​កំហុស​របស់​អ្នក"</string>
diff --git a/packages/Shell/res/values-kn-rIN/strings.xml b/packages/Shell/res/values-kn-rIN/strings.xml
index bca9c45..be34c85 100644
--- a/packages/Shell/res/values-kn-rIN/strings.xml
+++ b/packages/Shell/res/values-kn-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ಶೆಲ್"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ದೋಷ ವರದಿ ಪ್ರಗತಿಯಲ್ಲಿದೆ"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ದೋಷದ ವರದಿಯನ್ನು ಸೆರೆಹಿಡಿಯಲಾಗಿದೆ"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"ನಿಮ್ಮ ದೋಷ ವರದಿಯನ್ನು ಹಂಚಿಕೊಳ್ಳಲು ಎಡಕ್ಕೆ ಸ್ವೈಪ್‌ ಮಾಡಿ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"ನಿಮ್ಮ ದೋಷದ ವರದಿಯನ್ನು ಹಂಚಿಕೊಳ್ಳಲು ಸ್ಪರ್ಶಿಸಿ"</string>
diff --git a/packages/Shell/res/values-ko/strings.xml b/packages/Shell/res/values-ko/strings.xml
index a3a0bf3..46c0daa 100644
--- a/packages/Shell/res/values-ko/strings.xml
+++ b/packages/Shell/res/values-ko/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"셸"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"버그 신고서 캡처됨"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"왼쪽으로 스와이프하여 버그 신고서를 공유하세요."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"버그 신고서를 공유하려면 터치하세요."</string>
diff --git a/packages/Shell/res/values-ky-rKG/strings.xml b/packages/Shell/res/values-ky-rKG/strings.xml
index 622920a..aa8c538 100644
--- a/packages/Shell/res/values-ky-rKG/strings.xml
+++ b/packages/Shell/res/values-ky-rKG/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Командалык кабык"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Ката тууралуу билдирүү түзүлдү"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Ката жөнүндө кабар менен бөлүшүү үчүн солго серпип коюңуз"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Ката тууралуу билдирүүңүздү жөнөтүш үчүн, тийиңиз"</string>
diff --git a/packages/Shell/res/values-lo-rLA/strings.xml b/packages/Shell/res/values-lo-rLA/strings.xml
index 537f197..caf11c4 100644
--- a/packages/Shell/res/values-lo-rLA/strings.xml
+++ b/packages/Shell/res/values-lo-rLA/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ລາຍງານບັນຫາພວມດຳເນີນຢູ່"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ລາຍງານຈຸດບົກພ່ອງຖືກເກັບກຳແລ້ວ"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"​ປັດ​ໄປ​ຊ້າຍ​ເພື່ອ​ສົ່ງ​ລາຍ​ງານ​ຂໍ້​ຜິດ​ພາດ​ຂອງ​ທ່ານ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"ແຕະເພື່ອສົ່ງການລາຍງານປັນຫາຂອງທ່ານ"</string>
diff --git a/packages/Shell/res/values-lt/strings.xml b/packages/Shell/res/values-lt/strings.xml
index 6965e4c..e70cf9f 100644
--- a/packages/Shell/res/values-lt/strings.xml
+++ b/packages/Shell/res/values-lt/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Apvalkalas"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Riktų ataskaita užfiksuota"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Perbraukite kairėn, kad bendrintumėte rikto ataskaitą"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Palieskite, kad bendrintumėte riktų ataskaitą"</string>
diff --git a/packages/Shell/res/values-lv/strings.xml b/packages/Shell/res/values-lv/strings.xml
index efc40f3..c5d10bb 100644
--- a/packages/Shell/res/values-lv/strings.xml
+++ b/packages/Shell/res/values-lv/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Aizsargs"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Izveidots kļūdu pārskats"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Velciet pa kreisi, lai kopīgotu savu kļūdu ziņojumu."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Pieskarieties, lai kopīgotu kļūdu pārskatu."</string>
diff --git a/packages/Shell/res/values-mk-rMK/strings.xml b/packages/Shell/res/values-mk-rMK/strings.xml
index 7571c2c..4baa86a 100644
--- a/packages/Shell/res/values-mk-rMK/strings.xml
+++ b/packages/Shell/res/values-mk-rMK/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Обвивка"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Извештајот за грешка е во тек"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Извештајот за грешка е снимен"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Повлечете налево за да споделите пријава за грешка"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Допри да се сподели твојот извештај за грешка"</string>
diff --git a/packages/Shell/res/values-ml-rIN/strings.xml b/packages/Shell/res/values-ml-rIN/strings.xml
index 4779e4d..5dd7763 100644
--- a/packages/Shell/res/values-ml-rIN/strings.xml
+++ b/packages/Shell/res/values-ml-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ഷെൽ"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ബഗ് റിപ്പോർട്ട് പുരോഗതിയിലാണ്"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ബഗ് റിപ്പോർട്ട് ക്യാപ്‌ചർ ചെയ്‌തു"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"നിങ്ങളുടെ ബഗ് റിപ്പോർട്ട് പങ്കിടുന്നതിന് ഇടത്തേയ്‌ക്ക് സ്വൈപ്പുചെയ്യുക"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"നിങ്ങളുടെ ബഗ് റിപ്പോർട്ട് പങ്കിടാൻ സ്‌പർശിക്കുക"</string>
diff --git a/packages/Shell/res/values-mn-rMN/strings.xml b/packages/Shell/res/values-mn-rMN/strings.xml
index 71ad7f6..f7a9688 100644
--- a/packages/Shell/res/values-mn-rMN/strings.xml
+++ b/packages/Shell/res/values-mn-rMN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Шел"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Алдааны тайлан үргэлжилж байна"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Алдааны мэдээлэл хүлээн авав"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Өөрийн согог репортыг хуваалцахын тулд зүүн шудрана уу"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Та алдааны мэдэгдлийг хуваалцах бол хүрнэ үү"</string>
diff --git a/packages/Shell/res/values-mr-rIN/strings.xml b/packages/Shell/res/values-mr-rIN/strings.xml
index c32bb5b..e0db42b 100644
--- a/packages/Shell/res/values-mr-rIN/strings.xml
+++ b/packages/Shell/res/values-mr-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"शेल"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"दोष अहवाल प्रगतीपथावर आहे"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"दोष अहवाल कॅप्‍चर केला"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"आपला दोष अहवाल सामायिक करण्यासाठी डावीकडे स्वाइप करा"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"आपला दोष अहवाल सामायिक करण्‍यासाठी स्‍पर्श करा"</string>
diff --git a/packages/Shell/res/values-ms-rMY/strings.xml b/packages/Shell/res/values-ms-rMY/strings.xml
index 852a9e4..bbbb42a 100644
--- a/packages/Shell/res/values-ms-rMY/strings.xml
+++ b/packages/Shell/res/values-ms-rMY/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Laporan pepijat telah ditangkap"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Leret ke kiri untuk berkongsi laporan pepijat anda"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Sentuh untuk berkongsi laporan pepijat anda"</string>
diff --git a/packages/Shell/res/values-my-rMM/strings.xml b/packages/Shell/res/values-my-rMM/strings.xml
index 4ba9037..d49dc15 100644
--- a/packages/Shell/res/values-my-rMM/strings.xml
+++ b/packages/Shell/res/values-my-rMM/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"အခွံ"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ချွတ်ယွင်းချက် အစီရင်ခံစာ ပြုလုပ်ဆဲ"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"အမှားအယွင်းမှတ်တမ်းကို အောင်မြင်စွာ သိမ်းဆည်းပြီး"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"သင်၏ ဘာဂ် အစီရင်ခံစာကို မျှပေးရန် ဘယ်ဘက်သို့ ပွတ်ဆွဲရန်"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"အမှားအယွင်း မှတ်တမ်းကို မျှဝေရန် ထိလိုက်ပါ"</string>
diff --git a/packages/Shell/res/values-nb/strings.xml b/packages/Shell/res/values-nb/strings.xml
index c543e49..d3aafdd 100644
--- a/packages/Shell/res/values-nb/strings.xml
+++ b/packages/Shell/res/values-nb/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Kommandoliste"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Feilrapport pågår"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Feilrapporten er lagret"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Sveip til venstre for å dele feilrapporten din"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Trykk for å dele feilrapporten din"</string>
diff --git a/packages/Shell/res/values-ne-rNP/strings.xml b/packages/Shell/res/values-ne-rNP/strings.xml
index f57112a..fb81e55 100644
--- a/packages/Shell/res/values-ne-rNP/strings.xml
+++ b/packages/Shell/res/values-ne-rNP/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"सेल"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"बग प्रतिवेदन समातियो"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"तपाईँको बग रिपोर्ट साझेदारी गर्न बायाँ स्वाइप गर्नुहोस्"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"तपाईंको बग रिपोर्ट साझेदारी गर्न छुनुहोस्"</string>
diff --git a/packages/Shell/res/values-nl/strings.xml b/packages/Shell/res/values-nl/strings.xml
index 1519454..a097fea 100644
--- a/packages/Shell/res/values-nl/strings.xml
+++ b/packages/Shell/res/values-nl/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Bugrapport wordt uitgevoerd"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Foutenrapport vastgelegd"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Veeg naar links om je bugmelding te delen"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Raak aan om je foutenrapport te delen"</string>
diff --git a/packages/Shell/res/values-pa-rIN/strings.xml b/packages/Shell/res/values-pa-rIN/strings.xml
index 3f59bb9..54e30d6 100644
--- a/packages/Shell/res/values-pa-rIN/strings.xml
+++ b/packages/Shell/res/values-pa-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ਸ਼ੈਲ"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"ਬੱਗ ਰਿਪੋਰਟ \'ਤੇ ਕਾਰਵਾਈ ਹੋ ਰਹੀ ਹੈ"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"ਬਗ ਰਿਪੋਰਟ ਕੈਪਚਰ ਕੀਤੀ"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"ਤੁਹਾਡੀ ਬਗ ਰਿਪੋਰਟ ਸ਼ੇਅਰ ਕਰਨ ਲਈ ਖੱਬੇ ਪਾਸੇ ਸਵਾਈਪ ਕਰੋ"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"ਆਪਣੀ ਬਗ ਰਿਪੋਰਟ ਸ਼ੇਅਰ ਕਰਨ ਲਈ ਛੋਹਵੋ"</string>
diff --git a/packages/Shell/res/values-pl/strings.xml b/packages/Shell/res/values-pl/strings.xml
index accc92e8..599f8c1 100644
--- a/packages/Shell/res/values-pl/strings.xml
+++ b/packages/Shell/res/values-pl/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Powłoka"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Trwa zgłaszanie błędu"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Raport o błędach został zapisany"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Przesuń palcem w lewo, by udostępnić swoje zgłoszenie błędu"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Kliknij, by udostępnić raport o błędach"</string>
diff --git a/packages/Shell/res/values-pt-rBR/strings.xml b/packages/Shell/res/values-pt-rBR/strings.xml
index 7d4b0d3..a1a9ad1 100644
--- a/packages/Shell/res/values-pt-rBR/strings.xml
+++ b/packages/Shell/res/values-pt-rBR/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Relatório de bugs em andamento"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Relatório de bugs capturado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Deslize para a esquerda para compartilhar seu relatório de bugs"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toque para compartilhar seu relatório de bugs"</string>
diff --git a/packages/Shell/res/values-pt-rPT/strings.xml b/packages/Shell/res/values-pt-rPT/strings.xml
index 007d683..2e25f8c 100644
--- a/packages/Shell/res/values-pt-rPT/strings.xml
+++ b/packages/Shell/res/values-pt-rPT/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Relatório de erro em curso"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Relatório de erros capturado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Deslizar rapidamente para a esquerda para partilhar o seu relatório de erros"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toque para partilhar o relatório de erros"</string>
diff --git a/packages/Shell/res/values-pt/strings.xml b/packages/Shell/res/values-pt/strings.xml
index 7d4b0d3..a1a9ad1 100644
--- a/packages/Shell/res/values-pt/strings.xml
+++ b/packages/Shell/res/values-pt/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Relatório de bugs em andamento"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Relatório de bugs capturado"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Deslize para a esquerda para compartilhar seu relatório de bugs"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Toque para compartilhar seu relatório de bugs"</string>
diff --git a/packages/Shell/res/values-ro/strings.xml b/packages/Shell/res/values-ro/strings.xml
index e7395e1..d8a3b92 100644
--- a/packages/Shell/res/values-ro/strings.xml
+++ b/packages/Shell/res/values-ro/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Raportul de eroare se creează"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Raportul despre erori a fost creat"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Glisați la stânga pentru a trimite raportul de erori"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Atingeți pentru a permite accesul la raportul despre erori"</string>
diff --git a/packages/Shell/res/values-ru/strings.xml b/packages/Shell/res/values-ru/strings.xml
index c9276cf..436a590 100644
--- a/packages/Shell/res/values-ru/strings.xml
+++ b/packages/Shell/res/values-ru/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Оболочка"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Отправка сообщения об ошибке..."</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Отчет об ошибке сохранен"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Проведите влево, чтобы отправить отчет"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Нажмите, чтобы отправить отчет об ошибках"</string>
diff --git a/packages/Shell/res/values-si-rLK/strings.xml b/packages/Shell/res/values-si-rLK/strings.xml
index 937c1bc..a0bc5f6 100644
--- a/packages/Shell/res/values-si-rLK/strings.xml
+++ b/packages/Shell/res/values-si-rLK/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ෂෙල්"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"දෝෂය වාර්තා කිරීම සිදු කරමින් පවතී"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"දෝෂ වාර්තාව ලබාගන්නා ලදි"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"ඔබගේ දෝෂ වාර්තාව බෙදාගැනීමට වමට ස්වයිප් කරන්න"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"ඔබගේ දෝෂ වාර්තාව බෙදා ගැනීමට ස්පර්ශ කරන්න"</string>
diff --git a/packages/Shell/res/values-sk/strings.xml b/packages/Shell/res/values-sk/strings.xml
index cd52efc..e568946 100644
--- a/packages/Shell/res/values-sk/strings.xml
+++ b/packages/Shell/res/values-sk/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Prostredie"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Prebieha hlásenie chyby"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Hlásenie o chybách bolo vytvorené"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Ak chcete hlásenie o chybe zdieľať, prejdite prstom doľava."</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Hlásenie o chybách môžete zdielať klepnutím"</string>
diff --git a/packages/Shell/res/values-sl/strings.xml b/packages/Shell/res/values-sl/strings.xml
index 25553f2..6ac5ac8c 100644
--- a/packages/Shell/res/values-sl/strings.xml
+++ b/packages/Shell/res/values-sl/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Lupina"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Poročanje o napakah poteka"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Poročilo o napaki je posneto"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Povlecite v levo, če želite poslati sporočilo o napaki"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Dotaknite se, če želite deliti sporočilo o napaki z drugimi"</string>
diff --git a/packages/Shell/res/values-sq-rAL/strings.xml b/packages/Shell/res/values-sq-rAL/strings.xml
index add53d8..54f2aad 100644
--- a/packages/Shell/res/values-sq-rAL/strings.xml
+++ b/packages/Shell/res/values-sq-rAL/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Guaska"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Raporti i gabimeve në kod është në progres"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Raporti i defektit në kod u regjistrua"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Rrëshqit majtas për të ndarë raportin e defektit në kod"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Prek për të ndarë raportin e defektit në kod"</string>
diff --git a/packages/Shell/res/values-sr/strings.xml b/packages/Shell/res/values-sr/strings.xml
index bb60f3f..81cde00 100644
--- a/packages/Shell/res/values-sr/strings.xml
+++ b/packages/Shell/res/values-sr/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Прављење извештаја о грешци је у току"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Извештај о грешци је снимљен"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Превуците улево да бисте делили извештај о грешкама"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Додирните да бисте делили извештај о грешци"</string>
diff --git a/packages/Shell/res/values-sv/strings.xml b/packages/Shell/res/values-sv/strings.xml
index dd23e16..2287319 100644
--- a/packages/Shell/res/values-sv/strings.xml
+++ b/packages/Shell/res/values-sv/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Skal"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Felrapportering pågår"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Felrapporten har skapats"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Svep åt vänster om du vill dela felrapporten"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Tryck om du vill dela felrapporten"</string>
diff --git a/packages/Shell/res/values-sw/strings.xml b/packages/Shell/res/values-sw/strings.xml
index 3773cd7..adb97dd 100644
--- a/packages/Shell/res/values-sw/strings.xml
+++ b/packages/Shell/res/values-sw/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Ganda"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Mchakato wa kuripoti hitilafu unaendelea"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Ripoti ya hitilafu imenaswa"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Telezesha kidole kushoto ili ushiriki ripoti yako ya hitilafu"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Gusa ili ushiriki ripoti yako ya hitilafu"</string>
diff --git a/packages/Shell/res/values-ta-rIN/strings.xml b/packages/Shell/res/values-ta-rIN/strings.xml
index 244c929..15a6242 100644
--- a/packages/Shell/res/values-ta-rIN/strings.xml
+++ b/packages/Shell/res/values-ta-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"ஷெல்"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"பிழை அறிக்கை செயலிலுள்ளது"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"பிழை அறிக்கைகள் படமெடுக்கப்பட்டன"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"பிழை அறிக்கையைப் பகிர இடது புறமாகத் தேய்க்கவும்"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"உங்கள் பிழை அறிக்கையைப் பகிர, தொடவும்"</string>
diff --git a/packages/Shell/res/values-te-rIN/strings.xml b/packages/Shell/res/values-te-rIN/strings.xml
index cd9b4b7..cd951a2 100644
--- a/packages/Shell/res/values-te-rIN/strings.xml
+++ b/packages/Shell/res/values-te-rIN/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"షెల్"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"బగ్ నివేదిక ప్రోగ్రెస్‌లో ఉంది"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"బగ్ నివేదిక క్యాప్చర్ చేయబడింది"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"మీ బగ్ నివేదికను భాగస్వామ్యం చేయడానికి ఎడమవైపుకు స్వైప్ చేయండి"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"మీ బగ్ నివేదికను భాగస్వామ్యం చేయడానికి తాకండి"</string>
diff --git a/packages/Shell/res/values-th/strings.xml b/packages/Shell/res/values-th/strings.xml
index 35b7ec9..c61ffeb 100644
--- a/packages/Shell/res/values-th/strings.xml
+++ b/packages/Shell/res/values-th/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"รายงานข้อบกพร่องอยู่ระหว่างดำเนินการ"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"จับภาพรายงานข้อบกพร่องแล้ว"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"กวาดไปทางซ้ายเพื่อแชร์รายงานข้อบกพร่อง"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"แตะเพื่อแชร์รายงานข้อบกพร่องของคุณ"</string>
diff --git a/packages/Shell/res/values-tl/strings.xml b/packages/Shell/res/values-tl/strings.xml
index 21df206..3e9a68d 100644
--- a/packages/Shell/res/values-tl/strings.xml
+++ b/packages/Shell/res/values-tl/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Kasalukuyang ginagawa ang ulat ng bug"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Na-capture ang ulat ng bug"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Mag-swipe pakaliwa upang ibahagi ang iyong ulat ng bug"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Pindutin upang ibahagi ang iyong ulat ng bug"</string>
diff --git a/packages/Shell/res/values-tr/strings.xml b/packages/Shell/res/values-tr/strings.xml
index fa8b82b..f90dae0 100644
--- a/packages/Shell/res/values-tr/strings.xml
+++ b/packages/Shell/res/values-tr/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Kabuk"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Hata raporu hazırlanıyor"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Hata raporu kaydedildi"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Hata raporunuzu paylaşmak için hızlıca sola kaydırın"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Hata raporunuzu paylaşmak için dokunun"</string>
diff --git a/packages/Shell/res/values-uk/strings.xml b/packages/Shell/res/values-uk/strings.xml
index ba667f2..dac4fe0 100644
--- a/packages/Shell/res/values-uk/strings.xml
+++ b/packages/Shell/res/values-uk/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Оболонка"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Генерується повідомлення про помилку"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Звіт про помилки створено"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Проведіть пальцем ліворуч, щоб надіслати звіт про помилки"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Торкніться, щоб надіслати звіт про помилки"</string>
diff --git a/packages/Shell/res/values-ur-rPK/strings.xml b/packages/Shell/res/values-ur-rPK/strings.xml
index 255aaf8..206f02a 100644
--- a/packages/Shell/res/values-ur-rPK/strings.xml
+++ b/packages/Shell/res/values-ur-rPK/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"شیل"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"بگ رپورٹ پر پیشرفت جاری ہے"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"بَگ رپورٹ کیپچر کر لی گئی"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"اپنی بگ رپورٹ کا اشتراک کرنے کیلئے بائیں سوائپ کریں"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"اپنی بَگ رپورٹ کا اشتراک کرنے کیلئے ٹچ کریں"</string>
diff --git a/packages/Shell/res/values-uz-rUZ/strings.xml b/packages/Shell/res/values-uz-rUZ/strings.xml
index 998387e..0b8c1fb 100644
--- a/packages/Shell/res/values-uz-rUZ/strings.xml
+++ b/packages/Shell/res/values-uz-rUZ/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Terminal"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Xatoliklar hisoboti yuborilmoqda…"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Xatolik hisobotini yozib olindi"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Xatolik hisobotini yuborish uchun barmog‘ingiz bilan chapga suring"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Xatolik hisobotini bo‘lishish uchun barmog‘ingizni tegizing."</string>
diff --git a/packages/Shell/res/values-vi/strings.xml b/packages/Shell/res/values-vi/strings.xml
index 5c11b13..9ef7cf9 100644
--- a/packages/Shell/res/values-vi/strings.xml
+++ b/packages/Shell/res/values-vi/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Đang tiến hành báo cáo lỗi"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Báo cáo lỗi đã được chụp"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Vuốt sang trái để chia sẻ báo cáo lỗi của bạn"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Chạm để chia sẻ báo cáo lỗi của bạn"</string>
diff --git a/packages/Shell/res/values-zh-rCN/strings.xml b/packages/Shell/res/values-zh-rCN/strings.xml
index 0a2f81b..0928bb3 100644
--- a/packages/Shell/res/values-zh-rCN/strings.xml
+++ b/packages/Shell/res/values-zh-rCN/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"Shell"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"已抓取错误报告"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"向左滑动即可分享错误报告"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"触摸即可分享您的错误报告"</string>
diff --git a/packages/Shell/res/values-zh-rHK/strings.xml b/packages/Shell/res/values-zh-rHK/strings.xml
index 227d937..26a84c3 100644
--- a/packages/Shell/res/values-zh-rHK/strings.xml
+++ b/packages/Shell/res/values-zh-rHK/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"命令介面"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"已擷取錯誤報告"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"向左滑動即可分享錯誤報告"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"輕觸即可分享您的錯誤報告"</string>
diff --git a/packages/Shell/res/values-zh-rTW/strings.xml b/packages/Shell/res/values-zh-rTW/strings.xml
index b9f8ee8..f79e58e 100644
--- a/packages/Shell/res/values-zh-rTW/strings.xml
+++ b/packages/Shell/res/values-zh-rTW/strings.xml
@@ -17,6 +17,8 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"殼層"</string>
+    <!-- no translation found for bugreport_in_progress_title (6125357428413919520) -->
+    <skip />
     <string name="bugreport_finished_title" msgid="2293711546892863898">"已擷取錯誤報告"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"向左滑動即可分享錯誤報告"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"輕觸即可分享您的錯誤報告"</string>
diff --git a/packages/Shell/res/values-zu/strings.xml b/packages/Shell/res/values-zu/strings.xml
index b675858..2e209e1 100644
--- a/packages/Shell/res/values-zu/strings.xml
+++ b/packages/Shell/res/values-zu/strings.xml
@@ -17,6 +17,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label" msgid="3701846017049540910">"I-Shell"</string>
+    <string name="bugreport_in_progress_title" msgid="6125357428413919520">"Umbiko wesiphazamisi uyaqhubeka"</string>
     <string name="bugreport_finished_title" msgid="2293711546892863898">"Umbiko wesiphazamisi uthwetshuliwe"</string>
     <string name="bugreport_finished_text" product="watch" msgid="8389172248433597683">"Swayiphela kwesokunxele ukuze wabelane umbiko wesiphazamiso sakho"</string>
     <string name="bugreport_finished_text" product="default" msgid="3559904746859400732">"Thinta ukuze wabelane ngombiko wakho wesiphazamisi"</string>
diff --git a/packages/Shell/res/values/strings.xml b/packages/Shell/res/values/strings.xml
index 4469d38..cff36f7 100644
--- a/packages/Shell/res/values/strings.xml
+++ b/packages/Shell/res/values/strings.xml
@@ -17,6 +17,8 @@
 <resources>
     <string name="app_label">Shell</string>
 
+    <!-- Title of notification indicating a bugreport process is in progress. [CHAR LIMIT=50] -->
+    <string name="bugreport_in_progress_title">Bug report in progress</string>
     <!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] -->
     <string name="bugreport_finished_title">Bug report captured</string>
 
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index a2030ef..f41f52c 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -21,11 +21,16 @@
 
 import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -36,6 +41,7 @@
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.Notification;
+import android.app.Notification.Action;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -45,26 +51,107 @@
 import android.content.res.Configuration;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.HandlerThread;
 import android.os.IBinder;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Parcelable;
+import android.os.Process;
 import android.os.SystemProperties;
 import android.support.v4.content.FileProvider;
+import android.text.format.DateUtils;
 import android.util.Log;
 import android.util.Patterns;
+import android.util.SparseArray;
 import android.widget.Toast;
 
+/**
+ * Service used to keep progress of bug reports processes ({@code dumpstate}).
+ * <p>
+ * The workflow is:
+ * <ol>
+ * <li>When {@code dumpstate} starts, it sends a {@code BUGREPORT_STARTED} with its pid and the
+ * estimated total effort.
+ * <li>{@link BugreportReceiver} receives the intent and delegates it to this service.
+ * <li>Upon start, this service:
+ * <ol>
+ * <li>Issues a system notification so user can watch the progresss (which is 0% initially).
+ * <li>Polls the {@link SystemProperties} for updates on the {@code dumpstate} progress.
+ * <li>If the progress changed, it updates the system notification.
+ * </ol>
+ * <li>As {@code dumpstate} progresses, it updates the system property.
+ * <li>When {@code dumpstate} finishes, it sends a {@code BUGREPORT_FINISHED} intent.
+ * <li>{@link BugreportReceiver} receives the intent and delegates it to this service, which in
+ * turn:
+ * <ol>
+ * <li>Updates the system notification so user can share the bug report.
+ * <li>Stops monitoring that {@code dumpstate} process.
+ * <li>Stops itself if it doesn't have any process left to monitor.
+ * </ol>
+ * </ol>
+ */
 public class BugreportProgressService extends Service {
     private static final String TAG = "Shell";
+    private static final boolean DEBUG = false;
 
     private static final String AUTHORITY = "com.android.shell";
 
+    static final String INTENT_BUGREPORT_STARTED = "android.intent.action.BUGREPORT_STARTED";
+    static final String INTENT_BUGREPORT_FINISHED = "android.intent.action.BUGREPORT_FINISHED";
+    static final String INTENT_BUGREPORT_CANCEL = "android.intent.action.BUGREPORT_CANCEL";
+
     static final String EXTRA_BUGREPORT = "android.intent.extra.BUGREPORT";
     static final String EXTRA_SCREENSHOT = "android.intent.extra.SCREENSHOT";
+    static final String EXTRA_PID = "android.intent.extra.PID";
+    static final String EXTRA_MAX = "android.intent.extra.MAX";
+    static final String EXTRA_NAME = "android.intent.extra.NAME";
+    static final String EXTRA_ORIGINAL_INTENT = "android.intent.extra.ORIGINAL_INTENT";
+
+    private static final int MSG_SERVICE_COMMAND = 1;
+    private static final int MSG_POLL = 2;
+
+    /** Polling frequency, in milliseconds. */
+    private static final long POLLING_FREQUENCY = 500;
+
+    /** How long (in ms) a dumpstate process will be monitored if it didn't show progress. */
+    private static final long INACTIVITY_TIMEOUT = 3 * DateUtils.MINUTE_IN_MILLIS;
+
+    /** System property used for monitoring progress. */
+    private static final String PROPERTY_TEMPLATE_PROGRESS = "dumpstate.%d.progress";
+
+    /** System property (and value) used for stop dumpstate. */
+    private static final String PROPERTY_CTL_STOP = "ctl.stop";
+    private static final String BUGREPORT_SERVICE = "bugreport";
+
+    /** Managed dumpstate processes (keyed by pid) */
+    private final SparseArray<BugreportInfo> mProcesses = new SparseArray<>();
+
+    private Looper mServiceLooper;
+    private ServiceHandler mServiceHandler;
+
+    @Override
+    public void onCreate() {
+        HandlerThread thread = new HandlerThread("BugreportProgressServiceThread",
+                Process.THREAD_PRIORITY_BACKGROUND);
+        thread.start();
+
+        mServiceLooper = thread.getLooper();
+        mServiceHandler = new ServiceHandler(mServiceLooper);
+    }
 
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
         if (intent != null) {
-            onBugreportFinished(intent);
+            // Handle it in a separate thread.
+            Message msg = mServiceHandler.obtainMessage();
+            msg.what = MSG_SERVICE_COMMAND;
+            msg.obj = intent;
+            mServiceHandler.sendMessage(msg);
         }
+
+        // If service is killed it cannot be recreated because it would not know which
+        // dumpstate PIDs it would have to watch.
         return START_NOT_STICKY;
     }
 
@@ -73,26 +160,264 @@
         return null;
     }
 
-    private void onBugreportFinished(Intent intent) {
-        final Context context = getApplicationContext();
-        final Configuration conf = context.getResources().getConfiguration();
-        final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
-        final File screenshotFile = getFileExtra(intent, EXTRA_SCREENSHOT);
+    @Override
+    public void onDestroy() {
+        mServiceLooper.quit();
+        super.onDestroy();
+    }
 
-        if ((conf.uiMode & Configuration.UI_MODE_TYPE_MASK) != Configuration.UI_MODE_TYPE_WATCH) {
-            triggerLocalNotification(context, bugreportFile, screenshotFile);
+    @Override
+    protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
+        writer.printf("Monitored dumpstate processes: \n");
+        synchronized (mProcesses) {
+            for (int i = 0; i < mProcesses.size(); i++) {
+              writer.printf("\t%s\n", mProcesses.valueAt(i));
+            }
         }
-        stopSelf();
+    }
+
+    private final class ServiceHandler extends Handler {
+        public ServiceHandler(Looper looper) {
+            super(looper);
+            pollProgress();
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            if (msg.what == MSG_POLL) {
+                pollProgress();
+                return;
+            }
+
+            if (msg.what != MSG_SERVICE_COMMAND) {
+                // Sanity check.
+                Log.e(TAG, "Invalid message type: " + msg.what);
+                return;
+            }
+
+            // At this point it's handling onStartCommand(), whose intent contains the extras
+            // originally received by BugreportReceiver.
+            if (!(msg.obj instanceof Intent)) {
+                // Sanity check.
+                Log.e(TAG, "Internal error: invalid msg.obj: " + msg.obj);
+                return;
+            }
+            final Parcelable parcel = ((Intent) msg.obj).getParcelableExtra(EXTRA_ORIGINAL_INTENT);
+            if (!(parcel instanceof Intent)) {
+                // Sanity check.
+                Log.e(TAG, "Internal error: msg.obj is missing extra " + EXTRA_ORIGINAL_INTENT);
+                return;
+            }
+
+            final Intent intent = (Intent) parcel;
+            final String action = intent.getAction();
+            int pid = intent.getIntExtra(EXTRA_PID, 0);
+            int max = intent.getIntExtra(EXTRA_MAX, -1);
+            String name = intent.getStringExtra(EXTRA_NAME);
+
+            if (DEBUG) Log.v(TAG, "action: " + action + ", name: " + name + ", pid: " + pid
+                    + ", max: "+ max);
+            switch (action) {
+                case INTENT_BUGREPORT_STARTED:
+                    if (!startProgress(name, pid, max)) {
+                        stopSelfWhenDone();
+                        return;
+                    }
+                    break;
+                case INTENT_BUGREPORT_FINISHED:
+                    if (pid == -1) {
+                        // Shouldn't happen, unless BUGREPORT_FINISHED is received from a legacy,
+                        // out-of-sync dumpstate process.
+                        Log.w(TAG, "Missing " + EXTRA_PID + " on intent " + intent);
+                    }
+                    stopProgress(pid, intent);
+                    break;
+                case INTENT_BUGREPORT_CANCEL:
+                    cancel(pid);
+                    break;
+                default:
+                    Log.w(TAG, "Unsupported intent: " + action);
+            }
+            return;
+
+        }
+
+        /**
+         * Creates the {@link BugreportInfo} for a process and issue a system notification to
+         * indicate its progress.
+         *
+         * @return whether it succeeded or not.
+         */
+        private boolean startProgress(String name, int pid, int max) {
+            if (name == null) {
+                Log.w(TAG, "Missing " + EXTRA_NAME + " on start intent");
+                name = "N/A";
+            }
+            if (pid == -1) {
+                Log.e(TAG, "Missing " + EXTRA_PID + " on start intent");
+                return false;
+            }
+            if (max <= 0) {
+                Log.e(TAG, "Invalid value for extra " + EXTRA_MAX + ": " + max);
+                return false;
+            }
+
+            final BugreportInfo info = new BugreportInfo(pid, name, max);
+            synchronized (mProcesses) {
+                if (mProcesses.indexOfKey(pid) >= 0) {
+                    Log.w(TAG, "PID " + pid + " already watched");
+                } else {
+                    mProcesses.put(info.pid, info);
+                }
+            }
+            updateProgress(info);
+            return true;
+        }
+
+        /**
+         * Updates the system notification for a given bug report.
+         */
+        private void updateProgress(BugreportInfo info) {
+            if (info.max <= 0 || info.progress < 0 || info.name == null) {
+                Log.e(TAG, "Invalid progress values for " + info);
+                return;
+            }
+
+            final Context context = getApplicationContext();
+            final NumberFormat nf = NumberFormat.getPercentInstance();
+            nf.setMinimumFractionDigits(2);
+            nf.setMaximumFractionDigits(2);
+            final String percentText = nf.format((double) info.progress / info.max);
+
+            final Intent cancelIntent = new Intent(context, BugreportReceiver.class);
+            cancelIntent.setAction(INTENT_BUGREPORT_CANCEL);
+            cancelIntent.putExtra(EXTRA_PID, info.pid);
+            final Action cancelAction = new Action.Builder(null,
+                    context.getString(com.android.internal.R.string.cancel),
+                    PendingIntent.getBroadcast(context, info.pid, cancelIntent,
+                            PendingIntent.FLAG_CANCEL_CURRENT)).build();
+
+            final String title = context.getString(R.string.bugreport_in_progress_title);
+            final Notification notification = new Notification.Builder(context)
+                    .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
+                    .setContentTitle(title)
+                    .setTicker(title)
+                    .setContentText(info.name)
+                    .setContentInfo(percentText)
+                    .setProgress(info.max, info.progress, false)
+                    .setOngoing(true)
+                    .setLocalOnly(true)
+                    .setColor(context.getColor(
+                            com.android.internal.R.color.system_notification_accent_color))
+                    .addAction(cancelAction)
+                    .build();
+
+            NotificationManager.from(context).notify(TAG, info.pid, notification);
+        }
+
+        /**
+         * Finalizes the progress on a given process and sends the finished intent.
+         */
+        private void stopProgress(int pid, Intent intent) {
+            synchronized (mProcesses) {
+                if (mProcesses.indexOfKey(pid) < 0) {
+                    Log.w(TAG, "PID not watched: " + pid);
+                } else {
+                    mProcesses.remove(pid);
+                }
+                stopSelfWhenDone();
+            }
+            if (DEBUG) Log.v(TAG, "stopProgress(" + pid + "): cancel notification");
+            NotificationManager.from(getApplicationContext()).cancel(TAG, pid);
+            if (intent != null) {
+                // Bug report finished fine: send a new, different notification.
+                if (DEBUG) Log.v(TAG, "stopProgress(" + pid + "): finish bug report");
+                onBugreportFinished(pid, intent);
+            }
+        }
+
+        /**
+         * Cancels a bugreport upon user's request.
+         */
+        private void cancel(int pid) {
+            Log.i(TAG, "Cancelling PID " + pid + " on user's request");
+            SystemProperties.set(PROPERTY_CTL_STOP, BUGREPORT_SERVICE);
+            stopProgress(pid, null);
+        }
+
+        /**
+         * Poll {@link SystemProperties} to get the progress on each monitored process.
+         */
+        private void pollProgress() {
+            synchronized (mProcesses) {
+                if (mProcesses.size() == 0) {
+                    Log.d(TAG, "No process to poll progress.");
+                }
+                for (int i = 0; i < mProcesses.size(); i++) {
+                    int pid = mProcesses.keyAt(i);
+                    String property = String.format(PROPERTY_TEMPLATE_PROGRESS, pid);
+                    int progress = SystemProperties.getInt(property, 0);
+                    if (progress == 0) {
+                        Log.v(TAG, "System property " + property + " is not set yet");
+                        continue;
+                    }
+
+                    BugreportInfo info = mProcesses.valueAt(i);
+
+                    if (progress != info.progress) {
+                        if (DEBUG) Log.v(TAG, "Updating progress for PID " + pid + " from "
+                                + info.progress + " to " + progress);
+                        info.progress = progress;
+                        info.lastUpdate = System.currentTimeMillis();
+                        updateProgress(info);
+                    } else {
+                        long inactiveTime = System.currentTimeMillis() - info.lastUpdate;
+                        if (inactiveTime >= INACTIVITY_TIMEOUT) {
+                            Log.w(TAG, "No progress update for process " + pid + " since "
+                                    + info.getFormattedLastUpdate());
+                            stopProgress(info.pid, null);
+                        }
+                    }
+                }
+                // Keep polling...
+                sendEmptyMessageDelayed(MSG_POLL, POLLING_FREQUENCY);
+            }
+        }
+
+        /**
+         * Finishes the service when it's not monitoring any more processes.
+         */
+        private void stopSelfWhenDone() {
+            synchronized (mProcesses) {
+                if (mProcesses.size() > 0) {
+                    if (DEBUG) Log.v(TAG, "Staying alive, waiting for pids " + mProcesses);
+                    return;
+                }
+                Log.v(TAG, "No more pids to handle, shutting down");
+                stopSelf();
+            }
+        }
+
+        private void onBugreportFinished(int pid, Intent intent) {
+            final Context context = getApplicationContext();
+            final Configuration conf = context.getResources().getConfiguration();
+            final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
+            final File screenshotFile = getFileExtra(intent, EXTRA_SCREENSHOT);
+
+            if ((conf.uiMode & Configuration.UI_MODE_TYPE_MASK) != Configuration.UI_MODE_TYPE_WATCH) {
+                triggerLocalNotification(context, pid, bugreportFile, screenshotFile);
+            }
+        }
     }
 
     /**
-     * Responsible for triggering a notification that allows the user to start a
-     * "share" intent with the bug report. On watches we have other methods to allow the user to
-     * start this intent (usually by triggering it on another connected device); we don't need to
-     * display the notification in this case.
+     * Responsible for triggering a notification that allows the user to start a "share" intent with
+     * the bug report. On watches we have other methods to allow the user to start this intent
+     * (usually by triggering it on another connected device); we don't need to display the
+     * notification in this case.
      */
-    private static void triggerLocalNotification(final Context context, final File bugreportFile,
-            final File screenshotFile) {
+    private static void triggerLocalNotification(final Context context, final int pid,
+            final File bugreportFile, final File screenshotFile) {
         if (!bugreportFile.exists() || !bugreportFile.canRead()) {
             Log.e(TAG, "Could not read bugreport file " + bugreportFile);
             Toast.makeText(context, context.getString(R.string.bugreport_unreadable_text),
@@ -103,10 +428,10 @@
         boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt");
         if (!isPlainText) {
             // Already zipped, send it right away.
-            sendBugreportNotification(context, bugreportFile, screenshotFile);
+            sendBugreportNotification(context, pid, bugreportFile, screenshotFile);
         } else {
             // Asynchronously zip the file first, then send it.
-            sendZippedBugreportNotification(context, bugreportFile, screenshotFile);
+            sendZippedBugreportNotification(context, pid, bugreportFile, screenshotFile);
         }
     }
 
@@ -155,7 +480,7 @@
     /**
      * Sends a bugreport notitication.
      */
-    private static void sendBugreportNotification(Context context, File bugreportFile,
+    private static void sendBugreportNotification(Context context, int pid, File bugreportFile,
             File screenshotFile) {
         // Files are kept on private storage, so turn into Uris that we can
         // grant temporary permissions for.
@@ -173,10 +498,11 @@
         }
         notifIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
+        final String title = context.getString(R.string.bugreport_finished_title);
         final Notification.Builder builder = new Notification.Builder(context)
                 .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
-                .setContentTitle(context.getString(R.string.bugreport_finished_title))
-                .setTicker(context.getString(R.string.bugreport_finished_title))
+                .setContentTitle(title)
+                .setTicker(title)
                 .setContentText(context.getString(R.string.bugreport_finished_text))
                 .setContentIntent(PendingIntent.getActivity(
                         context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT))
@@ -185,19 +511,19 @@
                 .setColor(context.getColor(
                         com.android.internal.R.color.system_notification_accent_color));
 
-        NotificationManager.from(context).notify(TAG, 0, builder.build());
+        NotificationManager.from(context).notify(TAG, pid, builder.build());
     }
 
     /**
      * Sends a zipped bugreport notification.
      */
     private static void sendZippedBugreportNotification(final Context context,
-            final File bugreportFile, final File screenshotFile) {
+            final int pid, final File bugreportFile, final File screenshotFile) {
         new AsyncTask<Void, Void, Void>() {
             @Override
             protected Void doInBackground(Void... params) {
                 File zippedFile = zipBugreport(bugreportFile);
-                sendBugreportNotification(context, zippedFile, screenshotFile);
+                sendBugreportNotification(context, pid, zippedFile, screenshotFile);
                 return null;
             }
         }.execute();
@@ -213,8 +539,8 @@
         Log.v(TAG, "zipping " + bugreportPath + " as " + zippedPath);
         File bugreportZippedFile = new File(zippedPath);
         try (InputStream is = new FileInputStream(bugreportFile);
-            ZipOutputStream zos = new ZipOutputStream(
-                new BufferedOutputStream(new FileOutputStream(bugreportZippedFile)))) {
+                ZipOutputStream zos = new ZipOutputStream(
+                        new BufferedOutputStream(new FileOutputStream(bugreportZippedFile)))) {
             ZipEntry entry = new ZipEntry(bugreportFile.getName());
             entry.setTime(bugreportFile.lastModified());
             zos.putNextEntry(entry);
@@ -230,8 +556,8 @@
             }
             return bugreportZippedFile;
         } catch (IOException e) {
-          Log.e(TAG, "exception zipping file " + zippedPath, e);
-          return bugreportFile;  // Return original.
+            Log.e(TAG, "exception zipping file " + zippedPath, e);
+            return bugreportFile; // Return original.
         }
     }
 
@@ -281,4 +607,55 @@
             return null;
         }
     }
+
+    /**
+     * Information about a bug report process while its in progress.
+     */
+    private static final class BugreportInfo {
+        /**
+         * {@code pid} of the {@code dumpstate} process generating the bug report.
+         */
+        final int pid;
+
+        /**
+         * Name of the bug report, will be used to rename the final files.
+         * <p>
+         * Initial value is the bug report filename reported by {@code dumpstate}, but user can
+         * change it later to a more meaningful name.
+         */
+        final String name;
+
+        /**
+         * Maximum progress of the bug report generation.
+         */
+        final int max;
+
+        /**
+         * Current progress of the bug report generation.
+         */
+        int progress;
+
+        /**
+         * Time of the last progress update.
+         */
+        long lastUpdate = System.currentTimeMillis();
+
+        BugreportInfo(int pid, String name, int max) {
+            this.pid = pid;
+            this.name = name;
+            this.max = max;
+        }
+
+        String getFormattedLastUpdate() {
+            return SimpleDateFormat.getDateTimeInstance().format(new Date(lastUpdate));
+        }
+
+        @Override
+        public String toString() {
+            final float percent = ((float) progress * 100 / max);
+            return String.format("Progress for %s (pid=%d): %d/%d (%2.2f%%) Last update: %s", name,
+                    pid, progress, max, percent,
+                    getFormattedLastUpdate());
+        }
+    }
 }
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java
index f1da14d..5133162 100644
--- a/packages/Shell/src/com/android/shell/BugreportReceiver.java
+++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java
@@ -17,6 +17,8 @@
 package com.android.shell;
 
 import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
+import static com.android.shell.BugreportProgressService.EXTRA_ORIGINAL_INTENT;
+import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
 import static com.android.shell.BugreportProgressService.getFileExtra;
 
 import java.io.File;
@@ -50,13 +52,16 @@
         // Clean up older bugreports in background
         cleanupOldFiles(intent);
 
-        // Delegate to service.
+        // Delegate intent handling to service.
         Intent serviceIntent = new Intent(context, BugreportProgressService.class);
-        serviceIntent.putExtras(intent.getExtras());
+        serviceIntent.putExtra(EXTRA_ORIGINAL_INTENT, intent);
         context.startService(serviceIntent);
     }
 
     private void cleanupOldFiles(Intent intent) {
+        if (!INTENT_BUGREPORT_FINISHED.equals(intent.getAction())) {
+            return;
+        }
         final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
         final PendingResult result = goAsync();
         new AsyncTask<Void, Void, Void>() {
diff --git a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
index 1bdd9dd..33c4ef1 100644
--- a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
+++ b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java
@@ -19,7 +19,12 @@
 import static android.test.MoreAsserts.assertContainsRegex;
 import static com.android.shell.ActionSendMultipleConsumerActivity.UI_NAME;
 import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
+import static com.android.shell.BugreportProgressService.EXTRA_MAX;
+import static com.android.shell.BugreportProgressService.EXTRA_NAME;
+import static com.android.shell.BugreportProgressService.EXTRA_PID;
 import static com.android.shell.BugreportProgressService.EXTRA_SCREENSHOT;
+import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
+import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_STARTED;
 
 import java.io.BufferedOutputStream;
 import java.io.BufferedWriter;
@@ -96,6 +101,33 @@
         cancelExistingNotifications();
     }
 
+    public void testFullWorkflow() throws Exception {
+        final String name = "BUG, Y U NO REPORT?";
+        // TODO: call method to remove property instead
+        SystemProperties.set("dumpstate.42.progress", "-1");
+
+        Intent intent = new Intent(INTENT_BUGREPORT_STARTED);
+        intent.putExtra(EXTRA_PID, 42);
+        intent.putExtra(EXTRA_NAME, name);
+        intent.putExtra(EXTRA_MAX, 1000);
+        mContext.sendBroadcast(intent);
+
+        assertProgressNotification(name, "0.00%");
+
+        SystemProperties.set("dumpstate.42.progress", "108");
+        assertProgressNotification(name, "10.80%");
+
+        SystemProperties.set("dumpstate.42.progress", "500");
+        assertProgressNotification(name, "50.00%");
+
+        createTextFile(PLAIN_TEXT_PATH, BUGREPORT_CONTENT);
+        createTextFile(SCREENSHOT_PATH, SCREENSHOT_CONTENT);
+        Bundle extras = sendBugreportFinishedIntent(42, PLAIN_TEXT_PATH, SCREENSHOT_PATH);
+        assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT);
+
+        // TODO: assert service is down
+    }
+
     public void testBugreportFinished_plainBugreportAndScreenshot() throws Exception {
         createTextFile(PLAIN_TEXT_PATH, BUGREPORT_CONTENT);
         createTextFile(SCREENSHOT_PATH, SCREENSHOT_CONTENT);
@@ -131,13 +163,32 @@
         }
     }
 
+    private void assertProgressNotification(String name, String percent) {
+        // TODO: it current looks for 3 distinct objects, without taking advantage of their
+        // relationship.
+        String title = mContext.getString(R.string.bugreport_in_progress_title);
+        Log.v(TAG, "Looking for progress notification title: '" + title+ "'");
+        mUiBot.getNotification(title);
+        Log.v(TAG, "Looking for progress notification details: '" + name + "-" + percent + "'");
+        mUiBot.getObject(name);
+        mUiBot.getObject(percent);
+    }
+
     /**
      * Sends a "bugreport finished" intent and waits for the result.
      *
      * @return extras sent to the bugreport finished consumer.
      */
     private Bundle sendBugreportFinishedIntent(String bugreportPath, String screenshotPath) {
-        Intent intent = new Intent("android.intent.action.BUGREPORT_FINISHED");
+        return sendBugreportFinishedIntent(null, bugreportPath, screenshotPath);
+    }
+
+    private Bundle sendBugreportFinishedIntent(Integer pid, String bugreportPath,
+            String screenshotPath) {
+        Intent intent = new Intent(INTENT_BUGREPORT_FINISHED);
+        if (pid != null) {
+            intent.putExtra(EXTRA_PID, pid);
+        }
         if (bugreportPath != null) {
             intent.putExtra(EXTRA_BUGREPORT, bugreportPath);
         }
diff --git a/packages/Shell/tests/src/com/android/shell/UiBot.java b/packages/Shell/tests/src/com/android/shell/UiBot.java
index f5dd31c..5e8bab1 100644
--- a/packages/Shell/tests/src/com/android/shell/UiBot.java
+++ b/packages/Shell/tests/src/com/android/shell/UiBot.java
@@ -20,6 +20,7 @@
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiObjectNotFoundException;
+import android.support.test.uiautomator.UiScrollable;
 import android.support.test.uiautomator.UiSelector;
 import android.support.test.uiautomator.Until;
 import android.util.Log;
@@ -42,32 +43,49 @@
     }
 
     /**
-     * Opens the system notification and clicks a given notification.
+     * Opens the system notification and gets a given notification.
      *
      * @param text Notificaton's text as displayed by the UI.
+     * @return notification object.
      */
-    public void clickOnNotification(String text) {
+    public UiObject getNotification(String text) {
         boolean opened = mDevice.openNotification();
         Log.v(TAG, "openNotification(): " + opened);
         boolean gotIt = mDevice.wait(Until.hasObject(By.pkg(SYSTEMUI_PACKAGED)), mTimeout);
         assertTrue("could not get system ui (" + SYSTEMUI_PACKAGED + ")", gotIt);
 
-        gotIt = mDevice.wait(Until.hasObject(By.text(text)), mTimeout);
-        assertTrue("object with text '(" + text + "') not visible yet", gotIt);
+        return getObject(text);
+    }
 
-        UiObject notification = getVisibleObject(text);
-
+    /**
+     * Opens the system notification and clicks a given notification.
+     *
+     * @param text Notificaton's text as displayed by the UI.
+     */
+    public void clickOnNotification(String text) {
+        UiObject notification = getNotification(text);
         click(notification, "bug report notification");
     }
 
     /**
-     * Gets an object which is guaranteed to be present in the current UI.\
+     * Gets an object that might not yet be available in current UI.
+     *
+     * @param text Object's text as displayed by the UI.
+     */
+    public UiObject getObject(String text) {
+        boolean gotIt = mDevice.wait(Until.hasObject(By.text(text)), mTimeout);
+        assertTrue("object with text '(" + text + "') not visible yet", gotIt);
+        return getVisibleObject(text);
+    }
+
+    /**
+     * Gets an object which is guaranteed to be present in the current UI.
      *
      * @param text Object's text as displayed by the UI.
      */
     public UiObject getVisibleObject(String text) {
         UiObject uiObject = mDevice.findObject(new UiSelector().text(text));
-        assertTrue("could not find object with text '(" + text + "')", uiObject.exists());
+        assertTrue("could not find object with text '" + text + "'", uiObject.exists());
         return uiObject;
     }
 
@@ -99,21 +117,27 @@
      */
     // TODO: UI Automator should provide such logic.
     public void chooseActivity(String name) {
-        // First select activity if it's not the default option.
-        boolean gotIt = mDevice.wait(Until.hasObject(By.text(name)), mTimeout);
-        // TODO: if the activity is indeed the default option, call above will timeout, which will
-        // make the tests run slower. It might be better to change the logic to assume the default
-        // first.
+        // First check if the activity is the default option.
+        String shareText = String.format("Share with %s", name);
+        boolean gotIt = mDevice.wait(Until.hasObject(By.text(shareText)), mTimeout);
+
         if (gotIt) {
-            Log.v(TAG, "Found activity " + name + ", it's not default action");
-            UiObject activityChooser = getVisibleObject(name);
-            click(activityChooser, "activity chooser");
+            Log.v(TAG, "Found activity " + name + ", it's the default action");
         } else {
-            String text = String.format("Share with %s", name);
-            Log.v(TAG, "Didn't find activity " + name
-                    + ", assuming it's the default action and search for '" + text + "'");
-            gotIt = mDevice.wait(Until.hasObject(By.text(text)), mTimeout);
-            assertTrue("did not find text '" + text + "'", gotIt);
+            // Since it's not, need to find it in the scrollable list...
+            Log.v(TAG, "Activity " + name + " is not default action");
+            UiScrollable activitiesList = new UiScrollable(new UiSelector().scrollable(true));
+
+            UiObject activity;
+            try {
+                activitiesList.scrollForward();
+                activity = getVisibleObject(name);
+            } catch (UiObjectNotFoundException e) {
+                throw new IllegalStateException("didn't find activity '" + name
+                        + "' on activities chooser", e);
+            }
+            // ... then select it.
+            click(activity, name);
         }
 
         // Then clicks the "Just Once" button.
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 6fda2c6..2f79adf 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -87,6 +87,7 @@
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
     <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
     <uses-permission android:name="android.permission.MANAGE_APP_TOKENS" />
+    <uses-permission android:name="android.permission.REGISTER_WINDOW_MANAGER_LISTENERS" />
     <uses-permission android:name="android.permission.SET_ORIENTATION" />
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
 
diff --git a/packages/SystemUI/res/drawable/notification_expand_more.xml b/packages/SystemUI/res/drawable/notification_expand_more.xml
index 5aa7937..430fb0d 100644
--- a/packages/SystemUI/res/drawable/notification_expand_more.xml
+++ b/packages/SystemUI/res/drawable/notification_expand_more.xml
@@ -12,7 +12,7 @@
     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.
+    limitations under the License._more
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="22.0dp"
diff --git a/packages/SystemUI/res/layout/notification_header.xml b/packages/SystemUI/res/layout/notification_header.xml
deleted file mode 100644
index 3475d00..0000000
--- a/packages/SystemUI/res/layout/notification_header.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2015 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
-  -->
-
-<com.android.systemui.statusbar.notification.NotificationHeaderView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="@dimen/notification_header_height"
-    android:clipChildren="false">
-    <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="@dimen/notification_header_height"
-        android:layout_gravity="start"
-        android:gravity="center_vertical"
-        android:paddingStart="@dimen/notification_content_margin_start">
-        <ImageView
-            android:id="@+id/header_notification_icon"
-            android:layout_width="24dp"
-            android:layout_height="24dp"
-            android:layout_marginEnd="4dp"
-            />
-        <TextView
-            android:id="@+id/number_of_children"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="@*android:style/TextAppearance.Material.Notification"
-            android:layout_marginEnd="2dp"
-            android:layout_marginStart="1dp"
-            />
-        <TextView
-            android:id="@+id/app_name_text"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="@style/TextAppearance.Material.Notification.HeaderTitle"
-            android:layout_marginStart="4dp"
-            android:layout_marginEnd="8dp"
-            />
-        <TextView
-            android:id="@+id/app_title_sub_text_divider"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="@style/TextAppearance.Material.Notification.HeaderTitle"
-            android:layout_marginEnd="8dp"
-            android:text="@string/notification_header_divider_symbol"/>
-        <TextView
-            android:id="@+id/title_sub_text"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="@style/TextAppearance.Material.Notification.HeaderTitle"
-            android:layout_marginEnd="8dp" />
-        <TextView
-            android:id="@+id/post_time"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="end|center_vertical"
-            android:textAppearance="@*android:style/TextAppearance.Material.Notification.Time"
-            android:paddingEnd="8dp"
-            />
-    </LinearLayout>
-    <ImageButton
-        android:id="@+id/notification_expand_button"
-        android:background="@null"
-        android:layout_width="48dp"
-        android:layout_height="48dp"
-        android:layout_gravity="end|center_vertical"
-        android:src="@drawable/notification_expand_more"
-        android:layout_marginEnd="8dp"
-        />
-</com.android.systemui.statusbar.notification.NotificationHeaderView>
diff --git a/packages/SystemUI/res/layout/recents_history.xml b/packages/SystemUI/res/layout/recents_history.xml
index de70d30..b65a5c5 100644
--- a/packages/SystemUI/res/layout/recents_history.xml
+++ b/packages/SystemUI/res/layout/recents_history.xml
@@ -19,16 +19,6 @@
     android:layout_height="match_parent"
     android:background="#99000000"
     android:orientation="vertical">
-    <TextView
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:padding="14dp"
-        android:gravity="start"
-        android:text="@string/recents_history_label"
-        android:textSize="24sp"
-        android:textColor="#FFFFFF"
-        android:fontFamily="sans-serif-medium" />
     <android.support.v7.widget.RecyclerView
         android:id="@+id/list"
         android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/recents_history_button.xml b/packages/SystemUI/res/layout/recents_history_button.xml
index 471f518..601c5ed 100644
--- a/packages/SystemUI/res/layout/recents_history_button.xml
+++ b/packages/SystemUI/res/layout/recents_history_button.xml
@@ -22,5 +22,9 @@
     android:textSize="14sp"
     android:textColor="#FFFFFF"
     android:textAllCaps="true"
+    android:shadowColor="#99000000"
+    android:shadowDx="0"
+    android:shadowDy="2"
+    android:shadowRadius="5"
     android:fontFamily="sans-serif-medium"
     android:visibility="invisible" />
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index b9088ec..0cea7ae 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -61,14 +61,6 @@
         />
 
     <ViewStub
-        android:layout="@layout/notification_header"
-        android:id="@+id/notification_header_stub"
-        android:inflatedId="@+id/notification_header"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/notification_header_height"
-        />
-
-    <ViewStub
         android:layout="@layout/notification_guts"
         android:id="@+id/notification_guts_stub"
         android:inflatedId="@+id/notification_guts"
diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml
index 1e18523..7006d43 100644
--- a/packages/SystemUI/res/values-af/strings.xml
+++ b/packages/SystemUI/res/values-af/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"skermvaspen"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"soek"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Kon nie <xliff:g id="APP">%s</xliff:g> begin nie."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Meer"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Geskiedenis"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Verdeel horisontaal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Verdeel vertikaal"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Verdeel gepasmaak"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Wys horlosiesekondes op die statusbalk. Sal batterylewe dalk beïnvloed."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Herrangskik Kitsinstellings"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Wys helderheid in Kitsinstellings"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Aktiveer oproep"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Aktiveer oproep deur die Oorsig-knoppie"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Aktiveer vinnige wissel"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Aktiveer beginuitteltyd terwyl daar opgeroep word"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Aktiveer volskerm-skermkiekies"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Aktiveer volskerm-skermkiekies in Oorsig"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimenteel"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Skakel Bluetooth aan?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Jy moet Bluetooth aanskakel om jou sleutelbord aan jou tablet te koppel."</string>
diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml
index 8dae911..948c538 100644
--- a/packages/SystemUI/res/values-am/strings.xml
+++ b/packages/SystemUI/res/values-am/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ማያ ገጽ መሰካት"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ፈልግ"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>ን መጀመር አልተቻለም።"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"ተጨማሪ"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ታሪክ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"አግድም ክፈል"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ቁልቁል ክፈል"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"በብጁ ክፈል"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"የሰዓት ሰከንዶችን በሁኔታ አሞሌ ውስጥ አሳይ። በባትሪ ዕድሜ ላይ ተጽዕኖ ሊኖርው ይችል ይሆናል።"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ፈጣን ቅንብሮችን ዳግም ያደራጁ"</string>
     <string name="show_brightness" msgid="6613930842805942519">"በፈጣን ቅንብሮች ውስጥ ብሩህነትን አሳይ"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"ገጽ መስራትን አንቃ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"በአጠቃላይ እይታ አዝራር በኩል ገጽ መስራትን አንቃ"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"ፈጣን ቅይይርን አንቃ"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"ገጽ እየሰራ ሳለ የማስጀመሪያ ጊዜ ማብቂያውን አንቃ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"የሙሉ ማያ ገጽ ቅጽበታዊ ገጽ እይታዎችን አንቃ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"በአጠቃላይ እይታ ውስጥ የሙሉ ማያ ገጽ ቅጽበታዊ ገጽ እይታዎችን አንቃ"</string>
     <string name="experimental" msgid="6198182315536726162">"የሙከራ"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ብሉቱዝ ይብራ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"የቁልፍ ሰሌዳዎን ከእርስዎ ጡባዊ ጋር ለማገናኘት በመጀመሪያ ብሉቱዝን ማብራት አለብዎት።"</string>
diff --git a/packages/SystemUI/res/values-ar/strings.xml b/packages/SystemUI/res/values-ar/strings.xml
index b7d85b7..e272364 100644
--- a/packages/SystemUI/res/values-ar/strings.xml
+++ b/packages/SystemUI/res/values-ar/strings.xml
@@ -298,6 +298,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"تثبيت الشاشة"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"بحث"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"تعذر بدء <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"المزيد"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"السجلّ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"تقسيم أفقي"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"تقسيم رأسي"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"تقسيم مخصص"</string>
@@ -441,12 +443,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"عرض ثواني الساعة في شريط الحالة. قد يؤثر ذلك في عمر البطارية."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"إعادة ترتيب الإعدادات السريعة"</string>
     <string name="show_brightness" msgid="6613930842805942519">"عرض السطوع في الإعدادات السريعة"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"تمكين الترحيل"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"تمكين الترحيل عبر زر \"نظرة عامة\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"تمكين التبديل السريع"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"تمكين مهلة الإطلاق أثناء الترحيل"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"تمكين اللقطات بملء الشاشة"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"تمكين اللقطات بملء الشاشة في النظرة العامة"</string>
     <string name="experimental" msgid="6198182315536726162">"إعدادات تجريبية"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"تشغيل البلوتوث؟"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"لتوصيل لوحة المفاتيح بالجهاز اللوحي، يلزمك تشغيل بلوتوث أولاً."</string>
diff --git a/packages/SystemUI/res/values-az-rAZ/strings.xml b/packages/SystemUI/res/values-az-rAZ/strings.xml
index b872db3..7f2a6b07 100644
--- a/packages/SystemUI/res/values-az-rAZ/strings.xml
+++ b/packages/SystemUI/res/values-az-rAZ/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ekran sancağı"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"axtarış"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> başlana bilmir."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Daha çox"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Tarixçə"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Üfüqi Böl"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Şaquli Böl"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Fərdi Böl"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Saatın saniyəsini status panelində göstərin. Batareyaya təsir edə bilər."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Sürətli Ayarları yenidən tənzimləyin"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Sürətli ayarlarda parlaqlılığı göstərin"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Səhifə nömrələməni aktiv edin"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Baxış düyməsi vasitəsilə səhifələməni aktiv edin"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Sürətli keçidi aktiv edin"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Səhifə nömrələyərkən işə salma vaxtının bitməsini aktiv edin"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Tam ekran ani görüntülərini aktiv edin"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Tam ekran ani görüntülərini İcmalda aktiv edin"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth aktivləşsin?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Tabletinizlə klaviaturaya bağlanmaq üçün ilk olaraq Bluetooth\'u aktivləşdirməlisiniz."</string>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index fd5ddbf..6ed2adb 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"фиксиране на екрана"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"търсене"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> не можа да стартира."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Още"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"История"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Хоризонтално разделяне"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Вертикално разделяне"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Персонализирано разделяне"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Показване на секундите на часовника в лентата на състоянието. Може да се отрази на живота на батерията."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Пренареждане на бързите настройки"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Показване на яркостта от бързите настройки"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Активиране на разделянето на страници"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Активиране на разделянето на страници чрез бутона за общ преглед"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Активиране на бързото превключване"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Активиране на времето за изчакване при стартиране за разделянето на страници"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Активиране на екранните снимки на цял екран"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Активиране на екранните снимки на цял екран в режима на общ преглед"</string>
     <string name="experimental" msgid="6198182315536726162">"Експериментални"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Да се включи ли Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"За да свържете клавиатурата с таблета си, първо трябва да включите Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-bn-rBD/strings.xml b/packages/SystemUI/res/values-bn-rBD/strings.xml
index 442b179..20e2c35 100644
--- a/packages/SystemUI/res/values-bn-rBD/strings.xml
+++ b/packages/SystemUI/res/values-bn-rBD/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"স্ক্রীন পিন করা"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"অনুসন্ধান"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> শুরু করা যায়নি৷"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"আরো"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ইতিহাস"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"অনুভূমিক স্প্লিট"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"উল্লম্ব স্প্লিট"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"কাস্টম স্প্লিট করুন"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"স্থিতি দন্ডে ঘড়ির সেকেন্ড দেখায়৷ ব্যাটারি লাইফকে প্রভাবিত করতে পারে৷"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"দ্রুত সেটিংসে পুনরায় সাজান"</string>
     <string name="show_brightness" msgid="6613930842805942519">"দ্রুত সেটিংসে উজ্জ্বলতা দেখান"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"পেজিং সক্ষম করুন"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"\'এক নজরে\' বোতামের মাধ্যমে পেজিং সক্ষম করুন"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"\'দ্রুত টগল করা\'র ব্যবস্থাটি সক্ষম করুন"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"পেজিং এর সময় \'লঞ্চ সময় সমাপ্ত\' সক্ষম করুন"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"পূর্ণস্ক্রীন স্ক্রীনশট সক্ষম করুন"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"\'এক নজরে\'র মধ্যে পূর্ণস্ক্রীন স্ক্রীনশট সক্ষম করুন"</string>
     <string name="experimental" msgid="6198182315536726162">"পরীক্ষামূলক"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth চালু করবেন?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"আপনার ট্যাবলেটের সাথে আপনার কীবোর্ড সংযুক্ত করতে, আপনাকে প্রথমে Bluetooth চালু করতে হবে।"</string>
diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml
index f67b425..0bb4826 100644
--- a/packages/SystemUI/res/values-ca/strings.xml
+++ b/packages/SystemUI/res/values-ca/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixació de pantalla"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"cerca"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"No s\'ha pogut iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Més"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historial"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divisió horitzontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divisió vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divisió personalitzada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostra els segons del rellotge a la barra d\'estat. Això pot afectar la durada de la bateria."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganitza Configuració ràpida"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostra la brillantor a Configuració ràpida"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Activa la paginació"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Activa la paginació mitjançant el botó Visió general"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Activa el canvi ràpid"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Activa el temps d\'espera de llançament durant la paginació"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Activa les captures de pantalla completa"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Activa les captures de pantalla completa a Visió general"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vols activar el Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Per connectar el teclat amb la tauleta, primer has d\'activar el Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 08d833e..63a16ad 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"připnutí obrazovky"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"vyhledat"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Aplikaci <xliff:g id="APP">%s</xliff:g> nelze spustit."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Další"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historie"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Vodorovné rozdělení"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Vertikální rozdělení"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Vlastní rozdělení"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Na stavovém řádku se bude zobrazovat sekundová ručička. Může být ovlivněna výdrž baterie."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Změnit uspořádání Rychlého nastavení"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Zobrazit jas v Rychlém nastavení"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Povolit stránkování"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Povolit stránkování pomocí tlačítka Přehled"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Povolit rychlé přepínání"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Povolit časový limit pro spuštění při stránkování"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Povolit snímky celé obrazovky"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Povolit snímky celé obrazovky v Přehledu"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentální"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Zapnout Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Chcete-li klávesnici připojit k tabletu, nejdříve musíte zapnout Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 1fb1a51..eb8053d 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"bliv i app"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"søg"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> kunne ikke startes."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mere"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historik"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Opdel vandret"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Opdel lodret"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Opdel brugerdefineret"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Vis sekunder i statuslinjen. Dette kan påvirke batteriets levetid."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Omarranger Hurtige indstillinger"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Vis lysstyrke i Hurtige indstillinger"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Aktivér sideopdeling"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Aktivér sideopdeling via knappen Oversigt"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Aktivér hurtigt skift"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Aktivér åbningstimeout ved sideinddeling"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Aktivér skærmbilleder i fuld størrelse"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Aktivér skærmbilleder i fuld størrelse i Oversigt"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentel"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vil du slå Bluetooth til?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Bluetooth skal være slået til, før du kan knytte dit tastatur til din tablet."</string>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index a9196d6..e156c92 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"Bildschirmfixierung"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"Suche"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> konnte nicht gestartet werden."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mehr"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Verlauf"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Geteilte Schaltfläche – horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Geteilte Schaltfläche – vertikal"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Geteilte Schaltfläche – benutzerdefiniert"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Uhrsekunden in der Statusleiste anzeigen. Kann sich auf die Akkulaufzeit auswirken."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Schnelleinstellungen neu anordnen"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Helligkeit in den Schnelleinstellungen anzeigen"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Paging aktivieren"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Paging über die Schaltfläche \"Übersicht\" aktivieren"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Schnelles Wechseln aktivieren"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Beim Paging Zeitlimit für Start aktivieren"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Vollbild-Screenshots aktivieren"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Vollbild-Screenshots in der Übersicht aktivieren"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentell"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth aktivieren?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Zum Verbinden von Tastatur und Tablet muss Bluetooth aktiviert sein."</string>
diff --git a/packages/SystemUI/res/values-el/strings.xml b/packages/SystemUI/res/values-el/strings.xml
index e982df6..b0dcc40 100644
--- a/packages/SystemUI/res/values-el/strings.xml
+++ b/packages/SystemUI/res/values-el/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"καρφίτσωμα οθόνης"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"αναζήτηση"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Δεν ήταν δυνατή η εκκίνηση της εφαρμογής <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Περισσότερα"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Ιστορικό"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Οριζόντιος διαχωρισμός"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Κάθετος διαχωρισμός"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Προσαρμοσμένος διαχωρισμός"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Εμφάνιση δευτερολέπτων ρολογιού στη γραμμή κατάστασης. Ενδέχεται να επηρεάσει τη διάρκεια ζωής της μπαταρίας."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Αναδιάταξη Γρήγορων ρυθμίσεων"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Εμφάνιση φωτεινότητας στις Γρήγορες ρυθμίσεις"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Ενεργοποίηση σελιδοποίησης"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Ενεργοποίηση σελιδοποίησης μέσω του κουμπιού \"Επισκόπηση\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Ενεργοποίηση γρήγορης εναλλαγής"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Ενεργοποίηση του χρονικού ορίου λήξης εκκίνησης κατά τη σελιδοποίηση"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Ενεργοποίηση στιγμιοτύπων πλήρους οθόνης"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Ενεργοποίηση των στιγμιοτύπων πλήρους οθόνης στην Προεπισκόπηση"</string>
     <string name="experimental" msgid="6198182315536726162">"Σε πειραματικό στάδιο"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Ενεργοποίηση Bluetooth;"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Για να συνδέσετε το πληκτρολόγιο με το tablet σας, θα πρέπει πρώτα να ενεργοποιήσετε το Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-en-rAU/strings.xml b/packages/SystemUI/res/values-en-rAU/strings.xml
index 32c486f..84f1785 100644
--- a/packages/SystemUI/res/values-en-rAU/strings.xml
+++ b/packages/SystemUI/res/values-en-rAU/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"screen pinning"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"search"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"More"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"History"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Split Horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Split Vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Split Customised"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Show clock seconds in the status bar. May impact battery life."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Rearrange Quick Settings"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Show brightness in Quick Settings"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Enable paging"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Enable paging via the Overview button"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Enable fast toggle"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Enable launch timeout while paging"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Enable fullscreen screenshots"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Enable fullscreen screenshots in Overview"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Turn on Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"To connect your keyboard with your tablet, you first have to turn on Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-en-rGB/strings.xml b/packages/SystemUI/res/values-en-rGB/strings.xml
index 32c486f..84f1785 100644
--- a/packages/SystemUI/res/values-en-rGB/strings.xml
+++ b/packages/SystemUI/res/values-en-rGB/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"screen pinning"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"search"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"More"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"History"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Split Horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Split Vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Split Customised"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Show clock seconds in the status bar. May impact battery life."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Rearrange Quick Settings"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Show brightness in Quick Settings"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Enable paging"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Enable paging via the Overview button"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Enable fast toggle"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Enable launch timeout while paging"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Enable fullscreen screenshots"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Enable fullscreen screenshots in Overview"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Turn on Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"To connect your keyboard with your tablet, you first have to turn on Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-en-rIN/strings.xml b/packages/SystemUI/res/values-en-rIN/strings.xml
index 32c486f..84f1785 100644
--- a/packages/SystemUI/res/values-en-rIN/strings.xml
+++ b/packages/SystemUI/res/values-en-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"screen pinning"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"search"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"More"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"History"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Split Horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Split Vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Split Customised"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Show clock seconds in the status bar. May impact battery life."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Rearrange Quick Settings"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Show brightness in Quick Settings"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Enable paging"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Enable paging via the Overview button"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Enable fast toggle"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Enable launch timeout while paging"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Enable fullscreen screenshots"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Enable fullscreen screenshots in Overview"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Turn on Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"To connect your keyboard with your tablet, you first have to turn on Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml
index 27451ec6..c9af193 100644
--- a/packages/SystemUI/res/values-es-rUS/strings.xml
+++ b/packages/SystemUI/res/values-es-rUS/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"Fijar pantalla"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"buscar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"No se pudo iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Más"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historial"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"División horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"División vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"División personalizada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Muestra los segundos del reloj en la barra de estado. Puede afectar la duración de la batería."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar la Configuración rápida"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar el brillo en la Configuración rápida"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Habilitar paginación"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Habilita la paginación a través del botón Recientes"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Habilitar la activación rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Habilita el tiempo de espera de inicio durante la paginación"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Habilitar capturas de pantalla en pantalla completa"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Habilita las capturas de pantalla en pantalla completa en Recientes"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"¿Activar Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para conectar el teclado con la tablet, primero debes activar Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-es/strings.xml b/packages/SystemUI/res/values-es/strings.xml
index 1a7fea5..51984bf 100644
--- a/packages/SystemUI/res/values-es/strings.xml
+++ b/packages/SystemUI/res/values-es/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fijación de pantalla"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"buscar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"No se ha podido iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Más"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historial"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"División horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"División vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"División personalizada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Muestra los segundos del reloj en la barra de estado. Puede afectar a la duración de la batería."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar Ajustes rápidos"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar brillo en Ajustes rápidos"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Habilitar paginación"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Habilitar paginación con el botón Visión general"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Habilitar activación rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Habilitar tiempo de espera de lanzamiento durante paginación"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Habilitar capturas de pantalla completa"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Habilitar capturas de pantalla completa en Visión general"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"¿Activar Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para poder conectar tu teclado a tu tablet, debes activar el Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-et-rEE/strings.xml b/packages/SystemUI/res/values-et-rEE/strings.xml
index 1369252..b527b9f 100644
--- a/packages/SystemUI/res/values-et-rEE/strings.xml
+++ b/packages/SystemUI/res/values-et-rEE/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ekraanikuva kinnitamine"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"otsing"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Rakendust <xliff:g id="APP">%s</xliff:g> ei saanud käivitada."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Rohkem"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Ajalugu"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Horisontaalne poolitamine"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Vertikaalne poolitamine"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Kohandatud poolitamine"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Olekuribal kella sekundite kuvamine. See võib mõjutada aku kasutusaega."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Korralda kiirseaded ümber"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Kuva kiirseadetes heledus"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Luba sirvimine"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Saate lubada sirvimise nupuga Ülevaade"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Luba kiire vahetamine"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Luba sirvimisel käivitamise ajalõpp"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Luba täisekraanil ekraanipildid"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Saate lubada lehel Ülevaade täisekraanil ekraanipildid"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentaalne"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Kas lülitada Bluetooth sisse?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Klaviatuuri ühendamiseks tahvelarvutiga peate esmalt Bluetoothi sisse lülitama."</string>
diff --git a/packages/SystemUI/res/values-eu-rES/strings.xml b/packages/SystemUI/res/values-eu-rES/strings.xml
index 6a5212e..b7cfb2a2 100644
--- a/packages/SystemUI/res/values-eu-rES/strings.xml
+++ b/packages/SystemUI/res/values-eu-rES/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"pantaila-ainguratzea"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"bilatu"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Ezin izan da hasi <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Gehiago"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historia"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Banaketa horizontala"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Banaketa bertikala"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Banaketa pertsonalizatua"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Erakutsi erlojuko segundoak egoera-barran. Baliteke bateria gehiago erabiltzea."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Berrantolatu ezarpen bizkorrak"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Erakutsi distira Ezarpen bizkorretan"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Gaitu orriak pasatzeko aukera"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Gaitu ikuspegi orokorraren botoiaren bidez orriak pasatzeko aukera"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Gaitu bizkor aldatzeko aukera"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Gaitu orriak pasatu bitarteko abiarazteen denbora-muga"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Gaitu pantaila osoko pantaila-argazkiak"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Gaitu pantaila osoko pantaila-argazkiak ikuspegi orokorrean"</string>
     <string name="experimental" msgid="6198182315536726162">"Esperimentala"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth eginbidea aktibatu nahi duzu?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Teklatua tabletara konektatzeko, Bluetooth eginbidea aktibatu behar duzu."</string>
diff --git a/packages/SystemUI/res/values-fa/strings.xml b/packages/SystemUI/res/values-fa/strings.xml
index 6bfef66..b3d8216 100644
--- a/packages/SystemUI/res/values-fa/strings.xml
+++ b/packages/SystemUI/res/values-fa/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"پین کردن صفحه"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"جستجو"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> شروع نشد."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"بیشتر"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"سابقه"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"تقسیم افقی"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"تقسیم عمودی"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"سفارشی کردن تقسیم"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ثانیه‌های ساعت را در نوار وضعیت نشان می‌دهد. ممکن است بر ماندگاری باتری تأثیر بگذارد."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ترتیب مجدد در تنظیمات سریع"</string>
     <string name="show_brightness" msgid="6613930842805942519">"نمایش روشنایی در تنظیمات سریع"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"فعال کردن صفحه‌بندی"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"فعال کردن صفحه‌بندی از طریق دکمه «نمای کلی»"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"فعال کردن جابه‌جایی سریع"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"فعال کردن مهلت زمانی راه‌اندازی هنگام صفحه‌بندی"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"فعال کردن عکس‌های صفحه‌نمایش تمام‌صفحه"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"فعال کردن عکس‌های صفحه‌نمایش تمام‌صفحه در مرور کلی"</string>
     <string name="experimental" msgid="6198182315536726162">"آزمایشی"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"بلوتوث روشن شود؟"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"برای مرتبط کردن صفحه‌کلید با رایانه لوحی، ابتدا باید بلوتوث را روشن کنید."</string>
diff --git a/packages/SystemUI/res/values-fi/strings.xml b/packages/SystemUI/res/values-fi/strings.xml
index 4d0debe..235eef0 100644
--- a/packages/SystemUI/res/values-fi/strings.xml
+++ b/packages/SystemUI/res/values-fi/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"näytön kiinnitys"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"haku"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Sovelluksen <xliff:g id="APP">%s</xliff:g> käynnistäminen epäonnistui."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Lisää"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historia"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Vaakasuuntainen jako"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Pystysuuntainen jako"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Muokattu jako"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Näytä sekunnit tilapalkin kellossa. Tämä voi vaikuttaa akun kestoon."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Järjestä pika-asetukset uudelleen"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Näytä kirkkaus pika-asetuksissa"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Ota sivutus käyttöön"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Ottaa sivutuksen käyttöön Yleiskatsaus-painikkeen avulla."</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Ota käyttöön nopea päälle/pois-toiminto."</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Ottaa käynnistyksen aikakatkaisun käyttöön sivutuksen aikana."</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Salli koko ruudun kuvakaappaukset"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Sallii koko ruudun kuvakaappaukset Viimeisimmät-näkymässä."</string>
     <string name="experimental" msgid="6198182315536726162">"Kokeellinen"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Otetaanko Bluetooth käyttöön?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Jotta voit yhdistää näppäimistön tablettiisi, sinun on ensin otettava Bluetooth käyttöön."</string>
diff --git a/packages/SystemUI/res/values-fr-rCA/strings.xml b/packages/SystemUI/res/values-fr-rCA/strings.xml
index 24a033f..3493067 100644
--- a/packages/SystemUI/res/values-fr-rCA/strings.xml
+++ b/packages/SystemUI/res/values-fr-rCA/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"épinglage d\'écran"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"rechercher"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Impossible de lancer <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Plus"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historique"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Séparation horizontale"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Séparation verticale"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Séparation personnalisée"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Afficher les secondes sur l\'horloge dans la barre d\'état. Cela peut réduire l\'autonomie de la pile."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Réorganiser les paramètres rapides"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Afficher la luminosité dans les paramètres rapides"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Activer la mise en page"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Activer la mise en page à l\'aide du bouton Aperçu"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Activer le basculement rapide"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Activer le délai avant expiration du lancement pendant la mise en page"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Activer les saisies d\'écran plein écran"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Activer les saisies d\'écran plein écran dans Aperçu"</string>
     <string name="experimental" msgid="6198182315536726162">"Fonctions expérimentales"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Activer Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Pour connecter votre clavier à votre tablette, vous devez d\'abord activer la connectivité Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-fr/strings.xml b/packages/SystemUI/res/values-fr/strings.xml
index d652251..ebed6e9 100644
--- a/packages/SystemUI/res/values-fr/strings.xml
+++ b/packages/SystemUI/res/values-fr/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"épinglage d\'écran"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"rechercher"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Impossible de lancer <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Plus"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historique"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Séparation horizontale"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Séparation verticale"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Séparation personnalisée"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Afficher les secondes dans la barre d\'état. Cela risque de réduire l\'autonomie de la batterie."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Réorganiser la fenêtre de configuration rapide"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Afficher la luminosité dans fenêtre de configuration rapide"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Activer la mise en page"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Activer la mise en page via le bouton Aperçu"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Activer le basculement rapide"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Activer le délai avant expiration du lancement pendant la mise en page"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Activer les captures d\'écran en plein écran"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Activer les captures d\'écran en plein écran en mode Aperçu"</string>
     <string name="experimental" msgid="6198182315536726162">"Paramètres expérimentaux"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Activer le Bluetooth ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Pour connecter un clavier à votre tablette, vous devez avoir activé le Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-gl-rES/strings.xml b/packages/SystemUI/res/values-gl-rES/strings.xml
index 3a8b986..a9648b9 100644
--- a/packages/SystemUI/res/values-gl-rES/strings.xml
+++ b/packages/SystemUI/res/values-gl-rES/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixación de pantalla"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"buscar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Non foi posible iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Máis"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historial"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Dividir en horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Dividir en vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Dividir de xeito personalizado"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostra os segundos do reloxo na barra de estado. Pode influír na duración da batería."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar Configuración rápida"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar brillo en Configuración rápida"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Activar paxinación"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Activar paxinación a través do botón Visión xeral"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Activar alternancia rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Activa o tempo de espera do lanzamento durante a paxinación"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Activa as capturas de pantalla en pantalla completa"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Activa as capturas de pantalla en pantalla completa en Visión xeral"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Queres activar o Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para conectar o teu teclado co tablet, primeiro tes que activar o Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-gu-rIN/strings.xml b/packages/SystemUI/res/values-gu-rIN/strings.xml
index 86c1502..804a940 100644
--- a/packages/SystemUI/res/values-gu-rIN/strings.xml
+++ b/packages/SystemUI/res/values-gu-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"સ્ક્રીન પિનિંગ"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"શોધ"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> પ્રારંભ કરી શકાયું નથી."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"વધુ"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ઇતિહાસ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"આડું વિભક્ત કરો"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ઊભું વિભક્ત કરો"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"કસ્ટમ વિભક્ત કરો"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ઘડિયાળ સેકન્ડ સ્થિતિ બારમાં બતાવો. બૅટરીની આવરદા પર અસર કરી શકે છે."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ઝડપી સેટિંગ્સને ફરીથી ગોઠવો"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ઝડપી સેટિંગ્સમાં તેજ બતાવો"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"પેજિંગ સક્ષમ કરો"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"વિહંગાવલોકન બટન મારફતે પેજિંગ સક્ષમ કરો"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"ઝડપી ટૉગલ સક્ષમ કરો"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"પેજિંગ વખતે લોંચ સમયસમાપ્તિ સક્ષમ કરો"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"પૂર્ણસ્ક્રીન સ્ક્રીનશોટ્સ સક્ષમ કરો"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"વિહંગાવલોકનમાં પૂર્ણસ્ક્રીન સ્ક્રીનશોટ્સ સક્ષમ કરો"</string>
     <string name="experimental" msgid="6198182315536726162">"પ્રાયોગિક"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth ચાલુ કરવુ છે?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"તમારા ટેબ્લેટ સાથે કીબોર્ડ કનેક્ટ કરવા માટે, તમારે પહેલાં Bluetooth ચાલુ કરવાની જરૂર પડશે."</string>
diff --git a/packages/SystemUI/res/values-hi/strings.xml b/packages/SystemUI/res/values-hi/strings.xml
index 834d025..354de04 100644
--- a/packages/SystemUI/res/values-hi/strings.xml
+++ b/packages/SystemUI/res/values-hi/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"स्क्रीन पिन करना"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"खोज"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> प्रारंभ नहीं किया जा सका."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"अधिक"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"इतिहास"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"क्षैतिज रूप से विभाजित करें"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"लम्बवत रूप से विभाजित करें"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"कस्‍टम रूप से विभाजित करें"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"स्थिति बार में घड़ी के सेकंड दिखाएं. इससे बैटरी के जीवनकाल पर प्रभाव पड़ सकता है."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"त्वरित सेटिंग को पुन: व्यवस्थित करें"</string>
     <string name="show_brightness" msgid="6613930842805942519">"त्वरित सेटिंग में स्क्रीन की रोशनी दिखाएं"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"पेजिंग सक्षम करें"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"अवलोकन बटन के माध्‍यम से पेजिंग सक्षम करें"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"तेज़ टॉगल सक्षम करें"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"पेजिंग के दौरान लॉन्‍च समयबाह्य सक्षम करें"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"पूर्णस्‍क्रीन स्‍क्रीनशॉट सक्षम करें"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"अवलोकन में पूर्ण स्‍क्रीनशॉट सक्षम करें"</string>
     <string name="experimental" msgid="6198182315536726162">"प्रयोगात्मक"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ब्लूटूथ चालू करें?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"अपने कीबोर्ड को अपने टैबलेट से कनेक्ट करने के लिए, आपको पहले ब्लूटूथ चालू करना होगा."</string>
diff --git a/packages/SystemUI/res/values-hr/strings.xml b/packages/SystemUI/res/values-hr/strings.xml
index c929d9c..b35360e 100644
--- a/packages/SystemUI/res/values-hr/strings.xml
+++ b/packages/SystemUI/res/values-hr/strings.xml
@@ -295,6 +295,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"prikvačivanje zaslona"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"pretraži"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Aplikacija <xliff:g id="APP">%s</xliff:g> nije pokrenuta."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Više"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Povijest"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Podijeli vodoravno"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Podijeli okomito"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Podijeli prilagođeno"</string>
@@ -438,12 +440,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Prikazuju se sekunde na satu na traci statusa. Može utjecati na trajanje baterije."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Promijeni raspored Brzih postavki"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Prikaži svjetlinu u Brzim postavkama"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Omogući pregledavanje stranica"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Omogućivanje pregledavanja stranica gumbom Pregled"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Omogući brzo prebacivanje"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Omogućivanje vremenskog ograničenja pokretanja tijekom pregledavanja stranica"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Omogući snimanje cijelog zaslona"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Omogući snimanje cijelog zaslona u Pregledu"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentalno"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Želite li uključiti Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Da biste povezali tipkovnicu s tabletom, morate uključiti Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-hu/strings.xml b/packages/SystemUI/res/values-hu/strings.xml
index 145d904..7956a21 100644
--- a/packages/SystemUI/res/values-hu/strings.xml
+++ b/packages/SystemUI/res/values-hu/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"képernyő rögzítése"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"keresés"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Nem lehet elindítani a következőt: <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Továbbiak"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Előzmények"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Osztott vízszintes"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Osztott függőleges"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Osztott egyéni"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Másodpercek megjelenítése az állapotsor óráján. Ez hatással lehet az akkumulátor üzemidejére."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Gyorsbeállítások átrendezése"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Fényerő megjelenítése a gyorsbeállításokban"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Lapozás engedélyezése"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Lapozás engedélyezése az Áttekintés gombbal"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Gyors váltás engedélyezése"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Indítási időtúllépés engedélyezése lapozás közben"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Teljes képernyős képernyőképek engedélyezése"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Teljes képernyős képernyőképek engedélyezése Áttekintés módban"</string>
     <string name="experimental" msgid="6198182315536726162">"Kísérleti"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Engedélyezi a Bluetooth-kapcsolatot?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Ha a billentyűzetet csatlakoztatni szeretné táblagépéhez, először engedélyeznie kell a Bluetooth-kapcsolatot."</string>
diff --git a/packages/SystemUI/res/values-hy-rAM/strings.xml b/packages/SystemUI/res/values-hy-rAM/strings.xml
index 5a6ec62..de70fec 100644
--- a/packages/SystemUI/res/values-hy-rAM/strings.xml
+++ b/packages/SystemUI/res/values-hy-rAM/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"էկրանի ամրակցում"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"որոնել"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Հնարավոր չէ գործարկել <xliff:g id="APP">%s</xliff:g>-ը:"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Ավելին"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Պատմություն"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Հորիզոնական տրոհում"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Ուղղահայաց տրոհում"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Հատուկ տրոհում"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Ցույց տալ ժամացույցի վայրկյանները կարգավիճակի տողում: Կարող է ազդել մարտկոցի աշխատանքի ժամանակի վրա:"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Վերադասավորել Արագ կարգավորումները"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Ցույց տալ պայծառությունն Արագ կարգավորումներում"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Միացնել թերթումը"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Միացնել Համատեսք կոճակի միջոցով թերթումը"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Միացնել արագ փոխարկումը"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Միացնել գործարկման ժամանակի սպառումը թերթելու ժամանակ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Միացնել էկրանի պատկերների լիաէկրան ցուցադրումը"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Միացնել էկրանի պատկերների լիաէկրան ցուցադրումը Համատեսքում"</string>
     <string name="experimental" msgid="6198182315536726162">"Փորձնական"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Միացնե՞լ Bluetooth-ը:"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Ստեղնաշարը ձեր պլանշետին միացնելու համար նախ անհրաժեշտ է միացնել Bluetooth-ը:"</string>
diff --git a/packages/SystemUI/res/values-in/strings.xml b/packages/SystemUI/res/values-in/strings.xml
index cb2fe53..51ddcc0 100644
--- a/packages/SystemUI/res/values-in/strings.xml
+++ b/packages/SystemUI/res/values-in/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"pin ke layar"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"telusuri"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Tidak dapat memulai <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Lainnya"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Riwayat"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Pisahkan Horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Pisahkan Vertikal"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Pisahkan Khusus"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Tampilkan detik jam di bilah status. Dapat memengaruhi masa pakai baterai."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Atur Ulang Setelan Cepat"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Tampilkan kecerahan di Setelan Cepat"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Aktifkan tampilan laman"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Mengaktifkan tampilan laman melalui tombol Ringkasan"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Mengaktifkan pengalih cepat"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Aktifkan waktu tunggu peluncuran saat menampilkan laman"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Aktifkan tangkapan layar untuk layar penuh"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Aktifkan tangkapan layar untuk layar penuh di Ringkasan"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Aktifkan Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Untuk menghubungkan keyboard dengan tablet, terlebih dahulu aktifkan Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-is-rIS/strings.xml b/packages/SystemUI/res/values-is-rIS/strings.xml
index 63a4fe8..20d8693 100644
--- a/packages/SystemUI/res/values-is-rIS/strings.xml
+++ b/packages/SystemUI/res/values-is-rIS/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"skjáfesting"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"leita"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Ekki var hægt að ræsa <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Meira"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Ferill"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Lárétt skipting"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Lóðrétt skipting"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Sérsniðin skipting"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Sýna sekúndur á klukku í stöðustikunni. Getur haft áhrif á endingu rafhlöðu."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Endurraða flýtistillingum"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Sýna birtustig í flýtistillingum"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Kveikja á síðuskoðun"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Virkja síðuskoðun með yfirlitshnappinum"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Kveikja á flýtiskiptingum"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Kveikja á tímamörkum ræsingar þegar flett er"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Kveikja á skjámyndum sem fylla upp í skjáinn"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Kveikja á skjámyndum sem fylla upp í skjáinn í yfirliti"</string>
     <string name="experimental" msgid="6198182315536726162">"Tilraunastillingar"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Kveikja á Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Til að geta tengt lyklaborðið við spjaldtölvuna þarftu fyrst að kveikja á Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-it/strings.xml b/packages/SystemUI/res/values-it/strings.xml
index 24bb49f3..87267995 100644
--- a/packages/SystemUI/res/values-it/strings.xml
+++ b/packages/SystemUI/res/values-it/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"blocco su schermo"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"cerca"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Impossibile avviare <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Altro"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Cronologia"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divisione in orizzontale"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divisione in verticale"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divisione personalizzata"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostra i secondi nell\'orologio nella barra di stato. Ciò potrebbe ridurre la durata della carica della batteria."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Riorganizza Impostazioni rapide"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostra luminosità in Impostazioni rapide"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Attiva paging"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Attiva il paging tramite il pulsante Panoramica"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Abilita attivazione/disattivazione veloce"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Attiva timeout lancio durante il paging"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Attiva screenshot a schermo intero"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Attiva screenshot a schermo intero in Panoramica"</string>
     <string name="experimental" msgid="6198182315536726162">"Sperimentali"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Attivare il Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Per connettere la tastiera al tablet, devi prima attivare il Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-iw/strings.xml b/packages/SystemUI/res/values-iw/strings.xml
index 54a9ffe..a28dc2a 100644
--- a/packages/SystemUI/res/values-iw/strings.xml
+++ b/packages/SystemUI/res/values-iw/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"הצמדת מסך"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"חפש"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"לא ניתן היה להפעיל את <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"עוד"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"היסטוריה"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"פיצול אופקי"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"פיצול אנכי"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"פיצול מותאם אישית"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"הצג שניות בשעון בשורת הסטטוס. פעולה זו עשויה להשפיע על אורך חיי הסוללה."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"סידור מחדש של הגדרות מהירות"</string>
     <string name="show_brightness" msgid="6613930842805942519">"הצג בהירות בהגדרות מהירות"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"אפשר דפדוף"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"הפעל דפדוף באמצעות לחצן הסקירה"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"הפעל החלפת מצב מהירה"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"אפשר זמן קצוב להפעלה במהלך הדפדוף"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"אפשר צילומי מסך במסך מלא"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"אפשר צילומי מסך במסך מלא ב\'סקירה\'"</string>
     <string name="experimental" msgid="6198182315536726162">"ניסיוניות"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"‏האם להפעיל את ה-Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"‏כדי לחבר את המקלדת לטאבלט, תחילה עליך להפעיל את ה-Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index b0a1974..13217a0 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"画面固定"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"検索"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>を開始できません。"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"もっと見る"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"履歴"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"横に分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"縦に分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"分割(カスタム)"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ステータスバーに時計の秒を表示します。電池使用量に影響する可能性があります。"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"クイック設定を並べ替え"</string>
     <string name="show_brightness" msgid="6613930842805942519">"クイック設定に明るさ調整バーを表示する"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"ページ切り替えを有効にする"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"[概要] ボタンによるページ切り替えを有効にします"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"高速切り替えを有効にする"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"ページ切り替え中の起動タイムアウトを有効にします"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"全画面スクリーンショットを有効にする"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"[概要] で全画面スクリーンショットを有効にします"</string>
     <string name="experimental" msgid="6198182315536726162">"試験運用版"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"BluetoothをONにしますか?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"タブレットでキーボードに接続するには、最初にBluetoothをONにする必要があります。"</string>
diff --git a/packages/SystemUI/res/values-ka-rGE/strings.xml b/packages/SystemUI/res/values-ka-rGE/strings.xml
index ce8b417..c4e84a8 100644
--- a/packages/SystemUI/res/values-ka-rGE/strings.xml
+++ b/packages/SystemUI/res/values-ka-rGE/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ეკრანზე ჩამაგრება"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ძიება"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>-ის გამოძახება ვერ მოხერხდა."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"მეტი"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ისტორია"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"ჰორიზონტალური გაყოფა"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ვერტიკალური გაყოფა"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"ინდივიდუალური გაყობა"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"საათის წამების ჩვენება სტატუსის ზოლში. შეიძლება გავლენა იქონიოს ბატარეაზე."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"სწრაფი პარამეტრების გადაწყობა"</string>
     <string name="show_brightness" msgid="6613930842805942519">"სიკაშკაშის ჩვენება სწრაფ პარამეტრებში"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"გვერდების გადაფურცვლის ჩართვა"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"მიმოხილვის ღილაკის მეშვეობით გვერდების გადაფურცვლის ჩართვა"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"სწრაფი გადართვის ჩართვა"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"გვერდების გადაფურცვლისას გაშვების დროის ლიმიტის ჩართვა"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"სრულეკრანიანი ეკრანის ანაბეჭდების ჩართვა"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"მიმოხილვაში სრულეკრანიანი ეკრანის ანაბეჭდების ჩართვა"</string>
     <string name="experimental" msgid="6198182315536726162">"ექსპერიმენტული"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"გსურთ Bluetooth-ის ჩართვა?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"კლავიატურის ტაბლეტთან დასაკავშირებლად, ჯერ უნდა ჩართოთ Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-kk-rKZ/strings.xml b/packages/SystemUI/res/values-kk-rKZ/strings.xml
index 586b1bf9..2133170 100644
--- a/packages/SystemUI/res/values-kk-rKZ/strings.xml
+++ b/packages/SystemUI/res/values-kk-rKZ/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"экранды бекіту"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"іздеу"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> іске қосу мүмкін болмады."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Қосымша"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Тарих"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Бөлінген көлденең"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Бөлінген тік"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Бөлінген теңшелетін"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Күйін көрсету жолағында сағат секундтарын көрсету. Батареяның қызмет көрсету мерзіміне әсер етуі мүмкін."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Жылдам параметрлерді қайта реттеу"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Жылдам параметрлерде жарықтықты көрсету"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Беттерді аудару"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"\"Шолу\" түймесі арқылы беттерді аударуды қосу"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Тез ауыстырып қосуды қосу"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Беттерді аудару кезінде іске қосуды күту уақытын қосу"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Толық экрандық скриншоттарды қосу"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"\"Шолу\" ішінде толық экрандық скриншоттарды қосу"</string>
     <string name="experimental" msgid="6198182315536726162">"Эксперименттік"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth функциясын қосу керек пе?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Пернетақтаны планшетке қосу үшін алдымен Bluetooth функциясын қосу керек."</string>
diff --git a/packages/SystemUI/res/values-km-rKH/strings.xml b/packages/SystemUI/res/values-km-rKH/strings.xml
index f0f0d5f..6fbb325 100644
--- a/packages/SystemUI/res/values-km-rKH/strings.xml
+++ b/packages/SystemUI/res/values-km-rKH/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ការ​ភ្ជាប់​អេក្រង់"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ស្វែងរក"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"មិន​អាច​ចាប់ផ្ដើម <xliff:g id="APP">%s</xliff:g> ទេ។"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"ច្រើនទៀត"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ប្រវត្តិ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"បំបែកផ្តេក"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"បំបែកបញ្ឈរ"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"បំបែកផ្ទាល់ខ្លួន"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"បង្ហាញវិនាទីនៅលើរបារស្ថានភាពអាចនឹងប៉ះពាល់ដល់ថាមពលថ្ម។"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"រៀបចំការកំណត់រហ័សឡើងវិញ"</string>
     <string name="show_brightness" msgid="6613930842805942519">"បង្ហាញកម្រិតពន្លឺនៅក្នុងការកំណត់រហ័ស"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"បើកដំណើរការចុះទំព័រ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"បើកដំណើការចុះទំព័រតាមរយៈប៊ូតុងទិដ្ឋភាព"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"បើកដំណើរការបិទ/បើករហ័ស"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"បើកដំណើរការអស់ពេលចាប់ផ្តើមខណៈពេលចុះទំព័រ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"បើកដំណើរការរូបថតអេក្រង់ពេញអេក្រង់"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"បើកដំណើរការរូបថតអេក្រង់ពេញអេក្រង់នៅក្នុងទិដ្ឋភាព"</string>
     <string name="experimental" msgid="6198182315536726162">"ពិសោធន៍"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"បើកប៊្លូធូសឬ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ដើម្បីភ្ជាប់ក្តារចុចរបស់អ្នកជាមួយនឹងថេប្លេតរបស់អ្នក អ្នកត្រូវតែបើកប៊្លូធូសជាមុនសិន។"</string>
diff --git a/packages/SystemUI/res/values-kn-rIN/strings.xml b/packages/SystemUI/res/values-kn-rIN/strings.xml
index 9dec425..c8fc91d 100644
--- a/packages/SystemUI/res/values-kn-rIN/strings.xml
+++ b/packages/SystemUI/res/values-kn-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ಸ್ಕ್ರೀನ್ ಪಿನ್ನಿಂಗ್"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ಹುಡುಕಾಟ"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> ಪ್ರಾರಂಭಿಸಲು ಸಾದ್ಯವಿಲ್ಲ."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"ಇನ್ನಷ್ಟು"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ಇತಿಹಾಸ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"ಅಡ್ಡಲಾಗಿ ವಿಭಜಿಸಿದ"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ಲಂಬವಾಗಿ ವಿಭಜಿಸಿದ"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"ಕಸ್ಟಮ್ ವಿಭಜಿಸಿದ"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ಸ್ಥಿತಿ ಪಟ್ಟಿಯಲ್ಲಿ ಗಡಿಯಾರ ಸೆಕೆಂಡುಗಳನ್ನು ತೋರಿಸು. ಇದಕ್ಕೆ ಬ್ಯಾಟರಿ ಬಾಳಿಕೆಯು ಪರಿಣಾಮಬೀರಬಹುದು."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ತ್ವರಿತ ಸೆಟ್ಟಿಂಗ್‌‌ಗಳನ್ನು ಮರುಹೊಂದಿಸಿ"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ತ್ವರಿತ ಸೆಟ್ಟಿಂಗ್‌‌ಗಳಲ್ಲಿ ಪ್ರಖರತೆಯನ್ನು ತೋರಿಸಿ"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"ಪೇಜಿಂಗ್ ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"ಸಮಗ್ರ ನೋಟದ ಬಟನ್‌ ಮೂಲಕ ಪೇಜಿಂಗ್‌ ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"ವೇಗವಾಗಿ ಟಾಗಲ್‌ ಮಾಡುವಿಕೆ ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"ಪೇಜಿಂಗ್ ಸಂದರ್ಭದಲ್ಲಿ ಪ್ರಾರಂಭಿಸುವಿಕೆ ಕಾಲಾವಧಿಯನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"ಪೂರ್ಣ ಪರದೆ ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ಗಳನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"ಸಮಗ್ರ ನೋಟದಲ್ಲಿ ಪೂರ್ಣ ಪರದೆ ಸ್ಕ್ರೀನ್‌ಶಾಟ್‌ಗಳನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ"</string>
     <string name="experimental" msgid="6198182315536726162">"ಪ್ರಾಯೋಗಿಕ"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ಬ್ಲೂಟೂತ್ ಆನ್ ಮಾಡುವುದೇ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ನಿಮ್ಮ ಕೀಬೋರ್ಡ್ ಅನ್ನು ಟ್ಯಾಬ್ಲೆಟ್‌ಗೆ ಸಂಪರ್ಕಿಸಲು, ನೀವು ಮೊದಲು ಬ್ಲೂಟೂತ್ ಆನ್ ಮಾಡಬೇಕಾಗುತ್ತದೆ."</string>
diff --git a/packages/SystemUI/res/values-ko/strings.xml b/packages/SystemUI/res/values-ko/strings.xml
index 126d84a8..1296d21 100644
--- a/packages/SystemUI/res/values-ko/strings.xml
+++ b/packages/SystemUI/res/values-ko/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"화면 고정"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"검색"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>을(를) 시작할 수 없습니다."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"더보기"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"기록"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"수평 분할"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"수직 분할"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"맞춤 분할"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"상태 표시줄에 시계 초 단위를 표시합니다. 배터리 수명에 영향을 줄 수도 있습니다."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"빠른 설정 재정렬"</string>
     <string name="show_brightness" msgid="6613930842805942519">"빠른 설정에서 밝기 표시"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"페이징을 사용 설정합니다."</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"최근 사용 버튼을 통해 페이징 사용"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"빠른 전환 사용"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"페이징하는 동안 실행 제한시간을 사용 설정합니다."</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"전체 화면 스크린샷을 사용 설정합니다."</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"최근 사용에서 전체 화면 스크린샷을 사용 설정합니다."</string>
     <string name="experimental" msgid="6198182315536726162">"베타"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"블루투스를 켜시겠습니까?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"키보드를 태블릿에 연결하려면 먼저 블루투스를 켜야 합니다."</string>
diff --git a/packages/SystemUI/res/values-ky-rKG/strings.xml b/packages/SystemUI/res/values-ky-rKG/strings.xml
index 1be6f05..ead55c7 100644
--- a/packages/SystemUI/res/values-ky-rKG/strings.xml
+++ b/packages/SystemUI/res/values-ky-rKG/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"экран кадоо"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"издөө"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> баштай алган жок."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Дагы"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Таржымал"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Туурасынан бөлүү"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Тигинен бөлүү"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Ыңгайлаштырылган бөлүү"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Абал тилкесинен сааттын секунддары көрсөтүлсүн. Батареянын кубаты көбүрөөк сарпталышы мүмкүн."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Ыкчам жөндөөлөрдү кайра коюу"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Ыкчам жөндөөлөрдөн жарык деңгээлин көрсөтүү"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Барактоону иштетүү"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Сереп баскычы менен барактоону иштетүү"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Тез которгучту иштетүү"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Барактап жатканда таймаутту иштетүү"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Толук экран скриншотторун иштетүү"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Толук экран скриншотторун Серепте иштетүү"</string>
     <string name="experimental" msgid="6198182315536726162">"Сынамык"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth күйгүзүлсүнбү?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Баскычтобуңузду планшетиңизге туташтыруу үчүн, адегенде Bluetooth\'ту күйгүзүшүңүз керек."</string>
diff --git a/packages/SystemUI/res/values-lo-rLA/strings.xml b/packages/SystemUI/res/values-lo-rLA/strings.xml
index 2fac9b9..c0689c3 100644
--- a/packages/SystemUI/res/values-lo-rLA/strings.xml
+++ b/packages/SystemUI/res/values-lo-rLA/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ການ​ປັກ​ໝຸດ​ໜ້າ​ຈໍ​"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ຊອກຫາ"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"ບໍ່​ສາ​ມາດ​ເລີ່ມ <xliff:g id="APP">%s</xliff:g> ໄດ້."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"ເພີ່ມເຕີມ"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ປະຫວັດ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"ການ​ແຍກ​ລວງ​ຂວາງ"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ການ​ແຍກ​ລວງ​ຕັ້ງ"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"ການ​ແຍກ​ກຳ​ນົດ​ເອງ"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ສະ​ແດງວິ​ນາ​ທີ​ໂມງ​ຢູ່​ໃນ​ແຖບ​ສະ​ຖາ​ນະ. ອາດ​ຈະ​ມີ​ຜົນ​ກະ​ທົບ​ຕໍ່​ອາ​ຍຸ​ແບັດ​ເຕີ​ຣີ."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ຈັດ​ວາງ​ການ​ຕັ້ງ​ຄ່າ​ດ່ວນ​ຄືນ​ໃໝ່"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ສະ​ແດງ​ຄວາມ​ແຈ້ງ​ຢູ່​ໃນ​ການ​ຕັ້ງ​ຄ່າ​ດ່ວນ"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"​ເປີດ​ໃຊ້​ງານ​ການ​ແບ່ງ​ໜ້າ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"ເປີດນຳໃຊ້ການແບ່ງໜ້າຜ່ານປຸ່ມພາບລວມ"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"ເປີດນຳໃຊ້ການສັບປ່ຽນໄວ"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"​ເປີດ​ໃຊ້​ງານ​ການ​ໝົດ​ເວລາ​ການ​ເປີດ​ໃຊ້ ​ໃນ​ຂະນະ​ທີ່​ແບ່ງ​ໜ້າ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"​ເປີດ​ໃຊ້ງານພາບ​ໜ້າ​ຈໍ​ແບບ​ເຕັມ​ຈໍ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"​ເປີດ​ໃຊ້​ງານ​ພາບ​ໜ້າ​ຈໍ​ແບບ​ເຕັມ​ຈໍ​ໃນ​ໂໝດພາບ​ລວມ"</string>
     <string name="experimental" msgid="6198182315536726162">"ຍັງຢູ່ໃນການທົດລອງ"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ເປີດ​ໃຊ້ Bluetooth ບໍ່?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ເພື່ອ​ເຊື່ອມ​ຕໍ່​ແປ້ນ​ພິມ​ຂອງ​ທ່ານ​ກັບ​ແທັບ​ເລັດ​ຂອງ​ທ່ານ, ກ່ອນ​ອື່ນ​ໝົດ​ທ່ານ​ຕ້ອງ​ເປີດ Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-lt/strings.xml b/packages/SystemUI/res/values-lt/strings.xml
index 1533ae8d..4425d31 100644
--- a/packages/SystemUI/res/values-lt/strings.xml
+++ b/packages/SystemUI/res/values-lt/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ekrano prisegimas"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"paieška"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Nepavyko paleisti <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Daugiau"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Istorija"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Horizontalus skaidymas"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Vertikalus skaidymas"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Tinkintas skaidymas"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Rodyti laikrodžio sekundes būsenos juostoje. Tai gali paveikti akumuliatoriaus naudojimo laiką."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Pertvarkyti sparčiuosius nustatymus"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Rodyti skaistį sparčiuosiuose nustatymuose"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Įgalinti puslapių kaitą"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Įgalinti puslapių kaitą apžvalgos mygtuku"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Įgalinti greitą perjungimą"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Įgalinti paleidimo skirtąjį laiką keičiant puslapius"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Įgalinti viso ekrano kopijas"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Įgalinti viso ekrano kopijas apžvalgoje"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentinė versija"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Įjungti „Bluetooth“?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Kad galėtumėte prijungti klaviatūrą prie planšetinio kompiuterio, pirmiausia turite įjungti „Bluetooth“."</string>
diff --git a/packages/SystemUI/res/values-lv/strings.xml b/packages/SystemUI/res/values-lv/strings.xml
index 3479320..eca57a6 100644
--- a/packages/SystemUI/res/values-lv/strings.xml
+++ b/packages/SystemUI/res/values-lv/strings.xml
@@ -295,6 +295,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"Piespraust ekrānu"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"Meklēt"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Nevarēja palaist lietotni <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Vairāk"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Vēsture"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Horizontāls dalījums"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Vertikāls dalījums"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Pielāgots dalījums"</string>
@@ -438,12 +440,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Statusa joslā rādīt pulksteņa sekundes. Var ietekmēt akumulatora darbības laiku."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Pārkārtot ātros iestatījumus"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Rādīt spilgtumu ātrajos iestatījumos"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Iespējot lapošanu"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Iespējot lapošanu, izmantojot pogu Pārskats"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Iespējot ātro pārslēgšanu"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Iespējot palaišanas noildzi lapošanas laikā"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Iespējot pilnekrāna ekrānuzņēmumus"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Iespējot pilnekrāna ekrānuzņēmumus sadaļā Pārskats"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentāli"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vai ieslēgt Bluetooth savienojumu?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Lai pievienotu tastatūru planšetdatoram, vispirms ir jāieslēdz Bluetooth savienojums."</string>
diff --git a/packages/SystemUI/res/values-mk-rMK/strings.xml b/packages/SystemUI/res/values-mk-rMK/strings.xml
index 277a519..038c669 100644
--- a/packages/SystemUI/res/values-mk-rMK/strings.xml
+++ b/packages/SystemUI/res/values-mk-rMK/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"прикачување екран"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"пребарај"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> не може да се вклучи."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Повеќе"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Историја"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Раздели хоризонтално"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Раздели вертикално"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Раздели прилагодено"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Прикажи ги секундите на часовникот на статусната лента. Може да влијае на траењето на батеријата."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Преуредете ги Брзи поставки"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Прикажете ја осветленоста во Брзи поставки"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Овозможете прелистување страници"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Овозможете прелистување страници со копчето Краток преглед"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Овозможете брзо префрлање"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Овозможете истек на време при стартување додека прелистувате страници"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Овозможете слики од цел екран"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Овозможете слики од цел екран во Преглед"</string>
     <string name="experimental" msgid="6198182315536726162">"Експериментално"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Да се вклучи Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"За да ја поврзете тастатурата со таблетот, најпрво треба да вклучите Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ml-rIN/strings.xml b/packages/SystemUI/res/values-ml-rIN/strings.xml
index a448d9b..f4964d0 100644
--- a/packages/SystemUI/res/values-ml-rIN/strings.xml
+++ b/packages/SystemUI/res/values-ml-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"സ്ക്രീൻ പിൻ ചെയ്യൽ"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"തിരയുക"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> ആരംഭിക്കാനായില്ല."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"കൂടുതൽ"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ചരിത്രം"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"തിരശ്ചീനമായി വേർതിരിക്കുക"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ലംബമായി വേർതിരിക്കുക"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"ഇഷ്‌ടാനുസൃതമായി വേർതിരിക്കുക"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"സ്റ്റാറ്റസ് ബാറിൽ ക്ലോക്ക് സെക്കൻഡ് കാണിക്കുന്നത് ബാറ്ററിയുടെ ലൈഫിനെ ബാധിക്കാം."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ദ്രുത ക്രമീകരണം പുനഃസജ്ജീകരിക്കുക"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ദ്രുത ക്രമീകരണത്തിൽ തെളിച്ചം കാണിക്കുക"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"പേജിംഗ് പ്രവർത്തനക്ഷമമാക്കുക"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"ചുരുക്കവിവരണ ബട്ടൺ വഴി പേജിംഗ് പ്രവർത്തനക്ഷമമാക്കുക"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"അതിവേഗ ടോഗിൾ പ്രവർത്തനക്ഷമമാക്കുക"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"പേജിംഗിനിടെ ലോഞ്ച് ടൈമൗട്ട് പ്രവർത്തനക്ഷമമാക്കുക"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"പൂർണ്ണസ്ക്രീൻ സ്ക്രീൻഷോട്ടുകൾ പ്രവർത്തനക്ഷമമാക്കുക"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"ചുരുക്കവിവരണത്തിൽ പൂർണ്ണസ്ക്രീൻ സ്ക്രീൻഷോട്ടുകൾ പ്രവർത്തനക്ഷമമാക്കുക"</string>
     <string name="experimental" msgid="6198182315536726162">"പരീക്ഷണാത്മകം!"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth ഓണാക്കണോ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"നിങ്ങളുടെ ടാബ്‌ലെറ്റുമായി കീബോർഡ് കണക്റ്റുചെയ്യുന്നതിന്, ആദ്യം Bluetooth ഓണാക്കേണ്ടതുണ്ട്."</string>
diff --git a/packages/SystemUI/res/values-mn-rMN/strings.xml b/packages/SystemUI/res/values-mn-rMN/strings.xml
index 8dcb6d98..122068c 100644
--- a/packages/SystemUI/res/values-mn-rMN/strings.xml
+++ b/packages/SystemUI/res/values-mn-rMN/strings.xml
@@ -292,6 +292,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"дэлгэц тогтоох"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"хайх"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>-г эхлүүлж чадсангүй."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Илүү"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Түүх"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Хэвтээ чиглэлд хуваах"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Босоо чиглэлд хуваах"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Хүссэн хэлбэрээр хуваах"</string>
@@ -435,12 +437,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Статус талбарт цагийн секундыг харуулах. Энэ нь тэжээлийн цэнэгт нөлөөлж болно."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Түргэн тохиргоог дахин засварлах"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Түргэн тохиргоонд гэрэлтүүлэг харах"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Өгөгдөл хадгалах/сэргээхийг идэвхжүүлэх"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Тойм товчлуурыг ашиглан өгөгдөл хадгалах/сэргээхийг идэвхжүүлэх"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Түргэн унтраах/асаахыг идэвхжүүлэх"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Өгөгдөл хадгалах/сэргээх явцад завсарлагыг эхлүүлэх"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Бүтэн дэлгэцийн дэлгэцийн агшинг идэвхжүүлэх"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Тойм хэсэгт бүтэн дэлгэцийн \"Дэлгэцийн агшинг\" идэвхжүүлэх"</string>
     <string name="experimental" msgid="6198182315536726162">"Туршилтын"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth-г асаах уу?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Компьютерийн гараа таблетад холбохын тулд эхлээд Bluetooth-г асаана уу."</string>
diff --git a/packages/SystemUI/res/values-mr-rIN/strings.xml b/packages/SystemUI/res/values-mr-rIN/strings.xml
index 00c4965..6415adb 100644
--- a/packages/SystemUI/res/values-mr-rIN/strings.xml
+++ b/packages/SystemUI/res/values-mr-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"स्‍क्रीन पिन करणे"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"शोधा"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> प्रारंभ करणे शक्य झाले नाही."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"अधिक"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"इतिहास"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"क्षैतिज विभाजित करा"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"अनुलंब विभाजित करा"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"सानुकूल विभाजित करा"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"स्टेटस बारमध्‍ये घड्‍याळ सेकंद दर्शवा. कदाचित बॅटरी आयुष्‍य प्रभावित होऊ शकते."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"द्रुत सेटिंग्जची पुनर्रचना करा"</string>
     <string name="show_brightness" msgid="6613930842805942519">"द्रुत सेटिंग्जमध्‍ये चमक दर्शवा"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"लिखाण सक्षम करा"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"विहंगावलोकन बटणाद्वारे लिखाण सक्षम करा"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"जलद टॉगल करा सक्षम करा"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"लिखाण करताना लाँच कालबाह्य सक्षम करा"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"पूर्ण स्क्रीन स्क्रीनशॉट सक्षम करा"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"विहंगावलोकनामध्ये पूर्ण स्क्रीन स्क्रीनशॉट सक्षम करा"</string>
     <string name="experimental" msgid="6198182315536726162">"प्रायोगिक"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ब्लूटुथ सुरू करायचे?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"आपला कीबोर्ड आपल्या टॅब्लेटसह कनेक्ट करण्यासाठी, आपल्याला प्रथम ब्लूटुथ चालू करणे आवश्यक आहे."</string>
diff --git a/packages/SystemUI/res/values-ms-rMY/strings.xml b/packages/SystemUI/res/values-ms-rMY/strings.xml
index 7b53a6c..ceefc29 100644
--- a/packages/SystemUI/res/values-ms-rMY/strings.xml
+++ b/packages/SystemUI/res/values-ms-rMY/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"penyematan skrin"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"cari"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Tidak dapat memulakan <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Lagi"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Sejarah"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Mendatar Terpisah"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Menegak Terpisah"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Tersuai Terpisah"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Tunjukkan saat jam dalam bar status. Mungkin menjejaskan hayat bateri."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Susun Semula Tetapan Pantas"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Tunjukkan kecerahan dalam Tetapan Pantas"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Dayakan penghalamanan"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Mendayakan penghalamanan melalui butang Ikhtisar"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Dayakan togol pantas"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Membolehkan pelancaran tamat masa semasa penghalamanan"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Dayakan tangkapan skrin skrin penuh"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Mendayakan tangkapan skrin skrin penuh dalam Ikhtisar"</string>
     <string name="experimental" msgid="6198182315536726162">"Percubaan"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Hidupkan Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Untuk menyambungkan papan kekunci anda dengan tablet, anda perlu menghidupkan Bluetooth terlebih dahulu."</string>
diff --git a/packages/SystemUI/res/values-my-rMM/strings.xml b/packages/SystemUI/res/values-my-rMM/strings.xml
index 2f52a02..81c0932 100644
--- a/packages/SystemUI/res/values-my-rMM/strings.xml
+++ b/packages/SystemUI/res/values-my-rMM/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"မျက်နှာပြင် ပင်ထိုးမှု"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ရှာဖွေရန်"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> ကို မစနိုင်ပါ။"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"နောက်ထပ်"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"မှတ်တမ်း"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"ရေပြင်ညီ ပိုင်းမည်"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ဒေါင်လိုက်ပိုင်းမည်"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"စိတ်ကြိုက် ပိုင်းမည်"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"အခြေအနေပြနေရာမှာ နာရီ စက္ကန့်များကို ပြပါ။ ဘက်ထရီ သက်တမ်းကို အကျိုးသက်ရောက်နိုင်တယ်။"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"အမြန် ဆက်တင်များကို ပြန်စီစဉ်ရန်"</string>
     <string name="show_brightness" msgid="6613930842805942519">"အမြန် ဆက်တင်များထဲက တောက်ပမှုကို ပြရန်"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"စာမျက်နှာပြောင်းမှု ဖွင့်ပါ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"အနှစ်ချုပ်ကြည့်မှု မှတစ်ဆင့် စာမျက်နှာပြောင်းမှုကို ဖွင့်ပါ"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"အမြန်ဖွင့်/ပိတ်ခြင်း ဖွင့်ရန်"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"စာမျက်နှာပြောင်းမှု ဖွင့်တင်ရန်အတွက် ကန့်သတ်ချိန်ကို ဖွင့်ပါ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"မျက်နှာပြင်အပြည့် လျှပ်တစ်ပြက်ပုံများကို ဖွင့်ပါ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"အနှစ်ချုပ်ကြည့်မှုထဲတွင် မျက်နှာပြင်အပြည့် လျှပ်တစ်ပြက်ပုံများကို ဖွင့်ပါ"</string>
     <string name="experimental" msgid="6198182315536726162">"စမ်းသပ်ရေး"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ဘလူးတုသ် ဖွင့်ရမလား။"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ကီးဘုတ်ကို တပ်ဘလက်နှင့် ချိတ်ဆက်ရန်၊ ပမထဦးစွာ ဘလူးတုသ်ကို ဖွင့်ပါ။"</string>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index 014a6b1..7f6895e 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"én-appsmodus"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"Søk"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Kunne ikke starte <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mer"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Logg"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Del horisontalt"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Del vertikalt"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Del tilpasset"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Vis sekunder i statusfeltet på klokken. Det kan påvirke batteritiden."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Omorganiser hurtiginnstillingene"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Vis lysstyrke i hurtiginnstillingene"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Slå på paginering"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Slå på paginering via Oversikt-knappen"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Slå på hurtigveksling"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Slå på tidsavbrudd mens paginering pågår"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Slå på skjermdumper av fullskjerm"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Slå på skjermdumper av fullskjerm i Oversikt"</string>
     <string name="experimental" msgid="6198182315536726162">"På forsøksstadiet"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vil du slå på Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"For å koble tastaturet til nettbrettet ditt må du først slå på Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ne-rNP/strings.xml b/packages/SystemUI/res/values-ne-rNP/strings.xml
index 46fce99..51e8a16 100644
--- a/packages/SystemUI/res/values-ne-rNP/strings.xml
+++ b/packages/SystemUI/res/values-ne-rNP/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"स्क्रिन पिन गर्दै"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"खोजी गर्नुहोस्"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"सुरु गर्न सकिएन <xliff:g id="APP">%s</xliff:g>।"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"थप"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"इतिहास"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"तेर्सो रूपमा विभाजन गर्नुहोस्"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ठाडो रूपमा विभाजन गर्नुहोस्"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"अनुकूलन विभाजन गर्नुहोस्"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"वस्तुस्थिति पट्टीको घडीमा सेकेन्ड देखाउनुहोस्। ब्याट्री आयु प्रभावित हुन सक्छ।"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"द्रुत सेटिङहरू पुनः व्यवस्थित गर्नुहोस्"</string>
     <string name="show_brightness" msgid="6613930842805942519">"द्रुत सेटिङहरूमा उज्यालो देखाउनुहोस्"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"पेजिंग सक्रिय गर्नुहोस्"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"परिदृश्य बटन मार्फत पेजिङ सक्रिय गर्नुहोस्"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"छिटो टगल सक्रिय गर्नुहोस्"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"जब पेजिंग हुन्छ टाइमआउट प्रक्षेपण सक्रिय गर्नुहोस्"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"पूर्ण स्क्रिन स्क्रीनशटहरू सक्रिय गर्नुहोस्"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"परिदृश्यमा पूर्ण स्क्रिन स्क्रीनशटहरू सक्रिय गर्नुहोस्"</string>
     <string name="experimental" msgid="6198182315536726162">"प्रयोगात्मक"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"ब्लुटुथ सक्रिय पार्ने हो?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"आफ्नो ट्याब्लेटसँग किबोर्ड जोड्न, पहिले तपाईँले ब्लुटुथ सक्रिय गर्नुपर्छ।"</string>
diff --git a/packages/SystemUI/res/values-nl/strings.xml b/packages/SystemUI/res/values-nl/strings.xml
index dbcaab8..88d0b4b 100644
--- a/packages/SystemUI/res/values-nl/strings.xml
+++ b/packages/SystemUI/res/values-nl/strings.xml
@@ -283,7 +283,7 @@
     <string name="quick_settings_notifications_label" msgid="4818156442169154523">"Meldingen"</string>
     <string name="quick_settings_flashlight_label" msgid="2133093497691661546">"Zaklamp"</string>
     <string name="quick_settings_cellular_detail_title" msgid="8575062783675171695">"Mobiele gegevens"</string>
-    <string name="quick_settings_cellular_detail_data_usage" msgid="1964260360259312002">"Gegevensgebruik"</string>
+    <string name="quick_settings_cellular_detail_data_usage" msgid="1964260360259312002">"Datagebruik"</string>
     <string name="quick_settings_cellular_detail_remaining_data" msgid="722715415543541249">"Resterende gegevens"</string>
     <string name="quick_settings_cellular_detail_over_limit" msgid="967669665390990427">"Limiet overschreden"</string>
     <string name="quick_settings_cellular_detail_data_used" msgid="1476810587475761478">"<xliff:g id="DATA_USED">%s</xliff:g> gebruikt"</string>
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"scherm vastzetten"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"zoeken"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Kan <xliff:g id="APP">%s</xliff:g> niet starten."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Meer"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Geschiedenis"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Horizontaal splitsen"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Verticaal splitsen"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Aangepast splitsen"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Klokseconden op de statusbalk weergeven. Kan van invloed zijn op de accuduur."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Snelle instellingen opnieuw indelen"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Helderheid weergeven in Snelle instellingen"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Paginering inschakelen"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Paginering via de knop Overzicht inschakelen"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Snel schakelen inschakelen"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Starttime-out tijdens paginering inschakelen"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Screenshots op volledig scherm inschakelen"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Screenshots op volledig scherm in Overzicht inschakelen"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimenteel"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth inschakelen?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Als je je toetsenbord wilt verbinden met je tablet, moet je eerst Bluetooth inschakelen."</string>
diff --git a/packages/SystemUI/res/values-pa-rIN/strings.xml b/packages/SystemUI/res/values-pa-rIN/strings.xml
index 5f21e94..df6c473af 100644
--- a/packages/SystemUI/res/values-pa-rIN/strings.xml
+++ b/packages/SystemUI/res/values-pa-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ਸਕ੍ਰੀਨ ਪਿਨਿੰਗ"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ਖੋਜੋ"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> ਨੂੰ ਚਾਲੂ ਨਹੀਂ ਕਰ ਸਕਿਆ।"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"ਹੋਰ"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ਇਤਿਹਾਸ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"ਹੌਰੀਜ਼ੌਂਟਲ ਸਪਲਿਟ"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"ਵਰਟੀਕਲ ਸਪਲਿਟ"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"ਕਸਟਮ ਸਪਲਿਟ"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"ਸਥਿਤੀ ਬਾਰ ਵਿੱਚ ਘੜੀ ਸਕਿੰਟ ਦਿਖਾਓ। ਬੈਟਰੀ ਸਮਰੱਥਾ ਤੇ ਅਸਰ ਪੈ ਸਕਦਾ ਹੈ।"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ਤਤਕਾਲ ਸੈਟਿੰਗਾਂ ਨੂੰ ਦੁਬਾਰਾ ਕ੍ਰਮ ਦਿਓ"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ਤਤਕਾਲ ਸੈਟਿੰਗਾਂ ਵਿੱਚ ਚਮਕ ਦਿਖਾਓ"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"ਪੇਜਿੰਗ ਨੂੰ ਯੋਗ ਬਣਾਓ"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"ਰੂਪ-ਰੇਖਾ ਬਟਨ ਦੁਆਰਾ ਪੇਜਿੰਗ ਨੂੰ ਯੋਗ ਬਣਾਓ"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"ਤੇਜ਼ ਬਦਲੋ ਨੂੰ ਯੋਗ ਬਣਾਓ"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"ਪੇਜਿੰਗ ਦੌਰਾਨ ਲਾਂਚ ਸਮਾਂ ਸਮਾਪਤੀ ਦੀ ਮਿਅਾਦ ਯੋਗ ਬਣਾਓ"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"ਪੂਰੀ-ਸਕਰੀਨ ਸਕਰੀਨਸ਼ਾਟ ਨੂੰ ਯੋਗ ਬਣਾਓ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"ਰੂਪ-ਰੇਖਾ ਵਿੱਚ ਪੂਰੀ-ਸਕਰੀਨ ਸਕਰੀਨਸ਼ਾਟ ਨੂੰ ਯੋਗ ਬਣਾਓ"</string>
     <string name="experimental" msgid="6198182315536726162">"ਪ੍ਰਯੋਗਾਤਮਿਕ"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth ਚਾਲੂ ਕਰੋ?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ਆਪਣੇ ਟੈਬਲੇਟ ਨਾਲ ਆਪਣਾ ਕੀ-ਬੋਰਡ ਕਨੈਕਟ ਕਰਨ ਲਈ, ਤੁਹਾਨੂੰ ਪਹਿਲਾਂ Bluetooth ਚਾਲੂ ਕਰਨ ਦੀ ਜ਼ਰੂਰਤ ਹੈ।"</string>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index 68816ef..694132b 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"przypinanie ekranu"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"szukaj"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Nie udało się uruchomić aplikacji <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Więcej"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historia"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Podziel poziomo"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Podziel pionowo"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Podziel niestandardowo"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Pokaż sekundy na zegarku na pasku stanu. Może mieć wpływ na czas pracy baterii."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Uporządkuj Szybkie ustawienia"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Pokaż jasność w Szybkich ustawieniach"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Włącz stronicowanie"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Włącz stronicowanie za pomocą przycisku Przegląd"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Włącz szybkie przełączanie"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Włącz limit czasu uruchomienia podczas stronicowania"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Włącz pełnoekranowe zrzuty ekranu"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Włącz pełnoekranowe zrzuty ekranu w widoku Przegląd"</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperymentalne"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Włączyć Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Aby połączyć klawiaturę z tabletem, musisz najpierw włączyć Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml
index c875922..e806bfc 100644
--- a/packages/SystemUI/res/values-pt-rBR/strings.xml
+++ b/packages/SystemUI/res/values-pt-rBR/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixação de tela"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"pesquisar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Não foi possível iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mais"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Histórico"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divisão horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divisão vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divisão personalizada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostrar segundos do relógio na barra de status. Pode afetar a duração da bateria."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar \"Configurações rápidas\""</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar brilho nas \"Configurações rápidas\""</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Ativar paginação"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Ativar paginação pelo botão \"Visão geral\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Ativar alternância rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Ativar tempo limite de inicialização ao fazer paginação"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Ativar capturas de tela em tela cheia"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Ativar capturas de tela em tela cheia em \"Visão geral\""</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentais"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Ativar o Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para conectar o teclado ao tablet, é preciso primeiro ativar o Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml
index 1594dca..468c75d 100644
--- a/packages/SystemUI/res/values-pt-rPT/strings.xml
+++ b/packages/SystemUI/res/values-pt-rPT/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixação no ecrã"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"pesquisar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Não foi possível iniciar o <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mais"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Histórico"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divisão horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divisão vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divisão personalizada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostrar segundos do relógio na barra de estado. Pode afetar a autonomia da bateria."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar as Definições rápidas"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar luminosidade nas Definições rápidas"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Ativar a paginação"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Ativar a paginação através do botão Vista geral"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Ativar alternância rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Ativar o limite de tempo de lançamento durante a paginação"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Ativar capturas de ecrã inteiro"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Ativar capturas de ecrã inteiro na Vista geral"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimental"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Pretende ativar o Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para ligar o teclado ao tablet, tem de ativar primeiro o Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index c875922..e806bfc 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixação de tela"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"pesquisar"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Não foi possível iniciar <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mais"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Histórico"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divisão horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divisão vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divisão personalizada"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Mostrar segundos do relógio na barra de status. Pode afetar a duração da bateria."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Reorganizar \"Configurações rápidas\""</string>
     <string name="show_brightness" msgid="6613930842805942519">"Mostrar brilho nas \"Configurações rápidas\""</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Ativar paginação"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Ativar paginação pelo botão \"Visão geral\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Ativar alternância rápida"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Ativar tempo limite de inicialização ao fazer paginação"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Ativar capturas de tela em tela cheia"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Ativar capturas de tela em tela cheia em \"Visão geral\""</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentais"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Ativar o Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Para conectar o teclado ao tablet, é preciso primeiro ativar o Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index ab182a2..1b8e8de 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -295,6 +295,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fixare pe ecran"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"căutare"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> nu a putut porni."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mai mult"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Istoric"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Divizare pe orizontală"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Divizare pe verticală"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Divizare personalizată"</string>
@@ -438,12 +440,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Afișează secundele pe ceas în bara de stare. Poate afecta autonomia bateriei."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Rearanjați Setările rapide"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Afișați luminozitatea în Setările rapide"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Activați paginarea"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Activați paginarea prin butonul Recente"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Activați comutarea rapidă"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Activați timpul limită pentru lansare în timpul paginării"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Activați capturile de ecran pe ecran complet"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Activați capturile de ecran pe ecran complet în modul Prezentare generală"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentale"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Activați Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Pentru a conecta tastatura la tabletă, mai întâi trebuie să activați Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index ecacd4b..9068e0b 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"Заблокировать в приложении"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"поиск"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Не удалось запустить приложение \"<xliff:g id="APP">%s</xliff:g>\""</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Ещё"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Журнал"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Разделить по горизонтали"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Разделить по вертикали"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Разделить по-другому"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Показывать в строке состояния время с точностью до секунды (заряд батареи может расходоваться быстрее)."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Изменить порядок Быстрых настроек"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Добавить яркость в Быстрые настройки"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Включить подкачку страниц"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Разрешить подкачку страниц с помощью кнопки \"Обзор\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Быстрое переключение"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Включить тайм-аут запуска при подкачке страниц"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Разрешить скриншоты всего экрана"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Разрешить скриншоты всего экрана в режиме обзора"</string>
     <string name="experimental" msgid="6198182315536726162">"Экспериментальная функция"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Подключение по Bluetooth"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Чтобы подключить клавиатуру к планшету, включите Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-si-rLK/strings.xml b/packages/SystemUI/res/values-si-rLK/strings.xml
index a8f9469..3be3718 100644
--- a/packages/SystemUI/res/values-si-rLK/strings.xml
+++ b/packages/SystemUI/res/values-si-rLK/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"තිර ඇමිණීම"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"සෙවීම"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> ආරම්භ කළ නොහැක."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"තවත්"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ඉතිහාසය"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"තිරස්ව වෙන් කරන්න"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"සිරස්ව වෙන් කරන්න"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"අභිමත ලෙස වෙන් කරන්න"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"තත්ත්ව තීරුවෙහි ඔරලෝසු තත්පර පෙන්වන්න. බැටරි ආයු කාලයට බලපෑමට හැකිය."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"ඉක්මන් සැකසීම් යළි පිළිවෙළට සකසන්න"</string>
     <string name="show_brightness" msgid="6613930842805942519">"ඉක්මන් සැකසීම්වල දීප්තිය පෙන්වන්න"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"පේජින් සබල කිරීම"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"දළ විශ්ලේෂණ බොත්තම හරහා පේජින් සබල කිරීම"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"වේගවත් ටොගල කිරීම සබල කරන්න"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"පේජින් අතරතුර දියත් කිරීමේ කාල නිමාව සබල කිරීම"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"පූර්ණ තිරයේ තිර රූ සබල කිරීම"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"දළ විශ්ලේෂණය තුළ පූර්ණ තිරයේ තිර රූ සබල කිරීම"</string>
     <string name="experimental" msgid="6198182315536726162">"පරීක්ෂණාත්මක"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"බ්ලූටූත් ක්‍රියාත්මක කරන්නද?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"ඔබේ යතුරු පුවරුව ඔබේ ටැබ්ලට් පරිගණකයට සම්බන්ධ කිරීමට, ඔබ පළමුව බ්ලූටූත් ක්‍රියාත්මක කළ යුතුය."</string>
diff --git a/packages/SystemUI/res/values-sk/strings.xml b/packages/SystemUI/res/values-sk/strings.xml
index bd7e210..d96194c 100644
--- a/packages/SystemUI/res/values-sk/strings.xml
+++ b/packages/SystemUI/res/values-sk/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"pripnutie k obrazovke"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"hľadať"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Aplikáciu <xliff:g id="APP">%s</xliff:g> sa nepodarilo spustiť"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Viac"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"História"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Rozdeliť vodorovné"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Rozdeliť zvislé"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Rozdeliť vlastné"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Zobrazí sekundy v stavovom riadku. Môže to ovplyvňovať výdrž batérie."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Zmeniť usporiadanie Rýchlych nastavení"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Zobraziť jas v Rýchlych nastaveniach"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Povoliť prechádzanie po stranách"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Povoľte prechádzanie po stranách prostredníctvom tlačidla Prehľad"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Povoliť rýchle prepínanie"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Povolenie časového limitu pre spustenie počas prechádzania po stranách"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Povoliť snímky celej obrazovky"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Povolenie snímok celej obrazovky v Prehľade"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentálne"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Zapnúť Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Ak chcete klávesnicu pripojiť k tabletu, najprv musíte zapnúť Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-sl/strings.xml b/packages/SystemUI/res/values-sl/strings.xml
index 6d7fbc0..f3d3b39 100644
--- a/packages/SystemUI/res/values-sl/strings.xml
+++ b/packages/SystemUI/res/values-sl/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"pripenjanje zaslona"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"iskanje"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Aplikacije <xliff:g id="APP">%s</xliff:g> ni bilo mogoče zagnati."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Več"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Zgodovina"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Razdeli vodoravno"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Razdeli navpično"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Razdeli po meri"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Prikaže sekunde pri uri v vrstici stanja. To lahko vpliva na čas delovanja pri akumulatorskem napajanju."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Preuredi hitre nastavitve"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Prikaz svetlosti v hitrih nastavitvah"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Omogočanje pregleda strani"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Omogoči pregled strani z gumbom za pregled"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Omogoči hiter preklop"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Omogoči potek časovne omejitve za odpiranje med pregledom strani"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Omogočanje celozaslonskih posnetkov zaslona"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Omogoči celozaslonske posnetke zaslona v Pregledu"</string>
     <string name="experimental" msgid="6198182315536726162">"Poskusno"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Želite vklopiti Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Če želite povezati tipkovnico in tablični računalnik, vklopite Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-sq-rAL/strings.xml b/packages/SystemUI/res/values-sq-rAL/strings.xml
index 38066be..afad772 100644
--- a/packages/SystemUI/res/values-sq-rAL/strings.xml
+++ b/packages/SystemUI/res/values-sq-rAL/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"gozhdimi i ekranit"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"kërko"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> nuk mundi të nisej."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Më shumë"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historiku"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Ndaje horizontalisht"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Ndaj vertikalisht"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Ndaj të personalizuarën"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Trego sekondat e orës në shiritin e statusit. Mund të ndikojë te jeta e baterisë."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Risistemo Cilësimet e shpejta"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Shfaq ndriçimin te Cilësimet e shpejta"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Aktivizo shfletimin"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Aktivizo shfletimin me butonin \"Përmbledhja\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Aktivizo ndërrimin e shpejtë"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Aktivizo kohën e pritjes të nisjes gjatë shfletimit"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Aktivizo pamjet e ekranit në ekranin e plotë"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Aktivizo pamjet e ekranit në ekranin e plotë te \"Përmbledhja\""</string>
     <string name="experimental" msgid="6198182315536726162">"Eksperimentale"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Të aktivizohet \"bluetooth-i\"?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Për të lidhur tastierën me tabletin, në fillim duhet të aktivizosh \"bluetooth-in\"."</string>
diff --git a/packages/SystemUI/res/values-sr/strings.xml b/packages/SystemUI/res/values-sr/strings.xml
index 5fd78f0..ad14d26 100644
--- a/packages/SystemUI/res/values-sr/strings.xml
+++ b/packages/SystemUI/res/values-sr/strings.xml
@@ -295,6 +295,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"качење екрана"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"претражи"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Покретање апликације <xliff:g id="APP">%s</xliff:g> није успело."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Још"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Историја"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Подели хоризонтално"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Подели вертикално"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Прилагођено дељење"</string>
@@ -438,12 +440,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Секунде на сату се приказују на статусној траци. То може да утиче на трајање батерије."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Преуреди Брза подешавања"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Прикажи осветљеност у Брзим подешавањима"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Омогући листање"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Омогућава листање помоћу дугмета Преглед"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Омогући брзо листање"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Омогућава временско ограничење покретања при листању"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Омогући снимке екрана преко целог екрана"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Омогућава снимке екрана преко целог екрана у Прегледу"</string>
     <string name="experimental" msgid="6198182315536726162">"Експериментално"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Желите ли да укључите Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Да бисте повезали тастатуру са таблетом, прво морате да укључите Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index bec7593..15e8b12 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"fästa skärmen"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"sök"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Det gick inte att starta appen <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Mer"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historik"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Dela horisontellt"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Dela vertikalt"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Dela anpassad"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Visa klocksekunder i statusfältet. Detta kan påverka batteritiden."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Ordna snabbinställningarna"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Visa ljusstyrka i snabbinställningarna"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Aktivera sidindelning"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Aktivera sidindelning via knappen Översikt"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Aktivera snabb aktivering och inaktivering"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Aktivera timeout i lanseringen vid sidindelning"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Aktivera skärmdumpar på helskärm"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Aktivera skärmdumpar på helskärm i översikten"</string>
     <string name="experimental" msgid="6198182315536726162">"Experimentella"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vill du aktivera Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Om du vill ansluta tangentbordet till surfplattan måste du först aktivera Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-sw/strings.xml b/packages/SystemUI/res/values-sw/strings.xml
index 8cc6712..1d231fc 100644
--- a/packages/SystemUI/res/values-sw/strings.xml
+++ b/packages/SystemUI/res/values-sw/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"kudumisha programu moja"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"tafuta"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Haikuweza kuanzisha <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Zaidi"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Historia"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Gawanya Mlalo"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Gawanya Wima"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Maalum Iliyogawanywa"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Onyesha sekunde za saa katika sehemu ya arifa. Inaweza kuathiri muda wa matumizi ya betri."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Panga Upya Mipangilio ya Haraka"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Onyesha unga\'avu katika Mipangilio ya Haraka"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Washa kipengee cha kupata kumbukumbu"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Washa kipengee cha kupata kumbukumbu kupitia kitufe cha Muhtasari"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Washa kugeuza haraka"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Washa kipengee cha kuisha kwa muda wa uzinduzi unapopata kumbukumbu"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Washa picha za skrini nzima"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Washa picha za skrini nzima katika Muhtasari"</string>
     <string name="experimental" msgid="6198182315536726162">"Ya majaribio"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Je, ungependa kuwasha Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Ili uunganishe Kibodi yako kwenye kompyuta yako kibao, lazima kwanza uwashe Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ta-rIN/strings.xml b/packages/SystemUI/res/values-ta-rIN/strings.xml
index 5896c3001..c41494b 100644
--- a/packages/SystemUI/res/values-ta-rIN/strings.xml
+++ b/packages/SystemUI/res/values-ta-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"திரையை பின் செய்தல்"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"தேடு"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>ஐத் தொடங்க முடியவில்லை."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"மேலும்"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"வரலாறு"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"கிடைமட்டமாகப் பிரி"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"செங்குத்தாகப் பிரி"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"தனிவிருப்பத்தில் பிரி"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"நிலைப் பட்டியில் கடிகார வினாடிகளைக் காட்டும். பேட்டரியின் ஆயுளைக் குறைக்கலாம்."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"விரைவு அமைப்புகளை மறுவரிசைப்படுத்து"</string>
     <string name="show_brightness" msgid="6613930842805942519">"விரைவு அமைப்புகளில் ஒளிர்வுப் பட்டியைக் காட்டு"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"பேஜிங்கை இயக்கு"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"மேலோட்டப் பார்வை பொத்தான் வழியாக பேஜிங்கை இயக்கு"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"வேகமாக மாறுவதை இயக்கு"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"பேஜிங்கின் போது தொடக்க நேர முடிவை இயக்கு"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"முழுத்திரை ஸ்கிரீன் ஷாட்களை இயக்கு"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"மேலோட்டப் பார்வையில் முழுத்திரை ஸ்கிரீன் ஷாட்களை இயக்கு"</string>
     <string name="experimental" msgid="6198182315536726162">"சோதனை முயற்சி"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"புளூடூத்தை இயக்கவா?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"உங்கள் டேப்லெட்டுடன் விசைப்பலகையை இணைக்க, முதலில் புளூடூத்தை இயக்க வேண்டும்."</string>
diff --git a/packages/SystemUI/res/values-te-rIN/strings.xml b/packages/SystemUI/res/values-te-rIN/strings.xml
index dccac8b..a628ef7 100644
--- a/packages/SystemUI/res/values-te-rIN/strings.xml
+++ b/packages/SystemUI/res/values-te-rIN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"స్క్రీన్ పిన్నింగ్"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"శోధించు"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g>ని ప్రారంభించడం సాధ్యపడలేదు."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"మరింత"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"చరిత్ర"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"సమతలంగా విభజించు"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"లంబంగా విభజించు"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"అనుకూలంగా విభజించు"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"స్థితి పట్టీలో గడియారం సెకన్లు చూపుతుంది. బ్యాటరీ శక్తి ప్రభావితం చేయవచ్చు."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"శీఘ్ర సెట్టింగ్‌ల ఏర్పాటు క్రమం మార్చు"</string>
     <string name="show_brightness" msgid="6613930842805942519">"శీఘ్ర సెట్టింగ్‌ల్లో ప్రకాశం చూపు"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"పేజింగ్‌ను ప్రారంభించు"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"స్థూలదృష్టి బటన్ ద్వారా పేజింగ్‌ను ప్రారంభిస్తుంది"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"వేగవంతమైన టోగుల్‌ను ప్రారంభించు"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"పేజింగ్ చేస్తున్నప్పుడు గడువు ముగింపు లాంచ్ చేయిని ప్రారంభిస్తుంది"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"పూర్తి స్క్రీన్ స్క్రీన్‌షాట్‌లను ప్రారంభించండి"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"స్థూలదృష్టిలో పూర్తి స్క్రీన్ స్క్రీన్‌షాట్‌లను ప్రారంభిస్తుంది"</string>
     <string name="experimental" msgid="6198182315536726162">"ప్రయోగాత్మకం"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"బ్లూటూత్ ఆన్ చేయాలా?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"మీ కీబోర్డ్‌ను మీ టాబ్లెట్‌తో కనెక్ట్ చేయడానికి, మీరు ముందుగా బ్లూటూత్ ఆన్ చేయాలి."</string>
diff --git a/packages/SystemUI/res/values-th/strings.xml b/packages/SystemUI/res/values-th/strings.xml
index 625b676..44ad1fa 100644
--- a/packages/SystemUI/res/values-th/strings.xml
+++ b/packages/SystemUI/res/values-th/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"การตรึงหน้าจอ"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ค้นหา"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"ไม่สามารถเริ่มใช้ <xliff:g id="APP">%s</xliff:g>"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"เพิ่มเติม"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"ประวัติ"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"แยกในแนวนอน"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"แยกในแนวตั้ง"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"แยกแบบกำหนดเอง"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"แสดงวินาทีของนาฬิกาในแถบสถานะ อาจส่งผลต่ออายุแบตเตอรี"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"จัดเรียงการตั้งค่าด่วนใหม่"</string>
     <string name="show_brightness" msgid="6613930842805942519">"แสดงความสว่างในการตั้งค่าด่วน"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"เปิดใช้การสลับหน้า"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"เปิดใช้การสลับหน้าผ่านทางปุ่มภาพรวม"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"เปิดใช้การสลับแบบด่วน"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"เปิดใช้ระยะหมดเวลาการเปิดขณะสลับหน้า"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"เปิดใช้ภาพหน้าจอแบบเต็มจอ"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"เปิดใช้ภาพหน้าจอแบบเต็มจอใน \"ภาพรวม\""</string>
     <string name="experimental" msgid="6198182315536726162">"ทดสอบ"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"เปิดบลูทูธไหม"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"หากต้องการเชื่อมต่อแป้นพิมพ์กับแท็บเล็ต คุณต้องเปิดบลูทูธก่อน"</string>
diff --git a/packages/SystemUI/res/values-tl/strings.xml b/packages/SystemUI/res/values-tl/strings.xml
index e3b8e24..c1bb85c 100644
--- a/packages/SystemUI/res/values-tl/strings.xml
+++ b/packages/SystemUI/res/values-tl/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"pagpi-pin sa screen"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"maghanap"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Hindi masimulan <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Higit pa"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"History"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Split Horizontal"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Split Vertical"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Split Custom"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Ipakita ang mga segundo ng orasan sa status bar. Maaaring makaapekto sa tagal ng baterya."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Ayusing Muli ang Mga Mabilisang Setting"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Ipakita ang liwanag sa Mga Mabilisang Setting"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"I-enable ang paging"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"I-enable ang paging sa pamamagitan ng button na Pangkalahatang-ideya"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"I-enable ang mabilis na pag-toggle"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"I-enable ang pag-timeout ng paglunsad habang nagsasagawa ng paging"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"I-enable ang mga fullscreen na screenshot"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"I-enable ang mga fullscreen na screenshot sa Pangkalahatang-ideya"</string>
     <string name="experimental" msgid="6198182315536726162">"Pang-eksperimento"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"I-on ang Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Upang ikonekta ang iyong keyboard sa iyong tablet, kailangan mo munang i-on ang Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-tr/strings.xml b/packages/SystemUI/res/values-tr/strings.xml
index 2fe49e5..854f850 100644
--- a/packages/SystemUI/res/values-tr/strings.xml
+++ b/packages/SystemUI/res/values-tr/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ekran sabitleme"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"ara"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> başlatılamadı."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Diğer"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Geçmiş"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Yatay Ayırma"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Dikey Ayırma"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Özel Ayırma"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Durum çubuğunda saatin saniyelerini gösterir. Pil ömrünü etkileyebilir."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Hızlı Ayarlar\'ı Yeniden Düzenle"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Hızlı Ayarlar\'da parlaklığı göster"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Sayfalara ayırmayı etkinleştir"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Genel bakış düğmesiyle sayfalara ayırmayı etkinleştirin"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Hızlı açma/kapatmayı etkinleştir"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Sayfalara ayırma sırasında başlatma zaman aşımını etkinleştirin"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Tam ekran boyutunda ekran görüntülerini etkinleştir"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Genel bakışta tam ekran boyutundaki ekran görüntülerini etkinleştirin"</string>
     <string name="experimental" msgid="6198182315536726162">"Deneysel"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth açılsın mı?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Klavyenizi tabletinize bağlamak için önce Bluetooth\'u açmanız gerekir."</string>
diff --git a/packages/SystemUI/res/values-uk/strings.xml b/packages/SystemUI/res/values-uk/strings.xml
index 5a749c4..5347d93 100644
--- a/packages/SystemUI/res/values-uk/strings.xml
+++ b/packages/SystemUI/res/values-uk/strings.xml
@@ -296,6 +296,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"закріпити екран"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"пошук"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Не вдалося запустити <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Більше"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Історія"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Розділити горизонтально"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Розділити вертикально"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Розділити (власний варіант)"</string>
@@ -439,12 +441,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Показувати секунди на годиннику в рядку стану. Акумулятор може розряджатися швидше."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Упорядкувати швидкі налаштування"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Показувати панель яскравості у швидких налаштуваннях"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Увімкнути перехід між сторінками"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Увімкнути перехід між сторінками за допомогою кнопки \"Огляд\""</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Увімкнути швидкий перехід"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Увімкнути очікування на запуск під час переходу на сторінку"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Увімкнути знімки повного екрана"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Увімкнути знімки повного екрана в режимі огляду"</string>
     <string name="experimental" msgid="6198182315536726162">"Експериментальні налаштування"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Увімкнути Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Щоб під’єднати клавіатуру до планшета, спершу потрібно ввімкнути Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-ur-rPK/strings.xml b/packages/SystemUI/res/values-ur-rPK/strings.xml
index 7dcb076..b9da6e3 100644
--- a/packages/SystemUI/res/values-ur-rPK/strings.xml
+++ b/packages/SystemUI/res/values-ur-rPK/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"اسکرین کو پن کرنا"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"تلاش کریں"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"<xliff:g id="APP">%s</xliff:g> کو شروع نہیں کیا جا سکا۔"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"مزید"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"سرگزشت"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"بلحاظ افقی الگ کریں"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"بلحاظ عمودی الگ کریں"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"بلحاظ حسب ضرورت الگ کریں"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"گھڑی کے سیکنڈز اسٹیٹس بار میں دکھائیں۔ اس کا بیٹری کی زندگی پر اثر پڑ سکتا ہے۔"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"فوری ترتیبات کو دوبارہ ترتیب دیں"</string>
     <string name="show_brightness" msgid="6613930842805942519">"فوری ترتیبات میں چمکیلا پن دکھائیں"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"پیجنگ فعال کریں"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"مجموعی جائزہ بٹن کے ذریعے پیجنگ فعال کریں"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"تیز ٹوگل فعال کریں"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"پیجنگ کے دوران لانچ ٹائم آؤٹ فعال کریں"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"فل اسکرین کے اسکرین شاٹس فعال کریں"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"مجموعی جائزے میں فل اسکرین کے اسکرین شاٹس فعال کریں"</string>
     <string name="experimental" msgid="6198182315536726162">"تجرباتی"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"بلوٹوتھ آن کریں؟"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"اپنے کی بورڈ کو اپنے ٹیبلٹ کے ساتھ منسلک کرنے کیلئے پہلے آپ کو اپنا بلو ٹوتھ آن کرنا ہو گا۔"</string>
diff --git a/packages/SystemUI/res/values-uz-rUZ/strings.xml b/packages/SystemUI/res/values-uz-rUZ/strings.xml
index 1f26da6..67cd123 100644
--- a/packages/SystemUI/res/values-uz-rUZ/strings.xml
+++ b/packages/SystemUI/res/values-uz-rUZ/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"o‘zgarmas ekran"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"qidirish"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"“<xliff:g id="APP">%s</xliff:g>” ilovasini ishga tushirib bo‘lmadi."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Ko‘proq"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Jurnal"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Gorizontal yo‘nalishda bo‘lish"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Vertikal yo‘nalishda bo‘lish"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Boshqa usulda bo‘lish"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Holat panelida soat soniyalari ko‘rsatilsin. Bu batareya resursiga ta’sir qilishi mumkin."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Tezkor sozlamalarni qayta tartiblash"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Tezkor sozlamalarda yorqinlikni ko‘rsatish"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Sahifalashni yoqish"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Umumiy ma’lumot tugmasi orqali sahifalashni yoqish"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Tezkor almashtirishni yoqish"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Sahifalashda tanaffusni yoqish"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"To‘liq ekranni skrinshotga olishni yoqish"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Umumiy rejimda to‘liq ekranni skrinshotga olishni yoqish"</string>
     <string name="experimental" msgid="6198182315536726162">"Tajribaviy"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bluetooth yoqilsinmi?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Klaviaturani planshetingizga ulash uchun Bluetooth xizmatini yoqishingiz kerak."</string>
diff --git a/packages/SystemUI/res/values-vi/strings.xml b/packages/SystemUI/res/values-vi/strings.xml
index 41ecb45..aa81068 100644
--- a/packages/SystemUI/res/values-vi/strings.xml
+++ b/packages/SystemUI/res/values-vi/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"khóa màn hình"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"tìm kiếm"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Không thể khởi động <xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Thêm"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Lịch sử"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Phân tách ngang"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Phân tách dọc"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Tùy chỉnh phân tách"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Hiển thị giây đồng hồ trong thanh trạng thái. Có thể ảnh hưởng đến thời lượng pin."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Sắp xếp lại Cài đặt nhanh"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Hiển thị độ sáng trong Cài đặt nhanh"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Bật đánh số trang"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Bật đánh số trang qua nút Tổng quan"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Bật chuyển đổi nhanh"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Bật thời gian chờ khởi chạy trong khi đánh số trang"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Bật ảnh chụp toàn màn hình"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Bật ảnh chụp toàn màn hình trong Tổng quan"</string>
     <string name="experimental" msgid="6198182315536726162">"Thử nghiệm"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Bật Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Để kết nối bàn phím với máy tính bảng, trước tiên, bạn phải bật Bluetooth."</string>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index cc78ef7..fa69975 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"固定屏幕"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"搜索"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"无法启动<xliff:g id="APP">%s</xliff:g>。"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"更多"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"历史记录"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"水平分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"垂直分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"自定义分割"</string>
@@ -437,17 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"在状态栏中显示时钟的秒数。这可能会影响电池的续航时间。"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"重新排列快速设置"</string>
     <string name="show_brightness" msgid="6613930842805942519">"在快速设置中显示亮度栏"</string>
-    <!-- no translation found for overview_page_on_toggle (7332906295136546986) -->
-    <skip />
-    <!-- no translation found for overview_page_on_toggle_desc (3350421878356386241) -->
-    <skip />
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"启用快速切换"</string>
-    <!-- no translation found for overview_fast_toggle_via_button_desc (8983671478896649561) -->
-    <skip />
-    <!-- no translation found for overview_fullscreen_thumbnails (3052584848522856237) -->
-    <skip />
-    <!-- no translation found for overview_fullscreen_thumbnails_desc (3588874352141119692) -->
-    <skip />
     <string name="experimental" msgid="6198182315536726162">"实验性"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"要开启蓝牙吗?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"要将您的键盘连接到平板电脑,您必须先开启蓝牙。"</string>
diff --git a/packages/SystemUI/res/values-zh-rHK/strings.xml b/packages/SystemUI/res/values-zh-rHK/strings.xml
index 1a02914..7375a92 100644
--- a/packages/SystemUI/res/values-zh-rHK/strings.xml
+++ b/packages/SystemUI/res/values-zh-rHK/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"螢幕固定"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"搜尋"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"無法啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"更多"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"記錄"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"水平分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"垂直分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"自訂分割"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"在狀態列中顯示時鐘秒數,但可能會影響電池壽命。"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"重新排列快速設定"</string>
     <string name="show_brightness" msgid="6613930842805942519">"在快速設定顯示亮度"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"啟用分頁"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"透過「概覽」按鈕啟用分頁"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"啟用快速切換"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"進行分頁時啟用啟動逾時"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"啟用全螢幕擷取畫面"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"在「概覽」啟用全螢幕擷取畫面"</string>
     <string name="experimental" msgid="6198182315536726162">"實驗版"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"要開啟藍牙嗎?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"如要將鍵盤連接至平板電腦,請先開啟藍牙。"</string>
diff --git a/packages/SystemUI/res/values-zh-rTW/strings.xml b/packages/SystemUI/res/values-zh-rTW/strings.xml
index 659334d..5edda84 100644
--- a/packages/SystemUI/res/values-zh-rTW/strings.xml
+++ b/packages/SystemUI/res/values-zh-rTW/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"螢幕固定"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"搜尋"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"無法啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"更多"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"紀錄"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"水平分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"垂直分割"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"自訂分割"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"在狀態列中顯示時鐘秒數。這可能會影響電池續航力。"</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"重新排列快速設定"</string>
     <string name="show_brightness" msgid="6613930842805942519">"在快速設定中顯示亮度"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"啟用分頁功能"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"啟用透過 [總覽] 按鈕切換分頁的功能"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"啟用快速切換"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"切換分頁時啟用啟動逾時功能"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"啟用全螢幕的螢幕擷取畫面"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"在「總覽」畫面中啟用全螢幕的螢幕擷取畫面"</string>
     <string name="experimental" msgid="6198182315536726162">"實驗性"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"要開啟藍牙功能嗎?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"如要將鍵盤連線到平板電腦,您必須先開啟藍牙。"</string>
diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml
index 8ba9363..51c4389 100644
--- a/packages/SystemUI/res/values-zu/strings.xml
+++ b/packages/SystemUI/res/values-zu/strings.xml
@@ -294,6 +294,8 @@
     <string name="recents_lock_to_app_button_label" msgid="6942899049072506044">"ukuphina isikrini"</string>
     <string name="recents_search_bar_label" msgid="8074997400187836677">"sesha"</string>
     <string name="recents_launch_error_message" msgid="2969287838120550506">"Ayikwazanga ukuqala i-<xliff:g id="APP">%s</xliff:g>."</string>
+    <string name="recents_show_history_button_label" msgid="7062088196449747245">"Okuningi"</string>
+    <string name="recents_history_label" msgid="3076213823382198287">"Umlando"</string>
     <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="8848514474543427332">"Hlukanisa okuvundlile"</string>
     <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="9075292233696180813">"Hlukanisa okumile"</string>
     <string name="recents_multistack_add_stack_dialog_split_custom" msgid="4177837597513701943">"Hlukanisa kwezifiso"</string>
@@ -437,12 +439,6 @@
     <string name="clock_seconds_desc" msgid="6282693067130470675">"Bonisa amasekhondi wewashi kubha yesimo. Ingathinta impilo yebhethri."</string>
     <string name="qs_rearrange" msgid="8060918697551068765">"Hlela kabusha izilungiselelo ezisheshayo"</string>
     <string name="show_brightness" msgid="6613930842805942519">"Bonisa ukukhanya kuzilungiselelo ezisheshayo"</string>
-    <string name="overview_page_on_toggle" msgid="7332906295136546986">"Nika amandla ukuphenya"</string>
-    <string name="overview_page_on_toggle_desc" msgid="3350421878356386241">"Nika amandla wenkinobho yokubuka konke"</string>
-    <string name="overview_fast_toggle_via_button" msgid="8316769524084143500">"Nika amandla ukuguqula ngokushesha"</string>
-    <string name="overview_fast_toggle_via_button_desc" msgid="8983671478896649561">"Nika amandla ukuvula kokuphela kwesikhathi ngesikhathi uphenya"</string>
-    <string name="overview_fullscreen_thumbnails" msgid="3052584848522856237">"Nika amandla izithombe-skrini ezigcwele"</string>
-    <string name="overview_fullscreen_thumbnails_desc" msgid="3588874352141119692">"Nika amandla izithombe-skrini ezigcwele ngokubuka konke"</string>
     <string name="experimental" msgid="6198182315536726162">"Okokulinga"</string>
     <string name="enable_bluetooth_title" msgid="5027037706500635269">"Vula i-Bluetooth?"</string>
     <string name="enable_bluetooth_message" msgid="9106595990708985385">"Ukuze uxhume ikhibhodi yakho nethebhulethi yakho, kufanele uqale ngokuvula i-Bluetooth."</string>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 26a0577..5618e9b 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -21,7 +21,6 @@
     <drawable name="ticker_background_color">#ff1d1d1d</drawable>
     <drawable name="system_bar_background">@color/system_bar_background_opaque</drawable>
     <color name="system_bar_background_opaque">#ff000000</color>
-    <color name="system_bar_background_semi_transparent">#66000000</color> <!-- 40% black -->
     <color name="system_bar_background_transparent">#00000000</color>
     <color name="notification_panel_solid_background">#ff000000</color>
     <drawable name="status_bar_notification_row_background_color">#ff090909</drawable>
@@ -109,7 +108,6 @@
     <color name="assist_orb_color">#ffffff</color>
 
     <color name="keyguard_user_switcher_background_gradient_color">#77000000</color>
-    <color name="doze_small_icon_background_color">#ff434343</color>
 
     <!-- The color of the navigation bar icons. Need to be in sync with ic_sysbar_* -->
     <color name="navigation_bar_icon_color">#E5FFFFFF</color>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 902db26..a0052ce 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -175,7 +175,7 @@
     <integer name="recents_animate_task_view_remove_duration">250</integer>
 
     <!-- The animation duration for scrolling the stack to a particular item. -->
-    <integer name="recents_animate_task_stack_scroll_duration">225</integer>
+    <integer name="recents_animate_task_stack_scroll_duration">200</integer>
 
     <!-- The animation duration for entering and exiting the history. -->
     <integer name="recents_history_transition_duration">250</integer>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index c85ada8..086e9f4 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -48,11 +48,14 @@
     <!-- Height of a single line notification in the status bar -->
     <dimen name="notification_single_line_height">32sp</dimen>
 
-    <!-- Height of a small notification in the status bar -->
-    <dimen name="notification_min_height">64dp</dimen>
+    <!-- Height of a small notification in the status bar-->
+    <dimen name="notification_min_height">84dp</dimen>
+
+    <!-- Height of a small notification in the status bar which was used before android N -->
+    <dimen name="notification_min_height_legacy">64dp</dimen>
 
     <!-- Height of a large notification in the status bar -->
-    <dimen name="notification_max_height">256dp</dimen>
+    <dimen name="notification_max_height">276dp</dimen>
 
     <!-- Height of a medium notification in the status bar -->
     <dimen name="notification_mid_height">128dp</dimen>
@@ -214,9 +217,6 @@
     <!-- The amount to offset when animating into an affiliate group. -->
     <dimen name="recents_task_view_affiliate_group_enter_offset">64dp</dimen>
 
-    <!-- The alpha to apply to a task thumbnail. -->
-    <item name="recents_task_view_thumbnail_alpha" format="float" type="dimen">0.9</item>
-
     <!-- The height of a task view bar. -->
     <dimen name="recents_task_bar_height">56dp</dimen>
 
@@ -261,7 +261,7 @@
 
     <!-- bottom_stack_peek_amount + notification_min_height
          + notification_collapse_second_card_padding -->
-    <dimen name="min_stack_height">84dp</dimen>
+    <dimen name="min_stack_height">104dp</dimen>
 
     <!-- The height of the area before the bottom stack in which the notifications slow down -->
     <dimen name="bottom_stack_slow_down_length">12dp</dimen>
@@ -279,7 +279,7 @@
     <dimen name="notification_padding_dimmed">0dp</dimen>
 
     <!-- The padding between the individual notification cards. -->
-    <dimen name="notification_padding">4dp</dimen>
+    <dimen name="notification_padding">2dp</dimen>
 
     <!-- The minimum amount of top overscroll to go to the quick settings. -->
     <dimen name="min_top_overscroll_to_qs">36dp</dimen>
@@ -299,7 +299,7 @@
     <!-- Falsing threshold used when dismissing notifications from the lockscreen. -->
     <dimen name="swipe_helper_falsing_threshold">70dp</dimen>
 
-    <dimen name="notifications_top_padding">8dp</dimen>
+    <dimen name="notifications_top_padding">4dp</dimen>
     
     <!-- Minimum distance the user has to drag down to go to the full shade. -->
     <dimen name="keyguard_drag_down_min_distance">100dp</dimen>
@@ -351,9 +351,6 @@
     <!-- radius of the corners of the material rounded rect background but negative-->
     <dimen name="notification_material_rounded_rect_radius_negative">-2dp</dimen>
 
-    <!-- height of notification header view if present -->
-    <dimen name="notification_header_height">32dp</dimen>
-
     <!-- The padding between notification children -->
     <dimen name="notification_children_padding">2dp</dimen>
 
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 04233ba..002b9f5 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -753,9 +753,6 @@
     <!-- Text for overflow card on Keyguard when there is not enough space for all notifications on Keyguard. [CHAR LIMIT=1] -->
     <string name="keyguard_more_overflow_text">+<xliff:g id="number_of_notifications" example="5">%d</xliff:g></string>
 
-    <!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] -->
-    <string name="notification_header_divider_symbol" translatable="false">•</string>
-
     <!-- An explanation for the visual speed bump in the notifications, which will appear when you click on it. [CHAR LIMIT=50] -->
     <string name="speed_bump_explanation">Less urgent notifications below</string>
 
@@ -1174,13 +1171,23 @@
     <!-- Toggles fullscreen screenshots. DO NOT TRANSLATE -->
     <string name="overview_fullscreen_thumbnails">Enable fullscreen screenshots</string>
     <!-- Description for the toggle for fullscreen screenshots. DO NOT TRANSLATE -->
-    <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview</string>
+    <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview. Restart required.</string>
+
+    <!-- Toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
+    <string name="overview_nav_bar_gesture">Enable navigation bar gesture</string>
+    <!-- Description for the toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
+    <string name="overview_nav_bar_gesture_desc">Enables the gesture to enter Overview by swiping up on the Nav bar</string>
 
     <!-- Toggle to show the history view in Overview. DO NOT TRANSLATE -->
     <string name="overview_show_history">Show History</string>
     <!-- Description for the toggle to show the history view in Overview. DO NOT TRANSLATE -->
     <string name="overview_show_history_desc">Enables the history view to see more recent tasks</string>
 
+    <!-- Toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
+    <string name="overview_initial_state_paging">Initialize to paging</string>
+    <!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
+    <string name="overview_initial_state_paging_desc">Determines whether Overview will initially be in a stacked or paged state</string>
+
     <!-- Category in the System UI Tuner settings, where new/experimental
          settings are -->
     <string name="experimental">Experimental</string>
diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml
index f398af3..8dcf8a7 100644
--- a/packages/SystemUI/res/xml/tuner_prefs.xml
+++ b/packages/SystemUI/res/xml/tuner_prefs.xml
@@ -93,11 +93,21 @@
             android:summary="@string/overview_page_on_toggle_desc" />
 
         <com.android.systemui.tuner.TunerSwitch
+            android:key="overview_initial_state_paging"
+            android:title="@string/overview_initial_state_paging"
+            android:summary="@string/overview_initial_state_paging_desc" />
+
+        <com.android.systemui.tuner.TunerSwitch
             android:key="overview_fast_toggle"
             android:title="@string/overview_fast_toggle_via_button"
             android:summary="@string/overview_fast_toggle_via_button_desc" />
 
         <com.android.systemui.tuner.TunerSwitch
+            android:key="overview_nav_bar_gesture"
+            android:title="@string/overview_nav_bar_gesture"
+            android:summary="@string/overview_nav_bar_gesture_desc" />
+
+        <com.android.systemui.tuner.TunerSwitch
             android:key="overview_fullscreen_thumbnails"
             android:title="@string/overview_fullscreen_thumbnails"
             android:summary="@string/overview_fullscreen_thumbnails_desc" />
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index d9f7a46..051921a 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -509,7 +509,7 @@
         if (canBeExpanded) {
             if (DEBUG) Log.d(TAG, "working on an expandable child");
             mNaturalHeight = mScaler.getNaturalHeight();
-            mSmallSize = v.getMinHeight();
+            mSmallSize = v.getMinExpandHeight();
         } else {
             if (DEBUG) Log.d(TAG, "working on a non-expandable child");
             mNaturalHeight = mOldHeight;
diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
index 4cb8a3c..7f6cda0 100644
--- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
@@ -32,7 +32,7 @@
     /**
      * Docks the top-most task and opens recents.
      */
-    void dockTopTask(boolean draggingInRecents, Rect initialBounds);
+    void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds);
 
     /**
      * Called during a drag-from-navbar-in gesture.
diff --git a/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java b/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
index eddf2b1..5b8d3d6 100644
--- a/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
@@ -26,6 +26,8 @@
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 
+import java.util.ArrayList;
+
 /**
  * Helper to invert the colors of views and fade between the states.
  */
@@ -33,14 +35,24 @@
 
     private final Paint mDarkPaint = new Paint();
     private final Interpolator mLinearOutSlowInInterpolator;
-    private final View mTarget;
+    private final ArrayList<View> mTargets;
     private final ColorMatrix mMatrix = new ColorMatrix();
     private final ColorMatrix mGrayscaleMatrix = new ColorMatrix();
     private final long mFadeDuration;
 
     public ViewInvertHelper(View target, long fadeDuration) {
-        mTarget = target;
-        mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(mTarget.getContext(),
+        this(constructArray(target), fadeDuration);
+    }
+
+    private static ArrayList<View> constructArray(View target) {
+        final ArrayList<View> views = new ArrayList<>();
+        views.add(target);
+        return views;
+    }
+
+    public ViewInvertHelper(ArrayList<View> targets, long fadeDuration) {
+        mTargets = targets;
+        mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(mTargets.get(0).getContext(),
                 android.R.interpolator.linear_out_slow_in);
         mFadeDuration = fadeDuration;
     }
@@ -53,14 +65,18 @@
             @Override
             public void onAnimationUpdate(ValueAnimator animation) {
                 updateInvertPaint((Float) animation.getAnimatedValue());
-                mTarget.setLayerType(View.LAYER_TYPE_HARDWARE, mDarkPaint);
+                for (int i = 0; i < mTargets.size(); i++) {
+                    mTargets.get(i).setLayerType(View.LAYER_TYPE_HARDWARE, mDarkPaint);
+                }
             }
         });
         animator.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
                 if (!invert) {
-                    mTarget.setLayerType(View.LAYER_TYPE_NONE, null);
+                    for (int i = 0; i < mTargets.size(); i++) {
+                        mTargets.get(i).setLayerType(View.LAYER_TYPE_NONE, null);
+                    }
                 }
             }
         });
@@ -73,16 +89,16 @@
     public void update(boolean invert) {
         if (invert) {
             updateInvertPaint(1f);
-            mTarget.setLayerType(View.LAYER_TYPE_HARDWARE, mDarkPaint);
+            for (int i = 0; i < mTargets.size(); i++) {
+                mTargets.get(i).setLayerType(View.LAYER_TYPE_HARDWARE, mDarkPaint);
+            }
         } else {
-            mTarget.setLayerType(View.LAYER_TYPE_NONE, null);
+            for (int i = 0; i < mTargets.size(); i++) {
+                mTargets.get(i).setLayerType(View.LAYER_TYPE_NONE, null);
+            }
         }
     }
 
-    public View getTarget() {
-        return mTarget;
-    }
-
     private void updateInvertPaint(float intensity) {
         float components = 1 - 2 * intensity;
         final float[] invert = {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index eee685f..443778e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -43,6 +43,7 @@
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.os.storage.StorageManager;
 import android.provider.Settings;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -135,6 +136,8 @@
 
     private static final String DELAYED_KEYGUARD_ACTION =
         "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD";
+    private static final String DELAYED_LOCK_PROFILE_ACTION =
+            "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_LOCK";
 
     // used for handler messages
     private static final int SHOW = 2;
@@ -322,6 +325,8 @@
     private boolean mWakeAndUnlocking;
     private IKeyguardDrawnCallback mDrawnCallback;
 
+    private boolean mIsPerUserLock;
+
     KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
 
         @Override
@@ -565,6 +570,8 @@
         mShowKeyguardWakeLock.setReferenceCounted(false);
 
         mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(DELAYED_KEYGUARD_ACTION));
+        mContext.registerReceiver(
+                mBroadcastReceiver, new IntentFilter(DELAYED_LOCK_PROFILE_ACTION));
 
         mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
 
@@ -637,6 +644,7 @@
             doKeyguardLocked(null);
             mUpdateMonitor.registerCallback(mUpdateCallback);
         }
+        mIsPerUserLock = StorageManager.isFileBasedEncryptionEnabled();
         // Most services aren't available until the system reaches the ready state, so we
         // send it here when the device first boots.
         maybeSendUserPresentBroadcast();
@@ -660,7 +668,7 @@
             final boolean lockImmediately =
                     mLockPatternUtils.getPowerButtonInstantlyLocks(currentUser)
                             || !mLockPatternUtils.isSecure(currentUser);
-            long timeout = getLockTimeout();
+            long timeout = getLockTimeout(KeyguardUpdateMonitor.getCurrentUser());
 
             if (mExitSecureCallback != null) {
                 if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled");
@@ -710,10 +718,11 @@
                 mPendingLock = false;
             }
         }
+        doKeyguardLaterLockedForChildProfiles();
         KeyguardUpdateMonitor.getInstance(mContext).dispatchFinishedGoingToSleep(why);
     }
 
-    private long getLockTimeout() {
+    private long getLockTimeout(int userId) {
         // if the screen turned off because of timeout or the user hit the power button
         // and we don't need to lock immediately, set an alarm
         // to enable it a little bit later (i.e, give the user a chance
@@ -721,10 +730,6 @@
         // having to unlock the screen)
         final ContentResolver cr = mContext.getContentResolver();
 
-        // From DisplaySettings
-        long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
-                KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT);
-
         // From SecuritySettings
         final long lockAfterTimeout = Settings.Secure.getInt(cr,
                 Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
@@ -732,21 +737,28 @@
 
         // From DevicePolicyAdmin
         final long policyTimeout = mLockPatternUtils.getDevicePolicyManager()
-                .getMaximumTimeToLock(null, KeyguardUpdateMonitor.getCurrentUser());
+                .getMaximumTimeToLock(null, userId);
 
         long timeout;
-        if (policyTimeout > 0) {
+
+        UserInfo user = UserManager.get(mContext).getUserInfo(userId);
+        if ((!user.isManagedProfile() && LockPatternUtils.isSeparateWorkChallengeEnabled())
+                || policyTimeout <= 0) {
+            timeout = lockAfterTimeout;
+        } else {
+            // From DisplaySettings
+            long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
+                    KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT);
+
             // policy in effect. Make sure we don't go beyond policy limit.
             displayTimeout = Math.max(displayTimeout, 0); // ignore negative values
             timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout);
-        } else {
-            timeout = lockAfterTimeout;
         }
         return timeout;
     }
 
     private void doKeyguardLaterLocked() {
-        long timeout = getLockTimeout();
+        long timeout = getLockTimeout(KeyguardUpdateMonitor.getCurrentUser());
         if (timeout == 0) {
             doKeyguardLocked(null);
         } else {
@@ -764,6 +776,25 @@
         mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender);
         if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = "
                          + mDelayedShowingSequence);
+        doKeyguardLaterLockedForChildProfiles();
+    }
+
+    private void doKeyguardLaterLockedForChildProfiles() {
+        UserManager um = UserManager.get(mContext);
+        List<UserInfo> profiles = um.getEnabledProfiles(UserHandle.myUserId());
+        if (LockPatternUtils.isSeparateWorkChallengeEnabled() && profiles.size() > 1) {
+            for (UserInfo info : profiles) {
+                if (info.id != UserHandle.myUserId() && info.isManagedProfile()) {
+                    long userTimeout = getLockTimeout(info.id);
+                    long userWhen = SystemClock.elapsedRealtime() + userTimeout;
+                    Intent lockIntent = new Intent(DELAYED_LOCK_PROFILE_ACTION);
+                    lockIntent.putExtra(Intent.EXTRA_USER_ID, info.id);
+                    PendingIntent lockSender = PendingIntent.getBroadcast(
+                            mContext, 0, lockIntent, PendingIntent.FLAG_CANCEL_CURRENT);
+                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, userWhen, lockSender);
+                }
+            }
+        }
     }
 
     private void cancelDoKeyguardLaterLocked() {
@@ -1099,6 +1130,10 @@
         showLocked(options);
     }
 
+    private void lockProfile(int userId) {
+        mTrustManager.setDeviceLockedForUser(userId, true);
+    }
+
     private boolean shouldWaitForProvisioning() {
         return !mUpdateMonitor.isDeviceProvisioned() && !isSecure();
     }
@@ -1213,8 +1248,13 @@
                 if (DEBUG) Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = "
                         + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence);
                 synchronized (KeyguardViewMediator.this) {
-                    if (mDelayedShowingSequence == sequence) {
-                        doKeyguardLocked(null);
+                    doKeyguardLocked(null);
+                }
+            } else if (DELAYED_LOCK_PROFILE_ACTION.equals(intent.getAction())) {
+                int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, 0);
+                if (userId != 0) {
+                    synchronized (KeyguardViewMediator.this) {
+                        lockProfile(userId);
                     }
                 }
             }
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index a12a3f1..19b65f7 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -36,7 +36,6 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.util.Slog;
-import android.view.View;
 
 import com.android.systemui.R;
 import com.android.systemui.statusbar.phone.PhoneStatusBar;
@@ -162,9 +161,6 @@
                 .setColor(mContext.getColor(
                         com.android.internal.R.color.system_notification_accent_color));
         final Notification n = nb.build();
-        if (n.headsUpContentView != null) {
-            n.headsUpContentView.setViewVisibility(com.android.internal.R.id.right_icon, View.GONE);
-        }
         mNoMan.notifyAsUser(TAG_NOTIFICATION, R.id.notification_power, n, UserHandle.ALL);
     }
 
@@ -200,9 +196,6 @@
             mPlaySound = false;
         }
         final Notification n = nb.build();
-        if (n.headsUpContentView != null) {
-            n.headsUpContentView.setViewVisibility(com.android.internal.R.id.right_icon, View.GONE);
-        }
         mNoMan.notifyAsUser(TAG_NOTIFICATION, R.id.notification_power, n, UserHandle.ALL);
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileServiceWrapper.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileServiceWrapper.java
index 55f4736..a5e1fd5 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileServiceWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileServiceWrapper.java
@@ -66,9 +66,9 @@
     }
 
     @Override
-    public void onClick() {
+    public void onClick(IBinder token) {
         try {
-            mService.onClick();
+            mService.onClick(token);
         } catch (Exception e) {
             Log.d(TAG, "Caught exception from QSTileService", e);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
index f32cfdc..4cc2b8d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java
@@ -222,7 +222,6 @@
         final ImageView icon = new ImageView(mContext);
         icon.setId(android.R.id.icon);
         icon.setScaleType(ScaleType.CENTER_INSIDE);
-        icon.setImageTintList(ColorStateList.valueOf(getContext().getColor(android.R.color.white)));
         return icon;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomTile.java
index b0d885a..04006eb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CustomTile.java
@@ -23,12 +23,17 @@
 import android.content.ServiceConnection;
 import android.content.pm.PackageManager;
 import android.content.pm.ServiceInfo;
+import android.graphics.drawable.Drawable;
+import android.os.Binder;
 import android.os.IBinder;
+import android.os.RemoteException;
 import android.os.UserHandle;
 import android.service.quicksettings.IQSTileService;
 import android.service.quicksettings.Tile;
 import android.util.Log;
-
+import android.view.IWindowManager;
+import android.view.WindowManager;
+import android.view.WindowManagerGlobal;
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.qs.QSTile;
 import com.android.systemui.qs.QSTileServiceWrapper;
@@ -37,19 +42,26 @@
 public class CustomTile extends QSTile<QSTile.State> {
     public static final String PREFIX = "custom(";
 
+    private static final boolean DEBUG = false;
+
     // We don't want to thrash binding and unbinding if the user opens and closes the panel a lot.
     // So instead we have a period of waiting.
     private static final long UNBIND_DELAY = 30000;
 
     private final ComponentName mComponent;
     private final Tile mTile;
+    private final IWindowManager mWindowManager;
+    private final IBinder mToken = new Binder();
 
     private QSTileServiceWrapper mService;
     private boolean mListening;
     private boolean mBound;
+    private boolean mIsTokenGranted;
+    private boolean mIsShowingDialog;
 
     private CustomTile(QSTileHost host, String action) {
         super(host);
+        mWindowManager = WindowManagerGlobal.getWindowManagerService();
         mComponent = ComponentName.unflattenFromString(action);
         mTile = new Tile(mComponent, host);
         try {
@@ -71,12 +83,15 @@
     }
 
     public void updateState(Tile tile) {
-        Log.d("TileService", "Setting state " + tile.getLabel());
         mTile.setIcon(tile.getIcon());
         mTile.setLabel(tile.getLabel());
         mTile.setContentDescription(tile.getContentDescription());
     }
 
+    public void onDialogShown() {
+        mIsShowingDialog = true;
+    }
+
     @Override
     public void setListening(boolean listening) {
         if (mListening == listening) return;
@@ -94,14 +109,30 @@
             if (mService!= null) {
                 mService.onStopListening();
             }
+            if (mIsTokenGranted && !mIsShowingDialog) {
+                try {
+                    if (DEBUG) Log.d(TAG, "Removing token");
+                    mWindowManager.removeWindowToken(mToken);
+                } catch (RemoteException e) {
+                }
+                mIsTokenGranted = false;
+            }
+            mIsShowingDialog = false;
             mHandler.postDelayed(mUnbind, UNBIND_DELAY);
         }
     }
-    
+
     @Override
     protected void handleDestroy() {
         super.handleDestroy();
         mHandler.removeCallbacks(mUnbind);
+        if (mIsTokenGranted) {
+            try {
+                if (DEBUG) Log.d(TAG, "Removing token");
+                mWindowManager.removeWindowToken(mToken);
+            } catch (RemoteException e) {
+            }
+        }
         mUnbind.run();
     }
 
@@ -118,7 +149,13 @@
     @Override
     protected void handleClick() {
         if (mService != null) {
-            mService.onClick();
+            try {
+                if (DEBUG) Log.d(TAG, "Adding token");
+                mWindowManager.addWindowToken(mToken, WindowManager.LayoutParams.TYPE_QS_DIALOG);
+                mIsTokenGranted = true;
+            } catch (RemoteException e) {
+            }
+            mService.onClick(mToken);
         } else {
             Log.e(TAG, "Click with no service " + getTileSpec());
         }
@@ -132,7 +169,9 @@
     @Override
     protected void handleUpdateState(State state, Object arg) {
         state.visible = true;
-        state.icon = new DrawableIcon(mTile.getIcon().loadDrawable(mContext));
+        Drawable drawable = mTile.getIcon().loadDrawable(mContext);
+        drawable.setTint(mContext.getColor(android.R.color.white));
+        state.icon = new DrawableIcon(drawable);
         state.label = mTile.getLabel();
         if (mTile.getContentDescription() != null) {
             state.contentDescription = mTile.getContentDescription();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index c98ecb5..b81c23a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -365,8 +365,8 @@
     }
 
     @Override
-    public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
-        mImpl.dockTopTask(draggingInRecents, initialBounds);
+    public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) {
+        mImpl.dockTopTask(draggingInRecents, stackCreateMode,initialBounds);
         if (draggingInRecents) {
             mDraggingInRecentsCurrentUser = sSystemServicesProxy.getCurrentUser();
         }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 94c45a4..384b86f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -26,7 +26,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.content.pm.ActivityInfo;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.SystemClock;
@@ -62,8 +61,6 @@
 import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
 import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
 import com.android.systemui.recents.events.ui.UserInteractionEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
 import com.android.systemui.recents.events.ui.focus.DismissFocusedTaskViewEvent;
 import com.android.systemui.recents.events.ui.focus.FocusNextTaskViewEvent;
 import com.android.systemui.recents.events.ui.focus.FocusPreviousTaskViewEvent;
@@ -287,6 +284,20 @@
     }
 
     /**
+     * Dismisses recents back to the launch target task.
+     */
+    boolean dismissRecentsToLaunchTargetTaskOrHome() {
+        SystemServicesProxy ssp = Recents.getSystemServices();
+        if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
+            // If we have a focused Task, launch that Task now
+            if (mRecentsView.launchPreviousTask()) return true;
+            // If none of the other cases apply, then just go Home
+            dismissRecentsToHome(true);
+        }
+        return false;
+    }
+
+    /**
      * Dismisses recents if we are already visible and the intent is to toggle the recents view.
      */
     boolean dismissRecentsToFocusedTaskOrHome() {
@@ -414,10 +425,6 @@
             EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
         }
 
-        if (!launchState.launchedHasConfigurationChanged) {
-            mRecentsView.disableLayersForOneFrame();
-        }
-
         // Notify that recents is now visible
         SystemServicesProxy ssp = Recents.getSystemServices();
         EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true));
@@ -569,9 +576,8 @@
 
     @Override
     public void onBackPressed() {
-        if (!dismissHistory()) {
-            dismissRecentsToFocusedTaskOrHome();
-        }
+        // Back behaves like the recents button so just trigger a toggle event
+        EventBus.getDefault().send(new ToggleRecentsEvent());
     }
 
     /**** RecentsResizeTaskDialog ****/
@@ -587,7 +593,12 @@
 
     public final void onBusEvent(ToggleRecentsEvent event) {
         if (!dismissHistory()) {
-            dismissRecentsToFocusedTaskOrHome();
+            RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
+            if (launchState.launchedFromHome) {
+                dismissRecentsToHome(true);
+            } else {
+                dismissRecentsToLaunchTargetTaskOrHome();
+            }
         }
     }
 
@@ -724,18 +735,6 @@
         getResizeTaskDebugDialog().showResizeTaskDialog(event.task, mRecentsView);
     }
 
-    public final void onBusEvent(DragStartEvent event) {
-        // Lock the orientation while dragging
-        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
-
-        // TODO: docking requires custom accessibility actions
-    }
-
-    public final void onBusEvent(DragEndEvent event) {
-        // Unlock the orientation when dragging completes
-        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
-    }
-
     public final void onBusEvent(LaunchTaskSucceededEvent event) {
         MetricsLogger.histogram(this, "overview_task_launch_index", event.taskIndexFromStackFront);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
index 8dd9e47..e0bd59b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
@@ -82,7 +82,11 @@
             if (launchedFromHome) {
                 return numTasks - 1;
             } else {
-                return numTasks - 2;
+                if (flags.isFastToggleRecentsEnabled() || !flags.isInitialStatePaging()) {
+                    return numTasks - 1;
+                } else {
+                    return numTasks - 2;
+                }
             }
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index 440ed6b1..53c10b7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -69,7 +69,6 @@
     public final int smallestWidth;
 
     /** Misc **/
-    public boolean hasDockedTasks;
     public boolean useHardwareLayers;
     public boolean fakeShadows;
     public int svelteLevel;
@@ -112,13 +111,12 @@
         // settings or via multi window
         lockToAppEnabled = !ssp.hasFreeformWorkspaceSupport() &&
                 ssp.getSystemSetting(context, Settings.System.LOCK_TO_APP_ENABLED) != 0;
-        hasDockedTasks = ssp.hasDockedTask();
 
         // Recompute some values based on the given state, since we can not rely on the resource
         // system to get certain values.
         boolean isLandscape = windowRect.width() > windowRect.height();
-        hasTransposedNavBar = isLandscape && isLargeScreen && !isXLargeScreen;
-        hasTransposedSearchBar = isLandscape && isLargeScreen && !isXLargeScreen;
+        hasTransposedNavBar = isLandscape && !isXLargeScreen;
+        hasTransposedSearchBar = isLandscape && !isXLargeScreen;
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
index e8b8816..d778886 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
@@ -30,6 +30,7 @@
     private static final String KEY_PAGE_ON_TOGGLE = "overview_page_on_toggle";
     private static final String KEY_FULLSCREEN_THUMBNAILS = "overview_fullscreen_thumbnails";
     private static final String KEY_SHOW_HISTORY = "overview_show_history";
+    private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";
 
     public static class Static {
         // Enables debug drawing for the transition thumbnail
@@ -54,6 +55,7 @@
     private boolean mPageOnToggle;
     private boolean mUseFullscreenThumbnails;
     private boolean mShowHistory;
+    private boolean mInitialStatePaging;
 
     /**
      * We read the prefs once when we start the activity, then update them as the tuner changes
@@ -63,7 +65,7 @@
         // Register all our flags, this will also call onTuningChanged() for each key, which will
         // initialize the current state of each flag
         TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_PAGE_ON_TOGGLE,
-                KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY);
+                KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY, KEY_INITIAL_STATE_PAGING);
     }
 
     /**
@@ -94,6 +96,13 @@
         return mShowHistory;
     }
 
+    /**
+     * @return whether the initial stack state is paging.
+     */
+    public boolean isInitialStatePaging() {
+        return mInitialStatePaging;
+    }
+
     @Override
     public void onTuningChanged(String key, String newValue) {
         switch (key) {
@@ -113,6 +122,10 @@
                 mShowHistory = (newValue != null) &&
                         (Integer.parseInt(newValue) != 0);
                 break;
+            case KEY_INITIAL_STATE_PAGING:
+                mInitialStatePaging = (newValue != null) &&
+                        (Integer.parseInt(newValue) != 0);
+                break;
         }
         EventBus.getDefault().send(new DebugFlagsChangedEvent());
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 0f82cce..2a4017a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -35,7 +35,6 @@
 import android.view.AppTransitionAnimationSpec;
 import android.view.LayoutInflater;
 import android.view.View;
-
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.Prefs;
 import com.android.systemui.R;
@@ -200,7 +199,7 @@
         mDummyStackView = new TaskStackView(mContext, new TaskStack());
         mHeaderBar = (TaskViewHeader) inflater.inflate(R.layout.recents_task_view_header,
                 null, false);
-        reloadHeaderBarLayout(true /* tryAndBindSearchWidget */);
+        reloadHeaderBarLayout(true /* tryAndBindSearchWidget */, null /* stack */);
 
         // When we start, preload the data associated with the previous recent tasks.
         // We can use a new plan since the caches will be the same.
@@ -216,7 +215,7 @@
 
     public void onBootCompleted() {
         mBootCompleted = true;
-        reloadHeaderBarLayout(true /* tryAndBindSearchWidget */);
+        reloadHeaderBarLayout(true /* tryAndBindSearchWidget */, null /* stack */);
     }
 
     @Override
@@ -540,12 +539,11 @@
         showRelativeAffiliatedTask(false);
     }
 
-    public void dockTopTask(boolean draggingInRecents, Rect initialBounds) {
+    public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) {
         SystemServicesProxy ssp = Recents.getSystemServices();
         ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
         if (topTask != null && !SystemServicesProxy.isHomeStack(topTask.stackId)) {
-            ssp.moveTaskToDockedStack(topTask.id,
-                    ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, initialBounds);
+            ssp.moveTaskToDockedStack(topTask.id, stackCreateMode, initialBounds);
             showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */,
                     true /* reloadTasks*/);
         }
@@ -566,8 +564,9 @@
      *
      * @param tryAndBindSearchWidget if set, will attempt to fetch and bind the search widget if one
      *                               is not already bound (can be expensive)
+     * @param stack the stack to initialize the stack layout with
      */
-    private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget) {
+    private void reloadHeaderBarLayout(boolean tryAndBindSearchWidget, TaskStack stack) {
         RecentsConfiguration config = Recents.getConfiguration();
         SystemServicesProxy ssp = Recents.getSystemServices();
         Rect windowRect = ssp.getWindowRect();
@@ -593,7 +592,10 @@
         TaskStackLayoutAlgorithm algo = mDummyStackView.getStackAlgorithm();
         Rect taskStackBounds = new Rect(mTaskStackBounds);
         algo.setSystemInsets(systemInsets);
-        algo.initialize(taskStackBounds);
+        if (stack != null) {
+            algo.initialize(taskStackBounds,
+                    TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
+        }
         Rect taskViewBounds = algo.getUntransformedTaskViewBounds();
         if (!taskViewBounds.equals(mLastTaskViewBounds)) {
             mLastTaskViewBounds.set(taskViewBounds);
@@ -629,7 +631,7 @@
         preloadIcon(topTask);
 
         // Update the header bar if necessary
-        reloadHeaderBarLayout(false /* tryAndBindSearchWidget */);
+        reloadHeaderBarLayout(false /* tryAndBindSearchWidget */, stack);
 
         // Update the destination rect
         mDummyStackView.updateLayoutForStack(stack);
@@ -800,9 +802,6 @@
             boolean isTopTaskHome, boolean animate) {
         RecentsTaskLoader loader = Recents.getTaskLoader();
 
-        // Update the header bar if necessary
-        reloadHeaderBarLayout(false /* tryAndBindSearchWidget */);
-
         // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we
         // should always preload the tasks now. If we are dragging in recents, reload them as
         // the stacks might have changed.
@@ -815,6 +814,9 @@
         }
         TaskStack stack = sInstanceLoadPlan.getTaskStack();
 
+        // Update the header bar if necessary
+        reloadHeaderBarLayout(false /* tryAndBindSearchWidget */, stack);
+
         // Prepare the dummy stack for the transition
         mDummyStackView.updateLayoutForStack(stack);
         TaskStackLayoutAlgorithm.VisibilityReport stackVr =
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/EventBus.java b/packages/SystemUI/src/com/android/systemui/recents/events/EventBus.java
index eb81e80..d72218f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/events/EventBus.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/events/EventBus.java
@@ -761,7 +761,7 @@
         } catch (IllegalAccessException e) {
             Log.e(TAG, "Failed to invoke method", e.getCause());
         } catch (InvocationTargetException e) {
-            throw new RuntimeException("Failed to invoke method", e);
+            throw new RuntimeException(e.getCause());
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java
index 957da94..3deeb47 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java
@@ -19,7 +19,6 @@
 import com.android.systemui.recents.events.EventBus;
 import com.android.systemui.recents.misc.ReferenceCountedTrigger;
 import com.android.systemui.recents.model.Task;
-import com.android.systemui.recents.views.DragView;
 import com.android.systemui.recents.views.DropTarget;
 import com.android.systemui.recents.views.TaskView;
 
@@ -30,15 +29,13 @@
 
     public final Task task;
     public final TaskView taskView;
-    public final DragView dragView;
     public final DropTarget dropTarget;
     public final ReferenceCountedTrigger postAnimationTrigger;
 
-    public DragEndEvent(Task task, TaskView taskView, DragView dragView, DropTarget dropTarget,
+    public DragEndEvent(Task task, TaskView taskView, DropTarget dropTarget,
             ReferenceCountedTrigger postAnimationTrigger) {
         this.task = task;
         this.taskView = taskView;
-        this.dragView = dragView;
         this.dropTarget = dropTarget;
         this.postAnimationTrigger = postAnimationTrigger;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java
index 2d42a0e..b81c10c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java
@@ -16,9 +16,9 @@
 
 package com.android.systemui.recents.events.ui.dragndrop;
 
+import android.graphics.Point;
 import com.android.systemui.recents.events.EventBus;
 import com.android.systemui.recents.model.Task;
-import com.android.systemui.recents.views.DragView;
 import com.android.systemui.recents.views.TaskView;
 
 /**
@@ -28,11 +28,11 @@
 
     public final Task task;
     public final TaskView taskView;
-    public final DragView dragView;
+    public final Point tlOffset;
 
-    public DragStartEvent(Task task, TaskView taskView, DragView dragView) {
+    public DragStartEvent(Task task, TaskView taskView, Point tlOffset) {
         this.task = task;
         this.taskView = taskView;
-        this.dragView = dragView;
+        this.tlOffset = tlOffset;
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
index 913d427..2eee1da 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java
@@ -18,7 +18,6 @@
 
 import android.app.ActivityOptions;
 import android.content.Context;
-import android.content.res.Resources;
 import android.support.v7.widget.RecyclerView;
 import android.text.format.DateFormat;
 import android.view.LayoutInflater;
@@ -29,7 +28,6 @@
 import com.android.systemui.recents.Recents;
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.model.Task;
-import com.android.systemui.recents.model.TaskStack;
 
 import java.util.ArrayList;
 import java.util.Calendar;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
index f48883f..5851111 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
@@ -27,8 +27,9 @@
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 import android.widget.LinearLayout;
-
 import com.android.systemui.R;
+import com.android.systemui.recents.Recents;
+import com.android.systemui.recents.RecentsConfiguration;
 import com.android.systemui.recents.misc.ReferenceCountedTrigger;
 import com.android.systemui.recents.model.TaskStack;
 
@@ -43,6 +44,7 @@
     private RecyclerView mRecyclerView;
     private RecentsHistoryAdapter mAdapter;
     private boolean mIsVisible;
+    private Rect mSystemInsets = new Rect();
 
     private Interpolator mFastOutSlowInInterpolator;
     private Interpolator mFastOutLinearInInterpolator;
@@ -123,7 +125,8 @@
      * Updates the system insets of this history view to the provided values.
      */
     public void setSystemInsets(Rect systemInsets) {
-        setPadding(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
+        mSystemInsets.set(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
+        requestLayout();
     }
 
     /**
@@ -142,6 +145,26 @@
     }
 
     @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        RecentsConfiguration config = Recents.getConfiguration();
+        int width = MeasureSpec.getSize(widthMeasureSpec);
+        int height = MeasureSpec.getSize(heightMeasureSpec);
+
+        // Pad the view to align the history with the stack layout
+        Rect taskStackBounds = new Rect();
+        config.getTaskStackBounds(new Rect(0, 0, width, height), mSystemInsets.top,
+                mSystemInsets.right, new Rect() /* searchBarSpaceBounds */, taskStackBounds);
+        int stackWidthPadding = (int) (config.taskStackWidthPaddingPct * taskStackBounds.width());
+        int stackHeightPadding = mContext.getResources().getDimensionPixelSize(
+                R.dimen.recents_stack_top_padding);
+        mRecyclerView.setPadding(stackWidthPadding + mSystemInsets.left,
+                stackHeightPadding + mSystemInsets.top,
+                stackWidthPadding + mSystemInsets.right, mSystemInsets.bottom);
+
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+    }
+
+    @Override
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
         setSystemInsets(insets.getSystemWindowInsets());
         return insets;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index de40a37..5d17e2c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -56,6 +56,7 @@
 import android.util.MutableBoolean;
 import android.util.Pair;
 import android.view.Display;
+import android.view.IDockDividerVisibilityListener;
 import android.view.WindowManager;
 import android.view.WindowManagerGlobal;
 import android.view.accessibility.AccessibilityManager;
@@ -114,7 +115,6 @@
 
     /** Private constructor */
     public SystemServicesProxy(Context context) {
-        RecentsDebugFlags flags = Recents.getDebugFlags();
         mAccm = AccessibilityManager.getInstance(context);
         mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
         mIam = ActivityManagerNative.getDefault();
@@ -409,7 +409,7 @@
             return thumbnail;
         }
 
-        Bitmap thumbnail = SystemServicesProxy.getThumbnail(mAm, taskId);
+        Bitmap thumbnail = getThumbnail(taskId);
         if (thumbnail != null) {
             thumbnail.setHasAlpha(false);
             // We use a dumb heuristic for now, if the thumbnail is purely transparent in the top
@@ -429,8 +429,12 @@
     /**
      * Returns a task thumbnail from the activity manager
      */
-    public static Bitmap getThumbnail(ActivityManager activityManager, int taskId) {
-        ActivityManager.TaskThumbnail taskThumbnail = activityManager.getTaskThumbnail(taskId);
+    public Bitmap getThumbnail(int taskId) {
+        if (mAm == null) {
+            return null;
+        }
+
+        ActivityManager.TaskThumbnail taskThumbnail = mAm.getTaskThumbnail(taskId);
         if (taskThumbnail == null) return null;
 
         Bitmap thumbnail = taskThumbnail.mainThumbnail;
@@ -847,4 +851,15 @@
             e.printStackTrace();
         }
     }
+
+    public void registerDockDividerVisibilityListener(IDockDividerVisibilityListener listener) {
+        if (mWm == null) return;
+
+        try {
+            WindowManagerGlobal.getWindowManagerService().registerDockDividerVisibilityListener(
+                    listener);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
index 5921d13..63d09ee 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
@@ -48,7 +48,8 @@
     private static boolean DEBUG = false;
 
     private static int MIN_NUM_TASKS = 5;
-    private static int SESSION_BEGIN_TIME = 60 /* s/min */ * 60 /* min/hr */ * 6 /* hrs */;
+    private static int SESSION_BEGIN_TIME = 1000 /* ms/s */ * 60 /* s/min */ * 60 /* min/hr */ *
+            6 /* hrs */;
 
     /** The set of conditions to load tasks. */
     public static class Options {
@@ -128,7 +129,7 @@
             boolean isStackTask = true;
             if (debugFlags.isHistoryEnabled()) {
                 boolean isFreeformTask = SystemServicesProxy.isFreeformStack(t.stackId);
-                isStackTask = !isFreeformTask && (!isHistoricalTask(t) ||
+                isStackTask = isFreeformTask || (!isHistoricalTask(t) ||
                         (t.lastActiveTime >= lastStackActiveTime &&
                                 i >= (taskCount - MIN_NUM_TASKS)));
                 if (isStackTask && newLastStackActiveTime < 0) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index cd0a46f..7a98393 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -137,7 +137,7 @@
 
     /** Returns the index of this task in the list of filtered tasks */
     int indexOf(Task t) {
-        if (mTaskIndices.containsKey(t.key)) {
+        if (t != null && mTaskIndices.containsKey(t.key)) {
             return mTaskIndices.get(t.key);
         }
         return -1;
@@ -200,21 +200,30 @@
     public interface TaskStackCallbacks {
         /* Notifies when a task has been removed from the stack */
         void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
-                                       Task newFrontMostTask);
+            Task newFrontMostTask);
+
+        /* Notifies when a task has been removed from the history */
+        void onHistoryTaskRemoved(TaskStack stack, Task removedTask);
     }
 
     /**
      * The various possible dock states when dragging and dropping a task.
      */
-    public enum DockState implements DropTarget {
-        NONE(-1, 96, null, null),
-        LEFT(DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, 192,
-                new RectF(0, 0, 0.25f, 1), new RectF(0, 0, 0.25f, 1)),
-        TOP(DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, 192,
-                new RectF(0, 0, 1, 0.25f), new RectF(0, 0, 1, 0.25f)),
-        RIGHT(DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, 192,
-                new RectF(0.75f, 0, 1, 1), new RectF(0.75f, 0, 1, 1)),
-        BOTTOM(DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, 192,
+    public static class DockState implements DropTarget {
+
+        private static final int DOCK_AREA_ALPHA = 192;
+        public static final DockState NONE = new DockState(-1, 96, null, null);
+        public static final DockState LEFT = new DockState(
+                DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, DOCK_AREA_ALPHA,
+                new RectF(0, 0, 0.25f, 1), new RectF(0, 0, 0.25f, 1));
+        public static final DockState TOP = new DockState(
+                DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, DOCK_AREA_ALPHA,
+                new RectF(0, 0, 1, 0.25f), new RectF(0, 0, 1, 0.25f));
+        public static final DockState RIGHT = new DockState(
+                DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, DOCK_AREA_ALPHA,
+                new RectF(0.75f, 0, 1, 1), new RectF(0.75f, 0, 1, 1));
+        public static final DockState BOTTOM = new DockState(
+                DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT, DOCK_AREA_ALPHA,
                 new RectF(0, 0.75f, 1, 1), new RectF(0, 0.75f, 1, 1));
 
         @Override
@@ -376,6 +385,7 @@
     public void removeTask(Task t) {
         if (mStackTaskList.contains(t)) {
             boolean wasFrontMostTask = (getStackFrontMostTask() == t);
+            int removedTaskIndex = indexOfStackTask(t);
             removeTaskImpl(mStackTaskList, t);
             Task newFrontMostTask = getStackFrontMostTask();
             if (newFrontMostTask != null && newFrontMostTask.lockToTaskEnabled) {
@@ -389,7 +399,7 @@
             removeTaskImpl(mHistoryTaskList, t);
             if (mCb != null) {
                 // Notify that a task has been removed
-                mCb.onStackTaskRemoved(this, t, false, null);
+                mCb.onHistoryTaskRemoved(this, t);
             }
         }
     }
@@ -463,6 +473,22 @@
     }
 
     /**
+     * Returns the number of freeform tasks in the active stack.
+     */
+    public int getStackTaskFreeformCount() {
+        ArrayList<Task> tasks = mStackTaskList.getTasks();
+        int freeformCount = 0;
+        int taskCount = tasks.size();
+        for (int i = 0; i < taskCount; i++) {
+            Task task = tasks.get(i);
+            if (task.isFreeformTask()) {
+                freeformCount++;
+            }
+        }
+        return freeformCount;
+    }
+
+    /**
      * Returns the task in stack tasks which is the launch target.
      */
     public Task getLaunchTarget() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
index 945fdc1..757d2aa 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
@@ -16,7 +16,6 @@
 
 package com.android.systemui.recents.views;
 
-import android.animation.ObjectAnimator;
 import android.graphics.Outline;
 import android.graphics.Rect;
 import android.util.IntProperty;
@@ -65,6 +64,14 @@
         mCornerRadius = cornerRadius;
     }
 
+    /**
+     * Resets the right and bottom clip for this view.
+     */
+    public void reset() {
+        mClipRect.setEmpty();
+        updateClipBounds();
+    }
+
     @Override
     public void getOutline(View view, Outline outline) {
         outline.setAlpha(mMinAlpha + mAlpha / (1f - mMinAlpha));
@@ -82,20 +89,10 @@
         }
     }
 
-    /**
-     * Animates the bottom clip.
-     */
-    public void animateClipBottom(int bottom) {
-        ObjectAnimator animator = ObjectAnimator.ofInt(this, CLIP_BOTTOM, getClipBottom(), bottom);
-        animator.setDuration(150);
-        animator.start();
-    }
-
     /** Sets the bottom clip. */
     public void setClipBottom(int bottom, boolean force) {
         if (bottom != mClipRect.bottom || force) {
             mClipRect.bottom = bottom;
-            mSourceView.invalidateOutline();
             updateClipBounds();
         }
     }
@@ -109,7 +106,6 @@
     public void setClipRight(int right, boolean force) {
         if (right != mClipRect.right || force) {
             mClipRect.right = right;
-            mSourceView.invalidateOutline();
             updateClipBounds();
         }
     }
@@ -124,5 +120,6 @@
                 mSourceView.getWidth() - mClipRect.right,
                 mSourceView.getHeight() - mClipRect.bottom);
         mSourceView.setClipBounds(mClipBounds);
+        mSourceView.invalidateOutline();
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/DragView.java b/packages/SystemUI/src/com/android/systemui/recents/views/DragView.java
deleted file mode 100644
index 96dfaac..0000000
--- a/packages/SystemUI/src/com/android/systemui/recents/views/DragView.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Point;
-import android.widget.ImageView;
-
-public class DragView extends ImageView {
-
-    // The offset from the top-left of the dragBitmap
-    Point mTopLeftOffset;
-
-    public DragView(Context context, Bitmap dragBitmap, Point tlOffset) {
-        super(context);
-
-        mTopLeftOffset = tlOffset;
-        setImageBitmap(dragBitmap);
-    }
-
-    public Point getTopLeftOffset() {
-        return mTopLeftOffset;
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
index 90d62c1..9b9d58c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
@@ -16,10 +16,13 @@
 
 package com.android.systemui.recents.views;
 
+import android.graphics.Rect;
+import android.graphics.RectF;
 import android.util.Log;
 import com.android.systemui.recents.misc.Utilities;
 import com.android.systemui.recents.model.Task;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 
@@ -31,48 +34,91 @@
     private static final String TAG = "FreeformWorkspaceLayoutAlgorithm";
     private static final boolean DEBUG = false;
 
-    // The number of cells in the freeform workspace
-    private int mFreeformCellXCount;
-    private int mFreeformCellYCount;
-
-    // The width and height of the cells in the freeform workspace
-    private int mFreeformCellWidth;
-    private int mFreeformCellHeight;
-
-    // Optimization, allows for quick lookup of task -> index
-    private HashMap<Task.TaskKey, Integer> mTaskIndexMap = new HashMap<>();
+    // Optimization, allows for quick lookup of task -> rect
+    private HashMap<Task.TaskKey, RectF> mTaskRectMap = new HashMap<>();
 
     /**
      * Updates the layout for each of the freeform workspace tasks.  This is called after the stack
      * layout is updated.
      */
     public void update(List<Task> freeformTasks, TaskStackLayoutAlgorithm stackLayout) {
-        mTaskIndexMap.clear();
+        Collections.reverse(freeformTasks);
+        mTaskRectMap.clear();
 
         int numFreeformTasks = stackLayout.mNumFreeformTasks;
         if (!freeformTasks.isEmpty()) {
-            // Calculate the cell width/height depending on the number of freeform tasks
-            mFreeformCellXCount = Math.max(2, (int) Math.ceil(Math.sqrt(numFreeformTasks)));
-            mFreeformCellYCount = Math.max(2, (int) Math.ceil((float) numFreeformTasks /
-                    mFreeformCellXCount));
-            // For now, make the cells square
-            mFreeformCellWidth = Math.min(stackLayout.mFreeformRect.width() / mFreeformCellXCount,
-                    stackLayout.mFreeformRect.height() / mFreeformCellYCount);
-            mFreeformCellHeight = mFreeformCellWidth;
 
-            // Put each of the tasks in the progress map at a fixed index (does not need to actually
-            // map to a scroll position, just by index)
-            int taskCount = freeformTasks.size();
-            for (int i = taskCount - 1; i >= 0; i--) {
+            // Normalize the widths so that we can calculate the best layout below
+            int workspaceWidth = stackLayout.mFreeformRect.width();
+            int workspaceHeight = stackLayout.mFreeformRect.height();
+            float normalizedWorkspaceWidth = (float) workspaceWidth / workspaceHeight;
+            float normalizedWorkspaceHeight = 1f;
+            float[] normalizedTaskWidths = new float[numFreeformTasks];
+            for (int i = 0; i < numFreeformTasks; i++) {
                 Task task = freeformTasks.get(i);
-                mTaskIndexMap.put(task.key, taskCount - i - 1);
+                float rowTaskWidth;
+                if (task.bounds != null) {
+                    rowTaskWidth = (float) task.bounds.width() / task.bounds.height();
+                } else {
+                    // If this is a stack task that was dragged into the freeform workspace, then
+                    // the task will not yet have an associated bounds, so assume the full workspace
+                    // width for the time being
+                    rowTaskWidth = normalizedWorkspaceWidth;
+                }
+                // Bound the task width to the workspace width so that at the worst case, it will
+                // fit its own row
+                normalizedTaskWidths[i] = Math.min(rowTaskWidth,
+                        normalizedWorkspaceWidth);
             }
 
-            if (DEBUG) {
-                Log.d(TAG, "mFreeformCellXCount: " + mFreeformCellXCount);
-                Log.d(TAG, "mFreeformCellYCount: " + mFreeformCellYCount);
-                Log.d(TAG, "mFreeformCellWidth: " + mFreeformCellWidth);
-                Log.d(TAG, "mFreeformCellHeight: " + mFreeformCellHeight);
+            // Determine the scale to best fit each of the tasks in the workspace
+            float rowScale = 0.85f;
+            float rowWidth = 0f;
+            float maxRowWidth = 0f;
+            int rowCount = 1;
+            for (int i = 0; i < numFreeformTasks;) {
+                float width = normalizedTaskWidths[i] * rowScale;
+                if (rowWidth + width > normalizedWorkspaceWidth) {
+                    // That is too long for this row, create new row
+                    rowWidth = 0f;
+                    if ((rowCount + 1) * rowScale > normalizedWorkspaceHeight) {
+                        // The new row is too high, so we need to try fitting again.  Update the
+                        // scale to be the smaller of the scale needed to fit the task in the
+                        // previous row, or the scale needed to fit the new row
+                        rowScale = Math.min(normalizedWorkspaceWidth / (rowWidth + width),
+                                normalizedWorkspaceHeight / (rowCount + 1));
+                        rowCount = 1;
+                        i = 0;
+                    } else {
+                        // The new row fits, so continue
+                        rowCount++;
+                        i++;
+                    }
+                } else {
+                    // Task is OK in this row
+                    rowWidth += width;
+                    i++;
+                }
+                maxRowWidth = Math.max(rowWidth, maxRowWidth);
+            }
+
+            // Normalize each of the actual rects to that scale
+            int height = (int) (rowScale * workspaceHeight);
+            float rowTop = ((1f - (rowScale * rowCount)) * workspaceHeight) / 2f;
+            float defaultRowLeft = ((1f - (maxRowWidth / normalizedWorkspaceWidth)) *
+                    workspaceWidth) / 2f;
+            float rowLeft = defaultRowLeft;
+            for (int i = 0; i < numFreeformTasks; i++) {
+                Task task = freeformTasks.get(i);
+                int width = (int) (height * normalizedTaskWidths[i]);
+                if (rowLeft + width > workspaceWidth) {
+                    // This goes on the next line
+                    rowTop += height;
+                    rowLeft = defaultRowLeft;
+                }
+                RectF rect = new RectF(rowLeft, rowTop, rowLeft + width, rowTop + height);
+                rowLeft += width;
+                mTaskRectMap.put(task.key, rect);
             }
         }
     }
@@ -84,7 +130,7 @@
         if (stackLayout.mNumFreeformTasks == 0 || task == null) {
             return false;
         }
-        return mTaskIndexMap.containsKey(task.key);
+        return mTaskRectMap.containsKey(task.key);
     }
 
     /**
@@ -93,29 +139,41 @@
      */
     public TaskViewTransform getTransform(Task task, TaskViewTransform transformOut,
             TaskStackLayoutAlgorithm stackLayout) {
-        if (mTaskIndexMap.containsKey(task.key)) {
-            // This is a freeform task, so lay it out in the freeform workspace
-            int taskIndex = mTaskIndexMap.get(task.key);
-            int topOffset = (stackLayout.mFreeformRect.top - stackLayout.mTaskRect.top);
-            int x = taskIndex % mFreeformCellXCount;
-            int y = taskIndex / mFreeformCellXCount;
-            float scale = (float) mFreeformCellWidth / stackLayout.mTaskRect.width();
-            int scaleXOffset = (int) (((1f - scale) * stackLayout.mTaskRect.width()) / 2);
-            int scaleYOffset = (int) (((1f - scale) * stackLayout.mTaskRect.height()) / 2);
-            transformOut.scale = scale * 0.9f;
-            transformOut.translationX = x * mFreeformCellWidth - scaleXOffset;
-            transformOut.translationY = topOffset + y * mFreeformCellHeight - scaleYOffset;
+        if (mTaskRectMap.containsKey(task.key)) {
+            Rect taskRect = stackLayout.mTaskRect;
+            RectF ffRect = mTaskRectMap.get(task.key);
+            float scale = Math.max(ffRect.width() / taskRect.width(),
+                    ffRect.height() / taskRect.height());
+            int topOffset = (stackLayout.mFreeformRect.top - taskRect.top);
+            int scaleXOffset = (int) (((1f - scale) * taskRect.width()) / 2);
+            int scaleYOffset = (int) (((1f - scale) * taskRect.height()) / 2);
+
+            transformOut.scale = scale * 0.95f;
+            transformOut.translationX = (int) (ffRect.left - scaleXOffset);
+            transformOut.translationY = (int) (topOffset + ffRect.top - scaleYOffset);
             transformOut.translationZ = stackLayout.mMaxTranslationZ;
-            transformOut.rect.set(stackLayout.mTaskRect);
+            transformOut.clipBottom = (int) (taskRect.height() - (ffRect.height() / scale));
+            transformOut.clipRight = (int) (taskRect.width() - (ffRect.width() / scale));
+            if (task.thumbnail != null) {
+                transformOut.thumbnailScale = Math.min(
+                        ((float) taskRect.width() - transformOut.clipRight) /
+                                task.thumbnail.getWidth(),
+                        ((float) taskRect.height() - transformOut.clipBottom) /
+                                task.thumbnail.getHeight());
+            } else {
+                transformOut.thumbnailScale = 1f;
+            }
+            transformOut.rect.set(taskRect);
             transformOut.rect.offset(transformOut.translationX, transformOut.translationY);
             Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
+            transformOut.rect.right -= transformOut.clipRight * scale;
+            transformOut.rect.bottom -= transformOut.clipBottom * scale;
             transformOut.visible = true;
             transformOut.p = 1f;
 
             if (DEBUG) {
                 Log.d(TAG, "getTransform: " + task.key + ", " + transformOut);
             }
-
             return transformOut;
         }
         return null;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
index 736020f..96b1a41 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
@@ -257,7 +257,7 @@
         TaskStackLayoutAlgorithm layoutAlgorithm = stackView.getStackAlgorithm();
         Rect offscreenTaskRect = new Rect(layoutAlgorithm.mTaskRect);
         offscreenTaskRect.offsetTo(offscreenTaskRect.left,
-                layoutAlgorithm.mCurrentStackRect.bottom);
+                layoutAlgorithm.mStackRect.bottom);
 
         // If this is a full screen stack, the transition will be towards the single, full screen
         // task. We only need the transition spec for this task.
@@ -308,12 +308,6 @@
      */
     private static AppTransitionAnimationSpec composeAnimationSpec(TaskView taskView,
             TaskViewTransform transform, boolean addHeaderBitmap) {
-        // Disable any focused state before we draw the header
-        // Upfront the processing of the thumbnail
-        if (taskView.isFocusedTask()) {
-            taskView.setFocusedState(false, false /* animated */, false /* requestViewFocus */);
-        }
-
         Bitmap b = null;
         if (addHeaderBitmap) {
             float scale = transform.scale;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index 0557f65..a0a1bac 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -16,6 +16,8 @@
 
 package com.android.systemui.recents.views;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.Canvas;
@@ -27,6 +29,8 @@
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewPropertyAnimator;
 import android.view.WindowInsets;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
@@ -55,6 +59,8 @@
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.model.Task;
 import com.android.systemui.recents.model.TaskStack;
+import com.android.systemui.stackdivider.WindowManagerProxy;
+import com.android.systemui.statusbar.FlingAnimationUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -81,7 +87,6 @@
 
     RecentsTransitionHelper mTransitionHelper;
     RecentsViewTouchHandler mTouchHandler;
-    DragView mDragView;
     TaskStack.DockState[] mVisibleDockStates = {
             TaskStack.DockState.LEFT,
             TaskStack.DockState.TOP,
@@ -95,8 +100,10 @@
 
     Rect mSystemInsets = new Rect();
 
+    final FlingAnimationUtils mFlingAnimationUtils;
+
     public RecentsView(Context context) {
-        super(context);
+        this(context, null);
     }
 
     public RecentsView(Context context, AttributeSet attrs) {
@@ -119,6 +126,7 @@
                 com.android.internal.R.interpolator.fast_out_linear_in);
         mHistoryTransitionDuration = res.getInteger(R.integer.recents_history_transition_duration);
         mTouchHandler = new RecentsViewTouchHandler(this);
+        mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
 
         LayoutInflater inflater = LayoutInflater.from(context);
         mHistoryButton = inflater.inflate(R.layout.recents_history_button, this, false);
@@ -139,6 +147,8 @@
                 // If onRecentsHidden is not triggered, we need to the stack view again here
                 mTaskStackView.reset();
                 mTaskStackView.setStack(stack);
+                removeView(mTaskStackView);
+                addView(mTaskStackView);
             } else {
                 mTaskStackView = new TaskStackView(getContext(), stack);
                 mTaskStackView.setCallbacks(this);
@@ -214,6 +224,21 @@
         return false;
     }
 
+    /** Launches the task that recents was launched from if possible */
+    public boolean launchPreviousTask() {
+        if (mTaskStackView != null) {
+            TaskStack stack = mTaskStackView.getStack();
+            Task task = stack.getLaunchTarget();
+            if (task != null) {
+                TaskView taskView = mTaskStackView.getChildViewForTask(task);
+                onTaskViewClicked(mTaskStackView, taskView, stack, task, false, null,
+                        INVALID_STACK_ID);
+                return true;
+            }
+        }
+        return false;
+    }
+
     /** Launches a given task. */
     public boolean launchTask(Task task, Rect taskBounds, int destinationStack) {
         if (mTaskStackView != null) {
@@ -341,13 +366,6 @@
             mTaskStackView.measure(widthMeasureSpec, heightMeasureSpec);
         }
 
-        if (mDragView != null) {
-            Rect taskRect = mTaskStackView.mLayoutAlgorithm.mTaskRect;
-            mDragView.measure(
-                    MeasureSpec.makeMeasureSpec(taskRect.width(), MeasureSpec.AT_MOST),
-                    MeasureSpec.makeMeasureSpec(taskRect.height(), MeasureSpec.AT_MOST));
-        }
-
         // Measure the history button with the full space above the stack, but width-constrained
         // to the stack
         Rect historyButtonRect = mTaskStackView.mLayoutAlgorithm.mHistoryButtonRect;
@@ -379,11 +397,6 @@
             mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight());
         }
 
-        if (mDragView != null) {
-            mDragView.layout(left, top, left + mDragView.getMeasuredWidth(),
-                    top + mDragView.getMeasuredHeight());
-        }
-
         // Layout the history button left-aligned with the stack, but offset from the top of the
         // view
         Rect historyButtonRect = mTaskStackView.mLayoutAlgorithm.mHistoryButtonRect;
@@ -441,12 +454,6 @@
         return super.verifyDrawable(who);
     }
 
-    public void disableLayersForOneFrame() {
-        if (mTaskStackView != null) {
-            mTaskStackView.disableLayersForOneFrame();
-        }
-    }
-
     /**** TaskStackView.TaskStackCallbacks Implementation ****/
 
     @Override
@@ -461,10 +468,6 @@
     /**** EventBus Events ****/
 
     public final void onBusEvent(DragStartEvent event) {
-        // Add the drag view
-        mDragView = event.dragView;
-        addView(mDragView);
-
         updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
                 TaskStack.DockState.NONE.viewState.dockAreaAlpha);
     }
@@ -480,65 +483,33 @@
     }
 
     public final void onBusEvent(final DragEndEvent event) {
-        final Runnable cleanUpRunnable = new Runnable() {
-            @Override
-            public void run() {
-                // Remove the drag view
-                removeView(mDragView);
-                mDragView = null;
-            }
-        };
-
         // Animate the overlay alpha back to 0
         updateVisibleDockRegions(null, -1);
 
-        if (event.dropTarget == null) {
-            // No drop targets for hit, so just animate the task back to its place
-            event.postAnimationTrigger.increment();
-            event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
-                @Override
-                public void run() {
-                    cleanUpRunnable.run();
-                }
-            });
-            // Animate the task back to where it was before then clean up afterwards
-            TaskViewTransform taskTransform = new TaskViewTransform();
-            TaskStackLayoutAlgorithm layoutAlgorithm = mTaskStackView.getStackAlgorithm();
-            layoutAlgorithm.getStackTransform(event.task,
-                    mTaskStackView.getScroller().getStackScroll(), taskTransform, null);
-            event.dragView.animate()
-                    .scaleX(taskTransform.scale)
-                    .scaleY(taskTransform.scale)
-                    .translationX((layoutAlgorithm.mTaskRect.left - event.dragView.getLeft())
-                            + taskTransform.translationX)
-                    .translationY((layoutAlgorithm.mTaskRect.top - event.dragView.getTop())
-                            + taskTransform.translationY)
-                    .setDuration(175)
-                    .setInterpolator(mFastOutSlowInInterpolator)
-                    .withEndAction(event.postAnimationTrigger.decrementAsRunnable())
-                    .start();
-
-        } else if (event.dropTarget instanceof TaskStack.DockState) {
+        // Handle the case where we drop onto a dock region
+        if (event.dropTarget instanceof TaskStack.DockState) {
             final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget;
 
-            // For now, just remove the drag view and the original task
-            // TODO: Animate the task to the drop target rect before launching it above
-            cleanUpRunnable.run();
+            // Remove the task after it is docked
+            event.taskView.animate()
+                    .alpha(0f)
+                    .setDuration(150)
+                    .setInterpolator(mFastOutLinearInInterpolator)
+                    .setUpdateListener(null)
+                    .setListener(null)
+                    .withEndAction(new Runnable() {
+                        @Override
+                        public void run() {
+                            mTaskStackView.getStack().removeTask(event.task);
+                        }
+                    })
+                    .withLayer()
+                    .start();
 
             // Dock the task and launch it
             SystemServicesProxy ssp = Recents.getSystemServices();
             ssp.startTaskInDockedMode(event.task.key.id, dockState.createMode);
             launchTask(event.task, null, INVALID_STACK_ID);
-
-        } else {
-            // We dropped on another drop target, so just add the cleanup to the post animation
-            // trigger
-            event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
-                @Override
-                public void run() {
-                    cleanUpRunnable.run();
-                }
-            });
         }
     }
 
@@ -549,7 +520,22 @@
     }
 
     public final void onBusEvent(DraggingInRecentsEndedEvent event) {
-        animate().translationY(0f);
+        ViewPropertyAnimator animator = animate();
+        if (event.velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
+            animator.translationY(getHeight());
+            animator.withEndAction(new Runnable() {
+                @Override
+                public void run() {
+                    WindowManagerProxy.getInstance().maximizeDockedStack();
+                }
+            });
+            mFlingAnimationUtils.apply(animator, getTranslationY(), getHeight(), event.velocity);
+        } else {
+            animator.translationY(0f);
+            animator.setListener(null);
+            mFlingAnimationUtils.apply(animator, getTranslationY(), 0, event.velocity);
+        }
+        animator.start();
     }
 
     public final void onBusEvent(ShowHistoryEvent event) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
index c7edc92..2920295 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
@@ -27,6 +27,7 @@
 import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
 import com.android.systemui.recents.events.ui.dragndrop.DragStartInitializeDropTargetsEvent;
 import com.android.systemui.recents.misc.ReferenceCountedTrigger;
+import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.model.Task;
 import com.android.systemui.recents.model.TaskStack;
 
@@ -64,8 +65,8 @@
 
     private Task mDragTask;
     private TaskView mTaskView;
-    private DragView mDragView;
 
+    private Point mTaskViewOffset = new Point();
     private Point mDownPos = new Point();
     private boolean mDragging;
 
@@ -111,20 +112,24 @@
     /**** Events ****/
 
     public final void onBusEvent(DragStartEvent event) {
+        SystemServicesProxy ssp = Recents.getSystemServices();
         mRv.getParent().requestDisallowInterceptTouchEvent(true);
         mDragging = true;
         mDragTask = event.task;
         mTaskView = event.taskView;
-        mDragView = event.dragView;
         mDropTargets.clear();
 
-        float x = mDownPos.x - mDragView.getTopLeftOffset().x;
-        float y = mDownPos.y - mDragView.getTopLeftOffset().y;
-        mDragView.setTranslationX(x);
-        mDragView.setTranslationY(y);
+        int[] recentsViewLocation = new int[2];
+        mRv.getLocationInWindow(recentsViewLocation);
+        mTaskViewOffset.set(mTaskView.getLeft() - recentsViewLocation[0] + event.tlOffset.x,
+                mTaskView.getTop() - recentsViewLocation[1] + event.tlOffset.y);
+        float x = mDownPos.x - mTaskViewOffset.x;
+        float y = mDownPos.y - mTaskViewOffset.y;
+        mTaskView.setTranslationX(x);
+        mTaskView.setTranslationY(y);
 
         RecentsConfiguration config = Recents.getConfiguration();
-        if (!config.hasDockedTasks) {
+        if (!ssp.hasDockedTask()) {
             // Add the dock state drop targets (these take priority)
             TaskStack.DockState[] dockStates = getDockStatesForCurrentOrientation();
             for (TaskStack.DockState dockState : dockStates) {
@@ -140,7 +145,6 @@
         mDragging = false;
         mDragTask = null;
         mTaskView = null;
-        mDragView = null;
         mLastDropTarget = null;
     }
 
@@ -160,8 +164,8 @@
                     int height = mRv.getMeasuredHeight();
                     float evX = ev.getX();
                     float evY = ev.getY();
-                    float x = evX - mDragView.getTopLeftOffset().x;
-                    float y = evY - mDragView.getTopLeftOffset().y;
+                    float x = evX - mTaskViewOffset.x;
+                    float y = evY - mTaskViewOffset.y;
 
                     DropTarget currentDropTarget = null;
                     for (DropTarget target : mDropTargets) {
@@ -176,8 +180,8 @@
                                 currentDropTarget));
                     }
 
-                    mDragView.setTranslationX(x);
-                    mDragView.setTranslationY(y);
+                    mTaskView.setTranslationX(x);
+                    mTaskView.setTranslationY(y);
                 }
                 break;
             }
@@ -187,7 +191,7 @@
                     ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger(
                             mRv.getContext(), null, null, null);
                     postAnimationTrigger.increment();
-                    EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView, mDragView,
+                    EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView,
                             mLastDropTarget, postAnimationTrigger));
                     postAnimationTrigger.decrement();
                     break;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index 6af2ada..7d5daae 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -114,6 +114,74 @@
     public static final float STATE_UNFOCUSED = 0f;
 
     /**
+     * The various stack/freeform states.
+     */
+    public static class StackState {
+
+        public static final StackState FREEFORM_ONLY = new StackState(1f, 0);
+        public static final StackState STACK_ONLY = new StackState(0f, 0);
+        public static final StackState SPLIT = new StackState(0.5f, 255);
+
+        public final float freeformHeightPct;
+        public final int freeformBackgroundAlpha;
+
+        /**
+         * @param freeformHeightPct the percentage of the stack height (not including paddings) to
+         *                          allocate to the freeform workspace
+         * @param freeformBackgroundAlpha the background alpha for the freeform workspace
+         */
+        StackState(float freeformHeightPct, int freeformBackgroundAlpha) {
+            this.freeformHeightPct = freeformHeightPct;
+            this.freeformBackgroundAlpha = freeformBackgroundAlpha;
+        }
+
+        /**
+         * Resolves the stack state for the layout given a task stack.
+         */
+        public static StackState getStackStateForStack(TaskStack stack) {
+            SystemServicesProxy ssp = Recents.getSystemServices();
+            boolean hasFreeformWorkspaces = ssp.hasFreeformWorkspaceSupport();
+            int taskCount = stack.getStackTaskCount();
+            int freeformCount = stack.getStackTaskFreeformCount();
+            int stackCount = taskCount - freeformCount;
+            if (hasFreeformWorkspaces && stackCount > 0 && freeformCount > 0) {
+                return SPLIT;
+            } else if (hasFreeformWorkspaces && freeformCount > 0) {
+                return FREEFORM_ONLY;
+            } else {
+                return STACK_ONLY;
+            }
+        }
+
+        /**
+         * Computes the freeform and stack rect for this state.
+         *
+         * @param freeformRectOut the freeform rect to be written out
+         * @param stackRectOut the stack rect, we only write out the top of the stack
+         * @param taskStackBounds the full rect that the freeform rect can take up
+         */
+        public void computeRects(Rect freeformRectOut, Rect stackRectOut,
+                Rect taskStackBounds, int widthPadding, int heightPadding, int stackBottomOffset) {
+            int availableHeight = taskStackBounds.height() - stackBottomOffset;
+            int ffPaddedHeight = (int) (availableHeight * freeformHeightPct);
+            int ffHeight = Math.max(0, ffPaddedHeight - (2 * heightPadding));
+            freeformRectOut.set(taskStackBounds.left + widthPadding,
+                    taskStackBounds.top + heightPadding,
+                    taskStackBounds.right - widthPadding,
+                    taskStackBounds.top + heightPadding + ffHeight);
+            stackRectOut.set(taskStackBounds.left + widthPadding,
+                    taskStackBounds.top,
+                    taskStackBounds.right - widthPadding,
+                    taskStackBounds.bottom);
+            if (ffPaddedHeight > 0) {
+                stackRectOut.top += ffPaddedHeight;
+            } else {
+                stackRectOut.top += heightPadding;
+            }
+        }
+    }
+
+    /**
      * A Property wrapper around the <code>focusState</code> functionality handled by the
      * {@link TaskStackLayoutAlgorithm#setFocusState(float)} and
      * {@link TaskStackLayoutAlgorithm#getFocusState()} methods.
@@ -145,21 +213,16 @@
 
     Context mContext;
     private TaskStackView mStackView;
-    private Interpolator mFastOutSlowInInterpolator;
+    private Interpolator mLinearOutSlowInInterpolator;
+    private StackState mState = StackState.SPLIT;
 
     // The task bounds (untransformed) for layout.  This rect is anchored at mTaskRoot.
     public Rect mTaskRect = new Rect();
     // The freeform workspace bounds, inset from the top by the search bar, and is a fixed height
     public Rect mFreeformRect = new Rect();
-    // The freeform stack bounds, inset from the top by the search bar and freeform workspace, and
-    // runs to the bottom of the screen
-    private Rect mFreeformStackRect = new Rect();
     // The stack bounds, inset from the top by the search bar, and runs to
     // the bottom of the screen
-    private Rect mStackRect = new Rect();
-    // The current stack rect, can either by mFreeformStackRect or mStackRect depending on whether
-    // there is a freeform workspace
-    public Rect mCurrentStackRect = new Rect();
+    public Rect mStackRect = new Rect();
     // This is the current system insets
     public Rect mSystemInsets = new Rect();
     // This is the bounds of the history button above the stack rect
@@ -218,7 +281,6 @@
     FreeformWorkspaceLayoutAlgorithm mFreeformLayoutAlgorithm;
 
     public TaskStackLayoutAlgorithm(Context context, TaskStackView stackView) {
-        SystemServicesProxy ssp = Recents.getSystemServices();
         Resources res = context.getResources();
         mStackView = stackView;
 
@@ -233,8 +295,8 @@
         mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
         mContext = context;
         mFreeformLayoutAlgorithm = new FreeformWorkspaceLayoutAlgorithm();
-        mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
-                com.android.internal.R.interpolator.fast_out_slow_in);
+        mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
+                com.android.internal.R.interpolator.linear_out_slow_in);
     }
 
     /**
@@ -249,9 +311,6 @@
      */
     public void setSystemInsets(Rect systemInsets) {
         mSystemInsets.set(systemInsets);
-        if (DEBUG) {
-            Log.d(TAG, "setSystemInsets: " + systemInsets);
-        }
     }
 
     /**
@@ -273,41 +332,29 @@
      * Computes the stack and task rects.  The given task stack bounds is the whole bounds not
      * including the search bar.
      */
-    public void initialize(Rect taskStackBounds) {
-        SystemServicesProxy ssp = Recents.getSystemServices();
+    public void initialize(Rect taskStackBounds, StackState state) {
         RecentsDebugFlags debugFlags = Recents.getDebugFlags();
         RecentsConfiguration config = Recents.getConfiguration();
         int widthPadding = (int) (config.taskStackWidthPaddingPct * taskStackBounds.width());
         int heightPadding = mContext.getResources().getDimensionPixelSize(
                 R.dimen.recents_stack_top_padding);
-        Rect lastStackRect = new Rect(mCurrentStackRect);
+        Rect lastStackRect = new Rect(mStackRect);
 
         // The freeform height is the visible height (not including system insets) - padding above
         // freeform and below stack - gap between the freeform and stack
+        mState = state;
         mStackTopOffset = mFocusedPeekHeight + heightPadding;
         mStackBottomOffset = mSystemInsets.bottom + heightPadding;
-        int ffHeight = (taskStackBounds.height() - 2 * heightPadding - mStackBottomOffset) / 2;
-        mFreeformRect.set(taskStackBounds.left + widthPadding,
-                taskStackBounds.top + heightPadding,
-                taskStackBounds.right - widthPadding,
-                taskStackBounds.top + heightPadding + ffHeight);
-        mFreeformStackRect.set(taskStackBounds.left + widthPadding,
-                taskStackBounds.top + heightPadding + ffHeight + heightPadding,
-                taskStackBounds.right - widthPadding,
-                taskStackBounds.bottom);
-        mStackRect.set(taskStackBounds.left + widthPadding,
-                taskStackBounds.top + heightPadding,
-                taskStackBounds.right - widthPadding,
-                taskStackBounds.bottom);
-        mCurrentStackRect = ssp.hasFreeformWorkspaceSupport() ? mFreeformStackRect : mStackRect;
-        mHistoryButtonRect.set(mCurrentStackRect.left, mCurrentStackRect.top - heightPadding,
-                mCurrentStackRect.right, mCurrentStackRect.top + mFocusedPeekHeight);
+        state.computeRects(mFreeformRect, mStackRect, taskStackBounds, widthPadding, heightPadding,
+                mStackBottomOffset);
+        mHistoryButtonRect.set(mStackRect.left, mStackRect.top - heightPadding,
+                mStackRect.right, mStackRect.top + mFocusedPeekHeight);
 
         // Anchor the task rect to the top-center of the non-freeform stack rect
         float aspect = (float) (taskStackBounds.width() - mSystemInsets.left - mSystemInsets.right)
                 / (taskStackBounds.height() - mSystemInsets.bottom);
         int width = mStackRect.width();
-        int minHeight = mCurrentStackRect.height() - mFocusedPeekHeight - mStackBottomOffset;
+        int minHeight = mStackRect.height() - mFocusedPeekHeight - mStackBottomOffset;
         int height = debugFlags.isFullscreenThumbnailsEnabled()
                 ? (int) Math.min(width / aspect, minHeight)
                 : width;
@@ -315,7 +362,7 @@
                 mStackRect.left + width, mStackRect.top + height);
 
         // Short circuit here if the stack rects haven't changed so we don't do all the work below
-        if (lastStackRect.equals(mCurrentStackRect)) {
+        if (lastStackRect.equals(mStackRect)) {
             return;
         }
 
@@ -328,9 +375,7 @@
         if (DEBUG) {
             Log.d(TAG, "initialize");
             Log.d(TAG, "\tmFreeformRect: " + mFreeformRect);
-            Log.d(TAG, "\tmFreeformStackRect: " + mFreeformStackRect);
             Log.d(TAG, "\tmStackRect: " + mStackRect);
-            Log.d(TAG, "\tmCurrentStackRect: " + mCurrentStackRect);
             Log.d(TAG, "\tmTaskRect: " + mTaskRect);
             Log.d(TAG, "\tmSystemInsets: " + mSystemInsets);
         }
@@ -386,7 +431,7 @@
                 mMinScrollP = mMaxScrollP = 0;
             } else {
                 float bottomOffsetPct = (float) (mStackBottomOffset + mTaskRect.height()) /
-                        mCurrentStackRect.height();
+                        mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(bottomOffsetPct);
                 mMinScrollP = 0;
                 mMaxScrollP = Math.max(mMinScrollP,
@@ -408,7 +453,7 @@
                     mInitialScrollP = Math.max(mMinScrollP, mNumStackTasks - 2);
                 }
             } else {
-                float offsetPct = (float) (mTaskRect.height() / 2) / mCurrentStackRect.height();
+                float offsetPct = (float) (mTaskRect.height() / 2) / mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(offsetPct);
                 mInitialScrollP = (mNumStackTasks - 1) - mUnfocusedRange.getAbsoluteX(normX);
             }
@@ -428,7 +473,7 @@
     public void updateFocusStateOnScroll(int yMovement) {
         Utilities.cancelAnimationWithoutCallbacks(mFocusStateAnimator);
         if (mFocusState > STATE_UNFOCUSED) {
-            float delta = (float) yMovement / (UNFOCUS_MULTIPLIER * mCurrentStackRect.height());
+            float delta = (float) yMovement / (UNFOCUS_MULTIPLIER * mStackRect.height());
             mFocusState -= Math.min(mFocusState, Math.abs(delta));
         }
     }
@@ -441,8 +486,9 @@
         if (Float.compare(newState, getFocusState()) != 0) {
             mFocusStateAnimator = ObjectAnimator.ofFloat(this, FOCUS_STATE, getFocusState(),
                     newState);
-            mFocusStateAnimator.setDuration(200);
-            mFocusStateAnimator.setInterpolator(mFastOutSlowInInterpolator);
+            mFocusStateAnimator.setDuration(mContext.getResources().getInteger(
+                    R.integer.recents_animate_task_stack_scroll_duration));
+            mFocusStateAnimator.setInterpolator(mLinearOutSlowInInterpolator);
             mFocusStateAnimator.start();
         }
     }
@@ -453,13 +499,31 @@
     public float getDefaultFocusState() {
         RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
         RecentsDebugFlags debugFlags = Recents.getDebugFlags();
-        if (debugFlags.isPageOnToggleEnabled() || launchState.launchedWithAltTab) {
+        if (launchState.launchedWithAltTab ||
+                (debugFlags.isPageOnToggleEnabled() && debugFlags.isInitialStatePaging())) {
             return 1f;
         }
         return 0f;
     }
 
     /**
+     * Returns the task progress that would put the task just off the front of the stack.
+     */
+    public float getStackFrontTaskProgress(float stackScroll) {
+        float max = mUnfocusedRange.relativeMax +
+                mFocusState * (mFocusedRange.relativeMax - mUnfocusedRange.relativeMax);
+        return stackScroll + max;
+    }
+
+    /**
+     *
+     * Returns the current stack state.
+     */
+    public StackState getStackState() {
+        return mState;
+    }
+
+    /**
      * Computes the maximum number of visible tasks and thumbnails when the scroll is at the initial
      * stack scroll.  Requires that update() is called first.
      */
@@ -543,8 +607,15 @@
                 transformOut.reset();
                 return transformOut;
             }
-            return getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
+            getStackTransform(mTaskIndexMap.get(task.key), stackScroll, transformOut,
                     frontTransform);
+            if (task.thumbnail != null) {
+                transformOut.thumbnailScale = (float) mTaskRect.width() / task.thumbnail.getWidth();
+            }
+            if (DEBUG) {
+                Log.d(TAG, "getTransform: " + task.key + ", " + transformOut);
+            }
+            return transformOut;
         }
     }
 
@@ -558,7 +629,7 @@
         float p = mUnfocusedRange.getNormalizedX(taskProgress);
         float yp = mUnfocusedCurveInterpolator.getInterpolation(p);
         float unfocusedP = p;
-        int unFocusedY = (int) (Math.max(0f, (1f - yp)) * mCurrentStackRect.height());
+        int unFocusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
         boolean unfocusedVisible = mUnfocusedRange.isInRange(taskProgress);
         int focusedY = 0;
         boolean focusedVisible = true;
@@ -566,7 +637,7 @@
             mFocusedRange.offset(stackScroll);
             p = mFocusedRange.getNormalizedX(taskProgress);
             yp = mFocusedCurveInterpolator.getInterpolation(p);
-            focusedY = (int) (Math.max(0f, (1f - yp)) * mCurrentStackRect.height());
+            focusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
             focusedVisible = mFocusedRange.isInRange(taskProgress);
         }
 
@@ -583,8 +654,8 @@
             // When there is exactly one task, then decouple the task from the stack and just move
             // in screen space
             p = (mMinScrollP - stackScroll) / mNumStackTasks;
-            int centerYOffset = (mCurrentStackRect.top - mTaskRect.top) +
-                    (mCurrentStackRect.height() - mTaskRect.height()) / 2;
+            int centerYOffset = (mStackRect.top - mTaskRect.top) +
+                    (mStackRect.height() - mTaskRect.height()) / 2;
             y = centerYOffset + getYForDeltaP(p, 0);
             z = mMaxTranslationZ;
             relP = 1f;
@@ -592,7 +663,7 @@
         } else {
             // Otherwise, update the task to the stack layout
             y = unFocusedY + (int) (mFocusState * (focusedY - unFocusedY));
-            y += (mCurrentStackRect.top - mTaskRect.top);
+            y += (mStackRect.top - mTaskRect.top);
             z = Math.max(mMinTranslationZ, Math.min(mMaxTranslationZ,
                     mMinTranslationZ + (p * (mMaxTranslationZ - mMinTranslationZ))));
             relP = unfocusedP;
@@ -600,13 +671,17 @@
 
         // Fill out the transform
         transformOut.scale = 1f;
-        transformOut.translationX = (mCurrentStackRect.width() - mTaskRect.width()) / 2;
+        transformOut.translationX = (mStackRect.width() - mTaskRect.width()) / 2;
         transformOut.translationY = y;
         transformOut.translationZ = z;
         transformOut.rect.set(mTaskRect);
         transformOut.rect.offset(transformOut.translationX, transformOut.translationY);
         Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
-        transformOut.visible = true;
+        transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
+                (frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
+        transformOut.clipBottom = 0;
+        transformOut.clipRight = 0;
+        transformOut.thumbnailScale = 1f;
         transformOut.p = relP;
         return transformOut;
     }
@@ -633,7 +708,7 @@
      * screen along the arc-length proportionally (1/arclength).
      */
     public float getDeltaPForY(int downY, int y) {
-        float deltaP = (float) (y - downY) / mCurrentStackRect.height() *
+        float deltaP = (float) (y - downY) / mStackRect.height() *
                 mUnfocusedCurveInterpolator.getArcLength();
         return -deltaP;
     }
@@ -643,7 +718,7 @@
      * of the curve, map back to the screen y.
      */
     public int getYForDeltaP(float downScrollP, float p) {
-        int y = (int) ((p - downScrollP) * mCurrentStackRect.height() *
+        int y = (int) ((p - downScrollP) * mStackRect.height() *
                 (1f / mUnfocusedCurveInterpolator.getArcLength()));
         return -y;
     }
@@ -658,12 +733,12 @@
         // Initialize the focused curve. This curve is a piecewise curve composed of several
         // quadradic beziers that goes from (0,1) through (0.5, peek height offset),
         // (0.667, next task offset), (0.833, bottom task offset), and (1,0).
-        float peekHeightPct = (float) mFocusedPeekHeight / mCurrentStackRect.height();
+        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
         Path p = new Path();
         p.moveTo(0f, 1f);
         p.lineTo(0.5f, 1f - peekHeightPct);
-        p.lineTo(0.66666667f, (float) (taskBarHeight * 3) / mCurrentStackRect.height());
-        p.lineTo(0.83333333f, (float) (taskBarHeight / 2) / mCurrentStackRect.height());
+        p.lineTo(0.66666667f, (float) (taskBarHeight * 3) / mStackRect.height());
+        p.lineTo(0.83333333f, (float) (taskBarHeight / 2) / mStackRect.height());
         p.lineTo(1f, 0f);
         return p;
     }
@@ -680,7 +755,7 @@
         // there is a tangent at (0.5, peek height offset).
         float cpoint1X = 0.4f;
         float cpoint1Y = 1f;
-        float peekHeightPct = (float) mFocusedPeekHeight / mCurrentStackRect.height();
+        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
         float slope = ((1f - peekHeightPct) - cpoint1Y) / (0.5f - cpoint1X);
         float b = 1f - slope * cpoint1X;
         float cpoint2X = 0.75f;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 30efd5f..cc5aaae 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -16,6 +16,7 @@
 
 package com.android.systemui.recents.views;
 
+import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
 import android.content.ComponentName;
 import android.content.Context;
@@ -23,8 +24,11 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.util.IntProperty;
 import android.util.Log;
+import android.util.Property;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -90,6 +94,19 @@
     private static final float SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;
     private static final float HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;
 
+    public static final Property<ColorDrawable, Integer> COLOR_DRAWABLE_ALPHA =
+            new IntProperty<ColorDrawable>("colorDrawableAlpha") {
+                @Override
+                public void setValue(ColorDrawable object, int alpha) {
+                    object.setAlpha(alpha);
+                }
+
+                @Override
+                public Integer get(ColorDrawable object) {
+                    return object.getAlpha();
+                }
+            };
+
     /** The TaskView callbacks */
     interface TaskStackViewCallbacks {
         public void onTaskViewClicked(TaskStackView stackView, TaskView tv, TaskStack stack, Task t,
@@ -102,10 +119,11 @@
     TaskStackViewTouchHandler mTouchHandler;
     TaskStackViewCallbacks mCb;
     ColorDrawable mFreeformWorkspaceBackground;
+    ObjectAnimator mFreeformWorkspaceBackgroundAnimator;
     ViewPool<TaskView, Task> mViewPool;
     ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<>();
     DozeTrigger mUIDozeTrigger;
-    int mFocusedTaskIndex = -1;
+    Task mFocusedTask;
     // Optimizations
     int mStackViewsAnimationDuration;
     boolean mStackViewsDirty = true;
@@ -119,7 +137,6 @@
     int[] mTmpVisibleRange = new int[2];
     Rect mTmpRect = new Rect();
     RectF mTmpTaskRect = new RectF();
-    TaskViewTransform mTmpTransform = new TaskViewTransform();
     TaskViewTransform mTmpStackBackTransform = new TaskViewTransform();
     TaskViewTransform mTmpStackFrontTransform = new TaskViewTransform();
     HashMap<Task, TaskView> mTmpTaskViewMap = new HashMap<>();
@@ -127,7 +144,6 @@
     List<TaskView> mImmutableTaskViews = new ArrayList<>();
     List<TaskView> mTmpTaskViews = new ArrayList<>();
     LayoutInflater mInflater;
-    boolean mLayersDisabled;
     boolean mTouchExplorationEnabled;
 
     Interpolator mFastOutSlowInInterpolator;
@@ -135,11 +151,11 @@
     // A convenience update listener to request updating clipping of tasks
     private ValueAnimator.AnimatorUpdateListener mRequestUpdateClippingListener =
             new ValueAnimator.AnimatorUpdateListener() {
-        @Override
-        public void onAnimationUpdate(ValueAnimator animation) {
-            requestUpdateStackViewsClip();
-        }
-    };
+                @Override
+                public void onAnimationUpdate(ValueAnimator animation) {
+                    requestUpdateStackViewsClip();
+                }
+            };
 
     // The drop targets for a task drag
     private DropTarget mFreeformWorkspaceDropTarget = new DropTarget() {
@@ -152,7 +168,7 @@
     private DropTarget mStackDropTarget = new DropTarget() {
         @Override
         public boolean acceptsDrop(int x, int y, int width, int height) {
-            return mLayoutAlgorithm.mCurrentStackRect.contains(x, y);
+            return mLayoutAlgorithm.mStackRect.contains(x, y);
         }
     };
 
@@ -186,6 +202,7 @@
         setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
 
         mFreeformWorkspaceBackground = new ColorDrawable(0x33000000);
+        mFreeformWorkspaceBackground.setCallback(this);
     }
 
     /** Sets the callbacks */
@@ -280,7 +297,7 @@
     /** Resets this TaskStackView for reuse. */
     void reset() {
         // Reset the focused task
-        resetFocusedTask();
+        resetFocusedTask(getFocusedTask());
 
         // Return all the views to the pool
         List<TaskView> taskViews = getTaskViews();
@@ -397,7 +414,7 @@
 
             if (boundTranslationsToRect) {
                 transform.translationY = Math.min(transform.translationY,
-                        mLayoutAlgorithm.mCurrentStackRect.bottom);
+                        mLayoutAlgorithm.mStackRect.bottom);
             }
             frontTransform = transform;
         }
@@ -426,7 +443,6 @@
             // Return all the invisible children to the pool
             mTmpTaskViewMap.clear();
             List<TaskView> taskViews = getTaskViews();
-            boolean wasLastFocusedTaskAnimated = false;
             int lastFocusedTaskIndex = -1;
             int taskViewCount = taskViews.size();
             for (int i = taskViewCount - 1; i >= 0; i--) {
@@ -437,10 +453,9 @@
                         visibleStackRange[1] <= taskIndex && taskIndex <= visibleStackRange[0]) {
                     mTmpTaskViewMap.put(task, tv);
                 } else {
-                    if (mTouchExplorationEnabled && tv.isFocusedTask()) {
-                        wasLastFocusedTaskAnimated = tv.isFocusAnimated();
+                    if (mTouchExplorationEnabled) {
                         lastFocusedTaskIndex = taskIndex;
-                        resetFocusedTask();
+                        resetFocusedTask(task);
                     }
                     if (DEBUG) {
                         Log.d(TAG, "returning to pool: " + task.key);
@@ -464,45 +479,34 @@
                         Log.d(TAG, "picking up from pool: " + task.key);
                     }
                     tv = mViewPool.pickUpViewFromPool(task, task);
-                    if (mLayersDisabled) {
-                        tv.disableLayersForOneFrame();
+                } else {
+                    // Reattach it in the right z order
+                    int taskIndex = mStack.indexOfStackTask(task);
+                    int insertIndex = findTaskViewInsertIndex(task, taskIndex);
+                    if (insertIndex != getTaskViews().indexOf(tv)){
+                        detachViewFromParent(tv);
+                        attachViewToParent(tv, insertIndex, tv.getLayoutParams());
                     }
                 }
 
                 // Animate the task into place
-                tv.updateViewPropertiesToTaskTransform(transform,
-                        mStackViewsAnimationDuration, mRequestUpdateClippingListener);
-
-                // Reattach it in the right z order
-                detachViewFromParent(tv);
-                int insertIndex = -1;
-                int taskIndex = mStack.indexOfStackTask(task);
-                taskViews = getTaskViews();
-                taskViewCount = taskViews.size();
-                for (int j = 0; j < taskViewCount; j++) {
-                    Task tvTask = taskViews.get(j).getTask();
-                    if (taskIndex < mStack.indexOfStackTask(tvTask)) {
-                        insertIndex = j;
-                        break;
-                    }
-                }
-                attachViewToParent(tv, insertIndex, tv.getLayoutParams());
+                tv.updateViewPropertiesToTaskTransform(transform, transform.clipBottom,
+                        mStackViewsAnimationDuration, mFastOutSlowInInterpolator,
+                        mRequestUpdateClippingListener);
 
                 // Update the task views list after adding the new task view
                 updateTaskViewsList();
             }
 
             // Pick up all the newly visible children and update all the existing children
-            for (int i = visibleStackRange[0]; isValidVisibleStackRange && i >= visibleStackRange[1]; i--) {
+            for (int i = visibleStackRange[0];
+                    isValidVisibleStackRange && i >= visibleStackRange[1]; i--) {
                 Task task = tasks.get(i);
                 TaskViewTransform transform = mCurrentTaskTransforms.get(i);
                 TaskView tv = mTmpTaskViewMap.get(task);
 
                 if (tv == null) {
                     tv = mViewPool.pickUpViewFromPool(task, task);
-                    if (mLayersDisabled) {
-                        tv.disableLayersForOneFrame();
-                    }
                     if (mStackViewsAnimationDuration > 0) {
                         // For items in the list, put them in start animating them from the
                         // approriate ends of the list where they are expected to appear
@@ -512,29 +516,36 @@
                                 mLayoutAlgorithm.getStackTransform(0f, 0f, mTmpStackBackTransform,
                                         null);
                             }
-                            tv.updateViewPropertiesToTaskTransform(mTmpStackBackTransform, 0);
+                            tv.updateViewPropertiesToTaskTransform(mTmpStackBackTransform, 0, 0,
+                                    mFastOutSlowInInterpolator, mRequestUpdateClippingListener);
                         } else {
                             if (!hasStackFrontTransform) {
                                 hasStackFrontTransform = true;
-                                mLayoutAlgorithm.getStackTransform(1f, 0f, mTmpStackFrontTransform,
-                                        null);
+                                mLayoutAlgorithm.getStackTransform(
+                                        mLayoutAlgorithm.getStackFrontTaskProgress(0f), 0f,
+                                        mTmpStackFrontTransform, null);
                             }
-                            tv.updateViewPropertiesToTaskTransform(mTmpStackFrontTransform, 0);
+                            tv.updateViewPropertiesToTaskTransform(mTmpStackFrontTransform, 0, 0,
+                                    mFastOutSlowInInterpolator, mRequestUpdateClippingListener);
                         }
                     }
                 }
 
-                // Animate the task into place
+                // Animate the task into place, the clip for stack tasks will be calculated in
+                // clipTaskViews()
                 tv.updateViewPropertiesToTaskTransform(transform,
-                        mStackViewsAnimationDuration, mRequestUpdateClippingListener);
+                        tv.getViewBounds().getClipBottom(), mStackViewsAnimationDuration,
+                        mFastOutSlowInInterpolator, mRequestUpdateClippingListener);
             }
 
             // Update the focus if the previous focused task was returned to the view pool
             if (lastFocusedTaskIndex != -1) {
                 if (lastFocusedTaskIndex < visibleStackRange[1]) {
-                    setFocusedTask(visibleStackRange[1], false, wasLastFocusedTaskAnimated);
+                    setFocusedTask(visibleStackRange[1], false /* animated */,
+                            true /* requestViewFocus */);
                 } else {
-                    setFocusedTask(visibleStackRange[0], false, wasLastFocusedTaskAnimated);
+                    setFocusedTask(visibleStackRange[0], false /* animated */,
+                            true /* requestViewFocus */);
                 }
             }
 
@@ -606,7 +617,6 @@
         SystemServicesProxy ssp = Recents.getSystemServices();
         if (ssp.hasFreeformWorkspaceSupport()) {
             mTmpRect.set(mLayoutAlgorithm.mFreeformRect);
-            mFreeformWorkspaceBackground.setAlpha(255);
             mFreeformWorkspaceBackground.setBounds(mTmpRect);
         }
 
@@ -636,7 +646,7 @@
      * @return whether or not the stack will scroll as a part of this focus change
      */
     private boolean setFocusedTask(int taskIndex, boolean scrollToTask, final boolean animated,
-                                final boolean requestViewFocus) {
+            final boolean requestViewFocus) {
         // Find the next task to focus
         int newFocusedTaskIndex = mStack.getStackTaskCount() > 0 ?
                 Math.max(0, Math.min(mStack.getStackTaskCount() - 1, taskIndex)) : -1;
@@ -644,16 +654,13 @@
                 mStack.getStackTasks().get(newFocusedTaskIndex) : null;
 
         // Reset the last focused task state if changed
-        if (mFocusedTaskIndex != -1) {
-            Task focusedTask = mStack.getStackTasks().get(mFocusedTaskIndex);
-            if (focusedTask != newFocusedTask) {
-                resetFocusedTask();
-            }
+        if (mFocusedTask != null) {
+            resetFocusedTask(mFocusedTask);
         }
 
         boolean willScroll = false;
-        mFocusedTaskIndex = newFocusedTaskIndex;
-        if (mFocusedTaskIndex != -1) {
+        mFocusedTask = newFocusedTask;
+        if (newFocusedTask != null) {
             Runnable focusTaskRunnable = new Runnable() {
                 @Override
                 public void run() {
@@ -723,13 +730,11 @@
      */
     public void setRelativeFocusedTask(boolean forward, boolean stackTasksOnly, boolean animated,
                                        boolean cancelWindowAnimations) {
-        int newIndex = -1;
-        if (mFocusedTaskIndex != -1) {
+        int newIndex = mStack.indexOfStackTask(mFocusedTask);
+        if (mFocusedTask != null) {
             if (stackTasksOnly) {
                 List<Task> tasks =  mStack.getStackTasks();
-                newIndex = mFocusedTaskIndex;
-                Task task = tasks.get(mFocusedTaskIndex);
-                if (task.isFreeformTask()) {
+                if (mFocusedTask.isFreeformTask()) {
                     // Try and focus the front most stack task
                     TaskView tv = getFrontMostTaskView(stackTasksOnly);
                     if (tv != null) {
@@ -737,7 +742,7 @@
                     }
                 } else {
                     // Try the next task if it is a stack task
-                    int tmpNewIndex = mFocusedTaskIndex + (forward ? -1 : 1);
+                    int tmpNewIndex = newIndex + (forward ? -1 : 1);
                     if (0 <= tmpNewIndex && tmpNewIndex < tasks.size()) {
                         Task t = tasks.get(tmpNewIndex);
                         if (!t.isFreeformTask()) {
@@ -749,7 +754,7 @@
                 // No restrictions, lets just move to the new task (looping forward/backwards if
                 // necessary)
                 int taskCount = mStack.getStackTaskCount();
-                newIndex = (mFocusedTaskIndex + (forward ? -1 : 1) + taskCount) % taskCount;
+                newIndex = (newIndex + (forward ? -1 : 1) + taskCount) % taskCount;
             }
         } else {
             // We don't have a focused task, so focus the first visible task view
@@ -771,25 +776,21 @@
     /**
      * Resets the focused task.
      */
-    void resetFocusedTask() {
-        if (mFocusedTaskIndex != -1) {
-            Task t = mStack.getStackTasks().get(mFocusedTaskIndex);
-            TaskView tv = getChildViewForTask(t);
+    void resetFocusedTask(Task task) {
+        if (task != null) {
+            TaskView tv = getChildViewForTask(task);
             if (tv != null) {
                 tv.setFocusedState(false, false /* animated */, false /* requestViewFocus */);
             }
         }
-        mFocusedTaskIndex = -1;
+        mFocusedTask = null;
     }
 
     /**
      * Returns the focused task.
      */
     Task getFocusedTask() {
-        if (mFocusedTaskIndex != -1) {
-            return mStack.getStackTasks().get(mFocusedTaskIndex);
-        }
-        return null;
+        return mFocusedTask;
     }
 
     @Override
@@ -814,12 +815,13 @@
         super.onInitializeAccessibilityNodeInfo(info);
         List<TaskView> taskViews = getTaskViews();
         int taskViewCount = taskViews.size();
-        if (taskViewCount > 1 && mFocusedTaskIndex != -1) {
+        if (taskViewCount > 1 && mFocusedTask != null) {
             info.setScrollable(true);
-            if (mFocusedTaskIndex > 0) {
+            int focusedTaskIndex = mStack.indexOfStackTask(mFocusedTask);
+            if (focusedTaskIndex > 0) {
                 info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
             }
-            if (mFocusedTaskIndex < mStack.getStackTaskCount() - 1) {
+            if (focusedTaskIndex < mStack.getStackTaskCount() - 1) {
                 info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
             }
         }
@@ -876,7 +878,8 @@
     /** Computes the stack and task rects */
     public void computeRects(Rect taskStackBounds) {
         // Compute the rects in the stack algorithm
-        mLayoutAlgorithm.initialize(taskStackBounds);
+        mLayoutAlgorithm.initialize(taskStackBounds,
+                TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
 
         // Update the scroll bounds
         updateLayout(false);
@@ -983,13 +986,14 @@
             }
             requestSynchronizeStackViewsWithModel();
             synchronizeStackViewsWithModel();
+            requestUpdateStackViewsClip();
             clipTaskViews(true /* forceUpdate */);
         }
     }
 
     /** Handler for the first layout. */
     void onFirstLayout() {
-        int offscreenY = mLayoutAlgorithm.mCurrentStackRect.bottom;
+        int offscreenY = mLayoutAlgorithm.mStackRect.bottom;
 
         // Find the launch target task
         Task launchTargetTask = mStack.getLaunchTarget();
@@ -1020,6 +1024,11 @@
             mStartEnterAnimationContext = null;
         }
 
+        // Animate in the freeform workspace
+        animateFreeformWorkspaceBackgroundAlpha(
+                mLayoutAlgorithm.getStackState().freeformBackgroundAlpha, 150,
+                mFastOutSlowInInterpolator);
+
         // Set the task focused state without requesting view focus, and leave the focus animations
         // until after the enter-animation
         RecentsConfiguration config = Recents.getConfiguration();
@@ -1081,11 +1090,11 @@
                     // requesting view focus in onFirstLayout(), actually request view focus and
                     // animate the focused state if we are alt-tabbing now, after the window enter
                     // animation is completed
-                    if (mFocusedTaskIndex != -1) {
+                    if (mFocusedTask != null) {
                         RecentsConfiguration config = Recents.getConfiguration();
                         RecentsActivityLaunchState launchState = config.getLaunchState();
-                        setFocusedTask(mFocusedTaskIndex, false /* scrollToTask */,
-                                launchState.launchedWithAltTab);
+                        setFocusedTask(mStack.indexOfStackTask(mFocusedTask),
+                                false /* scrollToTask */, launchState.launchedWithAltTab);
                     }
                 }
             });
@@ -1098,7 +1107,12 @@
         mStackScroller.stopScroller();
         mStackScroller.stopBoundScrollAnimation();
         // Animate all the task views out of view
-        ctx.offscreenTranslationY = mLayoutAlgorithm.mCurrentStackRect.bottom;
+        ctx.offscreenTranslationY = mLayoutAlgorithm.mStackRect.bottom;
+        // Dismiss the freeform workspace background
+        int taskViewExitToHomeDuration = getResources().getInteger(
+                R.integer.recents_task_exit_to_home_duration);
+        animateFreeformWorkspaceBackgroundAlpha(0, taskViewExitToHomeDuration,
+                mFastOutSlowInInterpolator);
 
         List<TaskView> taskViews = getTaskViews();
         int taskViewCount = taskViews.size();
@@ -1126,14 +1140,19 @@
         }
     }
 
-    public boolean isTransformedTouchPointInView(float x, float y, View child) {
-        return isTransformedTouchPointInView(x, y, child, null);
+    public boolean isTransformedTouchPointInView(float x, float y, TaskView tv) {
+        final float[] point = new float[2];
+        point[0] = x;
+        point[1] = y;
+        transformPointToViewLocal(point, tv);
+        x = point[0];
+        y = point[1];
+        return (0 <= x) && (x < (tv.getMeasuredWidth() - tv.getViewBounds().getClipRight())) &&
+                (0 <= y) && (y < (tv.getMeasuredHeight() - tv.getViewBounds().getClipBottom()));
     }
 
     @Override
     protected void dispatchDraw(Canvas canvas) {
-        mLayersDisabled = false;
-
         // Draw the freeform workspace background
         SystemServicesProxy ssp = Recents.getSystemServices();
         if (ssp.hasFreeformWorkspaceSupport()) {
@@ -1145,12 +1164,12 @@
         super.dispatchDraw(canvas);
     }
 
-    public void disableLayersForOneFrame() {
-        mLayersDisabled = true;
-        List<TaskView> taskViews = getTaskViews();
-        for (int i = 0; i < taskViews.size(); i++) {
-            taskViews.get(i).disableLayersForOneFrame();
+    @Override
+    protected boolean verifyDrawable(Drawable who) {
+        if (who == mFreeformWorkspaceBackground) {
+            return true;
         }
+        return super.verifyDrawable(who);
     }
 
     /**
@@ -1170,6 +1189,10 @@
     @Override
     public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask,
             Task newFrontMostTask) {
+        if (mFocusedTask == removedTask) {
+            resetFocusedTask(removedTask);
+        }
+
         if (!removedTask.isFreeformTask()) {
             // Remove the view associated with this task, we can't rely on updateTransforms
             // to work here because the task is no longer in the list
@@ -1245,6 +1268,11 @@
         }
     }
 
+    @Override
+    public void onHistoryTaskRemoved(TaskStack stack, Task removedTask) {
+        // To be implemented
+    }
+
     /**** ViewPoolConsumer Implementation ****/
 
     @Override
@@ -1267,6 +1295,9 @@
         // Reset the view properties
         tv.resetViewProperties();
 
+        // Reset the focused view state
+        tv.setFocusedState(false, false /* animated */, false /* requestViewFocus */);
+
         // Reset the clip state of the task view
         tv.setClipViewInStack(false);
     }
@@ -1287,19 +1318,8 @@
         tv.setNoUserInteractionState();
 
         // Find the index where this task should be placed in the stack
-        int insertIndex = -1;
         int taskIndex = mStack.indexOfStackTask(task);
-        if (taskIndex != -1) {
-            List<TaskView> taskViews = getTaskViews();
-            int taskViewCount = taskViews.size();
-            for (int i = 0; i < taskViewCount; i++) {
-                Task tvTask = taskViews.get(i).getTask();
-                if (taskIndex < mStack.indexOfStackTask(tvTask)) {
-                    insertIndex = i;
-                    break;
-                }
-            }
-        }
+        int insertIndex = findTaskViewInsertIndex(task, taskIndex);
 
         // Add/attach the view to the hierarchy
         if (isNewView) {
@@ -1317,6 +1337,9 @@
         tv.setCallbacks(this);
         tv.setTouchEnabled(true);
         tv.setClipViewInStack(true);
+        if (mFocusedTask == task) {
+            tv.setFocusedState(true, false /* animated */, false /* requestViewFocus */);
+        }
     }
 
     @Override
@@ -1338,9 +1361,7 @@
 
     @Override
     public void onTaskViewClipStateChanged(TaskView tv) {
-        if (!mStackViewsDirty) {
-            invalidate();
-        }
+        requestUpdateStackViewsClip();
     }
 
     /**** TaskStackViewScroller.TaskStackViewScrollerCallbacks ****/
@@ -1402,10 +1423,12 @@
     }
 
     public final void onBusEvent(DismissFocusedTaskViewEvent event) {
-        if (mFocusedTaskIndex != -1) {
-            Task t = mStack.getStackTasks().get(mFocusedTaskIndex);
-            TaskView tv = getChildViewForTask(t);
-            tv.dismissTask();
+        if (mFocusedTask != null) {
+            TaskView tv = getChildViewForTask(mFocusedTask);
+            if (tv != null) {
+                tv.dismissTask();
+            }
+            resetFocusedTask(mFocusedTask);
         }
     }
 
@@ -1441,56 +1464,42 @@
     }
 
     public final void onBusEvent(final DragEndEvent event) {
-        if (event.dropTarget != mFreeformWorkspaceDropTarget &&
-                event.dropTarget != mStackDropTarget) {
-            return;
-        }
-        if (event.task.isFreeformTask() && event.dropTarget == mFreeformWorkspaceDropTarget) {
-            // TODO: Animate back into view
-            return;
-        }
-        if (!event.task.isFreeformTask() && event.dropTarget == mStackDropTarget) {
-            // TODO: Animate back into view
+        // We don't handle drops on the dock regions
+        if (event.dropTarget instanceof TaskStack.DockState) {
             return;
         }
 
-        // Move the task to the right position in the stack (ie. the front of the stack if freeform
-        // or the front of the stack if fullscreen).  Note, we MUST move the tasks before we update
-        // their stack ids, otherwise, the keys will have changed.
-        if (event.dropTarget == mFreeformWorkspaceDropTarget) {
-            mStack.moveTaskToStack(event.task, FREEFORM_WORKSPACE_STACK_ID);
-            updateLayout(true);
-        } else if (event.dropTarget == mStackDropTarget) {
-            mStack.moveTaskToStack(event.task, FULLSCREEN_WORKSPACE_STACK_ID);
-            updateLayout(true);
-        }
+        boolean isFreeformTask = event.task.isFreeformTask();
+        boolean hasChangedStacks =
+                (!isFreeformTask && event.dropTarget == mFreeformWorkspaceDropTarget) ||
+                        (isFreeformTask && event.dropTarget == mStackDropTarget);
 
         event.postAnimationTrigger.increment();
-        event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
-            @Override
-            public void run() {
-                SystemServicesProxy ssp = Recents.getSystemServices();
-                ssp.moveTaskToStack(event.task.key.id, event.task.key.stackId);
+        if (hasChangedStacks) {
+            // Move the task to the right position in the stack (ie. the front of the stack if
+            // freeform or the front of the stack if fullscreen).  Note, we MUST move the tasks
+            // before we update their stack ids, otherwise, the keys will have changed.
+            if (event.dropTarget == mFreeformWorkspaceDropTarget) {
+                mStack.moveTaskToStack(event.task, FREEFORM_WORKSPACE_STACK_ID);
+            } else if (event.dropTarget == mStackDropTarget) {
+                mStack.moveTaskToStack(event.task, FULLSCREEN_WORKSPACE_STACK_ID);
             }
-        });
+            updateLayout(true);
 
-        // Animate the drag view to the new position
-        mLayoutAlgorithm.getStackTransform(event.task, mStackScroller.getStackScroll(),
-                mTmpTransform, null);
-        event.dragView.animate()
-                .scaleX(mTmpTransform.scale)
-                .scaleY(mTmpTransform.scale)
-                .translationX((mLayoutAlgorithm.mTaskRect.left - event.dragView.getLeft())
-                        + mTmpTransform.translationX)
-                .translationY((mLayoutAlgorithm.mTaskRect.top - event.dragView.getTop())
-                        + mTmpTransform.translationY)
-                .setDuration(175)
-                .setInterpolator(mFastOutSlowInInterpolator)
-                .withEndAction(event.postAnimationTrigger.decrementAsRunnable())
-                .start();
+            // Move the task to the new stack in the system after the animation completes
+            event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
+                @Override
+                public void run() {
+                    SystemServicesProxy ssp = Recents.getSystemServices();
+                    ssp.moveTaskToStack(event.task.key.id, event.task.key.stackId);
+                }
+            });
+        }
+        event.taskView.animate()
+                .withEndAction(event.postAnimationTrigger.decrementAsRunnable());
 
-        // Animate the other views into place
-        requestSynchronizeStackViewsWithModel(175);
+        // Animate the tack view back into position
+        requestSynchronizeStackViewsWithModel(250);
     }
 
     public final void onBusEvent(StackViewScrolledEvent event) {
@@ -1522,7 +1531,13 @@
         int taskViewCount = taskViews.size();
         for (int i = taskViewCount - 1; i >= 0; i--) {
             TaskView tv = taskViews.get(i);
-            tv.animate().alpha(0f).setDuration(200).start();
+            tv.animate()
+                    .alpha(0f)
+                    .setDuration(200)
+                    .setUpdateListener(null)
+                    .setListener(null)
+                    .withLayer()
+                    .start();
         }
     }
 
@@ -1531,7 +1546,13 @@
         int taskViewCount = taskViews.size();
         for (int i = taskViewCount - 1; i >= 0; i--) {
             TaskView tv = taskViews.get(i);
-            tv.animate().alpha(1f).setDuration(200).start();
+            tv.animate()
+                    .alpha(1f)
+                    .setDuration(200)
+                    .setUpdateListener(null)
+                    .setListener(null)
+                    .withLayer()
+                    .start();
         }
     }
 
@@ -1542,9 +1563,6 @@
     private void removeTaskViewFromStack(TaskView tv) {
         Task task = tv.getTask();
 
-        // Reset the previously focused task before it is removed from the stack
-        resetFocusedTask();
-
         // Announce for accessibility
         tv.announceForAccessibility(getContext().getString(
                 R.string.accessibility_recents_item_dismissed, tv.getTask().activityLabel));
@@ -1552,4 +1570,50 @@
         // Remove the task from the stack
         mStack.removeTask(task);
     }
+
+    /**
+     * Starts an alpha animation on the freeform workspace background.
+     */
+    private void animateFreeformWorkspaceBackgroundAlpha(int targetAlpha, int duration,
+            Interpolator interpolator) {
+        if (mFreeformWorkspaceBackground.getAlpha() == targetAlpha) {
+            return;
+        }
+
+        Utilities.cancelAnimationWithoutCallbacks(mFreeformWorkspaceBackgroundAnimator);
+        mFreeformWorkspaceBackgroundAnimator = ObjectAnimator.ofInt(mFreeformWorkspaceBackground,
+                COLOR_DRAWABLE_ALPHA, mFreeformWorkspaceBackground.getAlpha(), targetAlpha);
+        mFreeformWorkspaceBackgroundAnimator.setDuration(duration);
+        mFreeformWorkspaceBackgroundAnimator.setInterpolator(interpolator);
+        mFreeformWorkspaceBackgroundAnimator.start();
+    }
+
+    /**
+     * Returns the insert index for the task in the current set of task views.  If the given task
+     * is already in the task view list, then this method returns the insert index assuming it
+     * is first removed at the previous index.
+     *
+     * @param task the task we are finding the index for
+     * @param taskIndex the index of the task in the stack
+     */
+    private int findTaskViewInsertIndex(Task task, int taskIndex) {
+        if (taskIndex != -1) {
+            List<TaskView> taskViews = getTaskViews();
+            boolean foundTaskView = false;
+            int taskViewCount = taskViews.size();
+            for (int i = 0; i < taskViewCount; i++) {
+                Task tvTask = taskViews.get(i).getTask();
+                if (tvTask == task) {
+                    foundTaskView = true;
+                } else if (taskIndex < mStack.indexOfStackTask(tvTask)) {
+                    if (foundTaskView) {
+                        return i - 1;
+                    } else {
+                        return i;
+                    }
+                }
+            }
+        }
+        return -1;
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
index 90b73fe..56942a8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
@@ -19,7 +19,6 @@
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
 import android.content.Context;
 import android.util.Log;
 import android.view.animation.AnimationUtils;
@@ -50,7 +49,7 @@
     ObjectAnimator mScrollAnimator;
     float mFinalAnimatedScroll;
 
-    Interpolator mLinearOutSlowInInterpolator;
+    private Interpolator mLinearOutSlowInInterpolator;
 
     public TaskStackViewScroller(Context context, TaskStackLayoutAlgorithm layoutAlgorithm) {
         mContext = context;
@@ -189,7 +188,7 @@
     // TODO: Remove
     @Deprecated
     int progressToScrollRange(float p) {
-        return (int) (p * mLayoutAlgorithm.mCurrentStackRect.height());
+        return (int) (p * mLayoutAlgorithm.mStackRect.height());
     }
 
     /** Called from the view draw, computes the next scroll. */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index 907ed2f..1a6f129 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -176,11 +176,11 @@
             }
             case MotionEvent.ACTION_POINTER_DOWN: {
                 final int index = ev.getActionIndex();
-                mDownX = (int) ev.getX();
-                mDownY = (int) ev.getY();
+                mActivePointerId = ev.getPointerId(index);
+                mDownX = (int) ev.getX(index);
+                mDownY = (int) ev.getY(index);
                 mLastY = mDownY;
                 mDownScrollP = mScroller.getStackScroll();
-                mActivePointerId = ev.getPointerId(index);
                 mVelocityTracker.addMovement(ev);
                 break;
             }
@@ -221,6 +221,10 @@
                     // Select a new active pointer id and reset the motion state
                     final int newPointerIndex = (pointerIndex == 0) ? 1 : 0;
                     mActivePointerId = ev.getPointerId(newPointerIndex);
+                    mDownX = (int) ev.getX(pointerIndex);
+                    mDownY = (int) ev.getY(pointerIndex);
+                    mLastY = mDownY;
+                    mDownScrollP = mScroller.getStackScroll();
                 }
                 mVelocityTracker.addMovement(ev);
                 break;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 6db2eb9..813a1fc 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -18,18 +18,18 @@
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
 import android.content.Context;
 import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Outline;
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.MotionEvent;
@@ -78,10 +78,9 @@
 
     Task mTask;
     boolean mTaskDataLoaded;
-    boolean mIsFocused;
-    boolean mIsFocusAnimated;
     boolean mClipViewInStack;
     AnimateableViewBounds mViewBounds;
+    private AnimatorSet mClipAnimation;
 
     View mContent;
     TaskViewThumbnail mThumbnailView;
@@ -211,23 +210,45 @@
                 MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY),
                 MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.EXACTLY));
         mThumbnailView.updateClipToTaskBar(mHeaderView);
+
         setMeasuredDimension(width, height);
         invalidateOutline();
     }
 
     /** Synchronizes this view's properties with the task's transform */
-    void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, int duration) {
-        updateViewPropertiesToTaskTransform(toTransform, duration, null);
-    }
-
-    void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, int duration,
-                                             ValueAnimator.AnimatorUpdateListener updateCallback) {
+    void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, int clipBottom,
+            int duration, Interpolator interpolator,
+            ValueAnimator.AnimatorUpdateListener updateCallback) {
         RecentsConfiguration config = Recents.getConfiguration();
+        Utilities.cancelAnimationWithoutCallbacks(mClipAnimation);
 
         // Apply the transform
-        toTransform.applyToTaskView(this, duration, mFastOutSlowInInterpolator, false,
+        toTransform.applyToTaskView(this, duration, interpolator, false,
                 !config.fakeShadows, updateCallback);
 
+        // Update the clipping
+        if (duration > 0) {
+            mClipAnimation = new AnimatorSet();
+            mClipAnimation.playTogether(
+                    ObjectAnimator.ofInt(mViewBounds, AnimateableViewBounds.CLIP_BOTTOM,
+                            mViewBounds.getClipBottom(), clipBottom),
+                    ObjectAnimator.ofInt(mViewBounds, AnimateableViewBounds.CLIP_RIGHT,
+                            mViewBounds.getClipRight(), toTransform.clipRight),
+                    ObjectAnimator.ofFloat(mThumbnailView, TaskViewThumbnail.BITMAP_SCALE,
+                            mThumbnailView.getBitmapScale(), toTransform.thumbnailScale));
+            mClipAnimation.setStartDelay(toTransform.startDelay);
+            mClipAnimation.setDuration(duration);
+            mClipAnimation.setInterpolator(interpolator);
+            mClipAnimation.start();
+        } else {
+            mViewBounds.setClipBottom(clipBottom, false /* forceUpdate */);
+            mViewBounds.setClipRight(toTransform.clipRight, false /* forceUpdate */);
+            mThumbnailView.setBitmapScale(toTransform.thumbnailScale);
+        }
+        if (!config.useHardwareLayers) {
+            mThumbnailView.updateThumbnailVisibility(clipBottom - getPaddingBottom());
+        }
+
         // Update the task progress
         Utilities.cancelAnimationWithoutCallbacks(mTaskProgressAnimator);
         if (duration <= 0) {
@@ -244,6 +265,8 @@
     void resetViewProperties() {
         setDim(0);
         setLayerType(View.LAYER_TYPE_NONE, null);
+        setVisibility(View.VISIBLE);
+        getViewBounds().reset();
         TaskViewTransform.reset(this);
         if (mActionButtonView != null) {
             mActionButtonView.setScaleX(1f);
@@ -251,18 +274,6 @@
             mActionButtonView.setAlpha(1f);
             mActionButtonView.setTranslationZ(mActionButtonTranslationZ);
         }
-        setVisibility(View.VISIBLE);
-    }
-
-    /**
-     * When we are un/filtering, this method will set up the transform that we are animating to,
-     * in order to hide the task.
-     */
-    void prepareTaskTransformForFilterTaskHidden(TaskViewTransform toTransform) {
-        // Fade the view out and slide it away
-        toTransform.alpha = 0f;
-        toTransform.translationY += 200;
-        toTransform.translationZ = 0;
     }
 
     /** Prepares this task view for the enter-recents animations.  This is called earlier in the
@@ -296,8 +307,6 @@
         }
         // Apply the current dim
         setDim(initialDim);
-        // Prepare the thumbnail view alpha
-        mThumbnailView.prepareEnterRecentsAnimation(isTaskViewLaunchTargetTask);
     }
 
     /** Animates this task view as it enters recents */
@@ -409,6 +418,7 @@
                 .translationY(ctx.offscreenTranslationY)
                 .setStartDelay(0)
                 .setUpdateListener(null)
+                .setListener(null)
                 .setInterpolator(mFastOutLinearInInterpolator)
                 .setDuration(taskViewExitToHomeDuration)
                 .withEndAction(ctx.postAnimationTrigger.decrementAsRunnable())
@@ -425,9 +435,6 @@
                 R.dimen.recents_task_view_affiliate_group_enter_offset);
 
         if (isLaunchingTask) {
-            // Animate the thumbnail alpha back into full opacity for the window animation out
-            mThumbnailView.startLaunchTaskAnimation(postAnimRunnable);
-
             // Animate the dim
             if (mDimAlpha > 0) {
                 ObjectAnimator anim = ObjectAnimator.ofInt(this, "dim", 0);
@@ -448,10 +455,11 @@
                     .setStartDelay(0)
                     .setDuration(taskViewExitToAppDuration)
                     .setInterpolator(mFastOutLinearInInterpolator)
+                    .withEndAction(postAnimRunnable)
                     .start();
         } else {
             // Hide the dismiss button
-            mHeaderView.startLaunchTaskDismissAnimation();
+            mHeaderView.startLaunchTaskDismissAnimation(postAnimRunnable);
             // If this is another view in the task grouping and is in front of the launch task,
             // animate it away first
             if (occludesLaunchTarget) {
@@ -459,6 +467,7 @@
                     .translationY(getTranslationY() + taskViewAffiliateGroupEnterOffset)
                     .setStartDelay(0)
                     .setUpdateListener(null)
+                    .setListener(null)
                     .setInterpolator(mFastOutLinearInInterpolator)
                     .setDuration(taskViewExitToAppDuration)
                     .start();
@@ -480,6 +489,7 @@
             .alpha(0f)
             .setStartDelay(delay)
             .setUpdateListener(null)
+            .setListener(null)
             .setInterpolator(mFastOutSlowInInterpolator)
             .setDuration(taskViewRemoveAnimDuration)
             .withEndAction(new Runnable() {
@@ -628,16 +638,13 @@
     public void setFocusedState(boolean isFocused, boolean animated, boolean requestViewFocus) {
         if (DEBUG) {
             Log.d(TAG, "setFocusedState: " + mTask.activityLabel + " focused: " + isFocused +
-                    " mIsFocused: " + mIsFocused + " animated: " + animated +
-                    " requestViewFocus: " + requestViewFocus + " isFocused(): " + isFocused() +
+                    " animated: " + animated + " requestViewFocus: " + requestViewFocus +
+                    " isFocused(): " + isFocused() +
                     " isAccessibilityFocused(): " + isAccessibilityFocused());
         }
 
         SystemServicesProxy ssp = Recents.getSystemServices();
-        mIsFocused = isFocused;
-        mIsFocusAnimated = animated;
         mHeaderView.onTaskViewFocusChanged(isFocused, animated);
-        mThumbnailView.onFocusChanged(isFocused);
         if (isFocused) {
             if (requestViewFocus && !isFocused()) {
                 requestFocus();
@@ -652,24 +659,6 @@
         }
     }
 
-    /**
-     * Returns whether we have explicitly been focused.
-     */
-    public boolean isFocusedTask() {
-        return mIsFocused;
-    }
-
-    /**
-     * Returns whether this focused task is animated.
-     */
-    public boolean isFocusAnimated() {
-        return mIsFocusAnimated;
-    }
-
-    public void disableLayersForOneFrame() {
-        mHeaderView.disableLayersForOneFrame();
-    }
-
     /**** TaskCallbacks Implementation ****/
 
     /** Binds this task view to the task */
@@ -687,22 +676,14 @@
 
     @Override
     public void onTaskDataLoaded() {
-        SystemServicesProxy ssp = Recents.getSystemServices();
-        RecentsConfiguration config = Recents.getConfiguration();
         if (mThumbnailView != null && mHeaderView != null) {
             // Bind each of the views to the new task data
             mThumbnailView.rebindToTask(mTask);
             mHeaderView.rebindToTask(mTask);
+
             // Rebind any listeners
             mActionButtonView.setOnClickListener(this);
-
-            // Only enable long-click if we have a freeform workspace to drag to/from, or if we
-            // aren't already docked
-            if (ssp.hasFreeformWorkspaceSupport() || !config.hasDockedTasks) {
-                setOnLongClickListener(this);
-            } else {
-                setOnLongClickListener(null);
-            }
+            setOnLongClickListener(this);
         }
         mTaskDataLoaded = true;
     }
@@ -742,58 +723,31 @@
 
     @Override
     public boolean onLongClick(View v) {
-        if (v == this) {
+        SystemServicesProxy ssp = Recents.getSystemServices();
+        // Since we are clipping the view to the bounds, manually do the hit test
+        Rect clipBounds = new Rect(mViewBounds.mClipBounds);
+        clipBounds.scale(getScaleX());
+        boolean inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
+        if (v == this && inBounds && !ssp.hasDockedTask()) {
             // Start listening for drag events
             setClipViewInStack(false);
 
+            // Enlarge the view slightly
             final float finalScale = getScaleX() * 1.05f;
-            final int width = getWidth();
-            final int height = getHeight();
-            Bitmap dragBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
-            Canvas c = new Canvas(dragBitmap);
-            mThumbnailView.draw(c);
-            mHeaderView.draw(c);
-            c.setBitmap(null);
+            animate()
+                    .scaleX(finalScale)
+                    .scaleY(finalScale)
+                    .setDuration(175)
+                    .setUpdateListener(null)
+                    .setListener(null)
+                    .setInterpolator(mFastOutSlowInInterpolator)
+                    .start();
 
-            // The downTouchPos is relative to the currently transformed TaskView, but we will be
-            // dragging a copy of the full task view, which makes it easier for us to animate them
-            // when the user drops
-            mDownTouchPos.x += ((1f - getScaleX()) * width) / 2;
-            mDownTouchPos.y += ((1f - getScaleY()) * height) / 2;
+            mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
+            mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
 
-            // Initiate the drag
-            final DragView dragView = new DragView(getContext(), dragBitmap, mDownTouchPos);
-            dragView.setOutlineProvider(new ViewOutlineProvider() {
-                @Override
-                public void getOutline(View view, Outline outline) {
-                    outline.setRect(0, 0, width, height);
-                }
-            });
-            dragView.setScaleX(getScaleX());
-            dragView.setScaleY(getScaleY());
-            dragView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
-                @Override
-                public void onViewAttachedToWindow(View v) {
-                    // Hide this task view after the drag view is attached
-                    setVisibility(View.INVISIBLE);
-                    // Animate the alpha slightly to indicate dragging
-                    dragView.setElevation(getElevation());
-                    dragView.setTranslationZ(getTranslationZ());
-                    dragView.animate()
-                            .scaleX(finalScale)
-                            .scaleY(finalScale)
-                            .setDuration(175)
-                            .setInterpolator(mFastOutSlowInInterpolator)
-                            .start();
-                }
-
-                @Override
-                public void onViewDetachedFromWindow(View v) {
-                    // Do nothing
-                }
-            });
             EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
-            EventBus.getDefault().send(new DragStartEvent(mTask, this, dragView));
+            EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
             return true;
         }
         return false;
@@ -806,9 +760,6 @@
             event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
                 @Override
                 public void run() {
-                    // Show this task view
-                    setVisibility(View.VISIBLE);
-
                     // Animate the drag view back from where it is, to the view location, then after
                     // it returns, update the clip state
                     setClipViewInStack(true);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 76c6691..78a2c7f 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -55,6 +55,8 @@
 public class TaskViewHeader extends FrameLayout
         implements View.OnClickListener, View.OnLongClickListener {
 
+    private static final float FOCUS_TRANSLATION_Z = 4f;
+
     Task mTask;
 
     // Header views
@@ -78,13 +80,10 @@
 
     // Header dim, which is only used when task view hardware layers are not used
     Paint mDimLayerPaint = new Paint();
-    PorterDuffColorFilter mDimColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
 
     Interpolator mFastOutSlowInInterpolator;
     Interpolator mFastOutLinearInInterpolator;
 
-    boolean mLayersDisabled;
-
     public TaskViewHeader(Context context) {
         this(context, null);
     }
@@ -109,6 +108,7 @@
         });
 
         // Load the dismiss resources
+        mDimLayerPaint.setColor(Color.argb(0, 0, 0, 0));
         mLightDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_light);
         mDarkDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_dark);
         mDismissContentDescription =
@@ -171,21 +171,13 @@
         canvas.restoreToCount(count);
     }
 
-    @Override
-    public boolean hasOverlappingRendering() {
-        return false;
-    }
-
     /**
      * Sets the dim alpha, only used when we are not using hardware layers.
      * (see RecentsConfiguration.useHardwareLayers)
      */
     void setDimAlpha(int alpha) {
-        mDimColorFilter.setColor(Color.argb(alpha, 0, 0, 0));
-        mDimLayerPaint.setColorFilter(mDimColorFilter);
-        if (!mLayersDisabled) {
-            setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint);
-        }
+        mDimLayerPaint.setColor(Color.argb(alpha, 0, 0, 0));
+        invalidate();
     }
 
     /** Returns the secondary color for a primary color. */
@@ -284,7 +276,7 @@
     }
 
     /** Animates this task bar dismiss button when launching a task. */
-    void startLaunchTaskDismissAnimation() {
+    void startLaunchTaskDismissAnimation(final Runnable postAnimationRunanble) {
         if (mDismissButton.getVisibility() == View.VISIBLE) {
             int taskViewExitToAppDuration = mContext.getResources().getInteger(
                     R.integer.recents_task_exit_to_app_duration);
@@ -294,6 +286,7 @@
                     .setStartDelay(0)
                     .setInterpolator(mFastOutSlowInInterpolator)
                     .setDuration(taskViewExitToAppDuration)
+                    .withEndAction(postAnimationRunanble)
                     .start();
         }
     }
@@ -338,23 +331,11 @@
     @Override
     protected void dispatchDraw(Canvas canvas) {
         super.dispatchDraw(canvas);
-        if (mLayersDisabled) {
-            mLayersDisabled = false;
-            postOnAnimation(new Runnable() {
-                @Override
-                public void run() {
-                    mLayersDisabled = false;
-                    setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint);
-                }
-            });
-        }
-    }
 
-    public void disableLayersForOneFrame() {
-        mLayersDisabled = true;
-
-        // Disable layer for a frame so we can draw our first frame faster.
-        setLayerType(LAYER_TYPE_NONE, null);
+        // Draw the thumbnail with the rounded corners
+        canvas.drawRoundRect(0, 0, getWidth(), getHeight(),
+                mCornerRadius,
+                mCornerRadius, mDimLayerPaint);
     }
 
     /** Notifies the associated TaskView has been focused. */
@@ -366,13 +347,14 @@
         Utilities.cancelAnimationWithoutCallbacks(mFocusAnimator);
 
         if (focused) {
-            // If we are not animating the visible state, just return
-            if (!animateFocusedState) return;
-
-            // Bump up the translation
-            mFocusAnimator = ObjectAnimator.ofFloat(this, "translationZ", 8f);
-            mFocusAnimator.setDuration(200);
-            mFocusAnimator.start();
+            if (animateFocusedState) {
+                // Bump up the translation
+                mFocusAnimator = ObjectAnimator.ofFloat(this, "translationZ", FOCUS_TRANSLATION_Z);
+                mFocusAnimator.setDuration(200);
+                mFocusAnimator.start();
+            } else {
+                setTranslationZ(FOCUS_TRANSLATION_Z);
+            }
         } else {
             if (isRunning) {
                 // Restore the translation
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
index b3d263e..7bb2c7b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
@@ -16,9 +16,6 @@
 
 package com.android.systemui.recents.views;
 
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapShader;
@@ -28,14 +25,14 @@
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Rect;
-import android.graphics.RectF;
 import android.graphics.Shader;
 import android.util.AttributeSet;
+import android.util.FloatProperty;
+import android.util.Property;
 import android.view.View;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 import com.android.systemui.R;
-import com.android.systemui.recents.misc.Utilities;
 import com.android.systemui.recents.model.Task;
 
 
@@ -45,33 +42,30 @@
  */
 public class TaskViewThumbnail extends View {
 
-    private Task mTask;
+    public static final Property<TaskViewThumbnail, Float> BITMAP_SCALE =
+            new FloatProperty<TaskViewThumbnail>("bitmapScale") {
+                @Override
+                public void setValue(TaskViewThumbnail object, float scale) {
+                    object.setBitmapScale(scale);
+                }
+
+                @Override
+                public Float get(TaskViewThumbnail object) {
+                    return object.getBitmapScale();
+                }
+            };
 
     // Drawing
     int mCornerRadius;
     float mDimAlpha;
     Matrix mScaleMatrix = new Matrix();
     Paint mDrawPaint = new Paint();
-    RectF mBitmapRect = new RectF();
-    RectF mLayoutRect = new RectF();
     float mBitmapScale = 1f;
     BitmapShader mBitmapShader;
     LightingColorFilter mLightingColorFilter = new LightingColorFilter(0xffffffff, 0);
 
     Interpolator mFastOutSlowInInterpolator;
 
-    // Thumbnail alpha
-    float mThumbnailAlpha;
-    ValueAnimator mThumbnailAlphaAnimator;
-    ValueAnimator.AnimatorUpdateListener mThumbnailAlphaUpdateListener
-            = new ValueAnimator.AnimatorUpdateListener() {
-        @Override
-        public void onAnimationUpdate(ValueAnimator animation) {
-            mThumbnailAlpha = (float) animation.getAnimatedValue();
-            updateThumbnailPaintFilter();
-        }
-    };
-
     // Task bar clipping, the top of this thumbnail can be clipped against the opaque header
     // bar that overlaps this thumbnail
     View mTaskBar;
@@ -105,21 +99,6 @@
     }
 
     @Override
-    protected void onFinishInflate() {
-        mThumbnailAlpha = getResources().getFloat(R.dimen.recents_task_view_thumbnail_alpha);
-        updateThumbnailPaintFilter();
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        super.onLayout(changed, left, top, right, bottom);
-        if (changed) {
-            mLayoutRect.set(0, 0, getWidth(), getHeight());
-            updateThumbnailScale();
-        }
-    }
-
-    @Override
     protected void onDraw(Canvas canvas) {
         if (mInvisible) {
             return;
@@ -136,13 +115,10 @@
             mBitmapShader = new BitmapShader(bm, Shader.TileMode.CLAMP,
                     Shader.TileMode.CLAMP);
             mDrawPaint.setShader(mBitmapShader);
-            mBitmapRect.set(0, 0, bm.getWidth(), bm.getHeight());
-            updateThumbnailScale();
         } else {
             mBitmapShader = null;
             mDrawPaint.setShader(null);
         }
-        updateThumbnailPaintFilter();
     }
 
     /** Updates the paint to draw the thumbnail. */
@@ -150,36 +126,35 @@
         if (mInvisible) {
             return;
         }
-        int mul = (int) ((1.0f - mDimAlpha) * mThumbnailAlpha * 255);
-        int add = (int) ((1.0f - mDimAlpha) * (1 - mThumbnailAlpha) * 255);
+        int mul = (int) ((1.0f - mDimAlpha) * 255);
         if (mBitmapShader != null) {
             mLightingColorFilter.setColorMultiply(Color.argb(255, mul, mul, mul));
-            mLightingColorFilter.setColorAdd(Color.argb(0, add, add, add));
             mDrawPaint.setColorFilter(mLightingColorFilter);
             mDrawPaint.setColor(0xffffffff);
         } else {
-            int grey = mul + add;
+            int grey = mul;
             mDrawPaint.setColorFilter(null);
             mDrawPaint.setColor(Color.argb(255, grey, grey, grey));
         }
         invalidate();
     }
 
-    /** Updates the thumbnail shader's scale transform. */
-    void updateThumbnailScale() {
+    /**
+     * Sets the scale of the bitmap relative to this view.
+     */
+    public void setBitmapScale(float scale) {
         if (mBitmapShader != null) {
-            if (mTask.isFreeformTask()) {
-                // For freeform tasks, we scale the bitmap rect to fit in the layout rect
-                mBitmapScale = Math.min(mLayoutRect.width() / mBitmapRect.width(),
-                        mLayoutRect.height() / mBitmapRect.height());
-            } else {
-                // For stack tasks, we scale the bitmap to fit the width
-                mBitmapScale = Math.max(1f, mLayoutRect.width() / mBitmapRect.width());
-            }
-
+            mBitmapScale = scale;
             mScaleMatrix.setScale(mBitmapScale, mBitmapScale);
             mBitmapShader.setLocalMatrix(mScaleMatrix);
         }
+        if (!mInvisible) {
+            invalidate();
+        }
+    }
+
+    public float getBitmapScale() {
+        return mBitmapScale;
     }
 
     /** Updates the clip rect based on the given task bar. */
@@ -214,7 +189,6 @@
 
     /** Binds the thumbnail view to the task */
     void rebindToTask(Task t) {
-        mTask = t;
         if (t.thumbnail != null) {
             setThumbnail(t.thumbnail);
         } else {
@@ -224,70 +198,6 @@
 
     /** Unbinds the thumbnail view from the task */
     void unbindFromTask() {
-        mTask = null;
         setThumbnail(null);
     }
-
-    /** Handles focus changes. */
-    void onFocusChanged(boolean focused) {
-        if (focused) {
-            if (Float.compare(getAlpha(), 1f) != 0) {
-                startFadeAnimation(1f, 150, null);
-            }
-        } else {
-            float taskViewThumbnailAlpha = getResources().getFloat(
-                    R.dimen.recents_task_view_thumbnail_alpha);
-            if (Float.compare(getAlpha(), taskViewThumbnailAlpha) != 0) {
-                startFadeAnimation(taskViewThumbnailAlpha, 150, null);
-            }
-        }
-    }
-
-    /**
-     * Prepares for the enter recents animation, this gets called before the the view
-     * is first visible and will be followed by a startEnterRecentsAnimation() call.
-     */
-    void prepareEnterRecentsAnimation(boolean isTaskViewLaunchTargetTask) {
-        if (isTaskViewLaunchTargetTask) {
-            mThumbnailAlpha = 1f;
-        } else {
-            mThumbnailAlpha = getResources().getFloat(
-                    R.dimen.recents_task_view_thumbnail_alpha);
-        }
-        updateThumbnailPaintFilter();
-    }
-
-    /** Animates this task thumbnail as it enters Recents. */
-    void startEnterRecentsAnimation(Runnable postAnimRunnable) {
-        float taskViewThumbnailAlpha = getResources().getFloat(
-                R.dimen.recents_task_view_thumbnail_alpha);
-        startFadeAnimation(taskViewThumbnailAlpha,
-                getResources().getInteger(R.integer.recents_task_enter_from_app_duration),
-                postAnimRunnable);
-    }
-
-    /** Animates this task thumbnail as it exits Recents. */
-    void startLaunchTaskAnimation(Runnable postAnimRunnable) {
-        int taskViewExitToAppDuration = mContext.getResources().getInteger(
-                R.integer.recents_task_exit_to_app_duration);
-        startFadeAnimation(1f, taskViewExitToAppDuration, postAnimRunnable);
-    }
-
-    /** Starts a new thumbnail alpha animation. */
-    void startFadeAnimation(float finalAlpha, int duration, final Runnable postAnimRunnable) {
-        Utilities.cancelAnimationWithoutCallbacks(mThumbnailAlphaAnimator);
-        mThumbnailAlphaAnimator = ValueAnimator.ofFloat(mThumbnailAlpha, finalAlpha);
-        mThumbnailAlphaAnimator.setDuration(duration);
-        mThumbnailAlphaAnimator.setInterpolator(mFastOutSlowInInterpolator);
-        mThumbnailAlphaAnimator.addUpdateListener(mThumbnailAlphaUpdateListener);
-        if (postAnimRunnable != null) {
-            mThumbnailAlphaAnimator.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    postAnimRunnable.run();
-                }
-            });
-        }
-        mThumbnailAlphaAnimator.start();
-    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
index 174ff33..c3e0906 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
@@ -18,19 +18,28 @@
 
 import android.animation.ValueAnimator;
 import android.graphics.RectF;
-import android.view.View;
 import android.view.ViewPropertyAnimator;
 import android.view.animation.Interpolator;
 
 
 /* The transform state for a task view */
 public class TaskViewTransform {
+
+    // TODO: Move this out of the transform
     public int startDelay = 0;
+
     public int translationX = 0;
     public int translationY = 0;
     public float translationZ = 0;
     public float scale = 1f;
     public float alpha = 1f;
+
+    // Clip and thumbnail scale are untransformed layout-space properties
+    // The bottom clip is only used for freeform workspace tasks
+    public int clipBottom = 0;
+    public int clipRight = 0;
+    public float thumbnailScale = 1f;
+
     public boolean visible = false;
     float p = 0f;
 
@@ -42,18 +51,6 @@
         // Do nothing
     }
 
-    public TaskViewTransform(TaskViewTransform o) {
-        startDelay = o.startDelay;
-        translationX = o.translationX;
-        translationY = o.translationY;
-        translationZ = o.translationZ;
-        scale = o.scale;
-        alpha = o.alpha;
-        visible = o.visible;
-        rect.set(o.rect);
-        p = o.p;
-    }
-
     /**
      * Resets the current transform.
      */
@@ -64,6 +61,9 @@
         translationZ = 0;
         scale = 1f;
         alpha = 1f;
+        clipBottom = 0;
+        clipRight = 0;
+        thumbnailScale = 1f;
         visible = false;
         rect.setEmpty();
         p = 0f;
@@ -87,7 +87,7 @@
     }
 
     /** Applies this transform to a view. */
-    public void applyToTaskView(View v, int duration, Interpolator interp, boolean allowLayers,
+    public void applyToTaskView(TaskView v, int duration, Interpolator interp, boolean allowLayers,
             boolean allowShadows, ValueAnimator.AnimatorUpdateListener updateCallback) {
         // Check to see if any properties have changed, and update the task view
         if (duration > 0) {
@@ -122,6 +122,7 @@
             } else {
                 anim.setUpdateListener(null);
             }
+            anim.setListener(null);
             anim.setStartDelay(startDelay)
                     .setDuration(duration)
                     .setInterpolator(interp)
@@ -148,7 +149,7 @@
     }
 
     /** Reset the transform on a view. */
-    public static void reset(View v) {
+    public static void reset(TaskView v) {
         // Cancel any running animations
         v.animate().cancel();
         v.setTranslationX(0f);
@@ -157,6 +158,9 @@
         v.setScaleX(1f);
         v.setScaleY(1f);
         v.setAlpha(1f);
+        v.getViewBounds().setClipRight(0, false /* forceUpdate */);
+        v.getViewBounds().setClipBottom(0, false /* forceUpdate */);
+        v.mThumbnailView.setBitmapScale(1f);
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
index 50e010f..6ff7a3e 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
@@ -17,10 +17,14 @@
 package com.android.systemui.stackdivider;
 
 import android.content.res.Configuration;
+import android.view.IDockDividerVisibilityListener;
 import android.view.LayoutInflater;
+import android.view.View;
 
 import com.android.systemui.R;
 import com.android.systemui.SystemUI;
+import com.android.systemui.recents.Recents;
+import com.android.systemui.recents.misc.SystemServicesProxy;
 
 import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
@@ -33,6 +37,8 @@
     private int mDividerWindowWidth;
     private DividerWindowManager mWindowManager;
     private DividerView mView;
+    private DockDividerVisibilityListener mDockDividerVisibilityListener;
+    private boolean mVisible = false;
 
     @Override
     public void start() {
@@ -41,6 +47,9 @@
                 com.android.internal.R.dimen.docked_stack_divider_thickness);
         update(mContext.getResources().getConfiguration());
         putComponent(Divider.class, this);
+        mDockDividerVisibilityListener = new DockDividerVisibilityListener();
+        SystemServicesProxy ssp = Recents.getSystemServices();
+        ssp.registerDockDividerVisibilityListener(mDockDividerVisibilityListener);
     }
 
     @Override
@@ -56,6 +65,7 @@
     private void addDivider(Configuration configuration) {
         mView = (DividerView)
                 LayoutInflater.from(mContext).inflate(R.layout.docked_stack_divider, null);
+        mView.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);
         final boolean landscape = configuration.orientation == ORIENTATION_LANDSCAPE;
         final int width = landscape ? mDividerWindowWidth : MATCH_PARENT;
         final int height = landscape ? MATCH_PARENT : mDividerWindowWidth;
@@ -71,4 +81,23 @@
         removeDivider();
         addDivider(configuration);
     }
+
+    private void updateVisibility(final boolean visible) {
+        mView.post(new Runnable() {
+            @Override
+            public void run() {
+                if (mVisible != visible) {
+                    mVisible = visible;
+                    mView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
+                }
+            }
+        });
+    }
+
+    class DockDividerVisibilityListener extends IDockDividerVisibilityListener.Stub {
+        @Override
+        public void onDockDividerVisibilityChanged(boolean visible) {
+            updateVisibility(visible);
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 98f3f0c..93264ff 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -74,7 +74,7 @@
 
     private final Rect mTmpRect = new Rect();
     private final Rect mLastResizeRect = new Rect();
-    private final WindowManagerProxy mWindowManagerProxy = new WindowManagerProxy();
+    private final WindowManagerProxy mWindowManagerProxy = WindowManagerProxy.getInstance();
     private Interpolator mFastOutSlowInInterpolator;
     private final Interpolator mTouchResponseInterpolator =
             new PathInterpolator(0.3f, 0f, 0.1f, 1f);
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
index 0d3f803..58de5d5 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java
@@ -37,6 +37,8 @@
 
     private static final String TAG = "WindowManagerProxy";
 
+    private static final WindowManagerProxy sInstance = new WindowManagerProxy();
+
     @GuardedBy("mResizeRect")
     private final Rect mResizeRect = new Rect();
     private final Rect mTmpRect = new Rect();
@@ -78,6 +80,13 @@
         }
     };
 
+    private WindowManagerProxy() {
+    }
+
+    public static WindowManagerProxy getInstance() {
+        return sInstance;
+    }
+
     public void resizeDockedStack(Rect rect) {
         synchronized (mResizeRect) {
             mResizeRect.set(rect);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index 6f8cd8c..da3cd54 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -130,6 +130,7 @@
     private final int mLowPriorityColor;
     private boolean mIsBelowSpeedBump;
     private FalsingManager mFalsingManager;
+    private boolean mTrackTouch;
 
     public ActivatableNotificationView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -175,15 +176,30 @@
     };
 
     @Override
-    public boolean onTouchEvent(MotionEvent event) {
-        if (mDimmed) {
+    public boolean dispatchTouchEvent(MotionEvent event) {
+        if (mDimmed && !mActivated) {
             return handleTouchEventDimmed(event);
         } else {
-            return super.onTouchEvent(event);
+            return super.dispatchTouchEvent(event);
         }
     }
 
     @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        boolean result;
+        if (mDimmed && mActivated) {
+            result = handleTouchEventDimmed(event);
+        } else {
+            result = super.onTouchEvent(event);
+        }
+        if (mActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
+            mFalsingManager.onNotificationDoubleTap();
+            removeCallbacks(mTapTimeoutRunnable);
+        }
+        return result;
+    }
+
+    @Override
     public void drawableHotspotChanged(float x, float y) {
         if (!mDimmed){
             mBackgroundNormal.drawableHotspotChanged(x, y);
@@ -206,14 +222,15 @@
             case MotionEvent.ACTION_DOWN:
                 mDownX = event.getX();
                 mDownY = event.getY();
+                mTrackTouch = true;
                 if (mDownY > getActualHeight()) {
-                    return false;
+                    mTrackTouch = false;
                 }
                 break;
             case MotionEvent.ACTION_MOVE:
                 if (!isWithinTouchSlop(event)) {
                     makeInactive(true /* animate */);
-                    return false;
+                    mTrackTouch = false;
                 }
                 break;
             case MotionEvent.ACTION_UP:
@@ -222,23 +239,23 @@
                         makeActive();
                         postDelayed(mTapTimeoutRunnable, DOUBLETAP_TIMEOUT_MS);
                     } else {
-                        mFalsingManager.onNotificationDoubleTap();
-                        boolean performed = performClick();
-                        if (performed) {
-                            removeCallbacks(mTapTimeoutRunnable);
+                        if (!performClick()) {
+                            return false;
                         }
                     }
                 } else {
                     makeInactive(true /* animate */);
+                    mTrackTouch = false;
                 }
                 break;
             case MotionEvent.ACTION_CANCEL:
                 makeInactive(true /* animate */);
+                mTrackTouch = false;
                 break;
             default:
                 break;
         }
-        return true;
+        return mTrackTouch;
     }
 
     private void makeActive() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 723989a..3c7ff7f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -40,7 +40,6 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.ContentObserver;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.os.AsyncTask;
@@ -117,7 +116,8 @@
 
 public abstract class BaseStatusBar extends SystemUI implements
         CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener,
-        ExpandableNotificationRow.ExpansionLogger, NotificationData.Environment {
+        ExpandableNotificationRow.ExpansionLogger, NotificationData.Environment,
+        ExpandableNotificationRow.OnExpandClickListener {
     public static final String TAG = "StatusBar";
     public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
     public static final boolean MULTIUSER_DEBUG = false;
@@ -193,6 +193,7 @@
     protected IDreamManager mDreamManager;
     PowerManager mPowerManager;
     protected StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+    protected int mRowMinHeightLegacy;
     protected int mRowMinHeight;
     protected int mRowMaxHeight;
 
@@ -887,15 +888,6 @@
                 entry.row.setShowingLegacyBackground(true);
                 entry.legacy = true;
             }
-        } else {
-            // Using platform templates
-            final int color = sbn.getNotification().color;
-            if (isMediaNotification(entry)) {
-                entry.row.setTintColor(color == Notification.COLOR_DEFAULT
-                        ? mContext.getColor(
-                                R.color.notification_material_background_media_default_color)
-                        : color);
-            }
         }
 
         if (entry.icon != null) {
@@ -1299,6 +1291,22 @@
         }
     }
 
+    /**
+     * Called when the panel was layouted expanded for the first time after being collapsed.
+     */
+    public void onPanelExpandedAndLayouted() {
+        if (mState == StatusBarState.KEYGUARD) {
+            // Since the number of notifications is determined based on the height of the view, we
+            // need to update them.
+            updateRowStates();
+            mStackScroller.onHeightChanged(null, false);
+        }
+    }
+
+    @Override
+    public void onExpandClicked(View clickedView, boolean nowExpanded) {
+    }
+
     protected class H extends Handler {
         public void handleMessage(Message m) {
             switch (m.what) {
@@ -1337,7 +1345,6 @@
         PackageManager pmUser = getPackageManagerForUser(mContext,
                 entry.notification.getUser().getIdentifier());
 
-        int maxHeight = mRowMaxHeight;
         final StatusBarNotification sbn = entry.notification;
         entry.cacheContentViews(mContext, null);
 
@@ -1380,6 +1387,7 @@
                     parent, false);
             row.setExpansionLogger(this, entry.notification.getKey());
             row.setGroupManager(mGroupManager);
+            row.setOnExpandClickListener(this);
         }
 
         workAroundBadLayerDrawableOpacity(row);
@@ -1498,18 +1506,6 @@
 
             Drawable iconDrawable = StatusBarIconView.getIcon(mContext, ic);
             icon.setImageDrawable(iconDrawable);
-            if (entry.targetSdk >= Build.VERSION_CODES.LOLLIPOP
-                    || mNotificationColorUtil.isGrayscaleIcon(iconDrawable)) {
-                icon.setBackgroundResource(
-                        com.android.internal.R.drawable.notification_icon_legacy_bg);
-                int padding = mContext.getResources().getDimensionPixelSize(
-                        com.android.internal.R.dimen.notification_large_icon_circle_padding);
-                icon.setPadding(padding, padding, padding, padding);
-                if (sbn.getNotification().color != Notification.COLOR_DEFAULT) {
-                    icon.getBackground().setColorFilter(
-                            sbn.getNotification().color, PorterDuff.Mode.SRC_ATOP);
-                }
-            }
 
             if (profileBadge != null) {
                 Drawable profileDrawable = mContext.getPackageManager().getUserBadgeForDensity(
@@ -1536,11 +1532,6 @@
                         R.style.TextAppearance_Material_Notification_Parenthetical);
             }
 
-            int topPadding = Notification.Builder.calculateTopPadding(mContext,
-                    false /* hasThreeLines */,
-                    mContext.getResources().getConfiguration().fontScale);
-            title.setPadding(0, topPadding, 0, 0);
-
             contentContainerPublic.setContractedChild(publicViewLocal);
             entry.autoRedacted = true;
         }
@@ -1553,7 +1544,7 @@
             }
         }
         entry.row = row;
-        entry.row.setHeightRange(mRowMinHeight, maxHeight);
+        updateNotificationHeightRange(entry);
         entry.row.setOnActivatedListener(this);
         entry.row.setExpandable(bigContentViewLocal != null);
 
@@ -1566,11 +1557,19 @@
             row.setUserExpanded(userExpanded);
         }
         row.setUserLocked(userLocked);
-        row.setEntry(entry);
+        row.updateStatusBarNotification(entry.notification);
         applyRemoteInput(entry);
         return true;
     }
 
+    private void updateNotificationHeightRange(Entry entry) {
+        boolean customView = entry.getContentView().getId()
+                != com.android.internal.R.id.status_bar_latest_event_content;
+        boolean beforeN = entry.targetSdk < Build.VERSION_CODES.N;
+        int minHeight = customView && beforeN ? mRowMinHeightLegacy : mRowMinHeight;
+        entry.row.setHeightRange(minHeight, mRowMaxHeight);
+    }
+
     /**
      * Adds RemoteInput actions from the WearableExtender; to be removed once more apps support this
      * via first-class API.
@@ -1982,15 +1981,15 @@
     }
 
     /**
+     * @param recompute wheter the number should be recomputed
      * @return The number of notifications we show on Keyguard.
      */
-    protected abstract int getMaxKeyguardNotifications();
+    protected abstract int getMaxKeyguardNotifications(boolean recompute);
 
     /**
      * Updates expanded, dimmed and locked states of notification rows.
      */
     protected void updateRowStates() {
-        int maxKeyguardNotifications = getMaxKeyguardNotifications();
         mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
 
         ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
@@ -1998,6 +1997,10 @@
 
         int visibleNotifications = 0;
         boolean onKeyguard = mState == StatusBarState.KEYGUARD;
+        int maxNotifications = 0;
+        if (onKeyguard) {
+            maxNotifications = getMaxKeyguardNotifications(true /* recompute */);
+        }
         for (int i = 0; i < N; i++) {
             NotificationData.Entry entry = activeNotifications.get(i);
             if (onKeyguard) {
@@ -2013,7 +2016,7 @@
                     == View.VISIBLE;
             boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
             if ((isLockscreenPublicMode() && !mShowLockscreenNotifications) ||
-                    (onKeyguard && (visibleNotifications >= maxKeyguardNotifications
+                    (onKeyguard && (visibleNotifications >= maxNotifications
                             && !childWithVisibleSummary
                             || !showOnKeyguard))) {
                 entry.row.setVisibility(View.GONE);
@@ -2188,8 +2191,7 @@
         // update the contentIntent
         mNotificationClicker.register(entry.row, sbn);
 
-        entry.row.setEntry(entry);
-        entry.row.notifyContentUpdated();
+        entry.row.updateStatusBarNotification(entry.notification);
         entry.row.resetHeight();
 
         applyRemoteInput(entry);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
index 14051916..8570198 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
@@ -120,12 +120,12 @@
                 if (mLastHeight > mMinDragDistance) {
                     if (!mDraggedFarEnough) {
                         mDraggedFarEnough = true;
-                        mDragDownCallback.onThresholdReached();
+                        mDragDownCallback.onCrossedThreshold(true);
                     }
                 } else {
                     if (mDraggedFarEnough) {
                         mDraggedFarEnough = false;
-                        mDragDownCallback.onDragDownReset();
+                        mDragDownCallback.onCrossedThreshold(false);
                     }
                 }
                 return true;
@@ -236,7 +236,12 @@
          */
         boolean onDraggedDown(View startingChild, int dragLengthY);
         void onDragDownReset();
-        void onThresholdReached();
+
+        /**
+         * The user has dragged either above or below the threshold
+         * @param above whether he dragged above it
+         */
+        void onCrossedThreshold(boolean above);
         void onTouchSlopExceeded();
         void setEmptyDragAmount(float amount);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 3603900..7a94a58 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -25,16 +25,17 @@
 import android.service.notification.StatusBarNotification;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
+import android.view.NotificationHeaderView;
 import android.view.View;
 import android.view.ViewStub;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.LinearInterpolator;
 import android.widget.Chronometer;
 import android.widget.ImageView;
+import android.widget.RemoteViews;
 
 import com.android.systemui.R;
 import com.android.systemui.classifier.FalsingManager;
-import com.android.systemui.statusbar.notification.NotificationHeaderView;
 import com.android.systemui.statusbar.phone.NotificationGroupManager;
 import com.android.systemui.statusbar.stack.NotificationChildrenContainer;
 import com.android.systemui.statusbar.stack.StackScrollState;
@@ -89,22 +90,37 @@
     private boolean mIsHeadsUp;
     private boolean mLastChronometerRunning = true;
     private NotificationHeaderView mNotificationHeader;
-    private ViewStub mNotificationHeaderStub;
     private ViewStub mChildrenContainerStub;
     private NotificationGroupManager mGroupManager;
     private boolean mChildrenExpanded;
     private boolean mIsSummaryWithChildren;
     private NotificationChildrenContainer mChildrenContainer;
     private ViewStub mGutsStub;
-    private boolean mHasNotificationHeader;
     private boolean mIsSystemChildExpanded;
     private boolean mIsPinned;
     private FalsingManager mFalsingManager;
 
     private boolean mJustClicked;
-    private NotificationData.Entry mEntry;
+    private boolean mIconAnimationRunning;
     private boolean mShowNoBackground;
     private ExpandableNotificationRow mNotificationParent;
+    private OnExpandClickListener mOnExpandClickListener;
+    private OnClickListener mExpandClickListener = new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            if (mGroupManager.isSummaryOfGroup(mStatusBarNotification)) {
+                mGroupManager.toggleGroupExpansion(mStatusBarNotification);
+                mOnExpandClickListener.onExpandClicked(ExpandableNotificationRow.this,
+                        mGroupManager.isGroupExpanded(mStatusBarNotification));
+            } else {
+                boolean nowExpanded = !isExpanded();
+                setUserExpanded(nowExpanded);
+                notifyHeightChanged(true);
+                mOnExpandClickListener.onExpandClicked(ExpandableNotificationRow.this,
+                        nowExpanded);
+            }
+        }
+    };
 
     public NotificationContentView getPrivateLayout() {
         return mPrivateLayout;
@@ -117,6 +133,16 @@
     public void setIconAnimationRunning(boolean running) {
         setIconAnimationRunning(running, mPublicLayout);
         setIconAnimationRunning(running, mPrivateLayout);
+        setIconAnimationRunningForChild(running, mNotificationHeader);
+        if (mIsSummaryWithChildren) {
+            List<ExpandableNotificationRow> notificationChildren =
+                    mChildrenContainer.getNotificationChildren();
+            for (int i = 0; i < notificationChildren.size(); i++) {
+                ExpandableNotificationRow child = notificationChildren.get(i);
+                child.setIconAnimationRunning(running);
+            }
+        }
+        mIconAnimationRunning = running;
     }
 
     private void setIconAnimationRunning(boolean running, NotificationContentView layout) {
@@ -161,10 +187,17 @@
         }
     }
 
-    private void setStatusBarNotification(StatusBarNotification statusBarNotification) {
+    public void updateStatusBarNotification(StatusBarNotification statusBarNotification) {
         mStatusBarNotification = statusBarNotification;
-        mPrivateLayout.setStatusBarNotification(statusBarNotification);
+        mPrivateLayout.onNotificationUpdated(statusBarNotification);
+        mPublicLayout.onNotificationUpdated(statusBarNotification);
         updateVetoButton();
+        if (mIsSummaryWithChildren) {
+            recreateNotificationHeader();
+        }
+        if (mIconAnimationRunning) {
+            setIconAnimationRunning(true);
+        }
         onChildrenCountChanged();
     }
 
@@ -381,11 +414,6 @@
         }
     }
 
-    public void setEntry(NotificationData.Entry entry) {
-        mEntry = entry;
-        setStatusBarNotification(entry.notification);
-    }
-
     public CharSequence getSubText() {
         Notification notification = mStatusBarNotification.getNotification();
         CharSequence subText = notification.extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT);
@@ -399,6 +427,10 @@
         mPrivateLayout.setSubTextVisible(visible);
     }
 
+    public void setOnExpandClickListener(OnExpandClickListener onExpandClickListener) {
+        mOnExpandClickListener = onExpandClickListener;
+    }
+
     public interface ExpansionLogger {
         public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
     }
@@ -452,6 +484,8 @@
         super.onFinishInflate();
         mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
         mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded);
+        mPrivateLayout.setExpandClickListener(mExpandClickListener);
+        mPublicLayout.setExpandClickListener(mExpandClickListener);
         mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub);
         mGutsStub.setOnInflateListener(new ViewStub.OnInflateListener() {
             @Override
@@ -462,15 +496,6 @@
                 mGutsStub = null;
             }
         });
-        mNotificationHeaderStub = (ViewStub) findViewById(R.id.notification_header_stub);
-        mNotificationHeaderStub.setOnInflateListener(new ViewStub.OnInflateListener() {
-            @Override
-            public void onInflate(ViewStub stub, View inflated) {
-                mNotificationHeader = (NotificationHeaderView) inflated;
-                mNotificationHeader.setGroupManager(mGroupManager);
-                mNotificationHeader.bind(mEntry);
-            }
-        });
         mChildrenContainerStub = (ViewStub) findViewById(R.id.child_container_stub);
         mChildrenContainerStub.setOnInflateListener(new ViewStub.OnInflateListener() {
 
@@ -494,6 +519,7 @@
             return;
         }
         mChildrenContainer.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
+        mNotificationHeader.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
         mPrivateLayout.setVisibility(!mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
     }
 
@@ -523,6 +549,8 @@
     public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
         mRowMinHeight = rowMinHeight;
         mMaxViewHeight = rowMaxHeight;
+        mPrivateLayout.setSmallHeight(mRowMinHeight);
+        mPublicLayout.setSmallHeight(mRowMinHeight);
     }
 
     public boolean isExpandable() {
@@ -534,6 +562,7 @@
 
     public void setExpandable(boolean expandable) {
         mExpandable = expandable;
+        mPrivateLayout.updateExpandButtons(isExpandable());
     }
 
     /**
@@ -654,8 +683,7 @@
         if (mSensitive && mHideSensitiveForIntrinsicHeight) {
             return mRowMinHeight;
         } else if (mIsSummaryWithChildren && !mOnKeyguard) {
-            return mChildrenContainer.getIntrinsicHeight()
-                    + mNotificationHeader.getHeight();
+            return mChildrenContainer.getIntrinsicHeight();
         } else if (mIsHeadsUp) {
             if (inExpansionState) {
                 return Math.max(mMaxExpandHeight, mHeadsUpHeight);
@@ -681,12 +709,18 @@
     }
 
     private void onChildrenCountChanged() {
-        mIsSummaryWithChildren  = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS
+        mIsSummaryWithChildren = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS
                 && mGroupManager.hasGroupChildren(mStatusBarNotification);
-        if (mIsSummaryWithChildren && mChildrenContainer == null) {
-            mChildrenContainerStub.inflate();
+        if (mIsSummaryWithChildren) {
+            if (mChildrenContainer == null) {
+                mChildrenContainerStub.inflate();
+            }
+            if (mNotificationHeader == null) {
+                recreateNotificationHeader();
+            }
         }
-        updateNotificationHeader();
+        mPrivateLayout.updateExpandButtons(isExpandable());
+        updateHeaderChildCount();
         updateChildrenVisibility(true);
     }
 
@@ -771,6 +805,7 @@
             animateShowingPublic(delay, duration);
         }
 
+        mPrivateLayout.updateExpandButtons(isExpandable());
         updateVetoButton();
         mShowingPublicInitialized = true;
     }
@@ -811,23 +846,11 @@
         }
     }
 
-    public void updateNotificationHeader() {
-        boolean hasHeader = hasNotificationHeader();
-        if (hasHeader != mHasNotificationHeader) {
-            if (hasHeader) {
-                if (mNotificationHeader == null) {
-                    mNotificationHeaderStub.inflate();
-                }
-                mNotificationHeader.setVisibility(View.VISIBLE);
-            } else if (mNotificationHeader != null) {
-                mNotificationHeader.setVisibility(View.GONE);
-            }
-            notifyHeightChanged(true  /* needsAnimation */);
+    public void updateHeaderChildCount() {
+        if (mIsSummaryWithChildren) {
+            mNotificationHeader.setChildCount(
+                    mChildrenContainer.getNotificationChildren().size());
         }
-        if (hasHeader) {
-            mNotificationHeader.bind(mEntry);
-        }
-        mHasNotificationHeader = hasHeader;
     }
 
     public static void applyTint(View v, int color) {
@@ -876,8 +899,7 @@
     @Override
     public int getMaxContentHeight() {
         if (mIsSummaryWithChildren && !mShowingPublic) {
-            return mChildrenContainer.getMaxContentHeight()
-                    + mNotificationHeader.getHeight();
+            return mChildrenContainer.getMaxContentHeight();
         }
         NotificationContentView showingLayout = getShowingLayout();
         return showingLayout.getMaxHeight();
@@ -885,15 +907,19 @@
 
     @Override
     public int getMinHeight() {
-        if (mIsSummaryWithChildren && !mOnKeyguard) {
-            return mChildrenContainer.getMinHeight()
-                    + mNotificationHeader.getHeight();
-        }
         NotificationContentView showingLayout = getShowingLayout();
         return showingLayout.getMinHeight();
     }
 
     @Override
+    public int getMinExpandHeight() {
+        if (mIsSummaryWithChildren && !mOnKeyguard) {
+            return mChildrenContainer.getMinHeight();
+        }
+        return getMinHeight();
+    }
+
+    @Override
     protected boolean shouldLimitViewHeight() {
         return !mIsSummaryWithChildren;
     }
@@ -908,9 +934,21 @@
         }
     }
 
-    public void notifyContentUpdated() {
-        mPublicLayout.notifyContentUpdated();
-        mPrivateLayout.notifyContentUpdated();
+    private void recreateNotificationHeader() {
+        final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(),
+                getStatusBarNotification().getNotification());
+        final RemoteViews header = builder.makeNotificationHeader();
+        if (mNotificationHeader == null) {
+            mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this);
+            final View expandButton = mNotificationHeader.findViewById(
+                    com.android.internal.R.id.expand_button);
+            expandButton.setVisibility(VISIBLE);
+            mNotificationHeader.setOnClickListener(mExpandClickListener);
+            addView(mNotificationHeader);
+        } else {
+            header.reapply(getContext(), mNotificationHeader);
+        }
+        updateHeaderChildCount();
     }
 
     public boolean isMaxExpandHeightInitialized() {
@@ -958,4 +996,8 @@
             mLogger.logNotificationExpansion(mLoggingKey, userAction, nowExpanded) ;
         }
     }
+
+    public interface OnExpandClickListener {
+        void onExpandClicked(View clickedView, boolean nowExpanded);
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index af59ac7..51602e7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -195,6 +195,15 @@
     }
 
     /**
+     * @return The minimum height this child chan be expanded to. Note that this might be different
+     * than {@link #getMinHeight()} because some elements can't be collapsed by an expand gesture
+     * to it's absolute minimal height
+     */
+    public int getMinExpandHeight() {
+        return getHeight();
+    }
+
+    /**
      * Sets the notification as dimmed. The default implementation does nothing.
      *
      * @param dimmed Whether the notification should be dimmed.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 6d13947..71904fa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -48,8 +48,8 @@
  */
 public class KeyguardIndicationController {
 
-    private static final String TAG = "KeyguardIndicationController";
-    private static final boolean DEBUG_CHARGING_CURRENT = false;
+    private static final String TAG = "KeyguardIndication";
+    private static final boolean DEBUG_CHARGING_SPEED = false;
 
     private static final int MSG_HIDE_TRANSIENT = 1;
     private static final int MSG_CLEAR_FP_MSG = 2;
@@ -72,7 +72,7 @@
     private boolean mPowerPluggedIn;
     private boolean mPowerCharged;
     private int mChargingSpeed;
-    private int mChargingCurrent;
+    private int mChargingWattage;
     private String mMessageToShowOnScreenOn;
 
     public KeyguardIndicationController(Context context, KeyguardIndicationTextView textView,
@@ -173,8 +173,8 @@
         }
         if (mPowerPluggedIn) {
             String indication = computePowerIndication();
-            if (DEBUG_CHARGING_CURRENT) {
-                indication += ",  " + (mChargingCurrent / 1000) + " mA";
+            if (DEBUG_CHARGING_SPEED) {
+                indication += ",  " + (mChargingWattage / 1000) + " mW";
             }
             return indication;
         }
@@ -231,7 +231,7 @@
                     || status.status == BatteryManager.BATTERY_STATUS_FULL;
             mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull;
             mPowerCharged = status.isCharged();
-            mChargingCurrent = status.maxChargingCurrent;
+            mChargingWattage = status.maxChargingWattage;
             mChargingSpeed = status.getChargingSpeed(mSlowThreshold, mFastThreshold);
             updateIndication();
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java
deleted file mode 100644
index 91e5404..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui.statusbar;
-
-import android.content.Context;
-import android.view.View;
-
-/**
- * Wraps a big media narrow notification template layout.
- */
-public class NotificationBigMediaNarrowViewWrapper extends NotificationMediaViewWrapper {
-
-    protected NotificationBigMediaNarrowViewWrapper(Context ctx,
-            View view) {
-        super(ctx, view);
-    }
-
-    @Override
-    public boolean needsRoundRectClipping() {
-        return true;
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java
deleted file mode 100644
index ffe0cd1..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui.statusbar;
-
-import android.content.Context;
-import android.view.View;
-
-/**
- * Wraps a notification view inflated from a big picture style template.
- */
-public class NotificationBigPictureViewWrapper extends NotificationTemplateViewWrapper {
-
-    protected NotificationBigPictureViewWrapper(Context ctx, View view) {
-        super(ctx, view);
-    }
-
-    @Override
-    public boolean needsRoundRectClipping() {
-        return true;
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 5aedaf1..fb8086c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -24,6 +24,7 @@
 import android.graphics.Rect;
 import android.service.notification.StatusBarNotification;
 import android.util.AttributeSet;
+import android.view.NotificationHeaderView;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewOutlineProvider;
@@ -52,7 +53,6 @@
 
     private final Rect mClipBounds = new Rect();
     private final int mSingleLineHeight;
-    private final int mSmallHeight;
     private final int mHeadsUpHeight;
     private final int mRoundRectRadius;
     private final Interpolator mLinearInterpolator = new LinearInterpolator();
@@ -77,7 +77,9 @@
     private boolean mIsHeadsUp;
     private boolean mShowingLegacyBackground;
     private boolean mIsChildInGroup;
+    private int mSmallHeight;
     private StatusBarNotification mStatusBarNotification;
+    private NotificationGroupManager mGroupManager;
 
     private final ViewTreeObserver.OnPreDrawListener mEnableAnimationPredrawListener
             = new ViewTreeObserver.OnPreDrawListener() {
@@ -96,7 +98,7 @@
                     mRoundRectRadius);
         }
     };
-    private NotificationGroupManager mGroupManager;
+    private OnClickListener mExpandClickListener;
 
     public NotificationContentView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -104,7 +106,6 @@
         mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
         mSingleLineHeight = getResources().getDimensionPixelSize(
                 R.dimen.notification_single_line_height);
-        mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
         mHeadsUpHeight = getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
         mRoundRectRadius = getResources().getDimensionPixelSize(
                 R.dimen.notification_material_rounded_rect_radius);
@@ -114,6 +115,10 @@
         setOutlineProvider(mOutlineProvider);
     }
 
+    public void setSmallHeight(int smallHeight) {
+        mSmallHeight = smallHeight;
+    }
+
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         int heightMode = MeasureSpec.getMode(heightMeasureSpec);
@@ -426,6 +431,11 @@
      */
     private int calculateVisibleType() {
         boolean noExpandedChild = mExpandedChild == null;
+
+        if (!noExpandedChild && mContentHeight == mExpandedChild.getHeight()) {
+            return VISIBLE_TYPE_EXPANDED;
+        }
+
         if (mIsHeadsUp && mHeadsUpChild != null) {
             if (mContentHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
                 return VISIBLE_TYPE_HEADSUP;
@@ -443,19 +453,6 @@
         }
     }
 
-    public void notifyContentUpdated() {
-        updateSingleLineView();
-        selectLayout(false /* animate */, true /* force */);
-        if (mContractedChild != null) {
-            mContractedWrapper.notifyContentUpdated();
-            mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
-        }
-        if (mExpandedChild != null) {
-            mExpandedWrapper.notifyContentUpdated();
-        }
-        updateRoundRectClipping();
-    }
-
     public boolean isContentExpandable() {
         return mExpandedChild != null;
     }
@@ -488,9 +485,21 @@
         updateSingleLineView();
     }
 
-    public void setStatusBarNotification(StatusBarNotification statusBarNotification) {
+    public void onNotificationUpdated(StatusBarNotification statusBarNotification) {
         mStatusBarNotification = statusBarNotification;
         updateSingleLineView();
+        selectLayout(false /* animate */, true /* force */);
+        if (mContractedChild != null) {
+            mContractedWrapper.notifyContentUpdated();
+            mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
+        }
+        if (mExpandedChild != null) {
+            mExpandedWrapper.notifyContentUpdated();
+        }
+        if (mHeadsUpChild != null) {
+            mHeadsUpWrapper.notifyContentUpdated();
+        }
+        updateRoundRectClipping();
     }
 
     private void updateSingleLineView() {
@@ -515,4 +524,20 @@
     public void setGroupManager(NotificationGroupManager groupManager) {
         mGroupManager = groupManager;
     }
+
+    public void setExpandClickListener(OnClickListener expandClickListener) {
+        mExpandClickListener = expandClickListener;
+    }
+
+    public void updateExpandButtons(boolean expandable) {
+        if (mExpandedChild != null) {
+            mExpandedWrapper.updateExpandability(expandable, mExpandClickListener);
+        }
+        if (mContractedChild != null) {
+            mContractedWrapper.updateExpandability(expandable, mExpandClickListener);
+        }
+        if (mHeadsUpChild != null) {
+            mHeadsUpWrapper.updateExpandability(expandable,  mExpandClickListener);
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 83dbde5..89edae3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -59,6 +59,7 @@
         public RemoteViews cachedBigContentView;
         public RemoteViews cachedHeadsUpContentView;
         public RemoteViews cachedPublicContentView;
+        public CharSequence remoteInputText;
 
         public Entry(StatusBarNotification n, StatusBarIconView ic) {
             this.key = n.getKey();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaViewWrapper.java
deleted file mode 100644
index 953c373..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaViewWrapper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.statusbar;
-
-import android.content.Context;
-import android.view.View;
-
-/**
- * Wraps a media notification.
- */
-public class NotificationMediaViewWrapper extends NotificationTemplateViewWrapper {
-
-    protected NotificationMediaViewWrapper(Context ctx, View view) {
-        super(ctx, view);
-    }
-
-    @Override
-    public void setDark(boolean dark, boolean fade, long delay) {
-
-        // Only update the large icon, because the rest is already inverted.
-        setPictureGrayscale(dark, fade, delay);
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
index af6ccd8..f20ccd5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
@@ -20,24 +20,32 @@
 import android.animation.AnimatorListenerAdapter;
 import android.animation.ValueAnimator;
 import android.content.Context;
+import android.content.res.ColorStateList;
 import android.graphics.Color;
 import android.graphics.ColorFilter;
 import android.graphics.ColorMatrix;
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
+import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
+import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 import android.widget.ImageView;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.android.systemui.R;
 import com.android.systemui.ViewInvertHelper;
 import com.android.systemui.statusbar.phone.NotificationPanelView;
 
+import java.util.ArrayList;
+
 /**
  * Wraps a notification view inflated from a template.
  */
@@ -47,69 +55,64 @@
     private final PorterDuffColorFilter mIconColorFilter = new PorterDuffColorFilter(
             0, PorterDuff.Mode.SRC_ATOP);
     private final int mIconDarkAlpha;
-    private final int mIconBackgroundDarkColor;
+    private final int mIconDarkColor = 0xffffffff;
+    private final int mDarkProgressTint = 0xffffffff;
     private final Interpolator mLinearOutSlowInInterpolator;
 
-    private int mIconBackgroundColor;
+    private int mColor;
     private ViewInvertHelper mInvertHelper;
     private ImageView mIcon;
     protected ImageView mPicture;
 
-    /** Whether the icon needs to be forced grayscale when in dark mode. */
-    private boolean mIconForceGraysaleWhenDark;
     private TextView mSubText;
-    private TextView mInfoText;
-    private View mProfileBadge;
-    private View mThirdLineDivider;
-    private View mThirdLine;
+    private View mSubTextDivider;
+    private ImageView mExpandButton;
+    private ViewGroup mNotificationHeader;
+    private ProgressBar mProgressBar;
 
     protected NotificationTemplateViewWrapper(Context ctx, View view) {
         super(view);
         mIconDarkAlpha = ctx.getResources().getInteger(R.integer.doze_small_icon_alpha);
-        mIconBackgroundDarkColor =
-                ctx.getColor(R.color.doze_small_icon_background_color);
         mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(ctx,
                 android.R.interpolator.linear_out_slow_in);
+
         resolveViews();
     }
 
     private void resolveViews() {
         View mainColumn = mView.findViewById(com.android.internal.R.id.notification_main_column);
-        mInvertHelper = mainColumn != null
-                ? new ViewInvertHelper(mainColumn, NotificationPanelView.DOZE_ANIMATION_DURATION)
-                : null;
-        ImageView largeIcon = (ImageView) mView.findViewById(com.android.internal.R.id.icon);
-        ImageView rightIcon = (ImageView) mView.findViewById(com.android.internal.R.id.right_icon);
-        mIcon = resolveIcon(largeIcon, rightIcon);
-        mPicture = resolvePicture(largeIcon);
-        mIconBackgroundColor = resolveBackgroundColor(mIcon);
-        mSubText = (TextView) mView.findViewById(com.android.internal.R.id.text);
-        mInfoText = (TextView) mView.findViewById(com.android.internal.R.id.info);
-        mProfileBadge = mView.findViewById(com.android.internal.R.id.profile_badge_line3);
-        mThirdLineDivider = mView.findViewById(com.android.internal.R.id.overflow_divider);
-        mThirdLine = mView.findViewById(com.android.internal.R.id.line3);
-
-        // If the icon already has a color filter, we assume that we already forced the icon to be
-        // white when we created the notification.
-        final Drawable iconDrawable = mIcon != null ? mIcon.getDrawable() : null;
-        mIconForceGraysaleWhenDark = iconDrawable != null && iconDrawable.getColorFilter() != null;
+        mIcon = (ImageView) mView.findViewById(com.android.internal.R.id.icon);
+        mPicture = (ImageView) mView.findViewById(com.android.internal.R.id.right_icon);
+        mSubText = (TextView) mView.findViewById(com.android.internal.R.id.header_sub_text);
+        mSubTextDivider = mView.findViewById(com.android.internal.R.id.sub_text_divider);
+        mExpandButton = (ImageView) mView.findViewById(com.android.internal.R.id.expand_button);
+        mColor = resolveColor(mExpandButton);
+        final View progress = mView.findViewById(com.android.internal.R.id.progress);
+        if (progress instanceof ProgressBar) {
+            mProgressBar = (ProgressBar) progress;
+        } else {
+            // It's still a viewstub
+            mProgressBar = null;
+        }
+        mNotificationHeader = (ViewGroup) mView.findViewById(
+                com.android.internal.R.id.notification_header);
+        ArrayList<View> viewsToInvert = new ArrayList<>();
+        if (mainColumn != null) {
+            viewsToInvert.add(mainColumn);
+        }
+        for (int i = 0; i < mNotificationHeader.getChildCount(); i++) {
+            View child = mNotificationHeader.getChildAt(i);
+            if (child != mIcon) {
+                viewsToInvert.add(child);
+            }
+        }
+        mInvertHelper = new ViewInvertHelper(viewsToInvert,
+                NotificationPanelView.DOZE_ANIMATION_DURATION);
     }
 
-    private ImageView resolveIcon(ImageView largeIcon, ImageView rightIcon) {
-        return largeIcon != null && largeIcon.getBackground() != null ? largeIcon
-                : rightIcon != null && rightIcon.getVisibility() == View.VISIBLE ? rightIcon
-                : null;
-    }
-
-    private ImageView resolvePicture(ImageView largeIcon) {
-        return largeIcon != null && largeIcon.getBackground() == null
-                ? largeIcon
-                : null;
-    }
-
-    private int resolveBackgroundColor(ImageView icon) {
-        if (icon != null && icon.getBackground() != null) {
-            ColorFilter filter = icon.getBackground().getColorFilter();
+    private int resolveColor(ImageView icon) {
+        if (icon != null && icon.getDrawable() != null) {
+            ColorFilter filter = icon.getDrawable().getColorFilter();
             if (filter instanceof PorterDuffColorFilter) {
                 return ((PorterDuffColorFilter) filter).getColor();
             }
@@ -138,18 +141,43 @@
             if (fade) {
                 fadeIconColorFilter(mIcon, dark, delay);
                 fadeIconAlpha(mIcon, dark, delay);
-                if (!mIconForceGraysaleWhenDark) {
-                    fadeGrayscale(mIcon, dark, delay);
-                }
             } else {
                 updateIconColorFilter(mIcon, dark);
                 updateIconAlpha(mIcon, dark);
-                if (!mIconForceGraysaleWhenDark) {
-                    updateGrayscale(mIcon, dark);
-                }
             }
         }
         setPictureGrayscale(dark, fade, delay);
+        setProgressBarDark(dark, fade, delay);
+    }
+
+    private void setProgressBarDark(boolean dark, boolean fade, long delay) {
+        if (mProgressBar != null) {
+            if (fade) {
+                fadeProgressDark(mProgressBar, dark, delay);
+            } else {
+                updateProgressDark(mProgressBar, dark);
+            }
+        }
+    }
+
+    private void fadeProgressDark(final ProgressBar target, final boolean dark, long delay) {
+        startIntensityAnimation(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator animation) {
+                float t = (float) animation.getAnimatedValue();
+                updateProgressDark(target, t);
+            }
+        }, dark, delay, null /* listener */);
+    }
+
+    private void updateProgressDark(ProgressBar target, float intensity) {
+        int color = interpolateColor(mColor, mDarkProgressTint, intensity);
+        target.getIndeterminateDrawable().mutate().setTint(color);
+        target.getProgressDrawable().mutate().setTint(color);
+    }
+
+    private void updateProgressDark(ProgressBar target, boolean dark) {
+        updateProgressDark(target, dark ? 1f : 0f);
     }
 
     protected void setPictureGrayscale(boolean grayscale, boolean fade, long delay) {
@@ -218,14 +246,14 @@
     }
 
     private void updateIconColorFilter(ImageView target, float intensity) {
-        int color = interpolateColor(mIconBackgroundColor, mIconBackgroundDarkColor, intensity);
+        int color = interpolateColor(mColor, mIconDarkColor, intensity);
         mIconColorFilter.setColor(color);
-        Drawable background = target.getBackground();
+        Drawable iconDrawable = target.getDrawable();
 
-        // The background might be null for legacy notifications. Also, the notification might have
-        // been modified during the animation, so background might be null here.
-        if (background != null) {
-            background.mutate().setColorFilter(mIconColorFilter);
+        // Also, the notification might have been modified during the animation, so background
+        // might be null here.
+        if (iconDrawable != null) {
+            iconDrawable.mutate().setColorFilter(mIconColorFilter);
         }
     }
 
@@ -250,33 +278,17 @@
         boolean subTextAvailable = !TextUtils.isEmpty(mSubText.getText());
         if (visible && subTextAvailable) {
             mSubText.setVisibility(View.VISIBLE);
+            mSubTextDivider.setVisibility(View.VISIBLE);
         } else {
             mSubText.setVisibility(View.GONE);
+            mSubTextDivider.setVisibility(View.GONE);
         }
-        // TODO: figure out what to do with the number (same place as contentInfo)
-        // work profile badge. For now we hide it since it looks nicer.
-        boolean infoAvailable = !TextUtils.isEmpty(mInfoText.getText());
-        if (visible && infoAvailable) {
-            mInfoText.setVisibility(View.VISIBLE);
-        } else {
-            mInfoText.setVisibility(View.GONE);
-        }
-        boolean showThirdLine = (visible && (infoAvailable || subTextAvailable))
-                || mProfileBadge.getVisibility() == View.VISIBLE;
-        if (mThirdLineDivider != null) {
-            if (showThirdLine) {
-                mThirdLineDivider.setVisibility(View.VISIBLE);
-            } else {
-                mThirdLineDivider.setVisibility(View.GONE);
-            }
-        }
-        if (mThirdLine != null) {
-            if (showThirdLine) {
-                mThirdLine.setVisibility(View.VISIBLE);
-            } else {
-                mThirdLine.setVisibility(View.GONE);
-            }
-        }
+    }
+
+    @Override
+    public void updateExpandability(boolean expandable, View.OnClickListener onClickListener) {
+        mExpandButton.setVisibility(expandable ? View.VISIBLE : View.GONE);
+        mNotificationHeader.setOnClickListener(expandable ? onClickListener : null);
     }
 
     private void updateGrayscaleMatrix(float intensity) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
index 9bce548..e83ecb7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
@@ -34,15 +34,7 @@
 
     public static NotificationViewWrapper wrap(Context ctx, View v) {
         if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
-            if (TAG_BIG_MEDIA_NARROW.equals(v.getTag())) {
-                return new NotificationBigMediaNarrowViewWrapper(ctx, v);
-            } else if (TAG_MEDIA.equals(v.getTag())) {
-                return new NotificationMediaViewWrapper(ctx, v);
-            } else if (TAG_BIG_PICTURE.equals(v.getTag())) {
-                return new NotificationBigMediaNarrowViewWrapper(ctx, v);
-            } else {
-                return new NotificationTemplateViewWrapper(ctx, v);
-            }
+            return new NotificationTemplateViewWrapper(ctx, v);
         } else {
             return new NotificationCustomViewWrapper(v);
         }
@@ -83,4 +75,12 @@
     public void setSubTextVisible(boolean visible) {
         mSubTextVisible = visible;
     }
+
+    /**
+     * Update the appearance of the expand button.
+     *
+     * @param expandable should this view be expandable
+     * @param onClickListener the listener to invoke when the expand affordance is clicked on
+     */
+    public void updateExpandability(boolean expandable, View.OnClickListener onClickListener) {}
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderView.java
deleted file mode 100644
index ec26cc4..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderView.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.systemui.statusbar.notification;
-
-import android.annotation.Nullable;
-import android.app.Notification;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.graphics.drawable.Drawable;
-import android.service.notification.StatusBarNotification;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.android.internal.util.NotificationColorUtil;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.ExpandableNotificationRow;
-import com.android.systemui.statusbar.NotificationData;
-import com.android.systemui.statusbar.phone.NotificationGroupManager;
-
-import java.util.List;
-
-/**
- * A header for a notification view
- */
-public class NotificationHeaderView extends FrameLayout {
-
-    private static final int DEFAULT_ICON_TINT_COLOR = 0xff616161;
-    private final NotificationColorUtil mNotificationColorUtil;
-    private NotificationData.Entry mNotificationEntry;
-    private ImageView mIconView;
-    private TextView mAppName;
-    private TextView mPostTime;
-    private TextView mChildCount;
-    private TextView mSubTextDivider;
-    private TextView mSubText;
-    private NotificationGroupManager mGroupManager;
-    private ImageButton mExpandButton;
-
-    public NotificationHeaderView(Context context) {
-        this(context, null);
-    }
-
-    public NotificationHeaderView(Context context, @Nullable AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public NotificationHeaderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
-        this(context, attrs, defStyleAttr, 0);
-    }
-
-    public NotificationHeaderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
-            int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-        mNotificationColorUtil = NotificationColorUtil.getInstance(context);
-    }
-
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-        mIconView = (ImageView) findViewById(R.id.header_notification_icon);
-        mAppName = (TextView) findViewById(R.id.app_name_text);
-        mSubTextDivider = (TextView) findViewById(R.id.app_title_sub_text_divider);
-        mSubText = (TextView) findViewById(R.id.title_sub_text);
-        mPostTime = (TextView) findViewById(R.id.post_time);
-        mChildCount = (TextView) findViewById(R.id.number_of_children);
-        mExpandButton = (ImageButton) findViewById(R.id.notification_expand_button);
-        mExpandButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mGroupManager.toggleGroupExpansion(mNotificationEntry.notification);
-            }
-        });
-    }
-
-    public void bind(NotificationData.Entry notificationEntry) {
-        mNotificationEntry = notificationEntry;
-        StatusBarNotification sbn = notificationEntry.notification;
-        int notificationColor = getNotificationColor(sbn);
-        bindIcon(notificationColor);
-        bindNumber(notificationColor);
-        bindAppName(sbn);
-        bindSubText();
-        bindTime(sbn);
-        bindExpandButton(sbn);
-    }
-
-    private void bindExpandButton(StatusBarNotification sbn) {
-        boolean summaryOfGroup = mGroupManager.isSummaryOfGroup(sbn);
-        mExpandButton.setVisibility(summaryOfGroup ? VISIBLE : GONE);
-    }
-
-    private void bindSubText() {
-        List<ExpandableNotificationRow> notificationChildren =
-                mNotificationEntry.row.getNotificationChildren();
-        CharSequence subText = null;
-        if (notificationChildren != null) {
-            for (int i = 0; i < notificationChildren.size(); i++) {
-                ExpandableNotificationRow row = notificationChildren.get(i);
-                CharSequence rowSubText = row.getSubText();
-                if (TextUtils.isEmpty(rowSubText)
-                        || (subText != null && !subText.equals(rowSubText))) {
-                    // The children don't have a common subText
-                    subText = null;
-                    break;
-                } else if (subText == null) {
-                    subText = rowSubText;
-                }
-            }
-        };
-        setSubText(subText);
-    }
-
-    private void setSubText(CharSequence subText) {
-        boolean goneInHeader = TextUtils.isEmpty(subText);
-        if (goneInHeader) {
-            mSubText.setVisibility(GONE);
-            mSubTextDivider.setVisibility(GONE);
-        } else {
-            mSubText.setVisibility(VISIBLE);
-            mSubText.setText(subText);
-            mSubTextDivider.setVisibility(VISIBLE);
-        }
-        List<ExpandableNotificationRow> notificationChildren =
-                mNotificationEntry.row.getNotificationChildren();
-        if (notificationChildren != null) {
-            for (int i = 0; i < notificationChildren.size(); i++) {
-                ExpandableNotificationRow row = notificationChildren.get(i);
-                row.setContentSubTextVisible(goneInHeader);
-            }
-        }
-    }
-
-    private int getNotificationColor(StatusBarNotification sbn) {
-        int color = sbn.getNotification().color;
-        if (color == Notification.COLOR_DEFAULT) {
-            return DEFAULT_ICON_TINT_COLOR;
-        }
-        return color;
-    }
-
-    private void bindNumber(int notificationColor) {
-        int numberOfNotificationChildren = mNotificationEntry.row.getNumberOfNotificationChildren();
-        boolean visible = numberOfNotificationChildren > 0;
-        if (visible) {
-            mChildCount.setText("(" + numberOfNotificationChildren + ")");
-            mChildCount.setTextColor(notificationColor);
-            mChildCount.setVisibility(VISIBLE);
-        } else {
-            mChildCount.setVisibility(GONE);
-        }
-    }
-
-    private void bindTime(StatusBarNotification sbn) {
-
-    }
-
-    private void bindIcon(int notificationColor) {
-        Drawable icon = mNotificationEntry.icon.getDrawable().getConstantState()
-                .newDrawable(getResources()).mutate();
-        mIconView.setImageDrawable(icon);
-        if (NotificationUtils.isGrayscale(mIconView, mNotificationColorUtil)) {
-            icon.setTint(notificationColor);
-        }
-    }
-
-    private void bindAppName(StatusBarNotification sbn) {
-        PackageManager pmUser = BaseStatusBar.getPackageManagerForUser(getContext(),
-                sbn.getUser().getIdentifier());
-        final String pkg = sbn.getPackageName();
-        String appname = pkg;
-        try {
-            final ApplicationInfo info = pmUser.getApplicationInfo(pkg,
-                    PackageManager.GET_UNINSTALLED_PACKAGES
-                            | PackageManager.GET_DISABLED_COMPONENTS);
-            if (info != null) {
-                appname = String.valueOf(pmUser.getApplicationLabel(info));
-
-            }
-        } catch (PackageManager.NameNotFoundException e) {
-            // app is gone, just show package name
-        }
-        mAppName.setText(appname);
-    }
-
-    public void setGroupManager(NotificationGroupManager groupManager) {
-        mGroupManager = groupManager;
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
index 1601b83..a3f404a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
@@ -146,7 +146,8 @@
                 mWarning = 0xffff0000;
             } else {
                 mOpaque = context.getColor(R.color.system_bar_background_opaque);
-                mSemiTransparent = context.getColor(R.color.system_bar_background_semi_transparent);
+                mSemiTransparent = context.getColor(
+                        com.android.internal.R.color.system_bar_background_semi_transparent);
                 mTransparent = context.getColor(R.color.system_bar_background_transparent);
                 mWarning = context.getColor(com.android.internal.R.color.battery_saver_mode_color);
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index a15d35e..784cb48 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -96,6 +96,11 @@
         mEmptyDragAmount = emptyDragAmount;
     }
 
+    public float getMinStackScrollerPadding(int height, int keyguardStatusHeight) {
+        return mClockYFractionMin * height + keyguardStatusHeight / 2
+                + mClockNotificationsMarginMin;
+    }
+
     public void run(Result result) {
         int y = getClockY() - mKeyguardStatusHeight / 2;
         float clockAdjustment = getClockYExpansionAdjustment();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
index d91bfb9..a2616fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
@@ -16,30 +16,29 @@
 
 package com.android.systemui.statusbar.phone;
 
+import android.app.ActivityManager;
 import android.content.Context;
-import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Rect;
-import android.os.SystemProperties;
 import android.view.GestureDetector;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
 import android.view.ViewConfiguration;
-import android.view.WindowManager;
 
 import com.android.systemui.R;
 import com.android.systemui.RecentsComponent;
 import com.android.systemui.stackdivider.Divider;
-import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.tuner.TunerService;
 
 import static android.view.WindowManager.*;
 
 /**
  * Class to detect gestures on the navigation bar.
  */
-public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener {
+public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener
+        implements TunerService.Tunable {
 
-    private static final String DOCK_WINDOW_GESTURE_ENABLED_PROP = "persist.dock_gesture_enabled";
+    private static final String KEY_DOCK_WINDOW_GESTURE = "overview_nav_bar_gesture";
 
     /**
      * When dragging from the navigation bar, we drag in recents.
@@ -53,6 +52,7 @@
 
     private RecentsComponent mRecentsComponent;
     private Divider mDivider;
+    private Context mContext;
     private boolean mIsVertical;
     private boolean mIsRTL;
 
@@ -69,13 +69,14 @@
     private int mDragMode;
 
     public NavigationBarGestureHelper(Context context) {
+        mContext = context;
         ViewConfiguration configuration = ViewConfiguration.get(context);
         Resources r = context.getResources();
         mScrollTouchSlop = r.getDimensionPixelSize(R.dimen.navigation_bar_min_swipe_distance);
         mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
         mMinFlingVelocity = configuration.getScaledMinimumFlingVelocity();
         mTaskSwitcherDetector = new GestureDetector(context, this);
-        mDockWindowEnabled = SystemProperties.getBoolean(DOCK_WINDOW_GESTURE_ENABLED_PROP, false);
+        TunerService.get(context).addTunable(this, KEY_DOCK_WINDOW_GESTURE);
     }
 
     public void setComponents(RecentsComponent recentsComponent, Divider divider) {
@@ -172,6 +173,7 @@
                     == DOCKED_INVALID) {
                 mDragMode = calculateDragMode();
                 Rect initialBounds = null;
+                int createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
                 if (mDragMode == DRAG_MODE_DIVIDER) {
                     initialBounds = new Rect();
                     mDivider.getView().calculateBoundsForPosition(mIsVertical
@@ -181,8 +183,12 @@
                                     ? DOCKED_TOP
                                     : DOCKED_LEFT,
                             initialBounds);
+                } else if (mDragMode == DRAG_MODE_RECENTS && mTouchDownX
+                        < mContext.getResources().getDisplayMetrics().widthPixels / 2) {
+                    createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
                 }
-                mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, initialBounds);
+                mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, createMode,
+                        initialBounds);
                 if (mDragMode == DRAG_MODE_DIVIDER) {
                     mDivider.getView().startDragging();
                 }
@@ -259,4 +265,14 @@
         }
         return true;
     }
+
+    @Override
+    public void onTuningChanged(String key, String newValue) {
+        switch (key) {
+            case KEY_DOCK_WINDOW_GESTURE:
+                mDockWindowEnabled = (newValue != null) &&
+                        (Integer.parseInt(newValue) != 0);
+                break;
+        }
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
index fbe9730..08da0d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationGroupManager.java
@@ -92,8 +92,6 @@
         if (group.children.isEmpty()) {
             if (group.summary == null) {
                 mGroupMap.remove(groupKey);
-            } else if (!group.expanded) {
-                group.summary.row.updateNotificationHeader();
             }
         }
     }
@@ -109,9 +107,6 @@
         }
         if (notif.isGroupChild()) {
             group.children.add(added);
-            if (group.summary != null && group.children.size() == 1 && !group.expanded) {
-                group.summary.row.updateNotificationHeader();
-            }
         } else {
             group.summary = added;
             group.expanded = added.row.areChildrenExpanded();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 79701ed..73ee363 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -44,6 +44,7 @@
 import android.view.animation.PathInterpolator;
 import android.widget.FrameLayout;
 import android.widget.TextView;
+
 import com.android.internal.logging.MetricsLogger;
 import com.android.keyguard.KeyguardStatusView;
 import com.android.systemui.DejankUtils;
@@ -448,6 +449,36 @@
         requestScrollerTopPaddingUpdate(animate);
     }
 
+    /**
+     * @param maximum the maximum to return at most
+     * @return the maximum keyguard notifications that can fit on the screen
+     */
+    public int computeMaxKeyguardNotifications(int maximum) {
+        float minPadding = mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),
+                mKeyguardStatusView.getHeight());
+        int keyguardPadding = getResources().getDimensionPixelSize(
+                R.dimen.notification_padding_dimmed);
+        final int overflowheight = getResources().getDimensionPixelSize(
+                R.dimen.notification_summary_height);
+        float bottomStackSize = mNotificationStackScroller.getKeyguardBottomStackSize();
+        float availableSpace = mNotificationStackScroller.getHeight() - minPadding - overflowheight
+                - bottomStackSize;
+        int count = 0;
+        for (int i = 0; i < mNotificationStackScroller.getChildCount(); i++) {
+            ExpandableView child = (ExpandableView) mNotificationStackScroller.getChildAt(i);
+            if (!(child instanceof ExpandableNotificationRow)) {
+                continue;
+            }
+            availableSpace -= child.getMinHeight() + keyguardPadding;
+            if (availableSpace >= 0 && count < maximum) {
+                count++;
+            } else {
+                return count;
+            }
+        }
+        return count;
+    }
+
     private void startClockAnimation(int y) {
         if (mClockAnimationTarget == y) {
             return;
@@ -924,15 +955,7 @@
                 mQsTracking = false;
                 mTrackingPointer = -1;
                 trackMovement(event);
-                float fraction = getQsExpansionFraction();
-                if ((fraction != 0f || y >= mInitialTouchY)
-                        && (fraction != 1f || y <= mInitialTouchY)) {
-                    flingQsWithCurrentVelocity(y,
-                            event.getActionMasked() == MotionEvent.ACTION_CANCEL);
-                } else {
-                    logQsSwipeDown(y);
-                    mScrollYOverride = -1;
-                }
+                flingQsWithCurrentVelocity(y, event.getActionMasked() == MotionEvent.ACTION_CANCEL);
                 if (mVelocityTracker != null) {
                     mVelocityTracker.recycle();
                     mVelocityTracker = null;
@@ -1663,7 +1686,7 @@
     }
 
     private float getFadeoutAlpha() {
-        float alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight())
+        float alpha = (getNotificationsTopY() + mNotificationStackScroller.getFirstItemMinHeight())
                 / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize()
                 - mNotificationStackScroller.getCollapseSecondCardPadding());
         alpha = Math.max(0, Math.min(alpha, 1));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index fafedc3..21d803d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -36,9 +36,7 @@
 import com.android.systemui.EventLogConstants;
 import com.android.systemui.EventLogTags;
 import com.android.systemui.R;
-import com.android.systemui.classifier.Classifier;
 import com.android.systemui.classifier.FalsingManager;
-import com.android.systemui.classifier.HumanInteractionClassifier;
 import com.android.systemui.doze.DozeLog;
 import com.android.systemui.statusbar.FlingAnimationUtils;
 import com.android.systemui.statusbar.StatusBarState;
@@ -891,6 +889,7 @@
                         if (mStatusBar.getStatusBarWindow().getHeight()
                                 != mStatusBar.getStatusBarHeight()) {
                             getViewTreeObserver().removeOnGlobalLayoutListener(this);
+                            mStatusBar.onPanelExpandedAndLayouted();
                             if (animate) {
                                 mBar.startOpeningPanel(PanelView.this);
                                 notifyExpandingStarted();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 6d8e650..e51cf7ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -25,7 +25,6 @@
 import android.app.IActivityManager;
 import android.app.Notification;
 import android.app.PendingIntent;
-import android.app.RemoteInput;
 import android.app.StatusBarManager;
 import android.content.BroadcastReceiver;
 import android.content.ComponentCallbacks2;
@@ -110,8 +109,8 @@
 import com.android.systemui.EventLogTags;
 import com.android.systemui.Prefs;
 import com.android.systemui.R;
-import com.android.systemui.classifier.FalsingManager;
 import com.android.systemui.assist.AssistManager;
+import com.android.systemui.classifier.FalsingManager;
 import com.android.systemui.doze.DozeHost;
 import com.android.systemui.doze.DozeLog;
 import com.android.systemui.keyguard.KeyguardViewMediator;
@@ -171,7 +170,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
@@ -338,7 +336,7 @@
     private long mKeyguardFadingAwayDelay;
     private long mKeyguardFadingAwayDuration;
 
-    int mKeyguardMaxNotificationCount;
+    int mMaxAllowedKeyguardNotifications;
 
     boolean mExpandedVisible;
 
@@ -428,6 +426,7 @@
     private boolean mAutohideSuspended;
     private int mStatusBarMode;
     private int mNavigationBarMode;
+    private int mMaxKeyguardNotifications;
 
     private ViewMediatorCallback mKeyguardViewMediatorCallback;
     private ScrimController mScrimController;
@@ -1134,7 +1133,9 @@
         @Override
         public boolean onLongClick(View v) {
             if (mRecents != null) {
-                mRecents.dockTopTask(false /* draggingInRecents */, null /* initialBounds */);
+                mRecents.dockTopTask(false /* draggingInRecents */,
+                        ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT,
+                        null /* initialBounds */);
                 return true;
             }
             return false;
@@ -2487,12 +2488,14 @@
 
             // update status bar mode
             final int sbMode = computeBarMode(oldVal, newVal, mStatusBarView.getBarTransitions(),
-                    View.STATUS_BAR_TRANSIENT, View.STATUS_BAR_TRANSLUCENT);
+                    View.STATUS_BAR_TRANSIENT, View.STATUS_BAR_TRANSLUCENT,
+                    View.STATUS_BAR_TRANSPARENT);
 
             // update navigation bar mode
             final int nbMode = mNavigationBarView == null ? -1 : computeBarMode(
                     oldVal, newVal, mNavigationBarView.getBarTransitions(),
-                    View.NAVIGATION_BAR_TRANSIENT, View.NAVIGATION_BAR_TRANSLUCENT);
+                    View.NAVIGATION_BAR_TRANSIENT, View.NAVIGATION_BAR_TRANSLUCENT,
+                    View.NAVIGATION_BAR_TRANSPARENT);
             final boolean sbModeChanged = sbMode != -1;
             final boolean nbModeChanged = nbMode != -1;
             boolean checkBarModes = false;
@@ -2543,21 +2546,21 @@
     }
 
     private int computeBarMode(int oldVis, int newVis, BarTransitions transitions,
-            int transientFlag, int translucentFlag) {
-        final int oldMode = barMode(oldVis, transientFlag, translucentFlag);
-        final int newMode = barMode(newVis, transientFlag, translucentFlag);
+            int transientFlag, int translucentFlag, int transparentFlag) {
+        final int oldMode = barMode(oldVis, transientFlag, translucentFlag, transparentFlag);
+        final int newMode = barMode(newVis, transientFlag, translucentFlag, transparentFlag);
         if (oldMode == newMode) {
             return -1; // no mode change
         }
         return newMode;
     }
 
-    private int barMode(int vis, int transientFlag, int translucentFlag) {
-        int lightsOutTransparent = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_TRANSPARENT;
+    private int barMode(int vis, int transientFlag, int translucentFlag, int transparentFlag) {
+        int lightsOutTransparent = View.SYSTEM_UI_FLAG_LOW_PROFILE | transparentFlag;
         return (vis & transientFlag) != 0 ? MODE_SEMI_TRANSPARENT
                 : (vis & translucentFlag) != 0 ? MODE_TRANSLUCENT
                 : (vis & lightsOutTransparent) == lightsOutTransparent ? MODE_LIGHTS_OUT_TRANSPARENT
-                : (vis & View.SYSTEM_UI_TRANSPARENT) != 0 ? MODE_TRANSPARENT
+                : (vis & transparentFlag) != 0 ? MODE_TRANSPARENT
                 : (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0 ? MODE_LIGHTS_OUT
                 : MODE_OPAQUE;
     }
@@ -3129,10 +3132,11 @@
         mNaturalBarHeight = res.getDimensionPixelSize(
                 com.android.internal.R.dimen.status_bar_height);
 
+        mRowMinHeightLegacy =  res.getDimensionPixelSize(R.dimen.notification_min_height_legacy);
         mRowMinHeight =  res.getDimensionPixelSize(R.dimen.notification_min_height);
         mRowMaxHeight =  res.getDimensionPixelSize(R.dimen.notification_max_height);
 
-        mKeyguardMaxNotificationCount = res.getInteger(R.integer.keyguard_max_notification_count);
+        mMaxAllowedKeyguardNotifications = res.getInteger(R.integer.keyguard_max_notification_count);
 
         if (DEBUG) Log.v(TAG, "updateResources");
     }
@@ -3913,8 +3917,18 @@
     }
 
     @Override
-    protected int getMaxKeyguardNotifications() {
-        return mKeyguardMaxNotificationCount;
+    protected int getMaxKeyguardNotifications(boolean recompute) {
+        if (recompute) {
+            mMaxKeyguardNotifications = Math.max(1,
+                    mNotificationPanel.computeMaxKeyguardNotifications(
+                            mMaxAllowedKeyguardNotifications));
+            return mMaxKeyguardNotifications;
+        }
+        return mMaxKeyguardNotifications;
+    }
+
+    public int getMaxKeyguardNotifications() {
+        return getMaxKeyguardNotifications(false /* recompute */);
     }
 
     public NavigationBarView getNavigationBarView() {
@@ -3944,11 +3958,12 @@
     @Override
     public void onDragDownReset() {
         mStackScroller.setDimmed(true /* dimmed */, true /* animated */);
+        mStackScroller.resetScrollPosition();
     }
 
     @Override
-    public void onThresholdReached() {
-        mStackScroller.setDimmed(false /* dimmed */, true /* animate */);
+    public void onCrossedThreshold(boolean above) {
+        mStackScroller.setDimmed(!above /* dimmed */, true /* animate */);
     }
 
     @Override
@@ -3987,6 +4002,13 @@
         }
     }
 
+    @Override
+    public void onExpandClicked(View clickedView, boolean nowExpanded) {
+        if (mState == StatusBarState.KEYGUARD && nowExpanded) {
+            goToLockedShade(clickedView);
+        }
+    }
+
     /**
      * Goes back to the keyguard after hanging around in {@link StatusBarState#SHADE_LOCKED}.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
index 57c2648..f7ff8aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
@@ -293,12 +293,21 @@
         verifyCaller(tile.getComponentName().getPackageName());
         CustomTile customTile = getTileForComponent(tile.getComponentName());
         if (customTile != null) {
-            Log.d("TileService", "Got tile update for " + tile.getComponentName());
             customTile.updateState(tile);
             customTile.refreshState();
         }
     }
 
+    @Override
+    public void onShowDialog(Tile tile) throws RemoteException {
+        verifyCaller(tile.getComponentName().getPackageName());
+        CustomTile customTile = getTileForComponent(tile.getComponentName());
+        if (customTile != null) {
+            customTile.onDialogShown();
+            collapsePanels();
+        }
+    }
+
     private void verifyCaller(String packageName) {
         try {
             int uid = mContext.getPackageManager().getPackageUid(packageName,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
index 93a8fd8..0917528 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java
@@ -110,7 +110,7 @@
         // When enabling location, a user consent dialog will pop up, and the
         // setting won't be fully enabled until the user accepts the agreement.
         int mode = enabled
-                ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF;
+                ? Settings.Secure.LOCATION_MODE_PREVIOUS : Settings.Secure.LOCATION_MODE_OFF;
         // QuickSettings always runs as the owner, so specifically set the settings
         // for the current foreground user.
         return Settings.Secure
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index acfe54d..22c0cb9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -148,6 +148,7 @@
 
     public void onDefocus() {
         mController.removeRemoteInput(mEntry);
+        mEntry.remoteInputText = mEditText.getText();
         setVisibility(INVISIBLE);
     }
 
@@ -171,6 +172,8 @@
         mEditText.setInnerFocusable(true);
         mController.addRemoteInput(mEntry);
         mEditText.mShowImeOnInputConnection = true;
+        mEditText.setText(mEntry.remoteInputText);
+        mEditText.setSelection(mEditText.getText().length());
         mEditText.requestFocus();
     }
 
@@ -216,8 +219,11 @@
 
         @Override
         public boolean onKeyPreIme(int keyCode, KeyEvent event) {
-            if (keyCode == KeyEvent.KEYCODE_BACK) {
+            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
                 defocusIfNeeded();
+                final InputMethodManager imm = InputMethodManager.getInstance();
+                imm.hideSoftInputFromWindow(getWindowToken(), 0);
+                return true;
             }
             return super.onKeyPreIme(keyCode, event);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index e00b890..b010761 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -342,7 +342,7 @@
 
     private void stopUserId(int id) {
         try {
-            ActivityManagerNative.getDefault().stopUser(id, null);
+            ActivityManagerNative.getDefault().stopUser(id, /* force= */ false, null);
         } catch (RemoteException e) {
             Log.e(TAG, "Couldn't stop user.", e);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
index c9ebc84..77a9871 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
@@ -78,7 +78,7 @@
         mNotificationAppearDistance = getResources().getDimensionPixelSize(
                 R.dimen.notification_appear_distance);
         mNotificationHeaderHeight = getResources().getDimensionPixelSize(
-                R.dimen.notification_header_height);
+                com.android.internal.R.dimen.notification_header_height);
         mHeaderTopPaddingSubstraction = 2 * getResources().getDisplayMetrics().density;
         mCollapsedBottompadding = 10 * getResources().getDisplayMetrics().density;
         mHybridViewManager = new HybridNotificationViewManager(getContext(), this);
@@ -246,7 +246,7 @@
      *         in @param maxAllowedVisibleChildren
      */
     private int getIntrinsicHeight(float maxAllowedVisibleChildren) {
-        int intrinsicHeight = 0;
+        int intrinsicHeight = mNotificationHeaderHeight;;
         int visibleChildren = 0;
         int childCount = mChildren.size();
         for (int i = 0; i < childCount; i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index aeca97c..ae6b729 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -272,7 +272,7 @@
     @Override
     protected void onDraw(Canvas canvas) {
         if (DEBUG) {
-            int y = mCollapsedSize;
+            int y = mTopPadding;
             canvas.drawLine(0, y, getWidth(), y, mDebugPaint);
             y = (int) (getLayoutHeight() - mBottomStackPeekSize
                     - mBottomStackSlowDownHeight);
@@ -550,8 +550,9 @@
         return Math.min(mMaxLayoutHeight, mCurrentStackHeight);
     }
 
-    public int getItemHeight() {
-        return mCollapsedSize;
+    public int getFirstItemMinHeight() {
+        final ExpandableView firstChild = getFirstChildNotGone();
+        return firstChild != null ? firstChild.getMinHeight() : mCollapsedSize;
     }
 
     public int getBottomStackPeekSize() {
@@ -1321,14 +1322,14 @@
         ExpandableView firstChild = (ExpandableView) getFirstChildNotGone();
         if (firstChild != null) {
             int contentHeight = getContentHeight();
-            int firstChildMaxExpandHeight = getMaxExpandHeight(firstChild);
             scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight + mBottomStackPeekSize
                     + mBottomStackSlowDownHeight);
             if (scrollRange > 0) {
-                View lastChild = getLastChildNotGone();
+                int firstChildMaxExpandHeight = getMaxExpandHeight(firstChild);
                 // We want to at least be able collapse the first item and not ending in a weird
                 // end state.
-                scrollRange = Math.max(scrollRange, firstChildMaxExpandHeight - mCollapsedSize);
+                scrollRange = Math.max(scrollRange, firstChildMaxExpandHeight
+                        - firstChild.getMinHeight());
             }
         }
         return scrollRange;
@@ -1337,12 +1338,12 @@
     /**
      * @return the first child which has visibility unequal to GONE
      */
-    private View getFirstChildNotGone() {
+    private ExpandableView getFirstChildNotGone() {
         int childCount = getChildCount();
         for (int i = 0; i < childCount; i++) {
             View child = getChildAt(i);
             if (child.getVisibility() != View.GONE) {
-                return child;
+                return (ExpandableView) child;
             }
         }
         return null;
@@ -1504,7 +1505,10 @@
     }
 
     public int getMinStackHeight() {
-        return mCollapsedSize + mBottomStackPeekSize + mCollapseSecondCardPadding;
+        final ExpandableView firstChild = getFirstChildNotGone();
+        final int firstChildMinHeight = firstChild != null ? (int) firstChild.getMinHeight()
+                : mCollapsedSize;
+        return firstChildMinHeight + mBottomStackPeekSize + mCollapseSecondCardPadding;
     }
 
     public float getTopPaddingOverflow() {
@@ -1512,7 +1516,10 @@
     }
 
     public int getPeekHeight() {
-        return mIntrinsicPadding + mCollapsedSize + mBottomStackPeekSize
+        final ExpandableView firstChild = getFirstChildNotGone();
+        final int firstChildMinHeight = firstChild != null ? (int) firstChild.getMinHeight()
+                : mCollapsedSize;
+        return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize
                 + mCollapseSecondCardPadding;
     }
 
@@ -1860,7 +1867,7 @@
             }
             mNeedsAnimation = true;
         }
-        if (isHeadsUp(child)) {
+        if (isHeadsUp(child) && !mChangePositionInProgress) {
             mAddedHeadsUpChildren.add(child);
             mChildrenToAddAnimated.remove(child);
         }
@@ -2266,6 +2273,11 @@
         return Math.max(emptyMargin, 0);
     }
 
+    public float getKeyguardBottomStackSize() {
+        return mBottomStackPeekSize + getResources().getDimensionPixelSize(
+                R.dimen.bottom_stack_slow_down_length);
+    }
+
     public void onExpansionStarted() {
         mIsExpansionChanging = true;
         mStackScrollAlgorithm.onExpansionStarted(mCurrentStackScrollState);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 65ca95b..953f287 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -42,7 +42,7 @@
     private static final int MAX_ITEMS_IN_BOTTOM_STACK = 3;
     private static final int MAX_ITEMS_IN_TOP_STACK = 3;
 
-    public static final float DIMMED_SCALE = 0.95f;
+    public static final float DIMMED_SCALE = 0.98f;
 
     private int mPaddingBetweenElements;
     private int mCollapsedSize;
@@ -72,6 +72,7 @@
     private int mMaxNotificationHeight;
     private boolean mScaleDimmed;
     private HeadsUpManager mHeadsUpManager;
+    private int mFirstChildMinHeight;
 
     public StackScrollAlgorithm(Context context) {
         initConstants(context);
@@ -155,7 +156,7 @@
         // Due to the overScroller, the stackscroller can have negative scroll state. This is
         // already accounted for by the top padding and doesn't need an additional adaption
         scrollY = Math.max(0, scrollY);
-        algorithmState.scrollY = (int) (scrollY + mCollapsedSize + bottomOverScroll);
+        algorithmState.scrollY = (int) (scrollY + mFirstChildMinHeight + bottomOverScroll);
 
         updateVisibleChildren(resultState, algorithmState);
 
@@ -424,7 +425,8 @@
             float yPositionInScrollViewAfterElement = yPositionInScrollView
                     + childHeight
                     + mPaddingBetweenElements;
-            float scrollOffset = yPositionInScrollView - algorithmState.scrollY + mCollapsedSize;
+            float scrollOffset = yPositionInScrollView - algorithmState.scrollY +
+                    mFirstChildMinHeight;
 
             if (i == algorithmState.lastTopStackIndex + 1) {
                 // Normally the position of this child is the position in the regular scrollview,
@@ -451,10 +453,10 @@
                         >= bottomStackStart && !mIsExpansionChanging && i != 0 && mIsSmallScreen) {
                     // we just collapse this element slightly
                     int newSize = (int) Math.max(bottomStackStart - mPaddingBetweenElements -
-                            childViewState.yTranslation, mCollapsedSize);
+                            childViewState.yTranslation, child.getMinHeight());
                     childViewState.height = newSize;
                     updateStateForChildTransitioningInBottom(algorithmState, bottomStackStart,
-                            bottomPeekStart, childViewState.yTranslation, childViewState,
+                            child, childViewState.yTranslation, childViewState,
                             childHeight);
                 }
                 clampPositionToBottomStackStart(childViewState, childViewState.height,
@@ -471,7 +473,7 @@
                     // According to the regular scroll view we are currently translating out of /
                     // into the bottom of the screen
                     updateStateForChildTransitioningInBottom(algorithmState,
-                            bottomStackStart, bottomPeekStart, currentYPosition,
+                            bottomStackStart, child, currentYPosition,
                             childViewState, childHeight);
                 }
             } else {
@@ -484,12 +486,13 @@
             // The first card is always rendered.
             if (i == 0) {
                 childViewState.alpha = 1.0f;
-                childViewState.yTranslation = Math.max(mCollapsedSize - algorithmState.scrollY, 0);
+                childViewState.yTranslation = Math.max(
+                        mFirstChildMinHeight - algorithmState.scrollY, 0);
                 if (childViewState.yTranslation + childViewState.height
                         > bottomPeekStart - mCollapseSecondCardPadding) {
                     childViewState.height = (int) Math.max(
                             bottomPeekStart - mCollapseSecondCardPadding
-                                    - childViewState.yTranslation, mCollapsedSize);
+                                    - childViewState.yTranslation, mFirstChildMinHeight);
                 }
                 childViewState.location = StackViewState.LOCATION_FIRST_CARD;
             }
@@ -501,7 +504,8 @@
 
             if (ambientState.isShadeExpanded() && topHeadsUpEntry != null
                     && child != topHeadsUpEntry) {
-                childViewState.yTranslation += topHeadsUpEntry.getHeadsUpHeight() - mCollapsedSize;
+                childViewState.yTranslation += topHeadsUpEntry.getHeadsUpHeight() -
+                        mFirstChildMinHeight;
             }
             childViewState.yTranslation += ambientState.getTopPadding()
                     + ambientState.getStackTranslation();
@@ -528,7 +532,7 @@
             boolean isTopEntry = topHeadsUpEntry == row;
             if (mIsExpanded) {
                 if (isTopEntry) {
-                    childState.height += row.getHeadsUpHeight() - mCollapsedSize;
+                    childState.height += row.getHeadsUpHeight() - mFirstChildMinHeight;
                 }
                 childState.height = Math.max(childState.height, row.getHeadsUpHeight());
                 // Ensure that the heads up is always visible even when scrolled off from the bottom
@@ -588,7 +592,7 @@
     private void clampPositionToTopStackEnd(StackViewState childViewState,
             int childHeight) {
         childViewState.yTranslation = Math.max(childViewState.yTranslation,
-                mCollapsedSize - childHeight);
+                mFirstChildMinHeight - childHeight);
     }
 
     private int getMaxAllowedChildHeight(View child, AmbientState ambientState) {
@@ -597,7 +601,7 @@
             if (ambientState == null && row.isHeadsUp()
                     || ambientState != null && ambientState.getTopHeadsUpEntry() == child) {
                 int extraSize = row.getIntrinsicHeight() - row.getHeadsUpHeight();
-                return mCollapsedSize + extraSize;
+                return mFirstChildMinHeight + extraSize;
             }
             return row.getIntrinsicHeight();
         } else if (child instanceof ExpandableView) {
@@ -608,7 +612,7 @@
     }
 
     private void updateStateForChildTransitioningInBottom(StackScrollAlgorithmState algorithmState,
-            float transitioningPositionStart, float bottomPeakStart, float currentYPosition,
+            float transitioningPositionStart, ExpandableView child, float currentYPosition,
             StackViewState childViewState, int childHeight) {
 
         // This is the transitioning element on top of bottom stack, calculate how far we are in.
@@ -620,9 +624,10 @@
         float offset = mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom);
         algorithmState.itemsInBottomStack += algorithmState.partialInBottom;
         int newHeight = childHeight;
-        if (childHeight > mCollapsedSize && mIsSmallScreen) {
+        if (childHeight > child.getMinHeight() && mIsSmallScreen) {
             newHeight = (int) Math.max(Math.min(transitioningPositionStart + offset -
-                    mPaddingBetweenElements - currentYPosition, childHeight), mCollapsedSize);
+                    mPaddingBetweenElements - currentYPosition, childHeight),
+                    child.getMinHeight());
             childViewState.height = newHeight;
         }
         childViewState.yTranslation = transitioningPositionStart + offset - newHeight
@@ -689,7 +694,7 @@
                     numItemsBefore = algorithmState.itemsInTopStack - i;
                 }
                 // The end position of the current child
-                float currentChildEndY = mCollapsedSize + mTopStackTotalSize
+                float currentChildEndY = mFirstChildMinHeight + mTopStackTotalSize
                         - mTopStackIndentationFunctor.getValue(numItemsBefore);
                 childViewState.yTranslation = currentChildEndY - childHeight;
             }
@@ -701,7 +706,7 @@
                 // We are hidden behind the top card and faded out, so we can hide ourselves.
                 childViewState.alpha = 0.0f;
             }
-            childViewState.yTranslation = mCollapsedSize - childHeight;
+            childViewState.yTranslation = mFirstChildMinHeight - childHeight;
             childViewState.location = StackViewState.LOCATION_TOP_STACK_HIDDEN;
         }
 
@@ -730,7 +735,7 @@
                     + childHeight
                     + mPaddingBetweenElements;
             if (yPositionInScrollView < algorithmState.scrollY) {
-                if (i == 0 && algorithmState.scrollY <= mCollapsedSize) {
+                if (i == 0 && algorithmState.scrollY <= mFirstChildMinHeight) {
 
                     // The starting position of the bottom stack peek
                     int bottomPeekStart = ambientState.getInnerHeight() - mBottomStackPeekSize -
@@ -740,14 +745,14 @@
                             ? mFirstChildMaxHeight
                             : childHeight;
                     childViewState.height = (int) Math.max(Math.min(bottomPeekStart, maxHeight),
-                            mCollapsedSize);
+                            mFirstChildMinHeight);
                     algorithmState.itemsInTopStack = 1.0f;
 
                 } else if (yPositionInScrollViewAfterElement < algorithmState.scrollY) {
                     // According to the regular scroll view we are fully off screen
                     algorithmState.itemsInTopStack += 1.0f;
                     if (i == 0) {
-                        childViewState.height = mCollapsedSize;
+                        childViewState.height = child.getMinHeight();
                     }
                 } else {
                     // According to the regular scroll view we are partially off screen
@@ -766,8 +771,8 @@
                         // If it is expanded we have to collapse it to a new size
                         float newSize = yPositionInScrollViewAfterElement
                                 - mPaddingBetweenElements
-                                - algorithmState.scrollY + mCollapsedSize;
-                        newSize = Math.max(mCollapsedSize, newSize);
+                                - algorithmState.scrollY + mFirstChildMinHeight;
+                        newSize = Math.max(mFirstChildMinHeight, newSize);
                         algorithmState.itemsInTopStack = 1.0f;
                         childViewState.height = (int) newSize;
                     }
@@ -809,7 +814,7 @@
                     // Interpolate the index from 0 to 2 while the second item is
                     // translating in.
                     stackIndex -= 1.0f;
-                    if (algorithmState.scrollY > mCollapsedSize) {
+                    if (algorithmState.scrollY > mFirstChildMinHeight) {
 
                         // Since there is a shadow treshhold, we cant just interpolate from 0 to
                         // 2 but we interpolate from 0.1f to 2.0f when scrolled in. The jump in
@@ -863,7 +868,7 @@
                     ExpandableNotificationRow row =
                             (ExpandableNotificationRow) mFirstChildWhileExpanding;
                     if (row.isHeadsUp()) {
-                        mFirstChildMaxHeight += mCollapsedSize - row.getHeadsUpHeight();
+                        mFirstChildMaxHeight += mFirstChildMinHeight - row.getHeadsUpHeight();
                     }
                 }
             } else {
@@ -927,7 +932,11 @@
         this.mIsExpanded = isExpanded;
     }
 
-    public void notifyChildrenChanged(final ViewGroup hostView) {
+    public void notifyChildrenChanged(final NotificationStackScrollLayout hostView) {
+        int firstItemMinHeight = hostView.getFirstItemMinHeight();
+        if (firstItemMinHeight != mFirstChildMinHeight) {
+            mFirstChildMinHeight = firstItemMinHeight;
+        }
         if (mIsExpansionChanging) {
             hostView.post(new Runnable() {
                 @Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index bbe5dd9..39a2986 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -130,7 +130,7 @@
     }
 
     @Override
-    protected int getMaxKeyguardNotifications() {
+    protected int getMaxKeyguardNotifications(boolean recompute) {
         return 0;
     }
 
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
index 76b2346..2fe6648 100644
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.net.IConnectivityManager;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.os.ServiceManager;
@@ -50,8 +51,8 @@
     private Handler mHandler;
 
     @Override
-    protected void onResume() {
-        super.onResume();
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
 
         if (getCallingPackage() != null) {
             Log.e(TAG, getCallingPackage() + " cannot start this activity");
@@ -108,11 +109,11 @@
     }
 
     @Override
-    protected void onPause() {
-        super.onPause();
+    protected void onDestroy() {
         if (!isFinishing()) {
             finish();
         }
+        super.onDestroy();
     }
 
     @Override
diff --git a/preloaded-classes b/preloaded-classes
index 79c0957..2301c41 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -1765,6 +1765,7 @@
 android.util.SuperNotCalledException
 android.util.TypedValue
 android.util.Xml
+android.util.jar.StrictJarFile
 android.view.AbsSavedState
 android.view.AbsSavedState$1
 android.view.AbsSavedState$2
@@ -3361,9 +3362,6 @@
 java.util.jar.JarEntry
 java.util.jar.JarFile
 java.util.jar.JarFile$JarFileEnumerator
-java.util.jar.Manifest
-java.util.jar.ManifestReader
-java.util.jar.StrictJarFile
 java.util.logging.ConsoleHandler
 java.util.logging.ErrorManager
 java.util.logging.Filter
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 3d358ec..11fdbb5 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -433,7 +433,6 @@
                         AccessibilityEvent.obtain(event)).sendToTarget();
             }
             event.recycle();
-            getUserStateLocked(resolvedUserId).mHandledFeedbackTypes = 0;
         }
         return (OWN_PROCESS_ID != Binder.getCallingPid());
     }
@@ -1051,9 +1050,7 @@
                 Service service = state.mBoundServices.get(i);
 
                 if (service.mIsDefault == isDefault) {
-                    if (canDispatchEventToServiceLocked(service, event,
-                            state.mHandledFeedbackTypes)) {
-                        state.mHandledFeedbackTypes |= service.mFeedbackType;
+                    if (canDispatchEventToServiceLocked(service, event)) {
                         service.notifyAccessibilityEvent(event);
                     }
                 }
@@ -1088,19 +1085,14 @@
 
     /**
      * Determines if given event can be dispatched to a service based on the package of the
-     * event source and already notified services for that event type. Specifically, a
-     * service is notified if it is interested in events from the package and no other service
-     * providing the same feedback type has been notified. Exception are services the
-     * provide generic feedback (feedback type left as a safety net for unforeseen feedback
-     * types) which are always notified.
+     * event source. Specifically, a service is notified if it is interested in events from the
+     * package.
      *
      * @param service The potential receiver.
      * @param event The event.
-     * @param handledFeedbackTypes The feedback types for which services have been notified.
      * @return True if the listener should be notified, false otherwise.
      */
-    private boolean canDispatchEventToServiceLocked(Service service, AccessibilityEvent event,
-            int handledFeedbackTypes) {
+    private boolean canDispatchEventToServiceLocked(Service service, AccessibilityEvent event) {
 
         if (!service.canReceiveEventsLocked()) {
             return false;
@@ -1121,15 +1113,7 @@
         String packageName = (event.getPackageName() != null)
                 ? event.getPackageName().toString() : null;
 
-        if (packageNames.isEmpty() || packageNames.contains(packageName)) {
-            int feedbackType = service.mFeedbackType;
-            if ((handledFeedbackTypes & feedbackType) != feedbackType
-                    || feedbackType == AccessibilityServiceInfo.FEEDBACK_GENERIC) {
-                return true;
-            }
-        }
-
-        return false;
+        return (packageNames.isEmpty() || packageNames.contains(packageName));
     }
 
     private void unbindAllServicesLocked(UserState userState) {
@@ -3886,8 +3870,6 @@
         public final Set<ComponentName> mTouchExplorationGrantedServices =
                 new HashSet<>();
 
-        public int mHandledFeedbackTypes = 0;
-
         public int mLastSentClientState = -1;
 
         public boolean mIsAccessibilityEnabled;
@@ -3950,7 +3932,6 @@
             mBindingServices.clear();
 
             // Clear event management state.
-            mHandledFeedbackTypes = 0;
             mLastSentClientState = -1;
 
             // Clear state persisted in settings.
diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java
index a5cef1a..ede92fb 100644
--- a/services/core/java/com/android/server/AppOpsService.java
+++ b/services/core/java/com/android/server/AppOpsService.java
@@ -513,33 +513,35 @@
         String[] uidPackageNames = getPackagesForUid(uid);
         ArrayMap<Callback, ArraySet<String>> callbackSpecs = null;
 
-        ArrayList<Callback> callbacks = mOpModeWatchers.get(code);
-        if (callbacks != null) {
-            final int callbackCount = callbacks.size();
-            for (int i = 0; i < callbackCount; i++) {
-                Callback callback = callbacks.get(i);
-                ArraySet<String> changedPackages = new ArraySet<>();
-                Collections.addAll(changedPackages, uidPackageNames);
-                callbackSpecs = new ArrayMap<>();
-                callbackSpecs.put(callback, changedPackages);
-            }
-        }
-
-        for (String uidPackageName : uidPackageNames) {
-            callbacks = mPackageModeWatchers.get(uidPackageName);
+        synchronized (this) {
+            ArrayList<Callback> callbacks = mOpModeWatchers.get(code);
             if (callbacks != null) {
-                if (callbackSpecs == null) {
-                    callbackSpecs = new ArrayMap<>();
-                }
                 final int callbackCount = callbacks.size();
                 for (int i = 0; i < callbackCount; i++) {
                     Callback callback = callbacks.get(i);
-                    ArraySet<String> changedPackages = callbackSpecs.get(callback);
-                    if (changedPackages == null) {
-                        changedPackages = new ArraySet<>();
-                        callbackSpecs.put(callback, changedPackages);
+                    ArraySet<String> changedPackages = new ArraySet<>();
+                    Collections.addAll(changedPackages, uidPackageNames);
+                    callbackSpecs = new ArrayMap<>();
+                    callbackSpecs.put(callback, changedPackages);
+                }
+            }
+
+            for (String uidPackageName : uidPackageNames) {
+                callbacks = mPackageModeWatchers.get(uidPackageName);
+                if (callbacks != null) {
+                    if (callbackSpecs == null) {
+                        callbackSpecs = new ArrayMap<>();
                     }
-                    changedPackages.add(uidPackageName);
+                    final int callbackCount = callbacks.size();
+                    for (int i = 0; i < callbackCount; i++) {
+                        Callback callback = callbacks.get(i);
+                        ArraySet<String> changedPackages = callbackSpecs.get(callback);
+                        if (changedPackages == null) {
+                            changedPackages = new ArraySet<>();
+                            callbackSpecs.put(callback, changedPackages);
+                        }
+                        changedPackages.add(uidPackageName);
+                    }
                 }
             }
         }
@@ -2051,7 +2053,7 @@
     private static String[] getPackagesForUid(int uid) {
         String[] packageNames = null;
         try {
-            packageNames= AppGlobals.getPackageManager().getPackagesForUid(uid);
+            packageNames = AppGlobals.getPackageManager().getPackagesForUid(uid);
         } catch (RemoteException e) {
             /* ignore - local call */
         }
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 78a4e35..42dd9a8 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -70,6 +70,7 @@
 import android.content.res.TypedArray;
 import android.database.ContentObserver;
 import android.graphics.drawable.Drawable;
+import android.hardware.input.InputManagerInternal;
 import android.inputmethodservice.InputMethodService;
 import android.net.Uri;
 import android.os.Binder;
@@ -1930,6 +1931,16 @@
         }
     }
 
+    private void notifyInputMethodSubtypeChanged(final int userId,
+            @Nullable final InputMethodInfo inputMethodInfo,
+            @Nullable final InputMethodSubtype subtype) {
+        final InputManagerInternal inputManagerInternal =
+                LocalServices.getService(InputManagerInternal.class);
+        if (inputManagerInternal != null) {
+            inputManagerInternal.onInputMethodSubtypeChanged(userId, inputMethodInfo, subtype);
+        }
+    }
+
     /* package */ void setInputMethodLocked(String id, int subtypeId) {
         InputMethodInfo info = mMethodMap.get(id);
         if (info == null) {
@@ -1972,8 +1983,10 @@
                         mCurMethod.changeInputMethodSubtype(newSubtype);
                     } catch (RemoteException e) {
                         Slog.w(TAG, "Failed to call changeInputMethodSubtype");
+                        return;
                     }
                 }
+                notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info, newSubtype);
             }
             return;
         }
@@ -1999,6 +2012,9 @@
         } finally {
             Binder.restoreCallingIdentity(ident);
         }
+
+        notifyInputMethodSubtypeChanged(mSettings.getCurrentUserId(), info,
+                getCurrentInputMethodSubtypeLocked());
     }
 
     @Override
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index da81528..033a4b8 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -16,9 +16,13 @@
 
 package com.android.server;
 
+import android.app.ActivityManagerNative;
+import android.app.AppGlobals;
 import android.app.admin.DevicePolicyManager;
 import android.app.backup.BackupManager;
 import android.app.trust.IStrongAuthTracker;
+import android.app.trust.ITrustManager;
+import android.app.trust.TrustManager;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -36,6 +40,7 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.storage.IMountService;
+import android.os.storage.StorageManager;
 import android.os.ServiceManager;
 import android.os.SystemProperties;
 import android.os.UserHandle;
@@ -388,6 +393,13 @@
         }
     }
 
+    private void unlockUser(int userId, byte[] token) {
+        try {
+            ActivityManagerNative.getDefault().unlockUser(userId, token);
+        } catch (RemoteException e) {
+            throw e.rethrowAsRuntimeException();
+        }
+    }
 
     private byte[] getCurrentHandle(int userId) {
         CredentialHash credential;
@@ -612,6 +624,13 @@
             byte[] hash = credentialUtil.toHash(credential, userId);
             if (Arrays.equals(hash, storedHash.hash)) {
                 unlockKeystore(credentialUtil.adjustForKeystore(credential), userId);
+
+                // TODO: pass through a meaningful token from gatekeeper to
+                // unlock credential keys; for now pass through a stub value to
+                // indicate that we came from a user challenge.
+                final byte[] token = String.valueOf(userId).getBytes();
+                unlockUser(userId, token);
+
                 // migrate credential to GateKeeper
                 credentialUtil.setCredential(credential, null, userId);
                 if (!hasChallenge) {
@@ -664,6 +683,19 @@
         if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
             // credential has matched
             unlockKeystore(credential, userId);
+
+            // TODO: pass through a meaningful token from gatekeeper to
+            // unlock credential keys; for now pass through a stub value to
+            // indicate that we came from a user challenge.
+            final byte[] token = String.valueOf(userId).getBytes();
+            unlockUser(userId, token);
+
+            UserInfo info = UserManager.get(mContext).getUserInfo(userId);
+            if (LockPatternUtils.isSeparateWorkChallengeEnabled() && info.isManagedProfile()) {
+                TrustManager trustManager =
+                        (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
+                trustManager.setDeviceLockedForUser(userId, false);
+            }
             if (shouldReEnroll) {
                 credentialUtil.setCredential(credential, credential, userId);
             }
diff --git a/services/core/java/com/android/server/LockSettingsStorage.java b/services/core/java/com/android/server/LockSettingsStorage.java
index eb49a78..137fa27 100644
--- a/services/core/java/com/android/server/LockSettingsStorage.java
+++ b/services/core/java/com/android/server/LockSettingsStorage.java
@@ -17,6 +17,7 @@
 package com.android.server;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.widget.LockPatternUtils;
 
 import android.content.ContentValues;
 import android.content.Context;
@@ -25,9 +26,7 @@
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.os.Environment;
-import android.os.SystemProperties;
 import android.os.UserManager;
-import android.os.storage.StorageManager;
 import android.util.ArrayMap;
 import android.util.Log;
 import android.util.Slog;
@@ -389,7 +388,7 @@
 
     private int getUserParentOrSelfId(int userId) {
         // Device supports per user encryption, so lock is applied to the given user.
-        if (StorageManager.isFileBasedEncryptionEnabled()) {
+        if (LockPatternUtils.isSeparateWorkChallengeEnabled()) {
             return userId;
         }
         // Device uses Block Based Encryption, and the parent user's lock is used for the whole
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index a32bb2f..807c0d6 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -100,6 +100,7 @@
 import com.android.internal.util.HexDump;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.internal.util.Preconditions;
+import com.android.internal.widget.LockPatternUtils;
 import com.android.server.NativeDaemonConnector.Command;
 import com.android.server.NativeDaemonConnector.SensitiveArg;
 import com.android.server.pm.PackageManagerService;
@@ -435,6 +436,7 @@
     private PackageManagerService mPms;
 
     private final Callbacks mCallbacks;
+    private final LockPatternUtils mLockPatternUtils;
 
     // Two connectors - mConnector & mCryptConnector
     private final CountDownLatch mConnectedSignal = new CountDownLatch(2);
@@ -781,6 +783,7 @@
     }
 
     private void handleSystemReady() {
+        initIfReadyAndConnected();
         resetIfReadyAndConnected();
 
         // Start scheduling nominally-daily fstrim operations
@@ -828,6 +831,22 @@
         mVolumes.put(internal.id, internal);
     }
 
+    private void initIfReadyAndConnected() {
+        Slog.d(TAG, "Thinking about init, mSystemReady=" + mSystemReady
+                + ", mDaemonConnected=" + mDaemonConnected);
+        if (mSystemReady && mDaemonConnected && StorageManager.isFileBasedEncryptionEnabled()) {
+            final List<UserInfo> users = mContext.getSystemService(UserManager.class)
+                    .getUsers();
+            for (UserInfo user : users) {
+                try {
+                    mCryptConnector.execute("cryptfs", "lock_user_key", user.id);
+                } catch (NativeDaemonConnectorException e) {
+                    Slog.w(TAG, "Failed to init vold", e);
+                }
+            }
+        }
+    }
+
     private void resetIfReadyAndConnected() {
         Slog.d(TAG, "Thinking about reset, mSystemReady=" + mSystemReady
                 + ", mDaemonConnected=" + mDaemonConnected);
@@ -928,6 +947,7 @@
     }
 
     private void handleDaemonConnected() {
+        initIfReadyAndConnected();
         resetIfReadyAndConnected();
 
         /*
@@ -1411,6 +1431,7 @@
 
         mContext = context;
         mCallbacks = new Callbacks(FgThread.get().getLooper());
+        mLockPatternUtils = new LockPatternUtils(mContext);
 
         // XXX: This will go away soon in favor of IMountServiceObserver
         mPms = (PackageManagerService) ServiceManager.getService("package");
@@ -2703,6 +2724,12 @@
         enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
         waitForReady();
 
+        // When a user has secure lock screen, require a challenge token to
+        // actually unlock. This check is mostly in place for emulation mode.
+        if (mLockPatternUtils.isSecure(userId) && ArrayUtils.isEmpty(token)) {
+            throw new IllegalStateException("Token required to unlock secure user " + userId);
+        }
+
         final String encodedToken;
         if (ArrayUtils.isEmpty(token)) {
             encodedToken = "!";
diff --git a/services/core/java/com/android/server/NativeDaemonConnector.java b/services/core/java/com/android/server/NativeDaemonConnector.java
index e6b6074..d6dbad8 100644
--- a/services/core/java/com/android/server/NativeDaemonConnector.java
+++ b/services/core/java/com/android/server/NativeDaemonConnector.java
@@ -177,6 +177,7 @@
 
             mCallbacks.onDaemonConnected();
 
+            FileDescriptor[] fdList = null;
             byte[] buffer = new byte[BUFFER_SIZE];
             int start = 0;
 
@@ -186,6 +187,7 @@
                     loge("got " + count + " reading with start = " + start);
                     break;
                 }
+                fdList = socket.getAncillaryFileDescriptors();
 
                 // Add our starting point to the count and reset the start.
                 count += start;
@@ -200,8 +202,8 @@
 
                         boolean releaseWl = false;
                         try {
-                            final NativeDaemonEvent event = NativeDaemonEvent.parseRawEvent(
-                                    rawEvent);
+                            final NativeDaemonEvent event =
+                                    NativeDaemonEvent.parseRawEvent(rawEvent, fdList);
 
                             log("RCV <- {" + event + "}");
 
diff --git a/services/core/java/com/android/server/NativeDaemonEvent.java b/services/core/java/com/android/server/NativeDaemonEvent.java
index 4e61c0b..e6feda3 100644
--- a/services/core/java/com/android/server/NativeDaemonEvent.java
+++ b/services/core/java/com/android/server/NativeDaemonEvent.java
@@ -19,6 +19,7 @@
 import android.util.Slog;
 import com.google.android.collect.Lists;
 
+import java.io.FileDescriptor;
 import java.util.ArrayList;
 
 /**
@@ -35,15 +36,17 @@
     private final String mRawEvent;
     private final String mLogMessage;
     private String[] mParsed;
+    private FileDescriptor[] mFdList;
 
     private NativeDaemonEvent(int cmdNumber, int code, String message,
-                              String rawEvent, String logMessage) {
+                              String rawEvent, String logMessage, FileDescriptor[] fdList) {
         mCmdNumber = cmdNumber;
         mCode = code;
         mMessage = message;
         mRawEvent = rawEvent;
         mLogMessage = logMessage;
         mParsed = null;
+        mFdList = fdList;
     }
 
     static public final String SENSITIVE_MARKER = "{{sensitive}}";
@@ -60,6 +63,10 @@
         return mMessage;
     }
 
+    public FileDescriptor[] getFileDescriptors() {
+        return mFdList;
+    }
+
     @Deprecated
     public String getRawEvent() {
         return mRawEvent;
@@ -127,7 +134,7 @@
      * @throws IllegalArgumentException when line doesn't match format expected
      *             from native side.
      */
-    public static NativeDaemonEvent parseRawEvent(String rawEvent) {
+    public static NativeDaemonEvent parseRawEvent(String rawEvent, FileDescriptor[] fdList) {
         final String[] parsed = rawEvent.split(" ");
         if (parsed.length < 2) {
             throw new IllegalArgumentException("Insufficient arguments");
@@ -164,7 +171,7 @@
 
         final String message = rawEvent.substring(skiplength);
 
-        return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage);
+        return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage, fdList);
     }
 
     /**
diff --git a/services/core/java/com/android/server/SystemService.java b/services/core/java/com/android/server/SystemService.java
index e0a9ab4..ce3166d 100644
--- a/services/core/java/com/android/server/SystemService.java
+++ b/services/core/java/com/android/server/SystemService.java
@@ -133,6 +133,15 @@
     public void onStartUser(int userHandle) {}
 
     /**
+     * Called when an existing user is unlocked. This means the
+     * credential-encrypted storage for that user is now available, and
+     * encryption-aware component filtering is no longer in effect.
+     *
+     * @param userHandle The identifier of the user.
+     */
+    public void onUnlockUser(int userHandle) {}
+
+    /**
      * Called when switching to a different foreground user, for system services that have
      * special behavior for whichever user is currently in the foreground.  This is called
      * before any application processes are aware of the new user.
diff --git a/services/core/java/com/android/server/SystemServiceManager.java b/services/core/java/com/android/server/SystemServiceManager.java
index 92e6814..ecc69e9 100644
--- a/services/core/java/com/android/server/SystemServiceManager.java
+++ b/services/core/java/com/android/server/SystemServiceManager.java
@@ -165,6 +165,19 @@
         }
     }
 
+    public void unlockUser(final int userHandle) {
+        final int serviceLen = mServices.size();
+        for (int i = 0; i < serviceLen; i++) {
+            final SystemService service = mServices.get(i);
+            try {
+                service.onUnlockUser(userHandle);
+            } catch (Exception ex) {
+                Slog.wtf(TAG, "Failure reporting unlock of user " + userHandle
+                        + " to service " + service.getClass().getName(), ex);
+            }
+        }
+    }
+
     public void switchUser(final int userHandle) {
         final int serviceLen = mServices.size();
         for (int i = 0; i < serviceLen; i++) {
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index 0b67ad8..6f713cd 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -57,7 +57,6 @@
     private static final boolean LOG = false;
 
     // Enable launching of applications when entering the dock.
-    private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true;
     private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = true;
 
     final Object mLock = new Object();
@@ -76,6 +75,13 @@
     private boolean mComputedNightMode;
     private int mCarModeEnableFlags;
 
+    // flag set by resource, whether to enable Car dock launch when starting car mode.
+    private boolean mEnableCarDockLaunch = true;
+    // flag set by resource, whether to lock UI mode to the default one or not.
+    private boolean mUiModeLocked = false;
+    // flag set by resource, whether to night mode change for normal all or not.
+    private boolean mNightModeLocked = false;
+
     int mCurUiMode = 0;
     private int mSetUiMode = 0;
     private boolean mHoldingConfiguration = false;
@@ -176,6 +182,10 @@
                 com.android.internal.R.integer.config_carDockKeepsScreenOn) == 1);
         mDeskModeKeepsScreenOn = (res.getInteger(
                 com.android.internal.R.integer.config_deskDockKeepsScreenOn) == 1);
+        mEnableCarDockLaunch = res.getBoolean(
+                com.android.internal.R.bool.config_enableCarDockHomeLaunch);
+        mUiModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockUiMode);
+        mNightModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockDayNightMode);
 
         final PackageManager pm = context.getPackageManager();
         mTelevision = pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
@@ -199,6 +209,10 @@
     private final IBinder mService = new IUiModeManager.Stub() {
         @Override
         public void enableCarMode(int flags) {
+            if (isUiModeLocked()) {
+                Slog.e(TAG, "enableCarMode while UI mode is locked");
+                return;
+            }
             final long ident = Binder.clearCallingIdentity();
             try {
                 synchronized (mLock) {
@@ -214,6 +228,10 @@
 
         @Override
         public void disableCarMode(int flags) {
+            if (isUiModeLocked()) {
+                Slog.e(TAG, "disableCarMode while UI mode is locked");
+                return;
+            }
             final long ident = Binder.clearCallingIdentity();
             try {
                 synchronized (mLock) {
@@ -241,6 +259,13 @@
 
         @Override
         public void setNightMode(int mode) {
+            if (isNightModeLocked() &&  (getContext().checkCallingOrSelfPermission(
+                    android.Manifest.permission.MODIFY_DAY_NIGHT_MODE)
+                    != PackageManager.PERMISSION_GRANTED)) {
+                Slog.e(TAG,
+                        "Night mode locked, requires MODIFY_DAY_NIGHT_MODE permission");
+                return;
+            }
             switch (mode) {
                 case UiModeManager.MODE_NIGHT_NO:
                 case UiModeManager.MODE_NIGHT_YES:
@@ -273,6 +298,20 @@
         }
 
         @Override
+        public boolean isUiModeLocked() {
+            synchronized (mLock) {
+                return mUiModeLocked;
+            }
+        }
+
+        @Override
+        public boolean isNightModeLocked() {
+            synchronized (mLock) {
+                return mNightModeLocked;
+            }
+        }
+
+        @Override
         protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
             if (getContext().checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                     != PackageManager.PERMISSION_GRANTED) {
@@ -293,10 +332,13 @@
             pw.print("  mDockState="); pw.print(mDockState);
                     pw.print(" mLastBroadcastState="); pw.println(mLastBroadcastState);
             pw.print("  mNightMode="); pw.print(mNightMode);
+                    pw.print(" mNightModeLocked="); pw.print(mNightModeLocked);
                     pw.print(" mCarModeEnabled="); pw.print(mCarModeEnabled);
                     pw.print(" mComputedNightMode="); pw.print(mComputedNightMode);
-                    pw.print(" mCarModeEnableFlags="); pw.println(mCarModeEnableFlags);
+                    pw.print(" mCarModeEnableFlags="); pw.print(mCarModeEnableFlags);
+                    pw.print(" mEnableCarDockLaunch="); pw.println(mEnableCarDockLaunch);
             pw.print("  mCurUiMode=0x"); pw.print(Integer.toHexString(mCurUiMode));
+                    pw.print(" mUiModeLocked="); pw.print(mUiModeLocked);
                     pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode));
             pw.print("  mHoldingConfiguration="); pw.print(mHoldingConfiguration);
                     pw.print(" mSystemReady="); pw.println(mSystemReady);
@@ -356,7 +398,9 @@
 
     private void updateConfigurationLocked() {
         int uiMode = mDefaultUiModeType;
-        if (mTelevision) {
+        if (mUiModeLocked) {
+            // no-op, keeps default one
+        } else if (mTelevision) {
             uiMode = Configuration.UI_MODE_TYPE_TELEVISION;
         } else if (mWatch) {
             uiMode = Configuration.UI_MODE_TYPE_WATCH;
@@ -460,7 +504,7 @@
         } else {
             String category = null;
             if (mCarModeEnabled) {
-                if (ENABLE_LAUNCH_CAR_DOCK_APP
+                if (mEnableCarDockLaunch
                         && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
                     category = Intent.CATEGORY_CAR_DOCK;
                 }
@@ -503,7 +547,7 @@
         if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(action)) {
             // Only launch car home when car mode is enabled and the caller
             // has asked us to switch to it.
-            if (ENABLE_LAUNCH_CAR_DOCK_APP
+            if (mEnableCarDockLaunch
                     && (enableFlags & UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) {
                 category = Intent.CATEGORY_CAR_DOCK;
             }
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 17b3d2a..2742c65 100755
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -30,10 +30,14 @@
 
 import android.app.ActivityThread;
 import android.app.AppOpsManager;
+import android.content.IIntentSender;
+import android.content.IntentSender;
 import android.os.Build;
+import android.os.Bundle;
 import android.os.DeadObjectException;
 import android.os.Handler;
 import android.os.Looper;
+import android.os.RemoteCallback;
 import android.os.SystemProperties;
 import android.os.TransactionTooLargeException;
 import android.util.ArrayMap;
@@ -300,7 +304,7 @@
     }
 
     ComponentName startServiceLocked(IApplicationThread caller, Intent service, String resolvedType,
-            int callingPid, int callingUid, String callingPackage, int userId)
+            int callingPid, int callingUid, String callingPackage, final int userId)
             throws TransactionTooLargeException {
         if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "startService: " + service
                 + " type=" + resolvedType + " args=" + service.getExtras());
@@ -340,6 +344,18 @@
 
         NeededUriGrants neededGrants = mAm.checkGrantUriPermissionFromIntentLocked(
                 callingUid, r.packageName, service, service.getFlags(), null, r.userId);
+
+        // If permissions need a review before any of the app components can run,
+        // we do not start the service and launch a review activity if the calling app
+        // is in the foreground passing it a pending intent to start the service when
+        // review is completed.
+        if (Build.PERMISSIONS_REVIEW_REQUIRED) {
+            if (!requestStartTargetPermissionsReviewIfNeededLocked(r, callingPackage,
+                    callingUid, service, callerFg, userId)) {
+                return null;
+            }
+        }
+
         if (unscheduleServiceRestartLocked(r, callingUid, false)) {
             if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "START SERVICE WHILE RESTART PENDING: " + r);
         }
@@ -417,6 +433,50 @@
         return startServiceInnerLocked(smap, service, r, callerFg, addToStarting);
     }
 
+    private boolean requestStartTargetPermissionsReviewIfNeededLocked(ServiceRecord r,
+            String callingPackage, int callingUid, Intent service, boolean callerFg,
+            final int userId) {
+        if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired(
+                r.packageName, r.userId)) {
+
+            // Show a permission review UI only for starting from a foreground app
+            if (!callerFg) {
+                Slog.w(TAG, "u" + r.userId + " Starting a service in package"
+                        + r.packageName + " requires a permissions review");
+                return false;
+            }
+
+            IIntentSender target = mAm.getIntentSenderLocked(
+                    ActivityManager.INTENT_SENDER_SERVICE, callingPackage,
+                    callingUid, userId, null, null, 0, new Intent[]{service},
+                    new String[]{service.resolveType(mAm.mContext.getContentResolver())},
+                    PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT
+                            | PendingIntent.FLAG_IMMUTABLE, null);
+
+            final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, r.packageName);
+            intent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
+
+            if (DEBUG_PERMISSIONS_REVIEW) {
+                Slog.i(TAG, "u" + r.userId + " Launching permission review for package "
+                        + r.packageName);
+            }
+
+            mAm.mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    mAm.mContext.startActivityAsUser(intent, new UserHandle(userId));
+                }
+            });
+
+            return false;
+        }
+
+        return  true;
+    }
+
     ComponentName startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r,
             boolean callerFg, boolean addToStarting) throws TransactionTooLargeException {
         ProcessStats.ServiceState stracker = r.getTracker();
@@ -427,7 +487,7 @@
         synchronized (r.stats.getBatteryStats()) {
             r.stats.startRunningLocked();
         }
-        String error = bringUpServiceLocked(r, service.getFlags(), callerFg, false);
+        String error = bringUpServiceLocked(r, service.getFlags(), callerFg, false, false);
         if (error != null) {
             return new ComponentName("!!", error);
         }
@@ -721,8 +781,8 @@
     }
 
     int bindServiceLocked(IApplicationThread caller, IBinder token, Intent service,
-            String resolvedType, IServiceConnection connection, int flags,
-            String callingPackage, int userId) throws TransactionTooLargeException {
+            String resolvedType, final IServiceConnection connection, int flags,
+            String callingPackage, final int userId) throws TransactionTooLargeException {
         if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "bindService: " + service
                 + " type=" + resolvedType + " conn=" + connection.asBinder()
                 + " flags=0x" + Integer.toHexString(flags));
@@ -783,6 +843,83 @@
         }
         ServiceRecord s = res.record;
 
+        boolean permissionsReviewRequired = false;
+
+        // If permissions need a review before any of the app components can run,
+        // we schedule binding to the service but do not start its process, then
+        // we launch a review activity to which is passed a callback to invoke
+        // when done to start the bound service's process to completing the binding.
+        if (Build.PERMISSIONS_REVIEW_REQUIRED) {
+            if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired(
+                    s.packageName, s.userId)) {
+
+                permissionsReviewRequired = true;
+
+                // Show a permission review UI only for binding from a foreground app
+                if (!callerFg) {
+                    Slog.w(TAG, "u" + s.userId + " Binding to a service in package"
+                            + s.packageName + " requires a permissions review");
+                    return 0;
+                }
+
+                final ServiceRecord serviceRecord = s;
+                final Intent serviceIntent = service;
+
+                RemoteCallback callback = new RemoteCallback(
+                        new RemoteCallback.OnResultListener() {
+                    @Override
+                    public void onResult(Bundle result) {
+                        synchronized(mAm) {
+                            final long identity = Binder.clearCallingIdentity();
+                            try {
+                                if (!mPendingServices.contains(serviceRecord)) {
+                                    return;
+                                }
+                                // If there is still a pending record, then the service
+                                // binding request is still valid, so hook them up. We
+                                // proceed only if the caller cleared the review requirement
+                                // otherwise we unbind because the user didn't approve.
+                                if (!mAm.getPackageManagerInternalLocked()
+                                        .isPermissionsReviewRequired(
+                                                serviceRecord.packageName,
+                                                serviceRecord.userId)) {
+                                    try {
+                                        bringUpServiceLocked(serviceRecord,
+                                                serviceIntent.getFlags(),
+                                                callerFg, false, false);
+                                    } catch (RemoteException e) {
+                                        /* ignore - local call */
+                                    }
+                                } else {
+                                    unbindServiceLocked(connection);
+                                }
+                            } finally {
+                                Binder.restoreCallingIdentity(identity);
+                            }
+                        }
+                    }
+                });
+
+                final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
+                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+                intent.putExtra(Intent.EXTRA_PACKAGE_NAME, s.packageName);
+                intent.putExtra(Intent.EXTRA_REMOTE_CALLBACK, callback);
+
+                if (DEBUG_PERMISSIONS_REVIEW) {
+                    Slog.i(TAG, "u" + s.userId + " Launching permission review for package "
+                            + s.packageName);
+                }
+
+                mAm.mHandler.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        mAm.mContext.startActivityAsUser(intent, new UserHandle(userId));
+                    }
+                });
+            }
+        }
+
         final long origId = Binder.clearCallingIdentity();
 
         try {
@@ -840,7 +977,8 @@
 
             if ((flags&Context.BIND_AUTO_CREATE) != 0) {
                 s.lastActivity = SystemClock.uptimeMillis();
-                if (bringUpServiceLocked(s, service.getFlags(), callerFg, false) != null) {
+                if (bringUpServiceLocked(s, service.getFlags(), callerFg, false,
+                        permissionsReviewRequired) != null) {
                     return 0;
                 }
             }
@@ -890,6 +1028,10 @@
         return 1;
     }
 
+    private void foo() {
+
+    }
+
     void publishServiceLocked(ServiceRecord r, Intent intent, IBinder service) {
         final long origId = Binder.clearCallingIdentity();
         try {
@@ -1366,7 +1508,7 @@
             return;
         }
         try {
-            bringUpServiceLocked(r, r.intent.getIntent().getFlags(), r.createdFromFg, true);
+            bringUpServiceLocked(r, r.intent.getIntent().getFlags(), r.createdFromFg, true, false);
         } catch (TransactionTooLargeException e) {
             // Ignore, it's been logged and nothing upstack cares.
         }
@@ -1410,8 +1552,9 @@
         }
     }
 
-    private final String bringUpServiceLocked(ServiceRecord r, int intentFlags, boolean execInFg,
-            boolean whileRestarting) throws TransactionTooLargeException {
+    private String bringUpServiceLocked(ServiceRecord r, int intentFlags, boolean execInFg,
+            boolean whileRestarting, boolean permissionsReviewRequired)
+            throws TransactionTooLargeException {
         //Slog.i(TAG, "Bring up service:");
         //r.dump("  ");
 
@@ -1497,7 +1640,7 @@
 
         // Not running -- get it started, and enqueue this service record
         // to be executed when the app comes up.
-        if (app == null) {
+        if (app == null && !permissionsReviewRequired) {
             if ((app=mAm.startProcessLocked(procName, r.appInfo, true, intentFlags,
                     "service", r.name, false, isolated, false)) == null) {
                 String msg = "Unable to launch app "
@@ -1920,6 +2063,9 @@
                 }
             }
 
+            // If unbound while waiting to start, remove the pending service
+            mPendingServices.remove(s);
+
             if ((c.flags&Context.BIND_AUTO_CREATE) != 0) {
                 boolean hasAutoCreate = s.hasAutoCreateConnections();
                 if (!hasAutoCreate) {
@@ -2962,5 +3108,4 @@
             }
         }
     }
-
 }
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index 16c959f..4f0d4d9 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -88,6 +88,7 @@
     static final boolean DEBUG_VISIBILITY = DEBUG_ALL || false;
     static final boolean DEBUG_VISIBLE_BEHIND = DEBUG_ALL_ACTIVITIES || false;
     static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
+    static final boolean DEBUG_PERMISSIONS_REVIEW = DEBUG_ALL || false;
 
     static final String POSTFIX_ADD_REMOVE = (APPEND_CATEGORY_NAME) ? "_AddRemove" : "";
     static final String POSTFIX_APP = (APPEND_CATEGORY_NAME) ? "_App" : "";
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 557b386..b769d39 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -16,9 +16,65 @@
 
 package com.android.server.am;
 
+import static android.Manifest.permission.INTERACT_ACROSS_USERS;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static com.android.internal.util.XmlUtils.readBooleanAttribute;
+import static com.android.internal.util.XmlUtils.readIntAttribute;
+import static com.android.internal.util.XmlUtils.readLongAttribute;
+import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
+import static com.android.internal.util.XmlUtils.writeIntAttribute;
+import static com.android.internal.util.XmlUtils.writeLongAttribute;
+import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
+import static com.android.server.am.ActivityManagerDebugConfig.*;
+import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
+import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK;
+import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV;
+import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_PINNABLE;
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
+
 import com.google.android.collect.Lists;
 import com.google.android.collect.Maps;
 
+import android.Manifest;
+import android.app.AppOpsManager;
+import android.app.ApplicationThreadNative;
+import android.app.BroadcastOptions;
+import android.app.IActivityContainer;
+import android.app.IActivityContainerCallback;
+import android.app.IAppTask;
+import android.app.ITaskStackListener;
+import android.app.ProfilerInfo;
+import android.app.assist.AssistContent;
+import android.app.assist.AssistStructure;
+import android.app.usage.UsageEvents;
+import android.app.usage.UsageStatsManagerInternal;
+import android.appwidget.AppWidgetManager;
+import android.content.pm.PackageManagerInternal;
+import android.content.pm.PermissionInfo;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.os.BatteryStats;
+import android.os.PersistableBundle;
+import android.os.PowerManager;
+import android.os.Trace;
+import android.os.TransactionTooLargeException;
+import android.os.WorkSource;
+import android.os.storage.IMountService;
+import android.os.storage.MountServiceInternal;
+import android.os.storage.StorageManager;
+import android.service.voice.IVoiceInteractionSession;
+import android.service.voice.VoiceInteractionSession;
+import android.util.ArrayMap;
+import android.util.ArraySet;
+import android.util.DebugUtils;
+import android.util.SparseIntArray;
+import android.view.Display;
+
 import com.android.internal.R;
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.app.AssistUtils;
@@ -1431,6 +1487,7 @@
     static final int APP_BOOST_DEACTIVATE_MSG = 58;
     static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT_MSG = 59;
     static final int IDLE_UIDS_MSG = 60;
+    static final int SYSTEM_USER_UNLOCK_MSG = 61;
 
     static final int FIRST_ACTIVITY_STACK_MSG = 100;
     static final int FIRST_BROADCAST_QUEUE_MSG = 200;
@@ -1457,6 +1514,8 @@
     final MainHandler mHandler;
     final UiHandler mUiHandler;
 
+    PackageManagerInternal mPackageManagerInt;
+
     final class UiHandler extends Handler {
         public UiHandler() {
             super(com.android.server.UiThread.get().getLooper(), null, true);
@@ -1931,6 +1990,10 @@
                 mSystemServiceManager.startUser(msg.arg1);
                 break;
             }
+            case SYSTEM_USER_UNLOCK_MSG: {
+                mSystemServiceManager.unlockUser(msg.arg1);
+                break;
+            }
             case SYSTEM_USER_CURRENT_MSG: {
                 mBatteryStatsService.noteEvent(
                         BatteryStats.HistoryItem.EVENT_USER_FOREGROUND_FINISH,
@@ -2713,57 +2776,60 @@
     }
 
     final void setFocusedActivityLocked(ActivityRecord r, String reason) {
-        if (r != null && mFocusedActivity != r) {
-            if (DEBUG_FOCUS) Slog.d(TAG_FOCUS, "setFocusedActivityLocked: r=" + r);
-            ActivityRecord last = mFocusedActivity;
-            mFocusedActivity = r;
-            if (r.task.taskType != ActivityRecord.HOME_ACTIVITY_TYPE
-                    && r.task.taskType != ActivityRecord.RECENTS_ACTIVITY_TYPE) {
-                if (mCurAppTimeTracker != r.appTimeTracker) {
-                    // We are switching app tracking.  Complete the current one.
-                    if (mCurAppTimeTracker != null) {
-                        mCurAppTimeTracker.stop();
-                        mHandler.obtainMessage(REPORT_TIME_TRACKER_MSG,
-                                mCurAppTimeTracker).sendToTarget();
-                        mStackSupervisor.clearOtherAppTimeTrackers(r.appTimeTracker);
-                        mCurAppTimeTracker = null;
-                    }
-                    if (r.appTimeTracker != null) {
-                        mCurAppTimeTracker = r.appTimeTracker;
-                        startTimeTrackingFocusedActivityLocked();
-                    }
-                } else {
+        if (r == null || mFocusedActivity == r) {
+            return;
+        }
+
+        if (DEBUG_FOCUS) Slog.d(TAG_FOCUS, "setFocusedActivityLocked: r=" + r);
+        final ActivityRecord last = mFocusedActivity;
+        mFocusedActivity = r;
+        if (r.task.isApplicationTask()) {
+            if (mCurAppTimeTracker != r.appTimeTracker) {
+                // We are switching app tracking.  Complete the current one.
+                if (mCurAppTimeTracker != null) {
+                    mCurAppTimeTracker.stop();
+                    mHandler.obtainMessage(
+                            REPORT_TIME_TRACKER_MSG, mCurAppTimeTracker).sendToTarget();
+                    mStackSupervisor.clearOtherAppTimeTrackers(r.appTimeTracker);
+                    mCurAppTimeTracker = null;
+                }
+                if (r.appTimeTracker != null) {
+                    mCurAppTimeTracker = r.appTimeTracker;
                     startTimeTrackingFocusedActivityLocked();
                 }
             } else {
-                r.appTimeTracker = null;
+                startTimeTrackingFocusedActivityLocked();
             }
-            if (r.task != null && r.task.voiceInteractor != null) {
-                startRunningVoiceLocked(r.task.voiceSession, r.info.applicationInfo.uid);
-            } else {
-                finishRunningVoiceLocked();
-                if (last != null && last.task.voiceSession != null) {
-                    // We had been in a voice interaction session, but now focused has
-                    // move to something different.  Just finish the session, we can't
-                    // return to it and retain the proper state and synchronization with
-                    // the voice interaction service.
-                    finishVoiceTask(last.task.voiceSession);
-                }
-            }
-            if (mStackSupervisor.setFocusedStack(r, reason + " setFocusedActivity")) {
-                mWindowManager.setFocusedApp(r.appToken, true);
-            }
-            applyUpdateLockStateLocked(r);
-            if (mFocusedActivity.userId != mLastFocusedUserId) {
-                mHandler.removeMessages(FOREGROUND_PROFILE_CHANGED_MSG);
-                mHandler.sendMessage(mHandler.obtainMessage(FOREGROUND_PROFILE_CHANGED_MSG,
-                        mFocusedActivity.userId, 0));
-                mLastFocusedUserId = mFocusedActivity.userId;
+        } else {
+            r.appTimeTracker = null;
+        }
+        if (r.task.voiceInteractor != null) {
+            startRunningVoiceLocked(r.task.voiceSession, r.info.applicationInfo.uid);
+        } else {
+            finishRunningVoiceLocked();
+            if (last != null && last.task.voiceSession != null) {
+                // We had been in a voice interaction session, but now focused has
+                // move to something different.  Just finish the session, we can't
+                // return to it and retain the proper state and synchronization with
+                // the voice interaction service.
+                finishVoiceTask(last.task.voiceSession);
             }
         }
-        EventLog.writeEvent(EventLogTags.AM_FOCUSED_ACTIVITY,
+        if (mStackSupervisor.setFocusedStack(r, reason + " setFocusedActivity")) {
+            mWindowManager.setFocusedApp(r.appToken, true);
+        }
+        applyUpdateLockStateLocked(r);
+        if (mFocusedActivity.userId != mLastFocusedUserId) {
+            mHandler.removeMessages(FOREGROUND_PROFILE_CHANGED_MSG);
+            mHandler.obtainMessage(
+                    FOREGROUND_PROFILE_CHANGED_MSG, mFocusedActivity.userId, 0).sendToTarget();
+            mLastFocusedUserId = mFocusedActivity.userId;
+        }
+
+        EventLogTags.writeAmFocusedActivity(
                 mFocusedActivity == null ? -1 : mFocusedActivity.userId,
-                mFocusedActivity == null ? "NULL" : mFocusedActivity.shortComponentName);
+                mFocusedActivity == null ? "NULL" : mFocusedActivity.shortComponentName,
+                reason);
     }
 
     final void clearFocusedActivity(ActivityRecord r) {
@@ -2779,7 +2845,7 @@
                 }
             }
             mFocusedActivity = null;
-            EventLog.writeEvent(EventLogTags.AM_FOCUSED_ACTIVITY, -1, "NULL");
+            EventLogTags.writeAmFocusedActivity(-1, "NULL", "clearFocusedActivity");
         }
     }
 
@@ -3356,10 +3422,8 @@
 
         try {
             try {
-                if (AppGlobals.getPackageManager().isPackageFrozen(app.info.packageName)) {
-                    // This is caught below as if we had failed to fork zygote
-                    throw new RuntimeException("Package " + app.info.packageName + " is frozen!");
-                }
+                final int userId = UserHandle.getUserId(app.uid);
+                AppGlobals.getPackageManager().checkPackageStartable(app.info.packageName, userId);
             } catch (RemoteException e) {
                 throw e.rethrowAsRuntimeException();
             }
@@ -4399,8 +4463,10 @@
             if (r == null) {
                 return;
             }
-            if (r.task != null && r.task.mResizeable) {
-                // Fixed screen orientation isn't supported with resizeable activities.
+            TaskRecord task = r.task;
+            if (task != null && (!task.mFullscreen || !task.stack.mFullscreen)) {
+                // Fixed screen orientation isn't supported when activities aren't in full screen
+                // mode.
                 return;
             }
             final long origId = Binder.clearCallingIdentity();
@@ -5328,6 +5394,11 @@
                     removeUriPermissionsForPackageLocked(packageName, userId, true);
                 }
 
+                // Remove all zen rules created by this package; revoke it's zen access.
+                INotificationManager inm = NotificationManager.getService();
+                inm.removeAutomaticZenRules(packageName);
+                inm.setNotificationPolicyAccessGranted(packageName, false);
+
                 Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
                         Uri.fromParts("package", packageName, null));
                 intent.putExtra(Intent.EXTRA_UID, pkgUid);
@@ -6011,6 +6082,8 @@
                         "No more processes in " + old.uidRecord);
                 enqueueUidChangeLocked(old.uidRecord, -1, UidRecord.CHANGE_GONE);
                 mActiveUids.remove(uid);
+                mBatteryStatsService.noteUidProcessState(uid,
+                        ActivityManager.PROCESS_STATE_NONEXISTENT);
             }
             old.uidRecord = null;
         }
@@ -6035,6 +6108,7 @@
             if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS,
                     "Creating new process uid: " + uidRec);
             mActiveUids.put(proc.uid, uidRec);
+            mBatteryStatsService.noteUidProcessState(uidRec.uid, uidRec.curProcState);
             enqueueUidChangeLocked(uidRec, -1, UidRecord.CHANGE_ACTIVE);
         }
         proc.uidRecord = uidRec;
@@ -7148,22 +7222,40 @@
 
         @Override
         public void getProcessStatesFromPids(/*in*/ int[] pids, /*out*/ int[] states) {
-            mActivityManagerService.getProcessStatesForPIDs(/*in*/ pids, /*out*/ states);
+            mActivityManagerService.getProcessStatesAndOomScoresForPIDs(
+                    /*in*/ pids, /*out*/ states, null);
+        }
+
+        @Override
+        public void getProcessStatesAndOomScoresFromPids(
+                /*in*/ int[] pids, /*out*/ int[] states, /*out*/ int[] scores) {
+            mActivityManagerService.getProcessStatesAndOomScoresForPIDs(
+                    /*in*/ pids, /*out*/ states, /*out*/ scores);
         }
     }
 
     /**
      * For each PID in the given input array, write the current process state
-     * for that process into the output array, or -1 to indicate that no
-     * process with the given PID exists.
+     * for that process into the states array, or -1 to indicate that no
+     * process with the given PID exists. If scores array is provided, write
+     * the oom score for the process into the scores array, with INVALID_ADJ
+     * indicating the PID doesn't exist.
      */
-    public void getProcessStatesForPIDs(/*in*/ int[] pids, /*out*/ int[] states) {
+    public void getProcessStatesAndOomScoresForPIDs(
+            /*in*/ int[] pids, /*out*/ int[] states, /*out*/ int[] scores) {
+        if (scores != null) {
+            enforceCallingPermission(android.Manifest.permission.GET_PROCESS_STATE_AND_OOM_SCORE,
+                    "getProcessStatesAndOomScoresForPIDs()");
+        }
+
         if (pids == null) {
             throw new NullPointerException("pids");
         } else if (states == null) {
             throw new NullPointerException("states");
         } else if (pids.length != states.length) {
-            throw new IllegalArgumentException("input and output arrays have different lengths!");
+            throw new IllegalArgumentException("pids and states arrays have different lengths!");
+        } else if (scores != null && pids.length != scores.length) {
+            throw new IllegalArgumentException("pids and scores arrays have different lengths!");
         }
 
         synchronized (mPidsSelfLocked) {
@@ -7171,6 +7263,9 @@
                 ProcessRecord pr = mPidsSelfLocked.get(pids[i]);
                 states[i] = (pr == null) ? ActivityManager.PROCESS_STATE_NONEXISTENT :
                         pr.curProcState;
+                if (scores != null) {
+                    scores[i] = (pr == null) ? ProcessList.INVALID_ADJ : pr.curAdj;
+                }
             }
         }
     }
@@ -9944,14 +10039,6 @@
                 }
 
                 if (cpr.proc != null) {
-                    if (false) {
-                        if (cpr.name.flattenToShortString().equals(
-                                "com.android.providers.calendar/.CalendarProvider2")) {
-                            Slog.v(TAG, "****************** KILLING "
-                                + cpr.name.flattenToShortString());
-                            Process.killProcess(cpr.proc.pid);
-                        }
-                    }
                     checkTime(startTime, "getContentProviderImpl: before updateOomAdj");
                     boolean success = updateOomAdjLocked(cpr.proc);
                     maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
@@ -10044,6 +10131,16 @@
                 final boolean firstClass = cpr == null;
                 if (firstClass) {
                     final long ident = Binder.clearCallingIdentity();
+
+                    // If permissions need a review before any of the app components can run,
+                    // we return no provider and launch a review activity if the calling app
+                    // is in the foreground.
+                    if (Build.PERMISSIONS_REVIEW_REQUIRED) {
+                        if (!requestTargetProviderPermissionsReviewIfNeededLocked(cpi, r, userId)) {
+                            return null;
+                        }
+                    }
+
                     try {
                         checkTime(startTime, "getContentProviderImpl: before getApplicationInfo");
                         ApplicationInfo ai =
@@ -10196,6 +10293,52 @@
         return cpr != null ? cpr.newHolder(conn) : null;
     }
 
+    private boolean requestTargetProviderPermissionsReviewIfNeededLocked(ProviderInfo cpi,
+            ProcessRecord r, final int userId) {
+        if (getPackageManagerInternalLocked().isPermissionsReviewRequired(
+                cpi.packageName, r.userId)) {
+
+            final boolean callerForeground = r != null ? r.setSchedGroup
+                    != Process.THREAD_GROUP_BG_NONINTERACTIVE : true;
+
+            // Show a permission review UI only for starting from a foreground app
+            if (!callerForeground) {
+                Slog.w(TAG, "u" + r.userId + " Instantiating a provider in package"
+                        + cpi.packageName + " requires a permissions review");
+                return false;
+            }
+
+            final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, cpi.packageName);
+
+            if (DEBUG_PERMISSIONS_REVIEW) {
+                Slog.i(TAG, "u" + r.userId + " Launching permission review "
+                        + "for package " + cpi.packageName);
+            }
+
+            final UserHandle userHandle = new UserHandle(userId);
+            mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    mContext.startActivityAsUser(intent, userHandle);
+                }
+            });
+
+            return false;
+        }
+
+        return true;
+    }
+
+    PackageManagerInternal getPackageManagerInternalLocked() {
+        if (mPackageManagerInt == null) {
+            mPackageManagerInt = LocalServices.getService(PackageManagerInternal.class);
+        }
+        return mPackageManagerInt;
+    }
+
     @Override
     public final ContentProviderHolder getContentProvider(
             IApplicationThread caller, String name, int userId, boolean stable) {
@@ -10899,7 +11042,7 @@
     public void stopAppSwitches() {
         if (checkCallingPermission(android.Manifest.permission.STOP_APP_SWITCHES)
                 != PackageManager.PERMISSION_GRANTED) {
-            throw new SecurityException("Requires permission "
+            throw new SecurityException("viewquires permission "
                     + android.Manifest.permission.STOP_APP_SWITCHES);
         }
 
@@ -17761,7 +17904,7 @@
      * @param userId is only used when persistent parameter is set to true to persist configuration
      *               for that particular user
      */
-    boolean updateConfigurationLocked(Configuration values,
+    private boolean updateConfigurationLocked(Configuration values,
             ActivityRecord starting, boolean initLocale, boolean persistent, int userId) {
         int changes = 0;
 
@@ -19372,10 +19515,6 @@
             if (proc.baseProcessTracker != null) {
                 proc.baseProcessTracker.setState(proc.repProcState, memFactor, now, proc.pkgList);
             }
-            if (proc.repProcState >= 0) {
-                mBatteryStatsService.noteProcessState(proc.processName, proc.info.uid,
-                        proc.repProcState);
-            }
         }
     }
 
@@ -19875,6 +20014,7 @@
                 }
                 uidRec.setProcState = uidRec.curProcState;
                 enqueueUidChangeLocked(uidRec, -1, uidChange);
+                mBatteryStatsService.noteUidProcessState(uidRec.uid, uidRec.curProcState);
             }
         }
 
@@ -20302,8 +20442,8 @@
     }
 
     @Override
-    public int stopUser(final int userId, final IStopUserCallback callback) {
-        return mUserController.stopUser(userId, callback);
+    public int stopUser(final int userId, boolean force, final IStopUserCallback callback) {
+        return mUserController.stopUser(userId, force, callback);
     }
 
     void onUserRemovedLocked(int userId) {
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index da2c8c5c..36a7cee 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -54,7 +54,6 @@
 import android.app.ResultInfo;
 import android.app.ActivityManager.RunningTaskInfo;
 import android.content.ComponentName;
-import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
@@ -73,7 +72,6 @@
 import android.os.SystemClock;
 import android.os.Trace;
 import android.os.UserHandle;
-import android.provider.Settings;
 import android.service.voice.IVoiceInteractionSession;
 import android.util.EventLog;
 import android.util.Slog;
@@ -2827,41 +2825,43 @@
     }
 
     private void adjustFocusedActivityLocked(ActivityRecord r, String reason) {
-        if (mStackSupervisor.isFocusedStack(this) && mService.mFocusedActivity == r) {
-            ActivityRecord next = topRunningActivityLocked();
-            final String myReason = reason + " adjustFocus";
-            if (next != r) {
-                if (next != null && StackId.keepFocusInStackIfPossible(mStackId)) {
-                    // For freeform, docked, and pinned stacks we always keep the focus within the
-                    // stack as long as there is a running activity in the stack that we can adjust
-                    // focus to.
-                    mService.setFocusedActivityLocked(next, myReason);
-                    return;
-                } else {
-                    final TaskRecord task = r.task;
-                    if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) {
-                        // For non-fullscreen stack, we want to move the focus to the next visible
-                        // stack to prevent the home screen from moving to the top and obscuring
-                        // other visible stacks.
-                        if (!mFullscreen
-                                && adjustFocusToNextVisibleStackLocked(null, myReason)) {
-                            return;
-                        }
-                        // Move the home stack to the top if this stack is fullscreen or there is no
-                        // other visible stack.
-                        if (mStackSupervisor.moveHomeStackTaskToTop(
-                                task.getTaskToReturnTo(), myReason)) {
-                            // Activity focus was already adjusted. Nothing else to do...
-                            return;
-                        }
+        if (!mStackSupervisor.isFocusedStack(this) || mService.mFocusedActivity != r) {
+            return;
+        }
+
+        final ActivityRecord next = topRunningActivityLocked();
+        final String myReason = reason + " adjustFocus";
+        if (next != r) {
+            if (next != null && StackId.keepFocusInStackIfPossible(mStackId)) {
+                // For freeform, docked, and pinned stacks we always keep the focus within the
+                // stack as long as there is a running activity in the stack that we can adjust
+                // focus to.
+                mService.setFocusedActivityLocked(next, myReason);
+                return;
+            } else {
+                final TaskRecord task = r.task;
+                if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) {
+                    // For non-fullscreen stack, we want to move the focus to the next visible
+                    // stack to prevent the home screen from moving to the top and obscuring
+                    // other visible stacks.
+                    if (!mFullscreen
+                            && adjustFocusToNextVisibleStackLocked(null, myReason)) {
+                        return;
+                    }
+                    // Move the home stack to the top if this stack is fullscreen or there is no
+                    // other visible stack.
+                    if (mStackSupervisor.moveHomeStackTaskToTop(
+                            task.getTaskToReturnTo(), myReason)) {
+                        // Activity focus was already adjusted. Nothing else to do...
+                        return;
                     }
                 }
             }
+        }
 
-            final ActivityRecord top = mStackSupervisor.topRunningActivityLocked();
-            if (top != null) {
-                mService.setFocusedActivityLocked(top, myReason);
-            }
+        final ActivityRecord top = mStackSupervisor.topRunningActivityLocked();
+        if (top != null) {
+            mService.setFocusedActivityLocked(top, myReason);
         }
     }
 
@@ -4751,7 +4751,7 @@
         final Rect bounds = task.getLaunchBounds();
         task.updateOverrideConfiguration(bounds);
         mWindowManager.setAppTask(
-                r.appToken, task.taskId, task.getLaunchBounds(), task.mOverrideConfig);
+                r.appToken, task.taskId, mStackId, task.getLaunchBounds(), task.mOverrideConfig);
         mWindowManager.setTaskResizeable(task.taskId, task.mResizeable);
         r.taskConfigOverride = task.mOverrideConfig;
     }
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index c3bd982..a6af0d10 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -76,6 +76,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManagerInternal;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
 import android.content.res.Configuration;
@@ -88,6 +89,7 @@
 import android.hardware.input.InputManagerInternal;
 import android.net.Uri;
 import android.os.Binder;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Debug;
 import android.os.Handler;
@@ -184,7 +186,6 @@
     static final int CONTAINER_CALLBACK_TASK_LIST_EMPTY = FIRST_SUPERVISOR_STACK_MSG + 11;
     static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12;
     static final int SHOW_LOCK_TASK_ESCAPE_MESSAGE_MSG = FIRST_SUPERVISOR_STACK_MSG + 13;
-    static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = FIRST_SUPERVISOR_STACK_MSG + 14;
 
     private static final String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay";
 
@@ -1668,11 +1669,11 @@
         }
 
         UserInfo user = getUserInfo(userId);
-        // TODO: Timeout for work challenge
-        if (user.isManagedProfile() && StorageManager.isFileBasedEncryptionEnabled()) {
-            KeyguardManager km = (KeyguardManager) mService.mContext
-                    .getSystemService(Context.KEYGUARD_SERVICE);
-
+        KeyguardManager km = (KeyguardManager) mService.mContext
+                .getSystemService(Context.KEYGUARD_SERVICE);
+        if (user.isManagedProfile()
+                && LockPatternUtils.isSeparateWorkChallengeEnabled()
+                && km.isDeviceLocked(userId)) {
             IIntentSender target = mService.getIntentSenderLocked(
                     ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage,
                     Binder.getCallingUid(), userId, null, null, 0, new Intent[]{ intent },
@@ -1708,6 +1709,46 @@
             return ActivityManager.START_SUCCESS;
         }
 
+        // If permissions need a review before any of the app components can run, we
+        // launch the review activity and pass a pending intent to start the activity
+        // we are to launching now after the review is completed.
+        if (Build.PERMISSIONS_REVIEW_REQUIRED && aInfo != null) {
+            if (mService.getPackageManagerInternalLocked().isPermissionsReviewRequired(
+                    aInfo.packageName, userId)) {
+                IIntentSender target = mService.getIntentSenderLocked(
+                        ActivityManager.INTENT_SENDER_ACTIVITY, callingPackage,
+                        callingUid, userId, null, null, 0, new Intent[]{intent},
+                        new String[]{resolvedType}, PendingIntent.FLAG_CANCEL_CURRENT
+                                | PendingIntent.FLAG_ONE_SHOT, null);
+
+                Intent newIntent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
+                newIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+                newIntent.putExtra(Intent.EXTRA_PACKAGE_NAME, aInfo.packageName);
+                newIntent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
+                if (resultRecord != null) {
+                    newIntent.putExtra(Intent.EXTRA_RESULT_NEEDED, true);
+                }
+                newIntent.setFlags(intent.getFlags());
+                intent = newIntent;
+
+                resolvedType = null;
+                callingUid = realCallingUid;
+                callingPid = realCallingPid;
+
+                aInfo = resolveActivity(intent, null, PackageManager.MATCH_DEFAULT_ONLY
+                        | ActivityManagerService.STOCK_PM_FLAGS, null, userId);
+
+                if (DEBUG_PERMISSIONS_REVIEW) {
+                    Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true,
+                            true, false) + "} from uid " + callingUid + " on display "
+                            + (container == null ? (mFocusedStack == null ?
+                            Display.DEFAULT_DISPLAY : mFocusedStack.mDisplayId) :
+                            (container.mActivityDisplay == null ? Display.DEFAULT_DISPLAY :
+                                    container.mActivityDisplay.mDisplayId)));
+                }
+            }
+        }
+
         ActivityRecord r = new ActivityRecord(mService, callerApp, callingUid, callingPackage,
                 intent, resolvedType, aInfo, mService.mConfiguration, resultRecord, resultWho,
                 requestCode, componentSpecified, voiceSession != null, this, container, options);
@@ -2592,6 +2633,11 @@
             mService.setFocusedActivityLocked(r, "startedActivity");
         }
         updateUserStackLocked(r.userId, targetStack);
+
+        if (!r.task.mResizeable && isStackDockedInEffect(targetStack.mStackId)) {
+            showNonResizeableDockToast(r.task.taskId);
+        }
+
         return ActivityManager.START_SUCCESS;
     }
 
@@ -3114,7 +3160,7 @@
                     for (int i = 0; i < count; i++) {
                         moveTaskToStackLocked(tasks.get(i).taskId,
                                 FULLSCREEN_WORKSPACE_STACK_ID, ON_TOP, FORCE_FOCUS, "resizeStack",
-                                true /* animate */);
+                                false /* animate */);
                     }
 
                     // stack shouldn't contain anymore activities, so nothing to resume.
@@ -3376,6 +3422,10 @@
         final ActivityStack stack = moveTaskToStackUncheckedLocked(
                 task, stackId, toTop, forceFocus, "moveTaskToStack:" + reason);
 
+        if (!animate) {
+            stack.mNoAnimActivities.add(topActivity);
+        }
+
         // Make sure the task has the appropriate bounds/size for the stack it is in.
         if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
             resizeTaskLocked(task, stack.mBounds, RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
@@ -3393,7 +3443,7 @@
         resumeTopActivitiesLocked();
 
         if (!task.mResizeable && isStackDockedInEffect(stackId)) {
-            showNonResizeableDockToast();
+            showNonResizeableDockToast(taskId);
         }
     }
 
@@ -4327,8 +4377,8 @@
         }
     }
 
-    void showNonResizeableDockToast() {
-        mHandler.sendEmptyMessage(SHOW_NON_RESIZEABLE_DOCK_TOAST);
+    private void showNonResizeableDockToast(int taskId) {
+        mWindowManager.scheduleShowNonResizeableDockToast(taskId);
     }
 
     void showLockTaskToast() {
@@ -4643,13 +4693,7 @@
                         }
                     }
                 } break;
-                case SHOW_NON_RESIZEABLE_DOCK_TOAST: {
-                    final Toast toast = Toast.makeText(
-                            mService.mContext,
-                            mService.mContext.getString(R.string.dock_non_resizeble_text),
-                            Toast.LENGTH_LONG);
-                    toast.show();
-                } break;
+
             }
         }
     }
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index c7228ce..f64b803 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -272,18 +272,18 @@
         }
     }
 
-    void noteProcessState(String name, int uid, int state) {
-        synchronized (mStats) {
-            mStats.noteProcessStateLocked(name, uid, state);
-        }
-    }
-
     void noteProcessFinish(String name, int uid) {
         synchronized (mStats) {
             mStats.noteProcessFinishLocked(name, uid);
         }
     }
 
+    void noteUidProcessState(int uid, int state) {
+        synchronized (mStats) {
+            mStats.noteUidProcessStateLocked(uid, state);
+        }
+    }
+
     // Public interface...
 
     public byte[] getStatistics() {
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java
index fb37eda..b160981 100644
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -27,12 +27,16 @@
 import android.app.AppGlobals;
 import android.app.AppOpsManager;
 import android.app.BroadcastOptions;
+import android.app.PendingIntent;
 import android.content.ComponentName;
 import android.content.IIntentReceiver;
+import android.content.IIntentSender;
 import android.content.Intent;
+import android.content.IntentSender;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -46,6 +50,7 @@
 import android.util.Slog;
 import android.util.TimeUtils;
 import com.android.server.DeviceIdleController;
+import com.android.server.LocalServices;
 
 import static com.android.server.am.ActivityManagerDebugConfig.*;
 
@@ -181,7 +186,7 @@
                 } break;
             }
         }
-    };
+    }
 
     private final class AppNotResponding implements Runnable {
         private final ProcessRecord mApp;
@@ -580,6 +585,17 @@
         }
 
         if (!skip) {
+            // If permissions need a review before any of the app components can run, we drop
+            // the broadcast and if the calling app is in the foreground and the broadcast is
+            // explicit we launch the review UI passing it a pending intent to send the skipped
+            // broadcast.
+            if (Build.PERMISSIONS_REVIEW_REQUIRED) {
+                if (!requestStartTargetPermissionsReviewIfNeededLocked(r, filter.packageName,
+                        filter.owningUserId)) {
+                    return;
+                }
+            }
+
             // If this is not being sent as an ordered broadcast, then we
             // don't want to touch the fields that keep track of the current
             // state of ordered broadcasts.
@@ -622,6 +638,54 @@
         }
     }
 
+    private boolean requestStartTargetPermissionsReviewIfNeededLocked(
+            BroadcastRecord receiverRecord, String receivingPackageName,
+            final int receivingUserId) {
+        if (!mService.getPackageManagerInternalLocked().isPermissionsReviewRequired(
+                receivingPackageName, receivingUserId)) {
+            return true;
+        }
+
+        final boolean callerForeground = receiverRecord.callerApp != null
+                ? receiverRecord.callerApp.setSchedGroup != Process.THREAD_GROUP_BG_NONINTERACTIVE
+                : true;
+
+        // Show a permission review UI only for explicit broadcast from a foreground app
+        if (callerForeground && receiverRecord.intent.getComponent() != null) {
+            IIntentSender target = mService.getIntentSenderLocked(
+                    ActivityManager.INTENT_SENDER_BROADCAST, receiverRecord.callerPackage,
+                    receiverRecord.callingUid, receiverRecord.userId, null, null, 0,
+                    new Intent[]{receiverRecord.intent},
+                    new String[]{receiverRecord.intent.resolveType(mService.mContext
+                            .getContentResolver())},
+                    PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT
+                            | PendingIntent.FLAG_IMMUTABLE, null);
+
+            final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSIONS);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, receivingPackageName);
+            intent.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
+
+            if (DEBUG_PERMISSIONS_REVIEW) {
+                Slog.i(TAG, "u" + receivingUserId + " Launching permission review for package "
+                        + receivingPackageName);
+            }
+
+            mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    mService.mContext.startActivityAsUser(intent, new UserHandle(receivingUserId));
+                }
+            });
+        } else {
+            Slog.w(TAG, "u" + receivingUserId + " Receiving a broadcast in package"
+                    + receivingPackageName + " requires a permissions review");
+        }
+
+        return false;
+    }
+
     final void scheduleTempWhitelistLocked(int uid, long duration, BroadcastRecord r) {
         if (duration > Integer.MAX_VALUE) {
             duration = Integer.MAX_VALUE;
@@ -1007,6 +1071,18 @@
                 }
             }
 
+            // If permissions need a review before any of the app components can run, we drop
+            // the broadcast and if the calling app is in the foreground and the broadcast is
+            // explicit we launch the review UI passing it a pending intent to send the skipped
+            // broadcast.
+            if (Build.PERMISSIONS_REVIEW_REQUIRED && !skip) {
+                if (!requestStartTargetPermissionsReviewIfNeededLocked(r,
+                        info.activityInfo.packageName, UserHandle.getUserId(
+                                info.activityInfo.applicationInfo.uid))) {
+                    skip = true;
+                }
+            }
+
             if (skip) {
                 if (DEBUG_BROADCAST)  Slog.v(TAG_BROADCAST,
                         "Skipping delivery of ordered [" + mQueueName + "] "
diff --git a/services/core/java/com/android/server/am/EventLogTags.logtags b/services/core/java/com/android/server/am/EventLogTags.logtags
index 78b5f33..0397553 100644
--- a/services/core/java/com/android/server/am/EventLogTags.logtags
+++ b/services/core/java/com/android/server/am/EventLogTags.logtags
@@ -91,7 +91,7 @@
 30042 am_activity_fully_drawn_time (User|1|5),(Token|1|5),(Component Name|3),(time|2|3)
 
 # Activity focused
-30043 am_focused_activity (User|1|5),(Component Name|3)
+30043 am_focused_activity (User|1|5),(Component Name|3),(Reason|3)
 
 # Stack focus
 30044 am_focused_stack (User|1|5),(Focused Stack Id|1|5),(Last Focused Stack Id|1|5),(Reason|3)
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index b30905e..f6f82da 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -18,6 +18,8 @@
 
 import static android.Manifest.permission.INTERACT_ACROSS_USERS;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.app.ActivityManager.USER_OP_ERROR_IS_SYSTEM;
+import static android.app.ActivityManager.USER_OP_ERROR_RELATED_USERS_CANNOT_STOP;
 import static android.app.ActivityManager.USER_OP_IS_CURRENT;
 import static android.app.ActivityManager.USER_OP_SUCCESS;
 import static android.os.Process.SYSTEM_UID;
@@ -32,8 +34,10 @@
 import static com.android.server.am.ActivityManagerService.REPORT_USER_SWITCH_MSG;
 import static com.android.server.am.ActivityManagerService.SYSTEM_USER_CURRENT_MSG;
 import static com.android.server.am.ActivityManagerService.SYSTEM_USER_START_MSG;
+import static com.android.server.am.ActivityManagerService.SYSTEM_USER_UNLOCK_MSG;
 import static com.android.server.am.ActivityManagerService.USER_SWITCH_TIMEOUT_MSG;
 
+import android.annotation.NonNull;
 import android.app.ActivityManager;
 import android.app.AppOpsManager;
 import android.app.Dialog;
@@ -56,11 +60,11 @@
 import android.os.RemoteCallbackList;
 import android.os.RemoteException;
 import android.os.ServiceManager;
-import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.os.storage.IMountService;
 import android.os.storage.StorageManager;
+import android.util.IntArray;
 import android.util.Pair;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -142,7 +146,6 @@
         // User 0 is the first and only user that runs at boot.
         final UserState uss = new UserState(UserHandle.SYSTEM);
         mStartedUsers.put(UserHandle.USER_SYSTEM, uss);
-        updateUserUnlockedState(uss);
         mUserLru.add(UserHandle.USER_SYSTEM);
         updateStartedUserArrayLocked();
     }
@@ -152,60 +155,113 @@
             finishUserBoot(uss);
 
             startProfilesLocked();
+            stopRunningUsersLocked(MAX_RUNNING_USERS);
+        }
+    }
 
-            int num = mUserLru.size();
-            int i = 0;
-            while (num > MAX_RUNNING_USERS && i < mUserLru.size()) {
-                Integer oldUserId = mUserLru.get(i);
-                UserState oldUss = mStartedUsers.get(oldUserId);
-                if (oldUss == null) {
-                    // Shouldn't happen, but be sane if it does.
-                    mUserLru.remove(i);
-                    num--;
-                    continue;
-                }
-                if (oldUss.mState == UserState.STATE_STOPPING
-                        || oldUss.mState == UserState.STATE_SHUTDOWN) {
-                    // This user is already stopping, doesn't count.
-                    num--;
-                    i++;
-                    continue;
-                }
-                if (oldUserId == UserHandle.USER_SYSTEM || oldUserId == mCurrentUserId) {
-                    // Owner/System user and current user can't be stopped. We count it as running
-                    // when it is not a pure system user.
-                    if (UserInfo.isSystemOnly(oldUserId)) {
-                        num--;
-                    }
-                    i++;
-                    continue;
-                }
-                // This is a user to be stopped.
-                stopUserLocked(oldUserId, null);
+    void stopRunningUsersLocked(int maxRunningUsers) {
+        int num = mUserLru.size();
+        int i = 0;
+        while (num > maxRunningUsers && i < mUserLru.size()) {
+            Integer oldUserId = mUserLru.get(i);
+            UserState oldUss = mStartedUsers.get(oldUserId);
+            if (oldUss == null) {
+                // Shouldn't happen, but be sane if it does.
+                mUserLru.remove(i);
+                num--;
+                continue;
+            }
+            if (oldUss.state == UserState.STATE_STOPPING
+                    || oldUss.state == UserState.STATE_SHUTDOWN) {
+                // This user is already stopping, doesn't count.
                 num--;
                 i++;
+                continue;
             }
+            if (oldUserId == UserHandle.USER_SYSTEM || oldUserId == mCurrentUserId) {
+                // Owner/System user and current user can't be stopped. We count it as running
+                // when it is not a pure system user.
+                if (UserInfo.isSystemOnly(oldUserId)) {
+                    num--;
+                }
+                i++;
+                continue;
+            }
+            // This is a user to be stopped.
+            if (stopUsersLocked(oldUserId, false, null) != USER_OP_SUCCESS) {
+                num--;
+            }
+            num--;
+            i++;
         }
     }
 
     void finishUserBoot(UserState uss) {
+        finishUserBoot(uss, null);
+    }
+
+    void finishUserBoot(UserState uss, IIntentReceiver resultTo) {
+        final int userId = uss.mHandle.getIdentifier();
         synchronized (mService) {
-            if (uss.mState == UserState.STATE_BOOTING
-                    && mStartedUsers.get(uss.mHandle.getIdentifier()) == uss) {
-                uss.mState = UserState.STATE_RUNNING;
-                final int userId = uss.mHandle.getIdentifier();
-                Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
+            // Bail if we ended up with a stale user
+            if (mStartedUsers.get(userId) != uss) return;
+
+            // We always walk through all the user lifecycle states to send
+            // consistent developer events. We step into RUNNING_LOCKED here,
+            // but we might immediately step into RUNNING below if the user
+            // storage is already unlocked.
+            if (uss.state == UserState.STATE_BOOTING) {
+                uss.setState(UserState.STATE_RUNNING_LOCKED);
+
+                Intent intent = new Intent(Intent.ACTION_LOCKED_BOOT_COMPLETED, null);
                 intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
                 intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
-                mService.broadcastIntentLocked(null, null, intent,
-                        null, null, 0, null, null,
-                        new String[]{android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
+                mService.broadcastIntentLocked(null, null, intent, null, resultTo, 0, null, null,
+                        new String[] { android.Manifest.permission.RECEIVE_BOOT_COMPLETED },
+                        AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
+            }
+
+            maybeUnlockUser(userId);
+        }
+    }
+
+    /**
+     * Consider stepping from {@link UserState#STATE_RUNNING_LOCKED} into
+     * {@link UserState#STATE_RUNNING}, which only occurs if the user storage is
+     * actually unlocked.
+     */
+    void finishUserUnlock(UserState uss) {
+        final int userId = uss.mHandle.getIdentifier();
+        synchronized (mService) {
+            // Bail if we ended up with a stale user
+            if (mStartedUsers.get(uss.mHandle.getIdentifier()) != uss) return;
+
+            // Only keep marching forward if user is actually unlocked
+            if (!isUserKeyUnlocked(userId)) return;
+
+            if (uss.state == UserState.STATE_RUNNING_LOCKED) {
+                uss.setState(UserState.STATE_RUNNING);
+
+                mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
+
+                final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
+                unlockedIntent.addFlags(
+                        Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
+                mService.broadcastIntentLocked(null, null, unlockedIntent, null, null, 0, null,
+                        null, null, AppOpsManager.OP_NONE, null, false, false, MY_PID, SYSTEM_UID,
+                        userId);
+
+                final Intent bootIntent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
+                bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
+                bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
+                mService.broadcastIntentLocked(null, null, bootIntent, null, null, 0, null, null,
+                        new String[] { android.Manifest.permission.RECEIVE_BOOT_COMPLETED },
                         AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
             }
         }
     }
 
-    int stopUser(final int userId, final IStopUserCallback callback) {
+    int stopUser(final int userId, final boolean force, final IStopUserCallback callback) {
         if (mService.checkCallingPermission(INTERACT_ACROSS_USERS_FULL)
                 != PackageManager.PERMISSION_GRANTED) {
             String msg = "Permission Denial: switchUser() from pid="
@@ -221,16 +277,44 @@
         mService.enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES,
                 userId);
         synchronized (mService) {
-            return stopUserLocked(userId, callback);
+            return stopUsersLocked(userId, force, callback);
         }
     }
 
-    private int stopUserLocked(final int userId, final IStopUserCallback callback) {
-        if (DEBUG_MU) Slog.i(TAG, "stopUserLocked userId=" + userId);
-        if (mCurrentUserId == userId && mTargetUserId == UserHandle.USER_NULL) {
+    /**
+     * Stops the user along with its related users. The method calls
+     * {@link #getUsersToStopLocked(int)} to determine the list of users that should be stopped.
+     */
+    private int stopUsersLocked(final int userId, boolean force, final IStopUserCallback callback) {
+        if (userId == UserHandle.USER_SYSTEM) {
+            return USER_OP_ERROR_IS_SYSTEM;
+        }
+        if (isCurrentUserLocked(userId)) {
             return USER_OP_IS_CURRENT;
         }
+        int[] usersToStop = getUsersToStopLocked(userId);
+        // If one of related users is system or current, no related users should be stopped
+        for (int i = 0; i < usersToStop.length; i++) {
+            int relatedUserId = usersToStop[i];
+            if ((UserHandle.USER_SYSTEM == relatedUserId) || isCurrentUserLocked(relatedUserId)) {
+                if (DEBUG_MU) Slog.i(TAG, "stopUsersLocked cannot stop related user "
+                        + relatedUserId);
+                // We still need to stop the requested user if it's a force stop.
+                if (force) {
+                    stopSingleUserLocked(userId, callback);
+                }
+                return USER_OP_ERROR_RELATED_USERS_CANNOT_STOP;
+            }
+        }
+        if (DEBUG_MU) Slog.i(TAG, "stopUsersLocked usersToStop=" + Arrays.toString(usersToStop));
+        for (int userIdToStop : usersToStop) {
+            stopSingleUserLocked(userIdToStop, userIdToStop == userId ? callback : null);
+        }
+        return USER_OP_SUCCESS;
+    }
 
+    private void stopSingleUserLocked(final int userId, final IStopUserCallback callback) {
+        if (DEBUG_MU) Slog.i(TAG, "stopSingleUserLocked userId=" + userId);
         final UserState uss = mStartedUsers.get(userId);
         if (uss == null) {
             // User is not started, nothing to do...  but we do need to
@@ -246,16 +330,16 @@
                     }
                 });
             }
-            return USER_OP_SUCCESS;
+            return;
         }
 
         if (callback != null) {
             uss.mStopCallbacks.add(callback);
         }
 
-        if (uss.mState != UserState.STATE_STOPPING
-                && uss.mState != UserState.STATE_SHUTDOWN) {
-            uss.mState = UserState.STATE_STOPPING;
+        if (uss.state != UserState.STATE_STOPPING
+                && uss.state != UserState.STATE_SHUTDOWN) {
+            uss.setState(UserState.STATE_STOPPING);
             updateStartedUserArrayLocked();
 
             long ident = Binder.clearCallingIdentity();
@@ -283,11 +367,11 @@
                             Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
                         // On to the next.
                         synchronized (mService) {
-                            if (uss.mState != UserState.STATE_STOPPING) {
+                            if (uss.state != UserState.STATE_STOPPING) {
                                 // Whoops, we are being started back up.  Abort, abort!
                                 return;
                             }
-                            uss.mState = UserState.STATE_SHUTDOWN;
+                            uss.setState(UserState.STATE_SHUTDOWN);
                         }
                         mService.mBatteryStatsService.noteEvent(
                                 BatteryStats.HistoryItem.EVENT_USER_RUNNING_FINISH,
@@ -307,8 +391,6 @@
                 Binder.restoreCallingIdentity(ident);
             }
         }
-
-        return USER_OP_SUCCESS;
     }
 
     void finishUserStop(UserState uss) {
@@ -319,7 +401,7 @@
             callbacks = new ArrayList<>(uss.mStopCallbacks);
             if (mStartedUsers.get(userId) != uss) {
                 stopped = false;
-            } else if (uss.mState != UserState.STATE_SHUTDOWN) {
+            } else if (uss.state != UserState.STATE_SHUTDOWN) {
                 stopped = false;
             } else {
                 stopped = true;
@@ -350,6 +432,36 @@
         }
     }
 
+    /**
+     * Determines the list of users that should be stopped together with the specified
+     * {@code userId}. The returned list includes {@code userId}.
+     */
+    private @NonNull int[] getUsersToStopLocked(int userId) {
+        int startedUsersSize = mStartedUsers.size();
+        IntArray userIds = new IntArray();
+        userIds.add(userId);
+        synchronized (mUserProfileGroupIdsSelfLocked) {
+            int userGroupId = mUserProfileGroupIdsSelfLocked.get(userId,
+                    UserInfo.NO_PROFILE_GROUP_ID);
+            for (int i = 0; i < startedUsersSize; i++) {
+                UserState uss = mStartedUsers.valueAt(i);
+                int startedUserId = uss.mHandle.getIdentifier();
+                // Skip unrelated users (profileGroupId mismatch)
+                int startedUserGroupId = mUserProfileGroupIdsSelfLocked.get(startedUserId,
+                        UserInfo.NO_PROFILE_GROUP_ID);
+                boolean sameGroup = (userGroupId != UserInfo.NO_PROFILE_GROUP_ID)
+                        && (userGroupId == startedUserGroupId);
+                // userId has already been added
+                boolean sameUserId = startedUserId == userId;
+                if (!sameGroup || sameUserId) {
+                    continue;
+                }
+                userIds.add(startedUserId);
+            }
+        }
+        return userIds.toArray();
+    }
+
     private void forceStopUserLocked(int userId, String reason) {
         mService.forceStopPackageLocked(null, -1, false, false, true, false, false,
                 userId, reason);
@@ -362,7 +474,6 @@
                 null, false, false, MY_PID, SYSTEM_UID, UserHandle.USER_ALL);
     }
 
-
     /**
      * Stops the guest user if it has gone to the background.
      */
@@ -373,14 +484,14 @@
                 Integer oldUserId = mUserLru.get(i);
                 UserState oldUss = mStartedUsers.get(oldUserId);
                 if (oldUserId == UserHandle.USER_SYSTEM || oldUserId == mCurrentUserId
-                        || oldUss.mState == UserState.STATE_STOPPING
-                        || oldUss.mState == UserState.STATE_SHUTDOWN) {
+                        || oldUss.state == UserState.STATE_STOPPING
+                        || oldUss.state == UserState.STATE_SHUTDOWN) {
                     continue;
                 }
                 UserInfo userInfo = getUserInfo(oldUserId);
                 if (userInfo.isGuest()) {
                     // This is a user to be stopped.
-                    stopUserLocked(oldUserId, null);
+                    stopUsersLocked(oldUserId, true, null);
                     break;
                 }
             }
@@ -417,18 +528,21 @@
         return userManager;
     }
 
-    private void updateUserUnlockedState(UserState uss) {
-        final IMountService mountService = IMountService.Stub
-                .asInterface(ServiceManager.getService("mount"));
+    private IMountService getMountService() {
+        return IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+    }
+
+    private boolean isUserKeyUnlocked(int userId) {
+        final IMountService mountService = getMountService();
         if (mountService != null) {
             try {
-                uss.unlocked = mountService.isUserKeyUnlocked(uss.mHandle.getIdentifier());
+                return mountService.isUserKeyUnlocked(userId);
             } catch (RemoteException e) {
                 throw e.rethrowAsRuntimeException();
             }
         } else {
-            // System isn't fully booted yet, so guess based on property
-            uss.unlocked = !StorageManager.isFileBasedEncryptionEnabled();
+            Slog.w(TAG, "Mount service not published; guessing locked state based on property");
+            return !StorageManager.isFileBasedEncryptionEnabled();
         }
     }
 
@@ -476,14 +590,12 @@
                 // If the user we are switching to is not currently started, then
                 // we need to start it now.
                 if (mStartedUsers.get(userId) == null) {
-                    mStartedUsers.put(userId, new UserState(new UserHandle(userId)));
+                    mStartedUsers.put(userId, new UserState(UserHandle.of(userId)));
                     updateStartedUserArrayLocked();
                     needStart = true;
                 }
 
                 final UserState uss = mStartedUsers.get(userId);
-                updateUserUnlockedState(uss);
-
                 final Integer userIdInt = userId;
                 mUserLru.remove(userIdInt);
                 mUserLru.add(userIdInt);
@@ -507,22 +619,22 @@
 
                 // Make sure user is in the started state.  If it is currently
                 // stopping, we need to knock that off.
-                if (uss.mState == UserState.STATE_STOPPING) {
+                if (uss.state == UserState.STATE_STOPPING) {
                     // If we are stopping, we haven't sent ACTION_SHUTDOWN,
                     // so we can just fairly silently bring the user back from
                     // the almost-dead.
-                    uss.mState = UserState.STATE_RUNNING;
+                    uss.setState(uss.lastState);
                     updateStartedUserArrayLocked();
                     needStart = true;
-                } else if (uss.mState == UserState.STATE_SHUTDOWN) {
+                } else if (uss.state == UserState.STATE_SHUTDOWN) {
                     // This means ACTION_SHUTDOWN has been sent, so we will
                     // need to treat this as a new boot of the user.
-                    uss.mState = UserState.STATE_BOOTING;
+                    uss.setState(UserState.STATE_BOOTING);
                     updateStartedUserArrayLocked();
                     needStart = true;
                 }
 
-                if (uss.mState == UserState.STATE_BOOTING) {
+                if (uss.state == UserState.STATE_BOOTING) {
                     // Let user manager propagate user restrictions to other services.
                     getUserManager().onBeforeStartUser(userId);
 
@@ -624,19 +736,46 @@
             throw new SecurityException(msg);
         }
 
-        final UserInfo userInfo = getUserInfo(userId);
-        final IMountService mountService = IMountService.Stub
-                .asInterface(ServiceManager.getService("mount"));
+        final long binderToken = Binder.clearCallingIdentity();
         try {
-            mountService.unlockUserKey(userId, userInfo.serialNumber, token);
-        } catch (RemoteException e) {
-            Slog.w(TAG, "Failed to unlock: " + e.getMessage());
-            throw e.rethrowAsRuntimeException();
+            return unlockUserCleared(userId, token);
+        } finally {
+            Binder.restoreCallingIdentity(binderToken);
+        }
+    }
+
+    /**
+     * Attempt to unlock user without a credential token. This typically
+     * succeeds when the device doesn't have credential-encrypted storage, or
+     * when the the credential-encrypted storage isn't tied to a user-provided
+     * PIN or pattern.
+     */
+    boolean maybeUnlockUser(final int userId) {
+        // Try unlocking storage using empty token
+        return unlockUserCleared(userId, null);
+    }
+
+    boolean unlockUserCleared(final int userId, byte[] token) {
+        synchronized (mService) {
+            // Bail if already running unlocked
+            final UserState uss = mStartedUsers.get(userId);
+            if (uss.state == UserState.STATE_RUNNING) return true;
+        }
+
+        if (!isUserKeyUnlocked(userId)) {
+            final UserInfo userInfo = getUserInfo(userId);
+            final IMountService mountService = getMountService();
+            try {
+                mountService.unlockUserKey(userId, userInfo.serialNumber, token);
+            } catch (RemoteException | RuntimeException e) {
+                Slog.w(TAG, "Failed to unlock: " + e.getMessage());
+                return false;
+            }
         }
 
         synchronized (mService) {
             final UserState uss = mStartedUsers.get(userId);
-            updateUserUnlockedState(uss);
+            finishUserUnlock(uss);
         }
 
         return true;
@@ -673,6 +812,24 @@
         mUserSwitchObservers.finishBroadcast();
     }
 
+    private void stopBackgroundUsersIfEnforced(int oldUserId) {
+        // Never stop system user
+        if (oldUserId == UserHandle.USER_SYSTEM) {
+            return;
+        }
+        // For now, only check for user restriction. Additional checks can be added here
+        boolean disallowRunInBg = hasUserRestriction(UserManager.DISALLOW_RUN_IN_BACKGROUND,
+                oldUserId);
+        if (!disallowRunInBg) {
+            return;
+        }
+        synchronized (mService) {
+            if (DEBUG_MU) Slog.i(TAG, "stopBackgroundUsersIfEnforced stopping " + oldUserId
+                    + " and related users");
+            stopUsersLocked(oldUserId, false, null);
+        }
+    }
+
     void timeoutUserSwitch(UserState uss, int oldUserId, int newUserId) {
         synchronized (mService) {
             Slog.wtf(TAG, "User switch timeout: from " + oldUserId + " to " + newUserId);
@@ -725,7 +882,7 @@
     }
 
     void continueUserSwitch(UserState uss, int oldUserId, int newUserId) {
-        completeSwitchAndInitialize(uss, newUserId, false, true);
+        completeSwitchAndInitialize(uss, oldUserId, newUserId, false, true);
     }
 
     void onUserInitialized(UserState uss, boolean foreground, int oldUserId, int newUserId) {
@@ -734,10 +891,10 @@
                 moveUserToForegroundLocked(uss, oldUserId, newUserId);
             }
         }
-        completeSwitchAndInitialize(uss, newUserId, true, false);
+        completeSwitchAndInitialize(uss, oldUserId, newUserId, true, false);
     }
 
-    void completeSwitchAndInitialize(UserState uss, int newUserId,
+    void completeSwitchAndInitialize(UserState uss, int oldUserId, int newUserId,
             boolean clearInitializing, boolean clearSwitching) {
         boolean unfrozen = false;
         synchronized (mService) {
@@ -759,6 +916,7 @@
                     newUserId, 0));
         }
         stopGuestUserIfBackground();
+        stopBackgroundUsersIfEnforced(oldUserId);
     }
 
     void moveUserToForegroundLocked(UserState uss, int oldUserId, int newUserId) {
@@ -939,8 +1097,8 @@
         for (int i = 0; i < mStartedUsers.size(); i++) {
             UserState uss = mStartedUsers.valueAt(i);
             // This list does not include stopping users.
-            if (uss.mState != UserState.STATE_STOPPING
-                    && uss.mState != UserState.STATE_SHUTDOWN) {
+            if (uss.state != UserState.STATE_STOPPING
+                    && uss.state != UserState.STATE_SHUTDOWN) {
                 num++;
             }
         }
@@ -948,8 +1106,8 @@
         num = 0;
         for (int i = 0; i < mStartedUsers.size(); i++) {
             UserState uss = mStartedUsers.valueAt(i);
-            if (uss.mState != UserState.STATE_STOPPING
-                    && uss.mState != UserState.STATE_SHUTDOWN) {
+            if (uss.state != UserState.STATE_STOPPING
+                    && uss.state != UserState.STATE_SHUTDOWN) {
                 mStartedUserArray[num] = mStartedUsers.keyAt(i);
                 num++;
             }
@@ -959,17 +1117,7 @@
     void sendBootCompletedLocked(IIntentReceiver resultTo) {
         for (int i = 0; i < mStartedUsers.size(); i++) {
             UserState uss = mStartedUsers.valueAt(i);
-            if (uss.mState == UserState.STATE_BOOTING) {
-                uss.mState = UserState.STATE_RUNNING;
-                final int userId = mStartedUsers.keyAt(i);
-                Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
-                intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
-                intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
-                mService.broadcastIntentLocked(null, null, intent, null,
-                        resultTo, 0, null, null,
-                        new String[] {android.Manifest.permission.RECEIVE_BOOT_COMPLETED},
-                        AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId);
-            }
+            finishUserBoot(uss, resultTo);
         }
     }
 
@@ -1011,15 +1159,33 @@
         if ((flags & ActivityManager.FLAG_OR_STOPPED) != 0) {
             return true;
         }
-        if ((flags & ActivityManager.FLAG_WITH_AMNESIA) != 0) {
-            // If user is currently locked, we fall through to default "running"
-            // behavior below
-            if (state.unlocked) {
+
+        final boolean unlocked;
+        switch (state.state) {
+            case UserState.STATE_STOPPING:
+            case UserState.STATE_SHUTDOWN:
+            default:
                 return false;
-            }
+
+            case UserState.STATE_BOOTING:
+            case UserState.STATE_RUNNING_LOCKED:
+                unlocked = false;
+                break;
+
+            case UserState.STATE_RUNNING:
+                unlocked = true;
+                break;
         }
-        return state.mState != UserState.STATE_STOPPING
-                && state.mState != UserState.STATE_SHUTDOWN;
+
+        if ((flags & ActivityManager.FLAG_AND_LOCKED) != 0) {
+            return !unlocked;
+        }
+        if ((flags & ActivityManager.FLAG_AND_UNLOCKED) != 0) {
+            return unlocked;
+        }
+
+        // One way or another, we're running!
+        return true;
     }
 
     UserInfo getCurrentUser() {
@@ -1052,6 +1218,10 @@
         return mCurrentUserId;
     }
 
+    private boolean isCurrentUserLocked(int userId) {
+        return mCurrentUserId == userId || mTargetUserId == userId;
+    }
+
     int setTargetUserIdLocked(int targetUserId) {
         return mTargetUserId = targetUserId;
     }
diff --git a/services/core/java/com/android/server/am/UserState.java b/services/core/java/com/android/server/am/UserState.java
index b5b5c1d..7b18a17 100644
--- a/services/core/java/com/android/server/am/UserState.java
+++ b/services/core/java/com/android/server/am/UserState.java
@@ -19,28 +19,37 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
+
 import android.app.IStopUserCallback;
 import android.os.UserHandle;
 import android.util.ArrayMap;
+import android.util.Slog;
 
 public final class UserState {
+    private static final String TAG = TAG_WITH_CLASS_NAME ? "UserState" : TAG_AM;
+
     // User is first coming up.
     public final static int STATE_BOOTING = 0;
+    // User is in the locked running state.
+    public final static int STATE_RUNNING_LOCKED = 1;
     // User is in the normal running state.
-    public final static int STATE_RUNNING = 1;
+    public final static int STATE_RUNNING = 2;
     // User is in the initial process of being stopped.
-    public final static int STATE_STOPPING = 2;
+    public final static int STATE_STOPPING = 3;
     // User is in the final phase of stopping, sending Intent.ACTION_SHUTDOWN.
-    public final static int STATE_SHUTDOWN = 3;
+    public final static int STATE_SHUTDOWN = 4;
 
     public final UserHandle mHandle;
     public final ArrayList<IStopUserCallback> mStopCallbacks
             = new ArrayList<IStopUserCallback>();
 
-    public int mState = STATE_BOOTING;
+    public int state = STATE_BOOTING;
+    public int lastState = STATE_BOOTING;
     public boolean switching;
     public boolean initializing;
-    public boolean unlocked;
 
     /**
      * The last time that a provider was reported to usage stats as being brought to important
@@ -52,22 +61,32 @@
         mHandle = handle;
     }
 
-    void dump(String prefix, PrintWriter pw) {
-        pw.print(prefix); pw.print("mState=");
-        switch (mState) {
-            case STATE_BOOTING: pw.print("BOOTING"); break;
-            case STATE_RUNNING: pw.print("RUNNING"); break;
-            case STATE_STOPPING: pw.print("STOPPING"); break;
-            case STATE_SHUTDOWN: pw.print("SHUTDOWN"); break;
-            default: pw.print(mState); break; 
+    public void setState(int newState) {
+        if (DEBUG_MU) {
+            Slog.i(TAG, "User " + mHandle.getIdentifier() + " state changed from "
+                    + stateToString(state) + " to " + stateToString(newState));
         }
+        lastState = state;
+        state = newState;
+    }
+
+    private static String stateToString(int state) {
+        switch (state) {
+            case STATE_BOOTING: return "BOOTING";
+            case STATE_RUNNING_LOCKED: return "RUNNING_LOCKED";
+            case STATE_RUNNING: return "RUNNING";
+            case STATE_STOPPING: return "STOPPING";
+            case STATE_SHUTDOWN: return "SHUTDOWN";
+            default: return Integer.toString(state);
+        }
+    }
+
+    void dump(String prefix, PrintWriter pw) {
+        pw.print(prefix);
+        pw.print("state="); pw.print(stateToString(state));
+        pw.print(" lastState="); pw.print(stateToString(lastState));
         if (switching) pw.print(" SWITCHING");
         if (initializing) pw.print(" INITIALIZING");
-        if (unlocked) {
-            pw.print(" UNLOCKED");
-        } else {
-            pw.print(" LOCKED");
-        }
         pw.println();
     }
 }
diff --git a/services/core/java/com/android/server/audio/MediaFocusControl.java b/services/core/java/com/android/server/audio/MediaFocusControl.java
index d44d89d..278d70b 100644
--- a/services/core/java/com/android/server/audio/MediaFocusControl.java
+++ b/services/core/java/com/android/server/audio/MediaFocusControl.java
@@ -387,8 +387,11 @@
     /** @see AudioManager#requestAudioFocus(AudioManager.OnAudioFocusChangeListener, int, int, int) */
     protected int requestAudioFocus(AudioAttributes aa, int focusChangeHint, IBinder cb,
             IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags) {
-        Log.i(TAG, " AudioFocus  requestAudioFocus() from " + clientId + " req=" + focusChangeHint +
-                "flags=0x" + Integer.toHexString(flags));
+        Log.i(TAG, " AudioFocus  requestAudioFocus() from uid/pid " + Binder.getCallingUid()
+                + "/" + Binder.getCallingPid()
+                + " clientId=" + clientId
+                + " req=" + focusChangeHint
+                + " flags=0x" + Integer.toHexString(flags));
         // we need a valid binder callback for clients
         if (!cb.pingBinder()) {
             Log.e(TAG, " AudioFocus DOA client for requestAudioFocus(), aborting.");
@@ -481,7 +484,9 @@
      * */
     protected int abandonAudioFocus(IAudioFocusDispatcher fl, String clientId, AudioAttributes aa) {
         // AudioAttributes are currently ignored, to be used for zones
-        Log.i(TAG, " AudioFocus  abandonAudioFocus() from " + clientId);
+        Log.i(TAG, " AudioFocus  abandonAudioFocus() from uid/pid " + Binder.getCallingUid()
+                + "/" + Binder.getCallingPid()
+                + " clientId=" + clientId);
         try {
             // this will take care of notifying the new focus owner if needed
             synchronized(mAudioFocusLock) {
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 81ae8ac..f2d0031 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -16,6 +16,7 @@
 
 package com.android.server.input;
 
+import android.annotation.Nullable;
 import android.view.Display;
 import com.android.internal.os.SomeArgs;
 import com.android.internal.R;
@@ -83,6 +84,9 @@
 import android.view.Surface;
 import android.view.ViewConfiguration;
 import android.view.WindowManagerPolicy;
+import android.view.inputmethod.InputMethod;
+import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodSubtype;
 import android.widget.Toast;
 
 import java.io.File;
@@ -116,6 +120,7 @@
     private static final int MSG_UPDATE_KEYBOARD_LAYOUTS = 4;
     private static final int MSG_RELOAD_DEVICE_ALIASES = 5;
     private static final int MSG_DELIVER_TABLET_MODE_CHANGED = 6;
+    private static final int MSG_INPUT_METHOD_SUBTYPE_CHANGED = 7;
 
     // Pointer to native input manager service object.
     private final long mPtr;
@@ -207,6 +212,7 @@
     private static native String nativeDump(long ptr);
     private static native void nativeMonitor(long ptr);
     private static native void nativeSetPointerIconShape(long ptr, int iconId);
+    private static native void nativeReloadPointerIcons(long ptr);
 
     // Input event injection constants defined in InputDispatcher.h.
     private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0;
@@ -306,12 +312,14 @@
 
         registerPointerSpeedSettingObserver();
         registerShowTouchesSettingObserver();
+        registerAccessibilityLargePointerSettingObserver();
 
         mContext.registerReceiver(new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
                 updatePointerSpeedFromSettings();
                 updateShowTouchesFromSettings();
+                nativeReloadPointerIcons(mPtr);
             }
         }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
 
@@ -1206,6 +1214,15 @@
         }
     }
 
+    // Must be called on handler.
+    private void handleSwitchInputMethodSubtype(int userId,
+            @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) {
+        if (DEBUG) {
+            Slog.i(TAG, "InputMethodSubtype changed: userId=" + userId
+                    + " ime=" + inputMethodInfo + " subtype=" + subtype);
+        }
+    }
+
     public void switchKeyboardLayout(int deviceId, int direction) {
         mHandler.obtainMessage(MSG_SWITCH_KEYBOARD_LAYOUT, deviceId, direction).sendToTarget();
     }
@@ -1348,6 +1365,17 @@
                 }, UserHandle.USER_ALL);
     }
 
+    private void registerAccessibilityLargePointerSettingObserver() {
+        mContext.getContentResolver().registerContentObserver(
+                Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON), true,
+                new ContentObserver(mHandler) {
+                    @Override
+                    public void onChange(boolean selfChange) {
+                        nativeReloadPointerIcons(mPtr);
+                    }
+                }, UserHandle.USER_ALL);
+    }
+
     private int getShowTouchesSetting(int defaultValue) {
         int result = defaultValue;
         try {
@@ -1417,11 +1445,11 @@
         }
     }
 
-  // Binder call
-  @Override
-  public void setPointerIconShape(int iconId) {
-      nativeSetPointerIconShape(mPtr, iconId);
-  }
+    // Binder call
+    @Override
+    public void setPointerIconShape(int iconId) {
+        nativeSetPointerIconShape(mPtr, iconId);
+    }
 
     @Override
     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
@@ -1757,12 +1785,22 @@
                 case MSG_RELOAD_DEVICE_ALIASES:
                     reloadDeviceAliases();
                     break;
-                case MSG_DELIVER_TABLET_MODE_CHANGED:
+                case MSG_DELIVER_TABLET_MODE_CHANGED: {
                     SomeArgs args = (SomeArgs) msg.obj;
                     long whenNanos = (args.argi1 & 0xFFFFFFFFl) | ((long) args.argi2 << 32);
                     boolean inTabletMode = (boolean) args.arg1;
                     deliverTabletModeChanged(whenNanos, inTabletMode);
                     break;
+                }
+                case MSG_INPUT_METHOD_SUBTYPE_CHANGED: {
+                    final int userId = msg.arg1;
+                    final SomeArgs args = (SomeArgs) msg.obj;
+                    final InputMethodInfo inputMethodInfo = (InputMethodInfo) args.arg1;
+                    final InputMethodSubtype subtype = (InputMethodSubtype) args.arg2;
+                    args.recycle();
+                    handleSwitchInputMethodSubtype(userId, inputMethodInfo, subtype);
+                    break;
+                }
             }
         }
     }
@@ -1920,5 +1958,15 @@
         public void setInteractive(boolean interactive) {
             nativeSetInteractive(mPtr, interactive);
         }
+
+        @Override
+        public void onInputMethodSubtypeChanged(int userId,
+                @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) {
+            final SomeArgs someArgs = SomeArgs.obtain();
+            someArgs.arg1 = inputMethodInfo;
+            someArgs.arg2 = subtype;
+            mHandler.obtainMessage(MSG_INPUT_METHOD_SUBTYPE_CHANGED, userId, 0, someArgs)
+                    .sendToTarget();
+        }
     }
 }
diff --git a/services/core/java/com/android/server/job/JobStore.java b/services/core/java/com/android/server/job/JobStore.java
index 0004c42..d9f94d0 100644
--- a/services/core/java/com/android/server/job/JobStore.java
+++ b/services/core/java/com/android/server/job/JobStore.java
@@ -278,6 +278,11 @@
                 // Copy over the jobs so we can release the lock before writing.
                 for (int i=0; i<mJobSet.size(); i++) {
                     JobStatus jobStatus = mJobSet.valueAt(i);
+
+                    if (!jobStatus.isPersisted()){
+                        continue;
+                    }
+
                     JobStatus copy = new JobStatus(jobStatus.getJob(), jobStatus.getUid(),
                             jobStatus.getEarliestRunTime(), jobStatus.getLatestRunTimeElapsed());
                     mStoreCopy.add(copy);
diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java
index f92f631..246da2e 100644
--- a/services/core/java/com/android/server/media/MediaSessionRecord.java
+++ b/services/core/java/com/android/server/media/MediaSessionRecord.java
@@ -63,7 +63,7 @@
  */
 public class MediaSessionRecord implements IBinder.DeathRecipient {
     private static final String TAG = "MediaSessionRecord";
-    private static final boolean DEBUG = false;
+    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
 
     /**
      * The length of time a session will still be considered active after
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 90dd10ea..d5c3113 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -287,6 +287,9 @@
      * 6. We need to tell the session to do any final cleanup (onDestroy)
      */
     private void destroySessionLocked(MediaSessionRecord session) {
+        if (DEBUG) {
+            Log.d(TAG, "Destroying session : " + session.toString());
+        }
         int userId = session.getUserId();
         UserRecord user = mUserRecords.get(userId);
         if (user != null) {
diff --git a/services/core/java/com/android/server/media/MediaSessionStack.java b/services/core/java/com/android/server/media/MediaSessionStack.java
index 611718e..61c320b 100644
--- a/services/core/java/com/android/server/media/MediaSessionStack.java
+++ b/services/core/java/com/android/server/media/MediaSessionStack.java
@@ -16,13 +16,17 @@
 
 package com.android.server.media;
 
+import android.app.ActivityManager;
+import android.app.ActivityManagerNative;
 import android.media.session.MediaController.PlaybackInfo;
 import android.media.session.PlaybackState;
 import android.media.session.MediaSession;
+import android.os.RemoteException;
 import android.os.UserHandle;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Keeps track of media sessions and their priority for notifications, media
@@ -61,6 +65,36 @@
     private ArrayList<MediaSessionRecord> mCachedTransportControlList;
 
     /**
+     * Checks if a media session is created from the most recent app.
+     *
+     * @param record A media session record to be examined.
+     * @return true if the media session's package name equals to the most recent app, false
+     * otherwise.
+     */
+    private static boolean isFromMostRecentApp(MediaSessionRecord record) {
+        if (ActivityManager.getCurrentUser() != record.getUserId()) {
+            return false;
+        }
+        try {
+            List<ActivityManager.RecentTaskInfo> tasks =
+                    ActivityManagerNative.getDefault().getRecentTasks(1,
+                            ActivityManager.RECENT_IGNORE_HOME_STACK_TASKS |
+                            ActivityManager.RECENT_IGNORE_UNAVAILABLE |
+                            ActivityManager.RECENT_INCLUDE_PROFILES |
+                            ActivityManager.RECENT_WITH_EXCLUDED, record.getUserId());
+            if (tasks != null && !tasks.isEmpty()) {
+                ActivityManager.RecentTaskInfo recentTask = tasks.get(0);
+                if (recentTask.baseIntent != null)
+                    return recentTask.baseIntent.getComponent().getPackageName()
+                            .equals(record.getPackageName());
+            }
+        } catch (RemoteException e) {
+            return false;
+        }
+        return false;
+    }
+
+    /**
      * Add a record to the priority tracker.
      *
      * @param record The record to add.
@@ -68,7 +102,9 @@
     public void addSession(MediaSessionRecord record) {
         mSessions.add(record);
         clearCache();
-        mLastInterestingRecord = record;
+        if (isFromMostRecentApp(record)) {
+            mLastInterestingRecord = record;
+        }
     }
 
     /**
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 946fbb1..c2666b8 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -17,6 +17,19 @@
 package com.android.server.notification;
 
 import static android.service.notification.NotificationListenerService.HINT_HOST_DISABLE_EFFECTS;
+import static android.service.notification.NotificationAssistantService.REASON_DELEGATE_CLICK;
+import static android.service.notification.NotificationAssistantService.REASON_DELEGATE_CANCEL;
+import static android.service.notification.NotificationAssistantService.REASON_DELEGATE_CANCEL_ALL;
+import static android.service.notification.NotificationAssistantService.REASON_DELEGATE_ERROR;
+import static android.service.notification.NotificationAssistantService.REASON_PACKAGE_CHANGED;
+import static android.service.notification.NotificationAssistantService.REASON_USER_STOPPED;
+import static android.service.notification.NotificationAssistantService.REASON_PACKAGE_BANNED;
+import static android.service.notification.NotificationAssistantService.REASON_APP_CANCEL;
+import static android.service.notification.NotificationAssistantService.REASON_APP_CANCEL_ALL;
+import static android.service.notification.NotificationAssistantService.REASON_LISTENER_CANCEL;
+import static android.service.notification.NotificationAssistantService.REASON_LISTENER_CANCEL_ALL;
+import static android.service.notification.NotificationAssistantService.REASON_GROUP_SUMMARY_CANCELED;
+import static android.service.notification.NotificationAssistantService.REASON_GROUP_OPTIMIZATION;
 import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_LIGHTS;
 import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_PEEK;
 import static android.service.notification.NotificationListenerService.TRIM_FULL;
@@ -281,19 +294,6 @@
 
     private static final int MY_UID = Process.myUid();
     private static final int MY_PID = Process.myPid();
-    private static final int REASON_DELEGATE_CLICK = 1;
-    private static final int REASON_DELEGATE_CANCEL = 2;
-    private static final int REASON_DELEGATE_CANCEL_ALL = 3;
-    private static final int REASON_DELEGATE_ERROR = 4;
-    private static final int REASON_PACKAGE_CHANGED = 5;
-    private static final int REASON_USER_STOPPED = 6;
-    private static final int REASON_PACKAGE_BANNED = 7;
-    private static final int REASON_NOMAN_CANCEL = 8;
-    private static final int REASON_NOMAN_CANCEL_ALL = 9;
-    private static final int REASON_LISTENER_CANCEL = 10;
-    private static final int REASON_LISTENER_CANCEL_ALL = 11;
-    private static final int REASON_GROUP_SUMMARY_CANCELED = 12;
-    private static final int REASON_GROUP_OPTIMIZATION = 13;
 
     private static class Archive {
         final int mBufferSize;
@@ -1176,7 +1176,7 @@
             cancelNotification(Binder.getCallingUid(), Binder.getCallingPid(), pkg, tag, id, 0,
                     Binder.getCallingUid() == Process.SYSTEM_UID
                             ? 0 : Notification.FLAG_FOREGROUND_SERVICE, false, userId,
-                    REASON_NOMAN_CANCEL, null);
+                    REASON_APP_CANCEL, null);
         }
 
         @Override
@@ -1190,7 +1190,7 @@
             // running foreground services.
             cancelAllNotificationsInt(Binder.getCallingUid(), Binder.getCallingPid(),
                     pkg, 0, Notification.FLAG_FOREGROUND_SERVICE, true, userId,
-                    REASON_NOMAN_CANCEL_ALL, null);
+                    REASON_APP_CANCEL_ALL, null);
         }
 
         @Override
@@ -1286,10 +1286,11 @@
                     Binder.getCallingUid(), incomingUserId, true, false,
                     "getAppActiveNotifications", pkg);
 
-            final int N = mNotificationList.size();
-            final ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>(N);
+            final ArrayList<StatusBarNotification> list
+                    = new ArrayList<StatusBarNotification>(mNotificationList.size());
 
             synchronized (mNotificationList) {
+                final int N = mNotificationList.size();
                 for (int i = 0; i < N; i++) {
                     final StatusBarNotification sbn = mNotificationList.get(i).sbn;
                     if (sbn.getPackageName().equals(pkg) && sbn.getUserId() == userId) {
@@ -1633,6 +1634,14 @@
         }
 
         @Override
+        public boolean removeAutomaticZenRules(String packageName) throws RemoteException {
+            Preconditions.checkNotNull(packageName, "Package name is null");
+            enforceSystemOrSystemUI("removeAutomaticZenRules");
+
+            return mZenModeHelper.removeAutomaticZenRules(packageName, "removeAutomaticZenRules");
+        }
+
+        @Override
         public void setInterruptionFilter(String pkg, int filter) throws RemoteException {
             enforcePolicyAccess(pkg, "setInterruptionFilter");
             final int zen = NotificationManager.zenModeFromInterruptionFilter(filter, -1);
@@ -2870,8 +2879,8 @@
             case REASON_LISTENER_CANCEL_ALL:
                 mUsageStats.registerDismissedByUser(r);
                 break;
-            case REASON_NOMAN_CANCEL:
-            case REASON_NOMAN_CANCEL_ALL:
+            case REASON_APP_CANCEL:
+            case REASON_APP_CANCEL_ALL:
                 mUsageStats.registerRemovedByApp(r);
                 break;
         }
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index dbdc3f4..3c891df 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -41,6 +41,7 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
+import android.os.Process;
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.provider.Settings.Global;
@@ -274,7 +275,7 @@
             newConfig = mConfig.copy();
         }
         final String ruleId = automaticZenRule.getId();
-        ZenModeConfig.ZenRule rule = new ZenModeConfig.ZenRule();
+        ZenModeConfig.ZenRule rule;
         if (ruleId == null) {
             throw new IllegalArgumentException("Rule doesn't exist");
         } else {
@@ -307,13 +308,32 @@
         return setConfig(newConfig, reason, true);
     }
 
+    public boolean removeAutomaticZenRules(String packageName, String reason) {
+        ZenModeConfig newConfig;
+        synchronized (mConfig) {
+            if (mConfig == null) return false;
+            newConfig = mConfig.copy();
+        }
+        for (int i = newConfig.automaticRules.size() - 1; i >= 0; i--) {
+            ZenRule rule = newConfig.automaticRules.get(newConfig.automaticRules.keyAt(i));
+            if (rule.component.getPackageName().equals(packageName)
+                    && canManageAutomaticZenRule(rule)) {
+                newConfig.automaticRules.removeAt(i);
+            }
+        }
+        return setConfig(newConfig, reason, true);
+    }
+
     public boolean canManageAutomaticZenRule(ZenRule rule) {
-        if (mContext.checkCallingPermission(android.Manifest.permission.MANAGE_NOTIFICATIONS)
+        final int callingUid = Binder.getCallingUid();
+        if (callingUid == 0 || callingUid == Process.SYSTEM_UID) {
+            return true;
+        } else if (mContext.checkCallingPermission(android.Manifest.permission.MANAGE_NOTIFICATIONS)
                 == PackageManager.PERMISSION_GRANTED) {
             return true;
         } else {
-            String[] packages = mContext.getPackageManager().getPackagesForUid(
-                    Binder.getCallingUid());
+            String[] packages =
+                    mContext.getPackageManager().getPackagesForUid(Binder.getCallingUid());
             if (packages != null) {
                 final int packageCount = packages.length;
                 for (int i = 0; i < packageCount; i++) {
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 4bc79cb..6f19911 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -26,6 +26,7 @@
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED;
+import static android.content.pm.PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
 import static android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED;
@@ -400,14 +401,11 @@
     /** Permission grant: grant the permission as an install permission. */
     private static final int GRANT_INSTALL = 2;
 
-    /** Permission grant: grant the permission as an install permission for a legacy app. */
-    private static final int GRANT_INSTALL_LEGACY = 3;
-
     /** Permission grant: grant the permission as a runtime one. */
-    private static final int GRANT_RUNTIME = 4;
+    private static final int GRANT_RUNTIME = 3;
 
     /** Permission grant: grant as runtime a permission that was granted as an install time one. */
-    private static final int GRANT_UPGRADE = 5;
+    private static final int GRANT_UPGRADE = 4;
 
     /** Canonical intent used to identify what counts as a "web browser" app */
     private static final Intent sBrowserIntent;
@@ -2800,15 +2798,24 @@
     }
 
     @Override
-    public boolean isPackageFrozen(String packageName) {
+    public void checkPackageStartable(String packageName, int userId) {
+        final boolean userKeyUnlocked = isUserKeyUnlocked(userId);
+
         synchronized (mPackages) {
             final PackageSetting ps = mSettings.mPackages.get(packageName);
-            if (ps != null) {
-                return ps.frozen;
+            if (ps == null) {
+                throw new SecurityException("Package " + packageName + " was not found!");
+            }
+
+            if (ps.frozen) {
+                throw new SecurityException("Package " + packageName + " is currently frozen!");
+            }
+
+            if (!userKeyUnlocked && !(ps.pkg.applicationInfo.isEncryptionAware()
+                    || ps.pkg.applicationInfo.isPartiallyEncryptionAware())) {
+                throw new SecurityException("Package " + packageName + " is not encryption aware!");
             }
         }
-        Slog.w(TAG, "Package " + packageName + " is missing; assuming frozen");
-        return true;
     }
 
     @Override
@@ -3143,29 +3150,36 @@
     }
 
     /**
-     * Augment the given flags depending on current user running state. This is
-     * purposefully done before acquiring {@link #mPackages} lock.
+     * Return if the user key is currently unlocked.
      */
-    private int augmentFlagsForUser(int flags, int userId) {
+    private boolean isUserKeyUnlocked(int userId) {
         if (StorageManager.isFileBasedEncryptionEnabled()) {
             final IMountService mount = IMountService.Stub
                     .asInterface(ServiceManager.getService("mount"));
             if (mount == null) {
-                // We must be early in boot, so the best we can do is assume the
-                // user is fully running.
-                Slog.w(TAG, "Early during boot, assuming not encrypted");
-                return flags;
+                Slog.w(TAG, "Early during boot, assuming locked");
+                return false;
             }
             final long token = Binder.clearCallingIdentity();
             try {
-                if (!mount.isUserKeyUnlocked(userId)) {
-                    flags |= PackageManager.MATCH_ENCRYPTION_AWARE_ONLY;
-                }
+                return mount.isUserKeyUnlocked(userId);
             } catch (RemoteException e) {
                 throw e.rethrowAsRuntimeException();
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * Augment the given flags depending on current user running state. This is
+     * purposefully done before acquiring {@link #mPackages} lock.
+     */
+    private int augmentFlagsForUser(int flags, int userId) {
+        if (!isUserKeyUnlocked(userId)) {
+            flags |= PackageManager.MATCH_ENCRYPTION_AWARE_ONLY;
         }
         return flags;
     }
@@ -3672,6 +3686,16 @@
 
             enforceDeclaredAsUsedAndRuntimeOrDevelopmentPermission(pkg, bp);
 
+            // If a permission review is required for legacy apps we represent
+            // their permissions as always granted runtime ones since we need
+            // to keep the review required permission flag per user while an
+            // install permission's state is shared across all users.
+            if (Build.PERMISSIONS_REVIEW_REQUIRED
+                    && pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M
+                    && bp.isRuntime()) {
+                return;
+            }
+
             uid = UserHandle.getUid(userId, pkg.applicationInfo.uid);
             sb = (SettingBase) pkg.mExtras;
             if (sb == null) {
@@ -3772,6 +3796,16 @@
 
             enforceDeclaredAsUsedAndRuntimeOrDevelopmentPermission(pkg, bp);
 
+            // If a permission review is required for legacy apps we represent
+            // their permissions as always granted runtime ones since we need
+            // to keep the review required permission flag per user while an
+            // install permission's state is shared across all users.
+            if (Build.PERMISSIONS_REVIEW_REQUIRED
+                    && pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M
+                    && bp.isRuntime()) {
+                return;
+            }
+
             SettingBase sb = (SettingBase) pkg.mExtras;
             if (sb == null) {
                 throw new IllegalArgumentException("Unknown package: " + packageName);
@@ -3890,6 +3924,7 @@
             flagValues &= ~PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
             flagMask &= ~PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT;
             flagValues &= ~PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT;
+            flagValues &= ~PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
         }
 
         synchronized (mPackages) {
@@ -4833,15 +4868,21 @@
                 // Check for results in the current profile.
                 List<ResolveInfo> result = mActivities.queryIntent(
                         intent, resolvedType, flags, userId);
+                result = filterIfNotSystemUser(result, userId);
 
                 // Check for cross profile results.
+                boolean hasNonNegativePriorityResult = hasNonNegativePriority(result);
                 xpResolveInfo = queryCrossProfileIntents(
-                        matchingFilters, intent, resolvedType, flags, userId);
+                        matchingFilters, intent, resolvedType, flags, userId,
+                        hasNonNegativePriorityResult);
                 if (xpResolveInfo != null && isUserEnabled(xpResolveInfo.targetUserId)) {
-                    result.add(xpResolveInfo);
-                    Collections.sort(result, mResolvePrioritySorter);
+                    boolean isVisibleToUser = filterIfNotSystemUser(
+                            Collections.singletonList(xpResolveInfo), userId).size() > 0;
+                    if (isVisibleToUser) {
+                        result.add(xpResolveInfo);
+                        Collections.sort(result, mResolvePrioritySorter);
+                    }
                 }
-                result = filterIfNotSystemUser(result, userId);
                 if (hasWebURI(intent)) {
                     CrossProfileDomainInfo xpDomainInfo = null;
                     final UserInfo parent = getProfileParent(userId);
@@ -4974,6 +5015,14 @@
         return resolveInfos;
     }
 
+    /**
+     * @param resolveInfos list of resolve infos in descending priority order
+     * @return if the list contains a resolve info with non-negative priority
+     */
+    private boolean hasNonNegativePriority(List<ResolveInfo> resolveInfos) {
+        return resolveInfos.size() > 0 && resolveInfos.get(0).priority >= 0;
+    }
+
     private static boolean hasWebURI(Intent intent) {
         if (intent.getData() == null) {
             return false;
@@ -5177,10 +5226,10 @@
         return null;
     }
 
-    // Return matching ResolveInfo if any for skip current profile intent filters.
+    // Return matching ResolveInfo in target user if any.
     private ResolveInfo queryCrossProfileIntents(
             List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType,
-            int flags, int sourceUserId) {
+            int flags, int sourceUserId, boolean matchInCurrentProfile) {
         if (matchingFilters != null) {
             // Two {@link CrossProfileIntentFilter}s can have the same targetUserId and
             // match the same intent. For performance reasons, it is better not to
@@ -5190,8 +5239,12 @@
             for (int i = 0; i < size; i++) {
                 CrossProfileIntentFilter filter = matchingFilters.get(i);
                 int targetUserId = filter.getTargetUserId();
-                if ((filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) == 0
-                        && !alreadyTriedUserIds.get(targetUserId)) {
+                boolean skipCurrentProfile =
+                        (filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0;
+                boolean skipCurrentProfileIfNoMatchFound =
+                        (filter.getFlags() & PackageManager.ONLY_IF_NO_MATCH_FOUND) != 0;
+                if (!skipCurrentProfile && !alreadyTriedUserIds.get(targetUserId)
+                        && (!skipCurrentProfileIfNoMatchFound || !matchInCurrentProfile)) {
                     // Checking if there are activities in the target user that can handle the
                     // intent.
                     ResolveInfo resolveInfo = createForwardingResolveInfo(filter, intent,
@@ -8362,9 +8415,9 @@
                 }
             }
             if ((p.info.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) != 0) {
-                ArraySet<String> appOpPerms = mAppOpPermissionPackages.get(p.info.name);
-                if (appOpPerms != null) {
-                    appOpPerms.remove(pkg.packageName);
+                ArraySet<String> appOpPkgs = mAppOpPermissionPackages.get(p.info.name);
+                if (appOpPkgs != null) {
+                    appOpPkgs.remove(pkg.packageName);
                 }
             }
         }
@@ -8378,10 +8431,10 @@
             String perm = pkg.requestedPermissions.get(i);
             BasePermission bp = mSettings.mPermissions.get(perm);
             if (bp != null && (bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) != 0) {
-                ArraySet<String> appOpPerms = mAppOpPermissionPackages.get(perm);
-                if (appOpPerms != null) {
-                    appOpPerms.remove(pkg.packageName);
-                    if (appOpPerms.isEmpty()) {
+                ArraySet<String> appOpPkgs = mAppOpPermissionPackages.get(perm);
+                if (appOpPkgs != null) {
+                    appOpPkgs.remove(pkg.packageName);
+                    if (appOpPkgs.isEmpty()) {
                         mAppOpPermissionPackages.remove(perm);
                     }
                 }
@@ -8625,6 +8678,8 @@
             }
 
             final int level = bp.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
+            final boolean appSupportsRuntimePermissions = pkg.applicationInfo.targetSdkVersion
+                    >= Build.VERSION_CODES.M;
             switch (level) {
                 case PermissionInfo.PROTECTION_NORMAL: {
                     // For all apps normal permissions are install time ones.
@@ -8632,9 +8687,13 @@
                 } break;
 
                 case PermissionInfo.PROTECTION_DANGEROUS: {
-                    if (pkg.applicationInfo.targetSdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1) {
+                    // If a permission review is required for legacy apps we represent
+                    // their permissions as always granted runtime ones since we need
+                    // to keep the review required permission flag per user while an
+                    // install permission's state is shared across all users.
+                    if (!appSupportsRuntimePermissions && !Build.PERMISSIONS_REVIEW_REQUIRED) {
                         // For legacy apps dangerous permissions are install time ones.
-                        grant = GRANT_INSTALL_LEGACY;
+                        grant = GRANT_INSTALL;
                     } else if (origPermissions.hasInstallPermission(bp.name)) {
                         // For legacy apps that became modern, install becomes runtime.
                         grant = GRANT_UPGRADE;
@@ -8681,7 +8740,7 @@
                 switch (grant) {
                     case GRANT_INSTALL: {
                         // Revoke this as runtime permission to handle the case of
-                        // a runtime permission being downgraded to an install one.
+                        // a runtime permission being downgraded to an install one. Also in permission review mode we keep dangerous permissions for legacy apps
                         for (int userId : UserManagerService.getInstance().getUserIds()) {
                             if (origPermissions.getRuntimePermissionState(
                                     bp.name, userId) != null) {
@@ -8701,20 +8760,12 @@
                         }
                     } break;
 
-                    case GRANT_INSTALL_LEGACY: {
-                        // Grant an install permission.
-                        if (permissionsState.grantInstallPermission(bp) !=
-                                PermissionsState.PERMISSION_OPERATION_FAILURE) {
-                            changedInstallPermission = true;
-                        }
-                    } break;
-
                     case GRANT_RUNTIME: {
                         // Grant previously granted runtime permissions.
                         for (int userId : UserManagerService.getInstance().getUserIds()) {
                             PermissionState permissionState = origPermissions
                                     .getRuntimePermissionState(bp.name, userId);
-                            final int flags = permissionState != null
+                            int flags = permissionState != null
                                     ? permissionState.getFlags() : 0;
                             if (origPermissions.hasRuntimePermission(bp.name, userId)) {
                                 if (permissionsState.grantRuntimePermission(bp, userId) ==
@@ -8723,6 +8774,27 @@
                                     changedRuntimePermissionUserIds = ArrayUtils.appendInt(
                                             changedRuntimePermissionUserIds, userId);
                                 }
+                                // If the app supports runtime permissions no need for a review.
+                                if (Build.PERMISSIONS_REVIEW_REQUIRED
+                                        && appSupportsRuntimePermissions
+                                        && (flags & PackageManager
+                                                .FLAG_PERMISSION_REVIEW_REQUIRED) != 0) {
+                                    flags &= ~PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED;
+                                    // Since we changed the flags, we have to write.
+                                    changedRuntimePermissionUserIds = ArrayUtils.appendInt(
+                                            changedRuntimePermissionUserIds, userId);
+                                }
+                            } else if (Build.PERMISSIONS_REVIEW_REQUIRED
+                                    && !appSupportsRuntimePermissions) {
+                                // For legacy apps that need a permission review, every new
+                                // runtime permission is granted but it is pending a review.
+                                if ((flags & FLAG_PERMISSION_REVIEW_REQUIRED) == 0) {
+                                    permissionsState.grantRuntimePermission(bp, userId);
+                                    flags |= FLAG_PERMISSION_REVIEW_REQUIRED;
+                                    // We changed the permission and flags, hence have to write.
+                                    changedRuntimePermissionUserIds = ArrayUtils.appendInt(
+                                            changedRuntimePermissionUserIds, userId);
+                                }
                             }
                             // Propagate the permission flags.
                             permissionsState.updatePermissionFlags(bp, userId, flags, flags);
@@ -11574,7 +11646,7 @@
         }
 
         int copyApk(IMediaContainerService imcs, boolean temp) throws RemoteException {
-            if (origin.staged) {
+            if (origin.staged && origin.cid != null) {
                 if (DEBUG_INSTALL) Slog.d(TAG, origin.cid + " already staged; skipping copy");
                 cid = origin.cid;
                 setMountPath(PackageHelper.getSdDir(cid));
@@ -13784,9 +13856,11 @@
             return;
         }
 
-        final int userSettableFlags = FLAG_PERMISSION_USER_SET
+        // These are flags that can change base on user actions.
+        final int userSettableMask = FLAG_PERMISSION_USER_SET
                 | FLAG_PERMISSION_USER_FIXED
-                | FLAG_PERMISSION_REVOKE_ON_UPGRADE;
+                | FLAG_PERMISSION_REVOKE_ON_UPGRADE
+                | FLAG_PERMISSION_REVIEW_REQUIRED;
 
         final int policyOrSystemFlags = FLAG_PERMISSION_SYSTEM_FIXED
                 | FLAG_PERMISSION_POLICY_FIXED;
@@ -13827,7 +13901,14 @@
             // Always clear the user settable flags.
             final boolean hasInstallState = permissionsState.getInstallPermissionState(
                     bp.name) != null;
-            if (permissionsState.updatePermissionFlags(bp, userId, userSettableFlags, 0)) {
+            // If permission review is enabled and this is a legacy app, mark the
+            // permission as requiring a review as this is the initial state.
+            int flags = 0;
+            if (Build.PERMISSIONS_REVIEW_REQUIRED
+                    && ps.pkg.applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) {
+                flags |= FLAG_PERMISSION_REVIEW_REQUIRED;
+            }
+            if (permissionsState.updatePermissionFlags(bp, userId, userSettableMask, flags)) {
                 if (hasInstallState) {
                     writeInstallPermissions = true;
                 } else {
@@ -13851,7 +13932,9 @@
                         != PERMISSION_OPERATION_FAILURE) {
                     writeRuntimePermissions = true;
                 }
-            } else {
+            // If permission review is enabled the permissions for a legacy apps
+            // are represented as constantly granted runtime ones, so don't revoke.
+            } else if ((flags & FLAG_PERMISSION_REVIEW_REQUIRED) == 0) {
                 // Otherwise, reset the permission.
                 final int revokeResult = permissionsState.revokeRuntimePermission(bp, userId);
                 switch (revokeResult) {
@@ -16744,6 +16827,15 @@
 
     void newUserCreated(final int userHandle) {
         mDefaultPermissionPolicy.grantDefaultPermissions(userHandle);
+        // If permission review for legacy apps is required, we represent
+        // dagerous permissions for such apps as always granted runtime
+        // permissions to keep per user flag state whether review is needed.
+        // Hence, if a new user is added we have to propagate dangerous
+        // permission grants for these legacy apps.
+        if (Build.PERMISSIONS_REVIEW_REQUIRED) {
+            updatePermissionsLPw(null, null, UPDATE_PERMISSIONS_ALL
+                    | UPDATE_PERMISSIONS_REPLACE_ALL);
+        }
     }
 
     @Override
@@ -17159,6 +17251,7 @@
                         packageName, userId);
             }
         }
+
         @Override
         public void grantDefaultPermissionsToDefaultSimCallManager(String packageName, int userId) {
             synchronized (mPackages) {
@@ -17194,6 +17287,30 @@
                 }
             }
         }
+
+        @Override
+        public boolean isPermissionsReviewRequired(String packageName, int userId) {
+            synchronized (mPackages) {
+                // If we do not support permission review, done.
+                if (!Build.PERMISSIONS_REVIEW_REQUIRED) {
+                    return false;
+                }
+
+                PackageSetting packageSetting = mSettings.mPackages.get(packageName);
+                if (packageSetting == null) {
+                    return false;
+                }
+
+                // Permission review applies only to apps not supporting the new permission model.
+                if (packageSetting.pkg.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.M) {
+                    return false;
+                }
+
+                // Legacy apps have the permission and get user consent on launch.
+                PermissionsState permissionsState = packageSetting.getPermissionsState();
+                return permissionsState.isPermissionReviewRequired(userId);
+            }
+        }
     }
 
     @Override
diff --git a/services/core/java/com/android/server/pm/PermissionsState.java b/services/core/java/com/android/server/pm/PermissionsState.java
index 57ef284..007b738 100644
--- a/services/core/java/com/android/server/pm/PermissionsState.java
+++ b/services/core/java/com/android/server/pm/PermissionsState.java
@@ -16,11 +16,13 @@
 
 package com.android.server.pm;
 
+import android.content.pm.PackageManager;
 import android.os.UserHandle;
 import android.util.ArrayMap;
 import android.util.ArraySet;
 
 import android.util.SparseArray;
+import android.util.SparseBooleanArray;
 import com.android.internal.util.ArrayUtils;
 
 import java.util.ArrayList;
@@ -64,6 +66,8 @@
 
     private int[] mGlobalGids = NO_GIDS;
 
+    private SparseBooleanArray mPermissionReviewRequired;
+
     public PermissionsState() {
         /* do nothing */
     }
@@ -116,6 +120,28 @@
             mGlobalGids = Arrays.copyOf(other.mGlobalGids,
                     other.mGlobalGids.length);
         }
+
+        if (mPermissionReviewRequired != null) {
+            if (other.mPermissionReviewRequired == null) {
+                mPermissionReviewRequired = null;
+            } else {
+                mPermissionReviewRequired.clear();
+            }
+        }
+        if (other.mPermissionReviewRequired != null) {
+            if (mPermissionReviewRequired == null) {
+                mPermissionReviewRequired = new SparseBooleanArray();
+            }
+            final int userCount = other.mPermissionReviewRequired.size();
+            for (int i = 0; i < userCount; i++) {
+                final boolean reviewRequired = other.mPermissionReviewRequired.valueAt(i);
+                mPermissionReviewRequired.put(i, reviewRequired);
+            }
+        }
+    }
+
+    public boolean isPermissionReviewRequired(int userId) {
+        return mPermissionReviewRequired != null && mPermissionReviewRequired.get(userId);
     }
 
     /**
@@ -357,7 +383,28 @@
             permissionData = ensurePermissionData(permission);
         }
 
-        return permissionData.updateFlags(userId, flagMask, flagValues);
+        final int oldFlags = permissionData.getFlags(userId);
+
+        final boolean updated = permissionData.updateFlags(userId, flagMask, flagValues);
+        if (updated) {
+            final int newFlags = permissionData.getFlags(userId);
+            if ((oldFlags & PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED) == 0
+                    && (newFlags & PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED) != 0) {
+                if (mPermissionReviewRequired == null) {
+                    mPermissionReviewRequired = new SparseBooleanArray();
+                }
+                mPermissionReviewRequired.put(userId, true);
+            } else if ((oldFlags & PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED) != 0
+                    && (newFlags & PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED) == 0) {
+                if (mPermissionReviewRequired != null) {
+                    mPermissionReviewRequired.delete(userId);
+                    if (mPermissionReviewRequired.size() <= 0) {
+                        mPermissionReviewRequired = null;
+                    }
+                }
+            }
+        }
+        return updated;
     }
 
     public boolean updatePermissionFlagsForAllPermissions(
@@ -430,6 +477,7 @@
     public void reset() {
         mGlobalGids = NO_GIDS;
         mPermissions = null;
+        mPermissionReviewRequired = null;
     }
 
     private PermissionState getPermissionState(String name, int userId) {
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 424b902..b859915 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -70,6 +70,7 @@
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.util.Preconditions;
 import com.android.internal.util.XmlUtils;
+import com.android.internal.widget.LockPatternUtils;
 import com.android.server.LocalServices;
 
 import org.xmlpull.v1.XmlPullParser;
@@ -411,7 +412,7 @@
     @Override
     public int getCredentialOwnerProfile(int userHandle) {
         checkManageUsersPermission("get the credential owner");
-        if (!StorageManager.isFileBasedEncryptionEnabled()) {
+        if (!LockPatternUtils.isSeparateWorkChallengeEnabled()) {
             synchronized (mUsersLock) {
                 UserInfo profileParent = getProfileParentLU(userHandle);
                 if (profileParent != null) {
@@ -652,6 +653,7 @@
     private void initDefaultGuestRestrictions() {
         synchronized (mGuestRestrictions) {
             if (mGuestRestrictions.isEmpty()) {
+                mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
                 mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
                 mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
             }
@@ -868,10 +870,8 @@
         mHandler.post(new Runnable() {
             @Override
             public void run() {
-                synchronized (mRestrictionsLock) {
-                    UserRestrictionsUtils.applyUserRestrictionsLR(
-                            mContext, userId, newRestrictionsFinal, prevRestrictionsFinal);
-                }
+                UserRestrictionsUtils.applyUserRestrictions(
+                        mContext, userId, newRestrictionsFinal, prevRestrictionsFinal);
 
                 final UserRestrictionsListener[] listeners;
                 synchronized (mUserRestrictionsListeners) {
@@ -1652,6 +1652,11 @@
             }
             updateUserIds();
             Bundle restrictions = new Bundle();
+            if (isGuest) {
+                synchronized (mGuestRestrictions) {
+                    restrictions.putAll(mGuestRestrictions);
+                }
+            }
             synchronized (mRestrictionsLock) {
                 mBaseUserRestrictions.append(userId, restrictions);
             }
@@ -1805,8 +1810,8 @@
             if (DBG) Slog.i(LOG_TAG, "Stopping user " + userHandle);
             int res;
             try {
-                res = ActivityManagerNative.getDefault().stopUser(userHandle,
-                        new IStopUserCallback.Stub() {
+                res = ActivityManagerNative.getDefault().stopUser(userHandle, /* force= */ true,
+                new IStopUserCallback.Stub() {
                             @Override
                             public void userStopped(int userId) {
                                 finishRemoveUser(userId);
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 77abd3e..816903e 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -22,11 +22,14 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.app.ActivityManager;
+import android.app.ActivityManagerNative;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.net.Uri;
 import android.os.Binder;
 import android.os.Bundle;
+import android.os.RemoteException;
 import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -84,7 +87,8 @@
             UserManager.DISALLOW_SAFE_BOOT,
             UserManager.ALLOW_PARENT_PROFILE_APP_LINKING,
             UserManager.DISALLOW_RECORD_AUDIO,
-            UserManager.DISALLOW_CAMERA
+            UserManager.DISALLOW_CAMERA,
+            UserManager.DISALLOW_RUN_IN_BACKGROUND
     );
 
     /**
@@ -126,6 +130,7 @@
      */
     private static final Set<String> GLOBAL_RESTRICTIONS = Sets.newArraySet(
             UserManager.DISALLOW_ADJUST_VOLUME,
+            UserManager.DISALLOW_RUN_IN_BACKGROUND,
             UserManager.DISALLOW_UNMUTE_MICROPHONE
     );
 
@@ -263,34 +268,28 @@
      * Takes a new use restriction set and the previous set, and apply the restrictions that have
      * changed.
      *
-     * <p>Note this method is called by {@link UserManagerService} while holding
-     * {@code mRestrictionLock}. Be aware when calling into other services, which could cause
-     * a deadlock.
+     * <p>Note this method is called by {@link UserManagerService} without holding any locks.
      */
-    public static void applyUserRestrictionsLR(Context context, int userId,
+    public static void applyUserRestrictions(Context context, int userId,
             Bundle newRestrictions, Bundle prevRestrictions) {
         for (String key : USER_RESTRICTIONS) {
             final boolean newValue = newRestrictions.getBoolean(key);
             final boolean prevValue = prevRestrictions.getBoolean(key);
 
             if (newValue != prevValue) {
-                applyUserRestrictionLR(context, userId, key, newValue);
+                applyUserRestriction(context, userId, key, newValue);
             }
         }
     }
-    
+
     /**
      * Apply each user restriction.
      *
-     * <p>Note this method is called by {@link UserManagerService} while holding
-     * {@code mRestrictionLock}. Be aware when calling into other services, which could cause
-     * a deadlock.
-     *
      * <p>See also {@link
      * com.android.providers.settings.SettingsProvider#isGlobalOrSecureSettingRestrictedForUser},
      * which should be in sync with this method.
      */
-    private static void applyUserRestrictionLR(Context context, int userId, String key,
+    private static void applyUserRestriction(Context context, int userId, String key,
             boolean newValue) {
         if (UserManagerService.DBG) {
             Log.d(TAG, "Applying user restriction: userId=" + userId
@@ -365,6 +364,17 @@
                                 userId);
                     }
                     break;
+                case UserManager.DISALLOW_RUN_IN_BACKGROUND:
+                    if (newValue) {
+                        int currentUser = ActivityManager.getCurrentUser();
+                        if (currentUser != userId && userId != UserHandle.USER_SYSTEM) {
+                            try {
+                                ActivityManagerNative.getDefault().stopUser(userId, false, null);
+                            } catch (RemoteException e) {
+                                throw e.rethrowAsRuntimeException();
+                            }
+                        }
+                    }
             }
         } finally {
             Binder.restoreCallingIdentity(id);
diff --git a/services/core/java/com/android/server/policy/BarController.java b/services/core/java/com/android/server/policy/BarController.java
index 051b7fb..0c80ffa 100644
--- a/services/core/java/com/android/server/policy/BarController.java
+++ b/services/core/java/com/android/server/policy/BarController.java
@@ -47,6 +47,7 @@
     private final int mTransientFlag;
     private final int mUnhideFlag;
     private final int mTranslucentFlag;
+    private final int mTransparentFlag;
     private final int mStatusBarManagerId;
     private final int mTranslucentWmFlag;
     protected final Handler mHandler;
@@ -63,13 +64,14 @@
     private boolean mNoAnimationOnNextShow;
 
     public BarController(String tag, int transientFlag, int unhideFlag, int translucentFlag,
-            int statusBarManagerId, int translucentWmFlag) {
+            int statusBarManagerId, int translucentWmFlag, int transparentFlag) {
         mTag = "BarController." + tag;
         mTransientFlag = transientFlag;
         mUnhideFlag = unhideFlag;
         mTranslucentFlag = translucentFlag;
         mStatusBarManagerId = statusBarManagerId;
         mTranslucentWmFlag = translucentWmFlag;
+        mTransparentFlag = transparentFlag;
         mHandler = new Handler();
     }
 
@@ -126,13 +128,13 @@
                     vis &= ~mTranslucentFlag;
                 }
                 if ((fl & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
-                    vis |= View.SYSTEM_UI_TRANSPARENT;
+                    vis |= mTransparentFlag;
                 } else {
-                    vis &= ~View.SYSTEM_UI_TRANSPARENT;
+                    vis &= ~mTransparentFlag;
                 }
             } else {
                 vis = (vis & ~mTranslucentFlag) | (oldVis & mTranslucentFlag);
-                vis = (vis & ~View.SYSTEM_UI_TRANSPARENT) | (oldVis & View.SYSTEM_UI_TRANSPARENT);
+                vis = (vis & ~mTransparentFlag) | (oldVis & mTransparentFlag);
             }
         }
         return vis;
@@ -247,7 +249,7 @@
             }
         }
         if (mShowTransparent) {
-            vis |= View.SYSTEM_UI_TRANSPARENT;
+            vis |= mTransparentFlag;
             if (mSetUnHideFlagWhenNextTransparent) {
                 vis |= mUnhideFlag;
                 mSetUnHideFlagWhenNextTransparent = false;
@@ -258,7 +260,7 @@
             vis &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;  // never show transient bars in low profile
         }
         if ((vis & mTranslucentFlag) != 0 || (oldVis & mTranslucentFlag) != 0 ||
-                ((vis | oldVis) & View.SYSTEM_UI_TRANSPARENT) != 0) {
+                ((vis | oldVis) & mTransparentFlag) != 0) {
             mLastTranslucent = SystemClock.uptimeMillis();
         }
         return vis;
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index ae6874f..fe427d3 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -108,9 +108,6 @@
 import android.view.KeyCharacterMap.FallbackAction;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.policy.PhoneWindow;
 import android.view.Surface;
 import android.view.View;
 import android.view.ViewConfiguration;
@@ -124,6 +121,8 @@
 import android.view.animation.AnimationSet;
 import android.view.animation.AnimationUtils;
 import com.android.internal.R;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.policy.PhoneWindow;
 import com.android.internal.statusbar.IStatusBarService;
 import com.android.internal.util.ScreenShapeHelper;
 import com.android.internal.widget.PointerLocationView;
@@ -159,8 +158,7 @@
     static final boolean SHOW_PROCESSES_ON_ALT_MENU = false;
 
     // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key.
-    // No longer recommended for desk docks; still useful in car docks.
-    static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true;
+    // No longer recommended for desk docks;
     static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false;
 
     static final int SHORT_PRESS_POWER_NOTHING = 0;
@@ -211,7 +209,8 @@
             | View.SYSTEM_UI_FLAG_FULLSCREEN
             | View.STATUS_BAR_TRANSLUCENT
             | View.NAVIGATION_BAR_TRANSLUCENT
-            | View.SYSTEM_UI_TRANSPARENT;
+            | View.STATUS_BAR_TRANSPARENT
+            | View.NAVIGATION_BAR_TRANSPARENT;
 
     private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
             .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
@@ -317,6 +316,10 @@
     int[] mNavigationBarHeightForRotation = new int[4];
     int[] mNavigationBarWidthForRotation = new int[4];
 
+    // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key.
+    // This is for car dock and this is updated from resource.
+    private boolean mEnableCarDockHomeCapture = true;
+
     boolean mBootMessageNeedsHiding;
     KeyguardServiceDelegate mKeyguardDelegate;
     final Runnable mWindowManagerDrawCallback = new Runnable() {
@@ -624,6 +627,8 @@
     private final LogDecelerateInterpolator mLogDecelerateInterpolator
             = new LogDecelerateInterpolator(100, 0);
 
+    private boolean mForceWindowDrawsStatusBarBackground;
+
     private static final int MSG_ENABLE_POINTER_LOCATION = 1;
     private static final int MSG_DISABLE_POINTER_LOCATION = 2;
     private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
@@ -804,7 +809,8 @@
             View.NAVIGATION_BAR_UNHIDE,
             View.NAVIGATION_BAR_TRANSLUCENT,
             StatusBarManager.WINDOW_NAVIGATION_BAR,
-            WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+            WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
+            View.NAVIGATION_BAR_TRANSPARENT);
 
     private ImmersiveModeConfirmation mImmersiveModeConfirmation;
 
@@ -1399,6 +1405,8 @@
         mHomeIntent.addCategory(Intent.CATEGORY_HOME);
         mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                 | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+        mEnableCarDockHomeCapture = context.getResources().getBoolean(
+                com.android.internal.R.bool.config_enableCarDockHomeLaunch);
         mCarDockIntent =  new Intent(Intent.ACTION_MAIN, null);
         mCarDockIntent.addCategory(Intent.CATEGORY_CAR_DOCK);
         mCarDockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
@@ -1583,6 +1591,8 @@
 
         mScreenshotChordEnabled = mContext.getResources().getBoolean(
                 com.android.internal.R.bool.config_enableScreenshotChord);
+        mForceWindowDrawsStatusBarBackground = mContext.getResources().getBoolean(
+                R.bool.config_forceWindowDrawsStatusBarBackground);
 
         mGlobalKeyManager = new GlobalKeyManager(mContext);
 
@@ -1915,6 +1925,7 @@
             case TYPE_PRIVATE_PRESENTATION:
             case TYPE_VOICE_INTERACTION:
             case TYPE_ACCESSIBILITY_OVERLAY:
+            case TYPE_QS_DIALOG:
                 // The window manager will check these.
                 break;
             case TYPE_PHONE:
@@ -2044,10 +2055,14 @@
             attrs.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
         }
 
-        if (ActivityManager.isHighEndGfx()
-                && (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
-            attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
-                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+        if (ActivityManager.isHighEndGfx()) {
+            if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
+                attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+            }
+            if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
+                    || mForceWindowDrawsStatusBarBackground) {
+                attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
+            }
         }
     }
 
@@ -2110,6 +2125,8 @@
             return 2;
         case TYPE_DOCK_DIVIDER:
             return 2;
+        case TYPE_QS_DIALOG:
+            return 2;
         case TYPE_PHONE:
             return 3;
         case TYPE_SEARCH_BAR:
@@ -2533,7 +2550,7 @@
                 }
             }
         } else if (win.getAttrs().type == TYPE_DOCK_DIVIDER) {
-            if (transit == TRANSIT_ENTER) {
+            if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) {
                 return R.anim.fade_in;
             } else if (transit == TRANSIT_EXIT) {
                 return R.anim.fade_out;
@@ -3602,7 +3619,7 @@
             final int sysui = mLastSystemUiFlags;
             boolean navVisible = (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
             boolean navTranslucent = (sysui
-                    & (View.NAVIGATION_BAR_TRANSLUCENT | View.SYSTEM_UI_TRANSPARENT)) != 0;
+                    & (View.NAVIGATION_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSPARENT)) != 0;
             boolean immersive = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
             boolean immersiveSticky = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0;
             boolean navAllowedHidden = immersive || immersiveSticky;
@@ -3670,7 +3687,7 @@
 
             boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0;
             boolean statusBarTranslucent = (sysui
-                    & (View.STATUS_BAR_TRANSLUCENT | View.SYSTEM_UI_TRANSPARENT)) != 0;
+                    & (View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT)) != 0;
             if (!isKeyguardShowing) {
                 statusBarTranslucent &= areTranslucentBarsAllowed();
             }
@@ -4001,7 +4018,8 @@
                         && (fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0
                         && (fl & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) == 0
                         && (fl & WindowManager.LayoutParams.
-                                FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0) {
+                                FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
+                        && !mForceWindowDrawsStatusBarBackground) {
                     // Ensure policy decor includes status bar
                     dcf.top = mStableTop;
                 }
@@ -6402,7 +6420,7 @@
      * true:
      * <ul>
      *  <li>The device is not in either car mode or desk mode
-     *  <li>The device is in car mode but ENABLE_CAR_DOCK_HOME_CAPTURE is false
+     *  <li>The device is in car mode but mEnableCarDockHomeCapture is false
      *  <li>The device is in desk mode but ENABLE_DESK_DOCK_HOME_CAPTURE is false
      *  <li>The device is in car mode but there's no CAR_DOCK app with METADATA_DOCK_HOME
      *  <li>The device is in desk mode but there's no DESK_DOCK app with METADATA_DOCK_HOME
@@ -6416,7 +6434,7 @@
         // is, when in car mode you should be taken to car home regardless
         // of whether we are actually in a car dock.
         if (mUiMode == Configuration.UI_MODE_TYPE_CAR) {
-            if (ENABLE_CAR_DOCK_HOME_CAPTURE) {
+            if (mEnableCarDockHomeCapture) {
                 intent = mCarDockIntent;
             }
         } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) {
@@ -6726,10 +6744,7 @@
         final boolean freeformStackVisible =
                 mWindowManagerInternal.isStackVisible(FREEFORM_WORKSPACE_STACK_ID);
         final boolean forceShowSystemBars = dockedStackVisible || freeformStackVisible;
-        // TODO(multi-window): Update to force opaque independently for status bar and nav bar.
-        // This will require refactoring the code to have separate vis flag for each bar so it can
-        // be adjusted independently.
-        final boolean forceOpaqueSystemBars = forceShowSystemBars;
+        final boolean forceOpaqueSystemBars = forceShowSystemBars && !mForceStatusBarFromKeyguard;
 
         // apply translucent bar vis flags
         WindowState transWin = isStatusBarKeyguard() && !mHideLockScreen
@@ -6759,6 +6774,11 @@
                     | View.SYSTEM_UI_TRANSPARENT);
         }
 
+        if (mForceWindowDrawsStatusBarBackground) {
+            vis |= View.STATUS_BAR_TRANSPARENT;
+            vis &= ~View.STATUS_BAR_TRANSLUCENT;
+        }
+
         // update status bar
         boolean immersiveSticky =
                 (vis & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0;
@@ -6936,6 +6956,7 @@
         pw.print(prefix); pw.print("mSupportAutoRotation="); pw.println(mSupportAutoRotation);
         pw.print(prefix); pw.print("mUiMode="); pw.print(mUiMode);
                 pw.print(" mDockMode="); pw.print(mDockMode);
+                pw.print(" mEnableCarDockHomeCapture="); pw.print(mEnableCarDockHomeCapture);
                 pw.print(" mCarDockRotation="); pw.print(mCarDockRotation);
                 pw.print(" mDeskDockRotation="); pw.println(mDeskDockRotation);
         pw.print(prefix); pw.print("mUserRotationMode="); pw.print(mUserRotationMode);
diff --git a/services/core/java/com/android/server/policy/StatusBarController.java b/services/core/java/com/android/server/policy/StatusBarController.java
index b935f5a..9d353c6 100644
--- a/services/core/java/com/android/server/policy/StatusBarController.java
+++ b/services/core/java/com/android/server/policy/StatusBarController.java
@@ -111,7 +111,8 @@
                 View.STATUS_BAR_UNHIDE,
                 View.STATUS_BAR_TRANSLUCENT,
                 StatusBarManager.WINDOW_STATUS_BAR,
-                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
+                View.STATUS_BAR_TRANSPARENT);
     }
 
     public AppTransitionListener getAppTransitionListener() {
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index f9d29ac..4b6db99 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -53,6 +53,7 @@
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.os.storage.StorageManager;
 import android.provider.Settings;
 import android.service.trust.TrustAgentService;
 import android.util.ArraySet;
@@ -102,6 +103,7 @@
     private static final int MSG_START_USER = 7;
     private static final int MSG_CLEANUP_USER = 8;
     private static final int MSG_SWITCH_USER = 9;
+    private static final int MSG_SET_DEVICE_LOCKED = 10;
 
     private final ArraySet<AgentInfo> mActiveAgents = new ArraySet<>();
     private final ArrayList<ITrustListener> mTrustListeners = new ArrayList<>();
@@ -288,6 +290,19 @@
         }
     }
 
+    public void setDeviceLockedForUser(int userId, boolean locked) {
+        if (LockPatternUtils.isSeparateWorkChallengeEnabled()) {
+            UserInfo info = mUserManager.getUserInfo(userId);
+            if (info.isManagedProfile()) {
+                synchronized (mDeviceLockedForUser) {
+                    mDeviceLockedForUser.put(userId, locked);
+                }
+            } else {
+                Log.wtf(TAG, "Requested to change lock state for non-profile user " + userId);
+            }
+        }
+    }
+
     boolean isDeviceLockedInner(int userId) {
         synchronized (mDeviceLockedForUser) {
             return mDeviceLockedForUser.get(userId, true);
@@ -655,7 +670,9 @@
         public boolean isDeviceLocked(int userId) throws RemoteException {
             userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId,
                     false /* allowAll */, true /* requireFull */, "isDeviceLocked", null);
-            userId = resolveProfileParent(userId);
+            if (!LockPatternUtils.isSeparateWorkChallengeEnabled()) {
+                userId = resolveProfileParent(userId);
+            }
 
             return isDeviceLockedInner(userId);
         }
@@ -762,6 +779,12 @@
         private String dumpHex(int i) {
             return "0x" + Integer.toHexString(i);
         }
+
+        @Override
+        public void setDeviceLockedForUser(int userId, boolean value) {
+            mHandler.obtainMessage(MSG_SET_DEVICE_LOCKED, value ? 1 : 0, userId)
+                    .sendToTarget();
+        }
     };
 
     private int resolveProfileParent(int userId) {
@@ -806,6 +829,9 @@
                     mCurrentUser = msg.arg1;
                     refreshDeviceLockedForUser(UserHandle.USER_ALL);
                     break;
+                case MSG_SET_DEVICE_LOCKED:
+                    setDeviceLockedForUser(msg.arg2, msg.arg1 != 0);
+                    break;
             }
         }
     };
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index c246609..a4b4276 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -351,6 +351,7 @@
                         case WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG:
                         case WindowManager.LayoutParams.TYPE_SYSTEM_ERROR:
                         case WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY:
+                        case WindowManager.LayoutParams.TYPE_QS_DIALOG:
                         case WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL: {
                             Rect magnifiedRegionBounds = mTempRect2;
                             mMagnifedViewport.getMagnifiedFrameInContentCoordsLocked(
diff --git a/services/core/java/com/android/server/wm/AppWindowAnimator.java b/services/core/java/com/android/server/wm/AppWindowAnimator.java
index b32ec2d..4861acc 100644
--- a/services/core/java/com/android/server/wm/AppWindowAnimator.java
+++ b/services/core/java/com/android/server/wm/AppWindowAnimator.java
@@ -109,7 +109,7 @@
     public AppWindowAnimator(final AppWindowToken atoken) {
         mAppToken = atoken;
         mService = atoken.service;
-        mAnimator = atoken.mAnimator;
+        mAnimator = mService.mAnimator;
     }
 
     public void setAnimation(Animation anim, int width, int height, boolean skipFirstFrame) {
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 425ff9b..3d00e02 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -24,6 +24,7 @@
 import com.android.server.input.InputApplicationHandle;
 import com.android.server.wm.WindowManagerService.H;
 
+import android.annotation.NonNull;
 import android.content.pm.ActivityInfo;
 import android.os.Message;
 import android.os.RemoteException;
@@ -49,9 +50,7 @@
     // All of the windows and child windows that are included in this
     // application token.  Note this list is NOT sorted!
     final WindowList allAppWindows = new WindowList();
-    final AppWindowAnimator mAppAnimator;
-
-    final WindowAnimator mAnimator;
+    @NonNull final AppWindowAnimator mAppAnimator;
 
     final boolean voiceInteraction;
 
@@ -145,7 +144,6 @@
         appToken = _token;
         voiceInteraction = _voiceInteraction;
         mInputApplicationHandle = new InputApplicationHandle(this);
-        mAnimator = service.mAnimator;
         mAppAnimator = new AppWindowAnimator(this);
     }
 
@@ -259,7 +257,7 @@
             if (win.mAttrs.type == WindowManager.LayoutParams.TYPE_BASE_APPLICATION
                     || win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
                 // In cases where there are multiple windows, we prefer the non-exiting window. This
-                // happens for example when when replacing windows during an activity relaunch. When
+                // happens for example when replacing windows during an activity relaunch. When
                 // constructing the animation, we want the new window, not the exiting one.
                 if (win.mExiting) {
                     candidate = win;
@@ -271,6 +269,10 @@
         return candidate;
     }
 
+    boolean stackCanReceiveKeys() {
+        return (windows.size() > 0) ? windows.get(windows.size() - 1).stackCanReceiveKeys() : false;
+    }
+
     boolean isVisible() {
         final int N = allAppWindows.size();
         for (int i=0; i<N; i++) {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index e9e09ec..4bbf586 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -94,8 +94,9 @@
     Region mNonResizeableRegion = new Region();
 
     /** Save allocating when calculating rects */
-    private Rect mTmpRect = new Rect();
-    private Rect mTmpRect2 = new Rect();
+    private final Rect mTmpRect = new Rect();
+    private final Rect mTmpRect2 = new Rect();
+    private final Region mTmpRegion = new Region();
 
     /** For gathering Task objects in order. */
     final ArrayList<Task> mTmpTaskHistory = new ArrayList<Task>();
@@ -403,6 +404,14 @@
         if (addBackFocusedTask) {
             mTouchExcludeRegion.op(mTmpRect2, Region.Op.UNION);
         }
+        final WindowState inputMethod = mService.mInputMethodWindow;
+        if (inputMethod != null && inputMethod.isVisibleLw()) {
+            // If the input method is visible and the user is typing, we don't want these touch
+            // events to be intercepted and used to change focus. This would likely cause a
+            // disappearance of the input method.
+            inputMethod.getTouchableRegion(mTmpRegion);
+            mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION);
+        }
         if (mTapDetector != null) {
             mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion, mNonResizeableRegion);
         }
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 6b62467..df8d5d6 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -18,7 +18,11 @@
 
 import android.content.Context;
 import android.graphics.Rect;
+import android.os.RemoteException;
 import android.util.Slog;
+import android.util.SparseArray;
+import android.util.SparseIntArray;
+import android.view.IDockDividerVisibilityListener;
 
 import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
 import static android.view.WindowManager.DOCKED_BOTTOM;
@@ -40,6 +44,8 @@
     private WindowState mWindow;
     private final Rect mTmpRect = new Rect();
     private final Rect mLastRect = new Rect();
+    private IDockDividerVisibilityListener mListener;
+    private boolean mLastVisibility = false;
 
     DockedStackDividerController(Context context, DisplayContent displayContent) {
         mDisplayContent = displayContent;
@@ -67,12 +73,21 @@
     }
 
     void reevaluateVisibility() {
-        if (mWindow == null) return;
+        if (mWindow == null) {
+            return;
+        }
         TaskStack stack = mDisplayContent.mService.mStackIdToStack.get(DOCKED_STACK_ID);
-        if (stack != null && stack.isVisibleLocked()) {
-            mWindow.showLw(true /* doAnimation */);
-        } else {
-            mWindow.hideLw(true /* doAnimation */);
+        final boolean visible = stack != null && stack.isVisibleLocked();
+        if (mLastVisibility == visible) {
+            return;
+        }
+        mLastVisibility = visible;
+        if (mListener != null) {
+            try {
+                mListener.onDockDividerVisibilityChanged(visible);
+            } catch (RemoteException e) {
+                Slog.e(TAG, "visibility call failed: " + e);
+            }
         }
     }
 
@@ -110,4 +125,11 @@
         }
         mLastRect.set(frame);
     }
+
+    public void registerDockDividerVisibilityListener(IDockDividerVisibilityListener listener) {
+        if (mListener != null && listener != null) {
+            throw new IllegalStateException("Dock divider visibility listener already set!");
+        }
+        mListener = listener;
+    }
 }
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 74e8e53..e4f6c56 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -26,6 +26,11 @@
 import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE;
 import static com.android.server.wm.WindowManagerService.DEBUG_STACK;
 import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK;
+import static com.android.server.wm.WindowManagerService.H.SHOW_NON_RESIZEABLE_DOCK_TOAST;
+import static android.view.WindowManager.DOCKED_INVALID;
+import static android.view.WindowManager.DOCKED_LEFT;
+import static android.view.WindowManager.DOCKED_RIGHT;
+import static android.view.WindowManager.DOCKED_TOP;
 
 import android.app.ActivityManager.StackId;
 import android.content.res.Configuration;
@@ -76,6 +81,11 @@
     // Whether the task is resizeable
     private boolean mResizeable;
 
+    // Whether we need to show toast about the app being non-resizeable when it becomes visible.
+    // This flag is set when a non-resizeable task is docked (or side-by-side). It's cleared
+    // after we show the toast.
+    private boolean mShowNonResizeableDockToast;
+
     // Whether the task is currently being drag-resized
     private boolean mDragResizing;
 
@@ -92,6 +102,41 @@
         return mStack.getDisplayContent();
     }
 
+    void setShowNonResizeableDockToast() {
+        mShowNonResizeableDockToast = true;
+    }
+
+    void scheduleShowNonResizeableDockToastIfNeeded() {
+        if (!mShowNonResizeableDockToast) {
+            return;
+        }
+        final DisplayContent displayContent = mStack.getDisplayContent();
+        // If docked stack is not yet visible, we don't want to show the toast yet,
+        // since we need the visible rect of the docked task to position the toast.
+        if (displayContent == null || displayContent.getDockedStackLocked() == null) {
+            return;
+        }
+
+        mShowNonResizeableDockToast = false;
+
+        final int dockSide = mStack.getDockSide();
+        int xOffset = 0;
+        int yOffset = 0;
+        if (dockSide != DOCKED_INVALID) {
+            mStack.getBounds(mTmpRect);
+            displayContent.getLogicalDisplayRect(mTmpRect2);
+
+            if (dockSide == DOCKED_LEFT || dockSide == DOCKED_RIGHT) {
+                xOffset = mTmpRect.centerX() - mTmpRect2.centerX();
+            } else if (dockSide == DOCKED_TOP) {
+                // We don't adjust for DOCKED_BOTTOM case since it's already at the bottom.
+                yOffset = mTmpRect2.bottom - mTmpRect.bottom;
+            }
+            mService.mH.obtainMessage(
+                    SHOW_NON_RESIZEABLE_DOCK_TOAST, xOffset, yOffset).sendToTarget();
+        }
+    }
+
     void addAppToken(int addPos, AppWindowToken wtoken) {
         final int lastPos = mAppTokens.size();
         if (addPos >= lastPos) {
@@ -207,7 +252,7 @@
         }
 
         int boundsChange = BOUNDS_CHANGE_NONE;
-        if (mBounds.left != bounds.left || mBounds.right != bounds.right) {
+        if (mBounds.left != bounds.left || mBounds.top != bounds.top) {
             boundsChange |= BOUNDS_CHANGE_POSITION;
         }
         if (mBounds.width() != bounds.width() || mBounds.height() != bounds.height()) {
@@ -517,8 +562,10 @@
     }
 
     public void printTo(String prefix, PrintWriter pw) {
-        pw.print(prefix); pw.print("taskId="); pw.print(mTaskId);
-                pw.print(prefix); pw.print("appTokens="); pw.print(mAppTokens);
-                pw.print(prefix); pw.print("mdr="); pw.println(mDeferRemoval);
+        pw.print(prefix); pw.print("taskId="); pw.println(mTaskId);
+            pw.print(prefix + prefix); pw.print("mFullscreen="); pw.println(mFullscreen);
+            pw.print(prefix + prefix); pw.print("mBounds="); pw.println(mBounds.toShortString());
+            pw.print(prefix + prefix); pw.print("mdr="); pw.println(mDeferRemoval);
+            pw.print(prefix + prefix); pw.print("appTokens="); pw.println(mAppTokens);
     }
 }
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 87deaa4..611ad40 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -602,6 +602,8 @@
     public void dump(String prefix, PrintWriter pw) {
         pw.print(prefix); pw.print("mStackId="); pw.println(mStackId);
         pw.print(prefix); pw.print("mDeferDetach="); pw.println(mDeferDetach);
+        pw.print(prefix); pw.print("mFullscreen="); pw.println(mFullscreen);
+        pw.print(prefix); pw.print("mBounds="); pw.println(mBounds.toShortString());
         for (int taskNdx = 0; taskNdx < mTasks.size(); ++taskNdx) {
             pw.print(prefix);
             mTasks.get(taskNdx).printTo(prefix + " ", pw);
@@ -658,10 +660,11 @@
     }
 
     /**
-     * For docked workspace provides information which side of the screen was the dock anchored.
+     * For docked workspace (or workspace that's side-by-side to the docked), provides
+     * information which side of the screen was the dock anchored.
      */
     int getDockSide() {
-        if (mStackId != DOCKED_STACK_ID) {
+        if (mStackId != DOCKED_STACK_ID && !StackId.isResizeableByDockedStack(mStackId)) {
             return DOCKED_INVALID;
         }
         if (mDisplayContent == null) {
@@ -699,26 +702,4 @@
         }
         return false;
     }
-
-    /**
-     * Returns true if this stack has a window that is fully visible, doesn't perform an entry
-     * animation and is just positioned where it's supposed to be.
-     */
-    boolean hasWindowWithFinalVisibility() {
-        for (int i = mTasks.size() - 1; i >= 0; i--) {
-            Task task = mTasks.get(i);
-            for (int j = task.mAppTokens.size() - 1; j >= 0; j--) {
-                final AppWindowToken token = task.mAppTokens.get(j);
-                if (token.mAppAnimator.animating || token.mWillReplaceWindow) {
-                    continue;
-                }
-                WindowState win = token.findMainWindow();
-                if (win != null && !win.mWinAnimator.mEnterAnimationPending
-                        && !win.mWinAnimator.mEnteringAnimation) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
 }
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 46fab2a..f20c4e5 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -220,8 +220,8 @@
 
         if (appShowWhenLocked != null) {
             allowWhenLocked |= appShowWhenLocked == win.mAppToken
-                    // Show all SHOW_WHEN_LOCKED windows while they're animating
-                    || (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.isAnimatingLw()
+                    // Show all SHOW_WHEN_LOCKED windows if some apps are shown over lockscreen
+                    || (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0
                     // Show error dialogs over apps that dismiss keyguard.
                     || (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
         }
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ac90daf..f25f1e3 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -43,6 +43,7 @@
 import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
 import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
 import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
+import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
 import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
 import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
 import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
@@ -121,6 +122,7 @@
 import android.view.Gravity;
 import android.view.IApplicationToken;
 import android.view.IAppTransitionAnimationSpecsFuture;
+import android.view.IDockDividerVisibilityListener;
 import android.view.IInputFilter;
 import android.view.IOnKeyguardExitResult;
 import android.view.IRotationWatcher;
@@ -149,8 +151,10 @@
 import android.view.WindowManagerPolicy;
 import android.view.WindowManagerPolicy.PointerEventListener;
 import android.view.animation.Animation;
+import android.widget.Toast;
 
 import com.android.internal.app.IAssistScreenshotReceiver;
+import com.android.internal.R;
 import com.android.internal.util.FastPrintWriter;
 import com.android.internal.view.IInputContext;
 import com.android.internal.view.IInputMethodClient;
@@ -1862,6 +1866,11 @@
                           + attrs.token + ".  Aborting.");
                     return WindowManagerGlobal.ADD_BAD_APP_TOKEN;
                 }
+                if (type == TYPE_QS_DIALOG) {
+                    Slog.w(TAG, "Attempted to add QS dialog window with unknown token "
+                          + attrs.token + ".  Aborting.");
+                    return WindowManagerGlobal.ADD_BAD_APP_TOKEN;
+                }
                 if (type == TYPE_ACCESSIBILITY_OVERLAY) {
                     Slog.w(TAG, "Attempted to add Accessibility overlay window with unknown token "
                             + attrs.token + ".  Aborting.");
@@ -2508,7 +2517,7 @@
     }
 
     void repositionChild(Session session, IWindow client,
-            int top, int left, int right, int bottom,
+            int left, int top, int right, int bottom,
             long deferTransactionUntilFrame, Rect outFrame) {
         Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "repositionChild");
         long origId = Binder.clearCallingIdentity();
@@ -2525,12 +2534,11 @@
                             + "attached to a parent win=" + win);
                 }
 
-                win.mFrame.left = left;
-                win.mFrame.top = top;
-                win.mFrame.right = right;
-                win.mFrame.bottom = bottom;
-
-                win.mWinAnimator.computeShownFrameLocked();
+                win.mAttrs.x = left;
+                win.mAttrs.y = top;
+                win.mAttrs.width = right - left;
+                win.mAttrs.height = bottom - top;
+                win.setWindowScale(win.mRequestedWidth, win.mRequestedHeight);
 
                 if (SHOW_TRANSACTIONS) {
                     Slog.i(TAG, ">>> OPEN TRANSACTION repositionChild");
@@ -2538,12 +2546,16 @@
 
                 SurfaceControl.openTransaction();
 
+                win.applyGravityAndUpdateFrame();
+                win.mWinAnimator.computeShownFrameLocked();
+
+                win.mWinAnimator.setSurfaceBoundariesLocked(false);
+
                 if (deferTransactionUntilFrame > 0) {
                     win.mWinAnimator.mSurfaceController.deferTransactionUntil(
                             win.mAttachedWindow.mWinAnimator.mSurfaceController.getHandle(),
                             deferTransactionUntilFrame);
                 }
-                win.mWinAnimator.setSurfaceBoundariesLocked(false);
 
                 SurfaceControl.closeTransaction();
                 if (SHOW_TRANSACTIONS) {
@@ -2577,6 +2589,7 @@
             if (win == null) {
                 return 0;
             }
+
             WindowStateAnimator winAnimator = win.mWinAnimator;
             if (viewVisibility != View.GONE) {
                 win.setRequestedSize(requestedWidth, requestedHeight);
@@ -2689,8 +2702,7 @@
                     // need to see about starting one.
                     final boolean notExitingOrAnimating =
                             !win.mExiting && !win.isAnimatingWithSavedSurface();
-                    result |= notExitingOrAnimating
-                            ? RELAYOUT_RES_SURFACE_CHANGED : 0;
+                    result |= notExitingOrAnimating ? RELAYOUT_RES_SURFACE_CHANGED : 0;
                     if (notExitingOrAnimating) {
                         focusMayChange = tryStartingAnimation(win, winAnimator, isDefaultDisplay,
                                 focusMayChange);
@@ -3075,7 +3087,7 @@
         // TODO:
     }
 
-    boolean checkCallingPermission(String permission, String func) {
+    private boolean checkCallingPermission(String permission, String func) {
         // Quick check: if the calling permission is me, it's all okay.
         if (Binder.getCallingPid() == Process.myPid()) {
             return true;
@@ -3263,7 +3275,8 @@
     }
 
     @Override
-    public void setAppTask(IBinder token, int taskId, Rect taskBounds, Configuration config) {
+    public void setAppTask(
+            IBinder token, int taskId, int stackId, Rect taskBounds, Configuration config) {
         if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                 "setAppTask()")) {
             throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
@@ -3281,8 +3294,7 @@
             Task newTask = mTaskIdToTask.get(taskId);
             if (newTask == null) {
                 newTask = createTaskLocked(
-                        taskId, oldTask.mStack.mStackId, oldTask.mUserId, atoken, taskBounds,
-                        config);
+                        taskId, stackId, oldTask.mUserId, atoken, taskBounds, config);
             }
             newTask.addAppToken(Integer.MAX_VALUE /* at top */, atoken);
         }
@@ -4787,6 +4799,17 @@
         }
     }
 
+    public void scheduleShowNonResizeableDockToast(int taskId) {
+        synchronized (mWindowMap) {
+            Task task = mTaskIdToTask.get(taskId);
+            if (task == null) {
+                if (DEBUG_STACK) Slog.i(TAG, "scheduleShowToast: could not find taskId=" + taskId);
+                return;
+            }
+            task.setShowNonResizeableDockToast();
+        }
+    }
+
     public void getStackBounds(int stackId, Rect bounds) {
         synchronized (mWindowMap) {
             final TaskStack stack = mStackIdToStack.get(stackId);
@@ -7385,7 +7408,9 @@
             if (displayContent != null) {
                 mAnimator.addDisplayLocked(displayId);
                 displayContent.initializeDisplayBaseInfo();
-                displayContent.mTapDetector.init();
+                if (displayContent.mTapDetector != null) {
+                    displayContent.mTapDetector.init();
+                }
             }
         }
     }
@@ -7452,6 +7477,7 @@
         public static final int RESIZE_TASK = 44;
 
         public static final int TWO_FINGER_SCROLL_START = 45;
+        public static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = 46;
 
         /**
          * Used to denote that an integer field in a message will not be used.
@@ -8024,6 +8050,17 @@
                     }
                 }
                 break;
+                case SHOW_NON_RESIZEABLE_DOCK_TOAST: {
+                    final Toast toast = Toast.makeText(mContext,
+                            mContext.getString(R.string.dock_non_resizeble_text),
+                            Toast.LENGTH_LONG);
+                    final int gravity = toast.getGravity();
+                    final int xOffset = toast.getXOffset() + msg.arg1;
+                    final int yOffset = toast.getYOffset() + msg.arg2;
+                    toast.setGravity(gravity, xOffset, yOffset);
+                    toast.show();
+                }
+                break;
             }
             if (DEBUG_WINDOW_TRACE) {
                 Slog.v(TAG, "handleMessage: exit");
@@ -9104,8 +9141,9 @@
                         if (wtoken == token) {
                             break;
                         }
-                        if (mFocusedApp == token) {
-                            // Whoops, we are below the focused app...  no focus for you!
+                        if (mFocusedApp == token && token.stackCanReceiveKeys()) {
+                            // Whoops, we are below the focused app whose stack can receive keys...
+                            // No focus for you!!!
                             if (localLOGV || DEBUG_FOCUS_LIGHT) Slog.v(TAG,
                                     "findFocusedWindow: Reached focused app=" + mFocusedApp);
                             return null;
@@ -10157,7 +10195,7 @@
     public void setReplacingWindow(IBinder token, boolean animate) {
         synchronized (mWindowMap) {
             AppWindowToken appWindowToken = findAppWindowToken(token);
-            if (appWindowToken == null) {
+            if (appWindowToken == null || !appWindowToken.isVisible()) {
                 Slog.w(TAG, "Attempted to set replacing window on non-existing app token " + token);
                 return;
             }
@@ -10211,6 +10249,29 @@
         mDestroySurface.add(win);
     }
 
+    @Override
+    public void registerDockDividerVisibilityListener(IDockDividerVisibilityListener listener) {
+        if (!checkCallingPermission(android.Manifest.permission.REGISTER_WINDOW_MANAGER_LISTENERS,
+                "registerDockDividerVisibilityListener()")) {
+            return;
+        }
+        // TODO(multi-display): The listener is registered on the default display only.
+        final DockedStackDividerController controller =
+                getDefaultDisplayContentLocked().getDockedDividerController();
+        controller.registerDockDividerVisibilityListener(listener);
+        try {
+            listener.asBinder().linkToDeath(new IBinder.DeathRecipient() {
+                @Override
+                public void binderDied() {
+                    getDefaultDisplayContentLocked().getDockedDividerController()
+                            .registerDockDividerVisibilityListener(null);
+                }
+            }, 0);
+        } catch (RemoteException e) {
+            controller.registerDockDividerVisibilityListener(null);
+        }
+    }
+
     private final class LocalService extends WindowManagerInternal {
         @Override
         public void requestTraversalFromDisplayManager() {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 064b412..5e38492 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -56,6 +56,7 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 
+import static android.app.ActivityManager.StackId;
 import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
 import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT;
 import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME;
@@ -71,6 +72,7 @@
 import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
 import static android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
 import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.MATCH_PARENT;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
 import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
@@ -617,39 +619,6 @@
         final int pw = mContainingFrame.width();
         final int ph = mContainingFrame.height();
 
-        int w,h;
-        if ((mAttrs.flags & FLAG_SCALED) != 0) {
-            if (mAttrs.width < 0) {
-                w = pw;
-            } else if (mEnforceSizeCompat) {
-                w = (int)(mAttrs.width * mGlobalScale + .5f);
-            } else {
-                w = mAttrs.width;
-            }
-            if (mAttrs.height < 0) {
-                h = ph;
-            } else if (mEnforceSizeCompat) {
-                h = (int)(mAttrs.height * mGlobalScale + .5f);
-            } else {
-                h = mAttrs.height;
-            }
-        } else {
-            if (mAttrs.width == WindowManager.LayoutParams.MATCH_PARENT) {
-                w = pw;
-            } else if (mEnforceSizeCompat) {
-                w = (int)(mRequestedWidth * mGlobalScale + .5f);
-            } else {
-                w = mRequestedWidth;
-            }
-            if (mAttrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
-                h = ph;
-            } else if (mEnforceSizeCompat) {
-                h = (int)(mRequestedHeight * mGlobalScale + .5f);
-            } else {
-                h = mRequestedHeight;
-            }
-        }
-
         if (!mParentFrame.equals(pf)) {
             //Slog.i(TAG, "Window " + this + " content frame from " + mParentFrame
             //        + " to " + pf);
@@ -675,28 +644,7 @@
         final int fw = mFrame.width();
         final int fh = mFrame.height();
 
-        float x, y;
-        if (mEnforceSizeCompat) {
-            x = mAttrs.x * mGlobalScale;
-            y = mAttrs.y * mGlobalScale;
-        } else {
-            x = mAttrs.x;
-            y = mAttrs.y;
-        }
-
-        if (nonFullscreenTask) {
-            // Make sure window fits in containing frame since it is in a non-fullscreen stack as
-            // required by {@link Gravity#apply} call.
-            w = Math.min(w, pw);
-            h = Math.min(h, ph);
-        }
-
-        Gravity.apply(mAttrs.gravity, w, h, mContainingFrame,
-                (int) (x + mAttrs.horizontalMargin * pw),
-                (int) (y + mAttrs.verticalMargin * ph), mFrame);
-
-        // Now make sure the window fits in the overall display frame.
-        Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame);
+        applyGravityAndUpdateFrame();
 
         // Calculate the outsets before the content frame gets shrinked to the window frame.
         if (hasOutsets) {
@@ -730,7 +678,7 @@
             mVisibleFrame.set(mContentFrame);
             mStableFrame.set(mContentFrame);
         } else if (mAttrs.type == TYPE_DOCK_DIVIDER) {
-            if (isVisibleLw()) {
+            if (isVisibleLw() || mWinAnimator.isAnimating()) {
                 // We don't adjust the dock divider frame for reasons other than performance. The
                 // real reason is that if it gets adjusted before it is shown for the first time,
                 // it would get size (0, 0). This causes a problem when we finally show the dock
@@ -1564,13 +1512,17 @@
         }
     }
 
-    /**
-     * @return true if this window desires key events.
-     */
-    public final boolean canReceiveKeys() {
+    /** @return true if this window desires key events. */
+    boolean canReceiveKeys() {
         return isVisibleOrAdding()
                 && (mViewVisibility == View.VISIBLE)
-                && ((mAttrs.flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0);
+                && ((mAttrs.flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0)
+                && stackCanReceiveKeys();
+    }
+
+    boolean stackCanReceiveKeys() {
+        final TaskStack stack = getStack();
+        return stack != null && StackId.canReceiveKeys(stack.mStackId);
     }
 
     @Override
@@ -2224,4 +2176,69 @@
             rect.bottom = rect.top + (int)((rect.bottom - rect.top) / mVScale);
         }
     }
+
+    void applyGravityAndUpdateFrame() {
+        final int pw = mContainingFrame.width();
+        final int ph = mContainingFrame.height();
+        final Task task = getTask();
+        final boolean nonFullscreenTask = task != null && !task.isFullscreen();
+
+        float x, y;
+        int w,h;
+
+        if ((mAttrs.flags & FLAG_SCALED) != 0) {
+            if (mAttrs.width < 0) {
+                w = pw;
+            } else if (mEnforceSizeCompat) {
+                w = (int)(mAttrs.width * mGlobalScale + .5f);
+            } else {
+                w = mAttrs.width;
+            }
+            if (mAttrs.height < 0) {
+                h = ph;
+            } else if (mEnforceSizeCompat) {
+                h = (int)(mAttrs.height * mGlobalScale + .5f);
+            } else {
+                h = mAttrs.height;
+            }
+        } else {
+            if (mAttrs.width == MATCH_PARENT) {
+                w = pw;
+            } else if (mEnforceSizeCompat) {
+                w = (int)(mRequestedWidth * mGlobalScale + .5f);
+            } else {
+                w = mRequestedWidth;
+            }
+            if (mAttrs.height == MATCH_PARENT) {
+                h = ph;
+            } else if (mEnforceSizeCompat) {
+                h = (int)(mRequestedHeight * mGlobalScale + .5f);
+            } else {
+                h = mRequestedHeight;
+            }
+        }
+
+        if (mEnforceSizeCompat) {
+            x = mAttrs.x * mGlobalScale;
+            y = mAttrs.y * mGlobalScale;
+        } else {
+            x = mAttrs.x;
+            y = mAttrs.y;
+        }
+
+        if (nonFullscreenTask) {
+            // Make sure window fits in containing frame since it is in a non-fullscreen stack as
+            // required by {@link Gravity#apply} call.
+            w = Math.min(w, pw);
+            h = Math.min(h, ph);
+        }
+
+        // Set mFrame
+        Gravity.apply(mAttrs.gravity, w, h, mContainingFrame,
+                (int) (x + mAttrs.horizontalMargin * pw),
+                (int) (y + mAttrs.verticalMargin * ph), mFrame);
+
+        // Now make sure the window fits in the overall display frame.
+        Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame);
+    }
 }
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 93c2ff6..132b1b6 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1474,6 +1474,11 @@
                 }
                 mWin.mAppToken.updateReportedVisibilityLocked();
             }
+
+            final Task task = mWin.getTask();
+            if (task != null) {
+                task.scheduleShowNonResizeableDockToastIfNeeded();
+            }
             return true;
         }
         return false;
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index b5654ee..9c9a5da 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -205,6 +205,7 @@
     void setInteractive(bool interactive);
     void reloadCalibration();
     void setPointerIconShape(int32_t iconId);
+    void reloadPointerIcons();
 
     /* --- InputReaderPolicyInterface implementation --- */
 
@@ -242,6 +243,7 @@
 
     /* --- PointerControllerPolicyInterface implementation --- */
 
+    virtual void loadPointerIcon(SpriteIcon* icon);
     virtual void loadPointerResources(PointerResources* outResources);
     virtual void loadAdditionalMouseResources(std::map<int32_t, SpriteIcon>* outResources,
             std::map<int32_t, PointerAnimation>* outAnimationResources);
@@ -477,22 +479,6 @@
                 v.logicalBottom - v.logicalTop,
                 v.orientation);
 
-        JNIEnv* env = jniEnv();
-        jobject pointerIconObj = env->CallObjectMethod(mServiceObj,
-                gServiceClassInfo.getPointerIcon);
-        if (!checkAndClearExceptionFromCallback(env, "getPointerIcon")) {
-            PointerIcon pointerIcon;
-            status_t status = android_view_PointerIcon_load(env, pointerIconObj,
-                    mContextObj, &pointerIcon);
-            if (!status && !pointerIcon.isNullIcon()) {
-                controller->setPointerIcon(SpriteIcon(pointerIcon.bitmap,
-                        pointerIcon.hotSpotX, pointerIcon.hotSpotY));
-            } else {
-                controller->setPointerIcon(SpriteIcon());
-            }
-            env->DeleteLocalRef(pointerIconObj);
-        }
-
         updateInactivityTimeoutLocked(controller);
     }
     return controller;
@@ -789,12 +775,19 @@
 }
 
 void NativeInputManager::setPointerIconShape(int32_t iconId) {
-  AutoMutex _l(mLock);
-  sp<PointerController> controller = mLocked.pointerController.promote();
-  if (controller != NULL) {
-        // Use 0 (the default icon) for ARROW.
+    AutoMutex _l(mLock);
+    sp<PointerController> controller = mLocked.pointerController.promote();
+    if (controller != NULL) {
         controller->updatePointerShape(iconId);
-  }
+    }
+}
+
+void NativeInputManager::reloadPointerIcons() {
+    AutoMutex _l(mLock);
+    sp<PointerController> controller = mLocked.pointerController.promote();
+    if (controller != NULL) {
+        controller->reloadPointerResources();
+    }
 }
 
 TouchAffineTransformation NativeInputManager::getTouchAffineTransformation(
@@ -1036,6 +1029,25 @@
     return result;
 }
 
+void NativeInputManager::loadPointerIcon(SpriteIcon* icon) {
+    JNIEnv* env = jniEnv();
+
+    ScopedLocalRef<jobject> pointerIconObj(env, env->CallObjectMethod(
+            mServiceObj, gServiceClassInfo.getPointerIcon));
+    if (checkAndClearExceptionFromCallback(env, "getPointerIcon")) {
+        return;
+    }
+
+    PointerIcon pointerIcon;
+    status_t status = android_view_PointerIcon_load(env, pointerIconObj.get(),
+                                                    mContextObj, &pointerIcon);
+    if (!status && !pointerIcon.isNullIcon()) {
+        *icon = SpriteIcon(pointerIcon.bitmap, pointerIcon.hotSpotX, pointerIcon.hotSpotY);
+    } else {
+        *icon = SpriteIcon();
+    }
+}
+
 void NativeInputManager::loadPointerResources(PointerResources* outResources) {
     JNIEnv* env = jniEnv();
 
@@ -1420,6 +1432,11 @@
     im->setPointerIconShape(iconId);
 }
 
+static void nativeReloadPointerIcons(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
+    NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr);
+    im->reloadPointerIcons();
+}
+
 // ----------------------------------------------------------------------------
 
 static const JNINativeMethod gInputManagerMethods[] = {
@@ -1480,6 +1497,8 @@
             (void*) nativeMonitor },
     { "nativeSetPointerIconShape", "(JI)V",
             (void*) nativeSetPointerIconShape },
+    { "nativeReloadPointerIcons", "(J)V",
+            (void*) nativeReloadPointerIcons },
 };
 
 #define FIND_CLASS(var, className) \
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 47951de..f2e89b1 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3095,12 +3095,7 @@
         enforceCrossUserPermission(userHandle);
 
         synchronized (this) {
-
-            // The active password is stored in the user that runs the launcher
-            // If the user this is called from is part of a profile group, that is the parent
-            // of the group.
-            UserInfo parent = getProfileParent(userHandle);
-            int id = (parent == null) ? userHandle : parent.id;
+            int id = getCredentialOwner(userHandle);
             DevicePolicyData policy = getUserDataUnchecked(id);
 
             // This API can only be called by an active device admin,
@@ -3130,10 +3125,8 @@
             getActiveAdminForCallerLocked(null,
                     DeviceAdminInfo.USES_POLICY_WATCH_LOGIN);
 
-            // The active password is stored in the parent.
-            UserInfo parent = getProfileParent(userHandle);
-            int id = (parent == null) ? userHandle : parent.id;
-            DevicePolicyData policy = getUserDataUnchecked(id);
+            int credentialOwnerId = getCredentialOwner(userHandle);
+            DevicePolicyData policy = getUserDataUnchecked(credentialOwnerId);
 
             return policy.mFailedPasswordAttempts;
         }
@@ -3224,7 +3217,7 @@
 
         long ident = mInjector.binderClearCallingIdentity();
         try {
-            if (mUserManager.getCredentialOwnerProfile(userHandle) != userHandle) {
+            if (getCredentialOwner(userHandle) != userHandle) {
                 throw new SecurityException("You can not change password for this profile because"
                     + " it shares the password with the owner profile");
             }
@@ -3855,10 +3848,7 @@
         synchronized (this) {
             ActiveAdmin admin = getActiveAdminUncheckedLocked(comp, userHandle);
             if (admin == null) {
-                try {
-                    result.sendResult(null);
-                } catch (RemoteException e) {
-                }
+                result.sendResult(null);
                 return;
             }
             Intent intent = new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_DISABLE_REQUESTED);
@@ -3868,10 +3858,7 @@
                     null, new BroadcastReceiver() {
                 @Override
                 public void onReceive(Context context, Intent intent) {
-                    try {
-                        result.sendResult(getResultExtras(false));
-                    } catch (RemoteException e) {
-                    }
+                    result.sendResult(getResultExtras(false));
                 }
             }, null, Activity.RESULT_OK, null, null);
         }
@@ -3885,45 +3872,37 @@
         }
         enforceCrossUserPermission(userHandle);
         // Managed Profile password can only be changed when per user encryption is present.
-        if (!StorageManager.isFileBasedEncryptionEnabled()) {
+        if (!LockPatternUtils.isSeparateWorkChallengeEnabled()) {
             enforceNotManagedProfile(userHandle, "set the active password");
         }
 
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.BIND_DEVICE_ADMIN, null);
-        DevicePolicyData p = getUserData(userHandle);
-
         validateQualityConstant(quality);
 
-        synchronized (this) {
-            if (p.mActivePasswordQuality != quality || p.mActivePasswordLength != length
-                    || p.mFailedPasswordAttempts != 0 || p.mActivePasswordLetters != letters
-                    || p.mActivePasswordUpperCase != uppercase
-                    || p.mActivePasswordLowerCase != lowercase
-                    || p.mActivePasswordNumeric != numbers
-                    || p.mActivePasswordSymbols != symbols
-                    || p.mActivePasswordNonLetter != nonletter) {
-                long ident = mInjector.binderClearCallingIdentity();
-                try {
-                    p.mActivePasswordQuality = quality;
-                    p.mActivePasswordLength = length;
-                    p.mActivePasswordLetters = letters;
-                    p.mActivePasswordLowerCase = lowercase;
-                    p.mActivePasswordUpperCase = uppercase;
-                    p.mActivePasswordNumeric = numbers;
-                    p.mActivePasswordSymbols = symbols;
-                    p.mActivePasswordNonLetter = nonletter;
-                    p.mFailedPasswordAttempts = 0;
-                    saveSettingsLocked(userHandle);
-                    updatePasswordExpirationsLocked(userHandle);
-                    setExpirationAlarmCheckLocked(mContext, p);
-                    sendAdminCommandToSelfAndProfilesLocked(
-                            DeviceAdminReceiver.ACTION_PASSWORD_CHANGED,
-                            DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle);
-                } finally {
-                    mInjector.binderRestoreCallingIdentity(ident);
-                }
+        DevicePolicyData policy = getUserData(userHandle);
+
+        long ident = mInjector.binderClearCallingIdentity();
+        try {
+            synchronized (this) {
+                policy.mActivePasswordQuality = quality;
+                policy.mActivePasswordLength = length;
+                policy.mActivePasswordLetters = letters;
+                policy.mActivePasswordLowerCase = lowercase;
+                policy.mActivePasswordUpperCase = uppercase;
+                policy.mActivePasswordNumeric = numbers;
+                policy.mActivePasswordSymbols = symbols;
+                policy.mActivePasswordNonLetter = nonletter;
+                policy.mFailedPasswordAttempts = 0;
+                saveSettingsLocked(userHandle);
+                updatePasswordExpirationsLocked(userHandle);
+                setExpirationAlarmCheckLocked(mContext, policy);
+                sendAdminCommandToSelfAndProfilesLocked(
+                        DeviceAdminReceiver.ACTION_PASSWORD_CHANGED,
+                        DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle);
             }
+        } finally {
+            mInjector.binderRestoreCallingIdentity(ident);
         }
     }
 
@@ -4504,11 +4483,11 @@
 
                 UserInfo user = mUserManager.getUserInfo(userHandle);
                 final List<UserInfo> profiles;
-                if (user.isManagedProfile()) {
-                    // If we are being asked about a managed profile just return
-                    // keyguard features disabled by admins in the profile.
-                    profiles = new ArrayList<UserInfo>(1);
-                    profiles.add(user);
+                if (user.isManagedProfile() || LockPatternUtils.isSeparateWorkChallengeEnabled()) {
+                    // If we are being asked about a managed profile or the main user profile has a
+                    // separate lock from the work profile, just return keyguard features disabled
+                    // by admins in the profile.
+                    profiles = Collections.singletonList(user);
                 } else {
                     // Otherwise return those set by admins in the user
                     // and its profiles.
@@ -5071,10 +5050,10 @@
         }
     }
 
-    private UserInfo getProfileParent(int userHandle) {
+    private int getCredentialOwner(int userHandle) {
         long ident = mInjector.binderClearCallingIdentity();
         try {
-            return mUserManager.getProfileParent(userHandle);
+            return mUserManager.getCredentialOwnerProfile(userHandle);
         } finally {
             mInjector.binderRestoreCallingIdentity(ident);
         }
@@ -6823,6 +6802,9 @@
     public boolean isProvisioningAllowed(String action) {
         final int callingUserId = mInjector.userHandleGetCallingUserId();
         if (DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE.equals(action)) {
+            if (!hasFeatureManagedUsers()) {
+                return false;
+            }
             synchronized (this) {
                 if (mOwners.hasDeviceOwner()) {
                     if (!mInjector.userManagerIsSplitSystemUser()) {
@@ -6845,13 +6827,6 @@
                 // Managed user cannot have a managed profile.
                 return false;
             }
-            try {
-                if (!mIPackageManager.hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS)) {
-                    return false;
-                }
-            } catch (RemoteException e) {
-                return false;
-            }
             final long ident = mInjector.binderClearCallingIdentity();
             try {
                 if (!mUserManager.canAddMoreManagedProfiles(callingUserId, true)) {
@@ -6864,10 +6839,17 @@
         } else if (DevicePolicyManager.ACTION_PROVISION_MANAGED_DEVICE.equals(action)) {
             return isDeviceOwnerProvisioningAllowed(callingUserId);
         } else if (DevicePolicyManager.ACTION_PROVISION_MANAGED_USER.equals(action)) {
+            if (!hasFeatureManagedUsers()) {
+                return false;
+            }
             if (!mInjector.userManagerIsSplitSystemUser()) {
                 // ACTION_PROVISION_MANAGED_USER only supported on split-user systems.
                 return false;
             }
+            if (callingUserId == UserHandle.USER_SYSTEM) {
+                // System user cannot be a managed user.
+                return false;
+            }
             if (hasUserSetupCompleted(callingUserId)) {
                 return false;
             }
@@ -6901,6 +6883,14 @@
         return true;
     }
 
+    private boolean hasFeatureManagedUsers() {
+        try {
+            return mIPackageManager.hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS);
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
     @Override
     public String getWifiMacAddress() {
         // Make sure caller has DO.
diff --git a/services/print/java/com/android/server/print/RemotePrintService.java b/services/print/java/com/android/server/print/RemotePrintService.java
index 0ab1657..77a47f8 100644
--- a/services/print/java/com/android/server/print/RemotePrintService.java
+++ b/services/print/java/com/android/server/print/RemotePrintService.java
@@ -16,6 +16,9 @@
 
 package com.android.server.print;
 
+import android.annotation.FloatRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -757,6 +760,33 @@
         }
 
         @Override
+        public void setProgress(@NonNull PrintJobId printJobId,
+                @FloatRange(from=0.0, to=1.0) float progress) {
+            RemotePrintService service = mWeakService.get();
+            if (service != null) {
+                final long identity = Binder.clearCallingIdentity();
+                try {
+                    service.mSpooler.setProgress(printJobId, progress);
+                } finally {
+                    Binder.restoreCallingIdentity(identity);
+                }
+            }
+        }
+
+        @Override
+        public void setStatus(@NonNull PrintJobId printJobId, @Nullable CharSequence status) {
+            RemotePrintService service = mWeakService.get();
+            if (service != null) {
+                final long identity = Binder.clearCallingIdentity();
+                try {
+                    service.mSpooler.setStatus(printJobId, status);
+                } finally {
+                    Binder.restoreCallingIdentity(identity);
+                }
+            }
+        }
+
+        @Override
         @SuppressWarnings({"rawtypes", "unchecked"})
         public void onPrintersAdded(ParceledListSlice printers) {
             RemotePrintService service = mWeakService.get();
diff --git a/services/print/java/com/android/server/print/RemotePrintSpooler.java b/services/print/java/com/android/server/print/RemotePrintSpooler.java
index e5370f4..c506b6f 100644
--- a/services/print/java/com/android/server/print/RemotePrintSpooler.java
+++ b/services/print/java/com/android/server/print/RemotePrintSpooler.java
@@ -16,6 +16,9 @@
 
 package com.android.server.print;
 
+import android.annotation.FloatRange;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -229,6 +232,61 @@
         return false;
     }
 
+    /**
+     * Set progress of a print job.
+     *
+     * @param printJobId The print job to update
+     * @param progress The new progress
+     */
+    public final void setProgress(@NonNull PrintJobId printJobId,
+            @FloatRange(from=0.0, to=1.0) float progress) {
+        throwIfCalledOnMainThread();
+        synchronized (mLock) {
+            throwIfDestroyedLocked();
+            mCanUnbind = false;
+        }
+        try {
+            getRemoteInstanceLazy().setProgress(printJobId, progress);
+        } catch (RemoteException|TimeoutException re) {
+            Slog.e(LOG_TAG, "Error setting progress.", re);
+        } finally {
+            if (DEBUG) {
+                Slog.i(LOG_TAG, "[user: " + mUserHandle.getIdentifier() + "] setProgress()");
+            }
+            synchronized (mLock) {
+                mCanUnbind = true;
+                mLock.notifyAll();
+            }
+        }
+    }
+
+    /**
+     * Set status of a print job.
+     *
+     * @param printJobId The print job to update
+     * @param status The new status
+     */
+    public final void setStatus(@NonNull PrintJobId printJobId, @Nullable CharSequence status) {
+        throwIfCalledOnMainThread();
+        synchronized (mLock) {
+            throwIfDestroyedLocked();
+            mCanUnbind = false;
+        }
+        try {
+            getRemoteInstanceLazy().setStatus(printJobId, status);
+        } catch (RemoteException|TimeoutException re) {
+            Slog.e(LOG_TAG, "Error setting status.", re);
+        } finally {
+            if (DEBUG) {
+                Slog.i(LOG_TAG, "[user: " + mUserHandle.getIdentifier() + "] setStatus()");
+            }
+            synchronized (mLock) {
+                mCanUnbind = true;
+                mLock.notifyAll();
+            }
+        }
+    }
+
     public final boolean setPrintJobTag(PrintJobId printJobId, String tag) {
         throwIfCalledOnMainThread();
         synchronized (mLock) {
diff --git a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
index 97e16da..27deb72 100644
--- a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
@@ -591,6 +591,12 @@
     public void setUp() throws Exception {
         super.setUp();
 
+        // InstrumentationTestRunner prepares a looper, but AndroidJUnitRunner does not.
+        // http://b/25897652 .
+        if (Looper.myLooper() == null) {
+            Looper.prepare();
+        }
+
         mServiceContext = new MockContext(getContext());
         mService = new WrappedConnectivityService(mServiceContext,
                 mock(INetworkManagementService.class),
diff --git a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
index 0b73beb..312b1b0 100644
--- a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
+++ b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
@@ -183,6 +183,28 @@
     }
 
     /**
+     * Test that non persisted job is not written to disk.
+     */
+    public void testNonPersistedTaskIsNotPersisted() throws Exception {
+        JobInfo.Builder b = new Builder(42, mComponent)
+                .setOverrideDeadline(10000)
+                .setPersisted(false);
+        JobStatus jsNonPersisted = new JobStatus(b.build(), SOME_UID);
+        mTaskStoreUnderTest.add(jsNonPersisted);
+        b = new Builder(43, mComponent)
+                .setOverrideDeadline(10000)
+                .setPersisted(true);
+        JobStatus jsPersisted = new JobStatus(b.build(), SOME_UID);
+        mTaskStoreUnderTest.add(jsPersisted);
+        Thread.sleep(IO_WAIT);
+        final ArraySet<JobStatus> jobStatusSet = new ArraySet<JobStatus>();
+        mTaskStoreUnderTest.readJobMapFromDisk(jobStatusSet);
+        assertEquals("Job count is incorrect.", 1, jobStatusSet.size());
+        JobStatus jobStatus = jobStatusSet.iterator().next();
+        assertEquals("Wrong job persisted.", 43, jobStatus.getJobId());
+    }
+
+    /**
      * Helper function to throw an error if the provided task and TaskStatus objects are not equal.
      */
     private void assertTasksEqual(JobInfo first, JobInfo second) {
diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
index 66c7dbb..b4bca3e 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
@@ -31,7 +31,8 @@
 
 /** Test {@link UserManager} functionality. */
 public class UserManagerTest extends AndroidTestCase {
-
+    private static final int REMOVE_CHECK_INTERVAL = 500;
+    private static final int REMOVE_TIMEOUT = 60 * 1000;
     private UserManager mUserManager = null;
     private final Object mUserLock = new Object();
     private List<Integer> usersToRemove;
@@ -227,10 +228,16 @@
     private void removeUser(int userId) {
         synchronized (mUserLock) {
             mUserManager.removeUser(userId);
+            long time = System.currentTimeMillis();
             while (mUserManager.getUserInfo(userId) != null) {
                 try {
-                    mUserLock.wait(500);
+                    mUserLock.wait(REMOVE_CHECK_INTERVAL);
                 } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
+                    return;
+                }
+                if (System.currentTimeMillis() - time > REMOVE_TIMEOUT) {
+                    fail("Timeout waiting for removeUser. userId = " + userId);
                 }
             }
         }
diff --git a/services/usb/java/com/android/server/usb/UsbSettingsManager.java b/services/usb/java/com/android/server/usb/UsbSettingsManager.java
index 154cbd3..4786d11 100644
--- a/services/usb/java/com/android/server/usb/UsbSettingsManager.java
+++ b/services/usb/java/com/android/server/usb/UsbSettingsManager.java
@@ -984,7 +984,14 @@
     public boolean hasPermission(UsbDevice device) {
         synchronized (mLock) {
             int uid = Binder.getCallingUid();
-            if (uid == Process.SYSTEM_UID || mDisablePermissionDialogs) {
+            int androidMediaUid;
+            try {
+                androidMediaUid = mPackageManager.getApplicationInfo("com.android.mtp", 0).uid;
+            } catch (NameNotFoundException e) {
+                androidMediaUid = -1;
+            }
+            if (uid == Process.SYSTEM_UID || UserHandle.getAppId(uid) == androidMediaUid ||
+                    mDisablePermissionDialogs) {
                 return true;
             }
             SparseBooleanArray uidList = mDevicePermissionMap.get(device.getDeviceName());
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 4115756..17bd08c 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -1805,6 +1805,13 @@
     public void onReject(String replyMessage) {}
 
     /**
+     * Notifies the Connection of a request to silence the ringer.
+     *
+     * @hide
+     */
+    public void onSilence() {}
+
+    /**
      * Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.
      */
     public void onPostDialContinue(boolean proceed) {}
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 6223495..b4a7ce0 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -102,6 +102,7 @@
     private static final int MSG_MERGE_CONFERENCE = 18;
     private static final int MSG_SWAP_CONFERENCE = 19;
     private static final int MSG_REJECT_WITH_MESSAGE = 20;
+    private static final int MSG_SILENCE = 21;
 
     private static Connection sNullConnection;
 
@@ -177,6 +178,11 @@
         }
 
         @Override
+        public void silence(String callId) {
+            mHandler.obtainMessage(MSG_SILENCE, callId).sendToTarget();
+        }
+
+        @Override
         public void disconnect(String callId) {
             mHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget();
         }
@@ -319,6 +325,9 @@
                 case MSG_DISCONNECT:
                     disconnect((String) msg.obj);
                     break;
+                case MSG_SILENCE:
+                    silence((String) msg.obj);
+                    break;
                 case MSG_HOLD:
                     hold((String) msg.obj);
                     break;
@@ -708,6 +717,11 @@
         findConnectionForAction(callId, "reject").onReject(rejectWithMessage);
     }
 
+    private void silence(String callId) {
+        Log.d(this, "silence %s", callId);
+        findConnectionForAction(callId, "silence").onSilence();
+    }
+
     private void disconnect(String callId) {
         Log.d(this, "disconnect %s", callId);
         if (mConnectionById.containsKey(callId)) {
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index 19c613d..5087080 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -48,13 +48,13 @@
  * {@code InCallService} implementation intends to replace the built-in in-call UI.
  * <pre>
  * {@code
- * &lt;service android:name="your.package.YourInCallServiceImplementation"
- *          android:permission="android.permission.BIND_IN_CALL_SERVICE"&gt;
- *      &lt;meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="true" /&gt;
- *      &lt;intent-filter&gt;
- *          &lt;action android:name="android.telecom.InCallService"/&gt;
- *      &lt;/intent-filter&gt;
- * &lt;/service&gt;
+ * <service android:name="your.package.YourInCallServiceImplementation"
+ *          android:permission="android.permission.BIND_IN_CALL_SERVICE">
+ *      <meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="true" />
+ *      <intent-filter>
+ *          <action android:name="android.telecom.InCallService"/>
+ *      </intent-filter>
+ * </service>
  * }
  * </pre>
  */
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
index dd253cf..8a54add 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
@@ -54,6 +54,8 @@
 
     void disconnect(String callId);
 
+    void silence(String callId);
+
     void hold(String callId);
 
     void unhold(String callId);
diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java
index f9a222f..5bcaa6e 100644
--- a/telephony/java/android/telephony/CellLocation.java
+++ b/telephony/java/android/telephony/CellLocation.java
@@ -81,6 +81,12 @@
     public abstract boolean isEmpty();
 
     /**
+     * Invalidate this object.  The location area code and the cell id are set to -1.
+     * @hide
+     */
+    public abstract void setStateInvalid();
+
+    /**
      * Return a new CellLocation object representing an unknown
      * location, or null for unknown/none phone radio types.
      *
diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
index 6cfae6a..7c10569 100644
--- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java
+++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
@@ -123,6 +123,7 @@
     /**
      * Invalidate this object.  The cell location data is set to invalid values.
      */
+    @Override
     public void setStateInvalid() {
         this.mBaseStationId = -1;
         this.mBaseStationLatitude = INVALID_LAT_LONG;
@@ -134,7 +135,7 @@
     /**
      * Set the cell location data.
      */
-     public void setCellLocationData(int baseStationId, int baseStationLatitude,
+    public void setCellLocationData(int baseStationId, int baseStationLatitude,
          int baseStationLongitude) {
          // The following values have to be written in the correct sequence
          this.mBaseStationId = baseStationId;
diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java
index a3889b2..1717802 100644
--- a/telephony/java/android/telephony/gsm/GsmCellLocation.java
+++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java
@@ -72,6 +72,7 @@
     /**
      * Invalidate this object.  The location area code and the cell id are set to -1.
      */
+    @Override
     public void setStateInvalid() {
         mLac = -1;
         mCid = -1;
diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java
index 4821678..c967c2b 100644
--- a/test-runner/src/android/test/mock/MockContext.java
+++ b/test-runner/src/android/test/mock/MockContext.java
@@ -147,6 +147,11 @@
     }
 
     @Override
+    public SharedPreferences getSharedPreferences(File file, int mode) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
     public FileInputStream openFileInput(String name) throws FileNotFoundException {
         throw new UnsupportedOperationException();
     }
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/MultiProducerActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MultiProducerActivity.java
index 7628c5c..63fa3f9 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/MultiProducerActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MultiProducerActivity.java
@@ -25,7 +25,7 @@
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.view.DisplayListCanvas;
-import android.view.HardwareRenderer;
+import android.view.ThreadedRenderer;
 import android.view.RenderNode;
 import android.view.ThreadedRenderer;
 import android.view.View;
@@ -120,7 +120,7 @@
             if (view == null) {
                 view.postDelayed(mSetup, 50);
             }
-            HardwareRenderer renderer = view.getHardwareRenderer();
+            ThreadedRenderer renderer = view.getHardwareRenderer();
             if (renderer == null || view.getWidth() == 0) {
                 view.postDelayed(mSetup, 50);
             }
diff --git a/tests/NetworkSecurityConfigTest/res/xml/override_dedup.xml b/tests/NetworkSecurityConfigTest/res/xml/override_dedup.xml
new file mode 100644
index 0000000..5ba5675
--- /dev/null
+++ b/tests/NetworkSecurityConfigTest/res/xml/override_dedup.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<network-security-config>
+  <!-- Entry with a bad pin. Connections to this will only succeed if overridePins is set. -->
+  <domain-config>
+    <domain>android.com</domain>
+    <pin-set>
+      <pin digest="SHA-256">aaaaaaaaIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=</pin>
+    </pin-set>
+    <trust-anchors>
+      <certificates src="system" overridePins="false" />
+    </trust-anchors>
+  </domain-config>
+  <!-- override that contains all of the system CA store. This should completely override the
+       anchors in the domain config-above with ones that have overridePins set. -->
+  <debug-overrides>
+    <trust-anchors>
+      <certificates src="system" />
+    </trust-anchors>
+  </debug-overrides>
+</network-security-config>
diff --git a/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java b/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java
index 92eadc0..69b2a9d 100644
--- a/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java
+++ b/tests/NetworkSecurityConfigTest/src/android/security/net/config/TestCertificateSource.java
@@ -19,15 +19,29 @@
 import java.util.Set;
 import java.security.cert.X509Certificate;
 
+import com.android.org.conscrypt.TrustedCertificateIndex;
+
 /** @hide */
 public class TestCertificateSource implements CertificateSource {
 
     private final Set<X509Certificate> mCertificates;
+    private final TrustedCertificateIndex mIndex = new TrustedCertificateIndex();
     public TestCertificateSource(Set<X509Certificate> certificates) {
         mCertificates = certificates;
+        for (X509Certificate cert : certificates) {
+            mIndex.index(cert);
+        }
     }
 
     public Set<X509Certificate> getCertificates() {
             return mCertificates;
     }
+
+    public X509Certificate findBySubjectAndPublicKey(X509Certificate cert) {
+        java.security.cert.TrustAnchor anchor = mIndex.findBySubjectAndPublicKey(cert);
+        if (anchor == null) {
+            return null;
+        }
+        return anchor.getTrustedCert();
+    }
 }
diff --git a/tests/NetworkSecurityConfigTest/src/android/security/net/config/XmlConfigTests.java b/tests/NetworkSecurityConfigTest/src/android/security/net/config/XmlConfigTests.java
index c6f3680..998bb68 100644
--- a/tests/NetworkSecurityConfigTest/src/android/security/net/config/XmlConfigTests.java
+++ b/tests/NetworkSecurityConfigTest/src/android/security/net/config/XmlConfigTests.java
@@ -402,4 +402,22 @@
         context.init(null, tms, null);
         TestUtils.assertConnectionSucceeds(context, "android.com" , 443);
     }
+
+    public void testDebugDedup() throws Exception {
+        XmlConfigSource source = new XmlConfigSource(getContext(), R.xml.override_dedup, true);
+        ApplicationConfig appConfig = new ApplicationConfig(source);
+        assertTrue(appConfig.hasPerDomainConfigs());
+        // Check android.com.
+        NetworkSecurityConfig config = appConfig.getConfigForHostname("android.com");
+        PinSet pinSet = config.getPins();
+        assertFalse(pinSet.pins.isEmpty());
+        // Check that all TrustAnchors come from the override pins debug source.
+        for (TrustAnchor anchor : config.getTrustAnchors()) {
+            assertTrue(anchor.overridesPins);
+        }
+        // Try connections.
+        SSLContext context = TestUtils.getSSLContext(source);
+        TestUtils.assertConnectionSucceeds(context, "android.com", 443);
+        TestUtils.assertUrlConnectionSucceeds(context, "android.com", 443);
+    }
 }
diff --git a/tests/RenderThreadTest/src/com/example/renderthread/MainActivity.java b/tests/RenderThreadTest/src/com/example/renderthread/MainActivity.java
index fc5426c..ee4c834 100644
--- a/tests/RenderThreadTest/src/com/example/renderthread/MainActivity.java
+++ b/tests/RenderThreadTest/src/com/example/renderthread/MainActivity.java
@@ -6,7 +6,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.util.Log;
-import android.view.HardwareRenderer;
 import android.view.RenderNodeAnimator;
 import android.view.View;
 import android.widget.AdapterView;
diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
index a390b0c..3c2659f 100644
--- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java
@@ -22,11 +22,10 @@
 import android.os.ServiceManager;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.view.IWindowManager;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
 import junit.framework.TestCase;
 
+import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
+
 /**
  * TODO: Remove this. This is only a placeholder, need to implement this.
  */
@@ -104,7 +103,7 @@
         }
 
         try {
-            mWm.setAppTask(null, 0, null, null);
+            mWm.setAppTask(null, 0, INVALID_STACK_ID, null, null);
             fail("IWindowManager.setAppGroupId did not throw SecurityException as"
                     + " expected");
         } catch (SecurityException e) {
diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp
index cb244ec..641c34b 100644
--- a/tools/aapt/Package.cpp
+++ b/tools/aapt/Package.cpp
@@ -33,7 +33,7 @@
     ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
     ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
     ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
-    ".amr", ".awb", ".wma", ".wmv"
+    ".amr", ".awb", ".wma", ".wmv", ".webm"
 };
 
 /* fwd decls, so I can write this downward */
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index e22e76d..fb0fe38 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1537,12 +1537,20 @@
     std::queue<CompileResourceWorkItem>& workQueue = table.getWorkQueue();
     while (!workQueue.empty()) {
         CompileResourceWorkItem& workItem = workQueue.front();
-        err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.file, &table, xmlFlags);
+        int xmlCompilationFlags = xmlFlags | XML_COMPILE_PARSE_VALUES
+                | XML_COMPILE_ASSIGN_ATTRIBUTE_IDS;
+        if (!workItem.needsCompiling) {
+            xmlCompilationFlags &= ~XML_COMPILE_ASSIGN_ATTRIBUTE_IDS;
+            xmlCompilationFlags &= ~XML_COMPILE_PARSE_VALUES;
+        }
+        err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.xmlRoot,
+                             workItem.file, &table, xmlCompilationFlags);
+
         if (err == NO_ERROR) {
             assets->addResource(workItem.resPath.getPathLeaf(),
-                    workItem.resPath,
-                    workItem.file,
-                    workItem.file->getResourceType());
+                                workItem.resPath,
+                                workItem.file,
+                                workItem.file->getResourceType());
         } else {
             hasErrors = true;
         }
@@ -1737,9 +1745,7 @@
             manifestFile->getGroupEntry(),
             manifestFile->getResourceType());
     err = compileXmlFile(bundle, assets, String16(), manifestFile,
-            outManifestFile, &table,
-            XML_COMPILE_ASSIGN_ATTRIBUTE_IDS
-            | XML_COMPILE_STRIP_WHITESPACE | XML_COMPILE_STRIP_RAW_VALUES);
+            outManifestFile, &table, XML_COMPILE_STANDARD_RESOURCE & ~XML_COMPILE_STRIP_COMMENTS);
     if (err < NO_ERROR) {
         return err;
     }
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index d5a09d8..0e470d9 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -88,8 +88,11 @@
         root->setUTF8(true);
     }
 
-    bool hasErrors = false;
+    if (table->processBundleFormat(bundle, resourceName, target, root) != NO_ERROR) {
+        return UNKNOWN_ERROR;
+    }
     
+    bool hasErrors = false;
     if ((options&XML_COMPILE_ASSIGN_ATTRIBUTE_IDS) != 0) {
         status_t err = root->assignResourceIds(assets, table);
         if (err != NO_ERROR) {
@@ -97,9 +100,11 @@
         }
     }
 
-    status_t err = root->parseValues(assets, table);
-    if (err != NO_ERROR) {
-        hasErrors = true;
+    if ((options&XML_COMPILE_PARSE_VALUES) != 0) {
+        status_t err = root->parseValues(assets, table);
+        if (err != NO_ERROR) {
+            hasErrors = true;
+        }
     }
 
     if (hasErrors) {
@@ -114,7 +119,7 @@
         printf("Input XML Resource:\n");
         root->print();
     }
-    err = root->flatten(target,
+    status_t err = root->flatten(target,
             (options&XML_COMPILE_STRIP_COMMENTS) != 0,
             (options&XML_COMPILE_STRIP_RAW_VALUES) != 0);
     if (err != NO_ERROR) {
@@ -4755,9 +4760,9 @@
         newConfig.sdkVersion = sdkVersionToGenerate;
         sp<AaptFile> newFile = new AaptFile(target->getSourceFile(),
                 AaptGroupEntry(newConfig), target->getResourceType());
-        String8 resPath = String8::format("res/%s/%s",
+        String8 resPath = String8::format("res/%s/%s.xml",
                 newFile->getGroupEntry().toDirName(target->getResourceType()).string(),
-                target->getSourceFile().getPathLeaf().string());
+                String8(resourceName).string());
         resPath.convertToResPath();
 
         // Add a resource table entry.
@@ -4784,9 +4789,11 @@
         item.resourceName = resourceName;
         item.resPath = resPath;
         item.file = newFile;
+        item.xmlRoot = newRoot;
+        item.needsCompiling = false;    // This step occurs after we parse/assign, so we don't need
+                                        // to do it again.
         mWorkQueue.push(item);
     }
-
     return NO_ERROR;
 }
 
@@ -4825,3 +4832,226 @@
         }
     }
 }
+
+static String16 buildNamespace(const String16& package) {
+    return String16("http://schemas.android.com/apk/res/") + package;
+}
+
+static sp<XMLNode> findOnlyChildElement(const sp<XMLNode>& parent) {
+    const Vector<sp<XMLNode> >& children = parent->getChildren();
+    sp<XMLNode> onlyChild;
+    for (size_t i = 0; i < children.size(); i++) {
+        if (children[i]->getType() != XMLNode::TYPE_CDATA) {
+            if (onlyChild != NULL) {
+                return NULL;
+            }
+            onlyChild = children[i];
+        }
+    }
+    return onlyChild;
+}
+
+/**
+ * Detects use of the `bundle' format and extracts nested resources into their own top level
+ * resources. The bundle format looks like this:
+ *
+ * <!-- res/drawable/bundle.xml -->
+ * <animated-vector xmlns:aapt="http://schemas.android.com/aapt">
+ *   <aapt:attr name="android:drawable">
+ *     <vector android:width="60dp"
+ *             android:height="60dp">
+ *       <path android:name="v"
+ *             android:fillColor="#000000"
+ *             android:pathData="M300,70 l 0,-70 70,..." />
+ *     </vector>
+ *   </aapt:attr>
+ * </animated-vector>
+ *
+ * When AAPT sees the <aapt:attr> tag, it will extract its single element and its children
+ * into a new high-level resource, assigning it a name and ID. Then value of the `name`
+ * attribute must be a resource attribute. That resource attribute is inserted into the parent
+ * with the reference to the extracted resource as the value.
+ *
+ * <!-- res/drawable/bundle.xml -->
+ * <animated-vector android:drawable="@drawable/bundle_1.xml">
+ * </animated-vector>
+ *
+ * <!-- res/drawable/bundle_1.xml -->
+ * <vector android:width="60dp"
+ *         android:height="60dp">
+ *   <path android:name="v"
+ *         android:fillColor="#000000"
+ *         android:pathData="M300,70 l 0,-70 70,..." />
+ * </vector>
+ */
+status_t ResourceTable::processBundleFormat(const Bundle* bundle,
+                                            const String16& resourceName,
+                                            const sp<AaptFile>& target,
+                                            const sp<XMLNode>& root) {
+    Vector<sp<XMLNode> > namespaces;
+    if (root->getType() == XMLNode::TYPE_NAMESPACE) {
+        namespaces.push(root);
+    }
+    return processBundleFormatImpl(bundle, resourceName, target, root, &namespaces);
+}
+
+status_t ResourceTable::processBundleFormatImpl(const Bundle* bundle,
+                                                const String16& resourceName,
+                                                const sp<AaptFile>& target,
+                                                const sp<XMLNode>& parent,
+                                                Vector<sp<XMLNode> >* namespaces) {
+    const String16 kAaptNamespaceUri16("http://schemas.android.com/aapt");
+    const String16 kName16("name");
+    const String16 kAttr16("attr");
+    const String16 kAssetPackage16(mAssets->getPackage());
+
+    Vector<sp<XMLNode> >& children = parent->getChildren();
+    for (size_t i = 0; i < children.size(); i++) {
+        const sp<XMLNode>& child = children[i];
+
+        if (child->getType() == XMLNode::TYPE_CDATA) {
+            continue;
+        } else if (child->getType() == XMLNode::TYPE_NAMESPACE) {
+            namespaces->push(child);
+        }
+
+        if (child->getElementNamespace() != kAaptNamespaceUri16 ||
+                child->getElementName() != kAttr16) {
+            status_t result = processBundleFormatImpl(bundle, resourceName, target, child,
+                                                      namespaces);
+            if (result != NO_ERROR) {
+                return result;
+            }
+
+            if (child->getType() == XMLNode::TYPE_NAMESPACE) {
+                namespaces->pop();
+            }
+            continue;
+        }
+
+        // This is the <aapt:attr> tag. Look for the 'name' attribute.
+        SourcePos source(child->getFilename(), child->getStartLineNumber());
+
+        sp<XMLNode> nestedRoot = findOnlyChildElement(child);
+        if (nestedRoot == NULL) {
+            source.error("<%s:%s> must have exactly one child element",
+                         String8(child->getElementNamespace()).string(),
+                         String8(child->getElementName()).string());
+            return UNKNOWN_ERROR;
+        }
+
+        // Find the special attribute 'parent-attr'. This attribute's value contains
+        // the resource attribute for which this element should be assigned in the parent.
+        const XMLNode::attribute_entry* attr = child->getAttribute(String16(), kName16);
+        if (attr == NULL) {
+            source.error("inline resource definition must specify an attribute via 'name'");
+            return UNKNOWN_ERROR;
+        }
+
+        // Parse the attribute name.
+        const char* errorMsg = NULL;
+        String16 attrPackage, attrType, attrName;
+        bool result = ResTable::expandResourceRef(attr->string.string(),
+                                                  attr->string.size(),
+                                                  &attrPackage, &attrType, &attrName,
+                                                  &kAttr16, &kAssetPackage16,
+                                                  &errorMsg, NULL);
+        if (!result) {
+            source.error("invalid attribute name for 'name': %s", errorMsg);
+            return UNKNOWN_ERROR;
+        }
+
+        if (attrType != kAttr16) {
+            // The value of the 'name' attribute must be an attribute reference.
+            source.error("value of 'name' must be an attribute reference.");
+            return UNKNOWN_ERROR;
+        }
+
+        // Generate a name for this nested resource and try to add it to the table.
+        // We do this in a loop because the name may be taken, in which case we will
+        // increment a suffix until we succeed.
+        String8 nestedResourceName;
+        String8 nestedResourcePath;
+        int suffix = 1;
+        while (true) {
+            // This child element will be extracted into its own resource file.
+            // Generate a name and path for it from its parent.
+            nestedResourceName = String8::format("%s_%d",
+                        String8(resourceName).string(), suffix++);
+            nestedResourcePath = String8::format("res/%s/%s.xml",
+                        target->getGroupEntry().toDirName(target->getResourceType())
+                                               .string(),
+                        nestedResourceName.string());
+
+            // Lookup or create the entry for this name.
+            sp<Entry> entry = getEntry(kAssetPackage16,
+                                       String16(target->getResourceType()),
+                                       String16(nestedResourceName),
+                                       source,
+                                       false,
+                                       &target->getGroupEntry().toParams(),
+                                       true);
+            if (entry == NULL) {
+                return UNKNOWN_ERROR;
+            }
+
+            if (entry->getType() == Entry::TYPE_UNKNOWN) {
+                // The value for this resource has never been set,
+                // meaning we're good!
+                entry->setItem(source, String16(nestedResourcePath));
+                break;
+            }
+
+            // We failed (name already exists), so try with a different name
+            // (increment the suffix).
+        }
+
+        if (bundle->getVerbose()) {
+            source.printf("generating nested resource %s:%s/%s",
+                    mAssets->getPackage().string(), target->getResourceType().string(),
+                    nestedResourceName.string());
+        }
+
+        // Build the attribute reference and assign it to the parent.
+        String16 nestedResourceRef = String16(String8::format("@%s:%s/%s",
+                    mAssets->getPackage().string(), target->getResourceType().string(),
+                    nestedResourceName.string()));
+
+        String16 attrNs = buildNamespace(attrPackage);
+        if (parent->getAttribute(attrNs, attrName) != NULL) {
+            SourcePos(parent->getFilename(), parent->getStartLineNumber())
+                    .error("parent of nested resource already defines attribute '%s:%s'",
+                           String8(attrPackage).string(), String8(attrName).string());
+            return UNKNOWN_ERROR;
+        }
+
+        // Add the reference to the inline resource.
+        parent->addAttribute(attrNs, attrName, nestedResourceRef);
+
+        // Remove the <aapt:attr> child element from here.
+        children.removeAt(i);
+        i--;
+
+        // Append all namespace declarations that we've seen on this branch in the XML tree
+        // to this resource.
+        // We do this because the order of namespace declarations and prefix usage is determined
+        // by the developer and we do not want to override any decisions. Be conservative.
+        for (size_t nsIndex = namespaces->size(); nsIndex > 0; nsIndex--) {
+            const sp<XMLNode>& ns = namespaces->itemAt(nsIndex - 1);
+            sp<XMLNode> newNs = XMLNode::newNamespace(ns->getFilename(), ns->getNamespacePrefix(),
+                                                      ns->getNamespaceUri());
+            newNs->addChild(nestedRoot);
+            nestedRoot = newNs;
+        }
+
+        // Schedule compilation of the nested resource.
+        CompileResourceWorkItem workItem;
+        workItem.resPath = nestedResourcePath;
+        workItem.resourceName = String16(nestedResourceName);
+        workItem.xmlRoot = nestedRoot;
+        workItem.file = new AaptFile(target->getSourceFile(), target->getGroupEntry(),
+                                     target->getResourceType());
+        mWorkQueue.push(workItem);
+    }
+    return NO_ERROR;
+}
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index c4bdf09..4b7b3cd 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -23,13 +23,14 @@
 enum {
     XML_COMPILE_STRIP_COMMENTS = 1<<0,
     XML_COMPILE_ASSIGN_ATTRIBUTE_IDS = 1<<1,
-    XML_COMPILE_COMPACT_WHITESPACE = 1<<2,
-    XML_COMPILE_STRIP_WHITESPACE = 1<<3,
-    XML_COMPILE_STRIP_RAW_VALUES = 1<<4,
-    XML_COMPILE_UTF8 = 1<<5,
+    XML_COMPILE_PARSE_VALUES = 1 << 2,
+    XML_COMPILE_COMPACT_WHITESPACE = 1<<3,
+    XML_COMPILE_STRIP_WHITESPACE = 1<<4,
+    XML_COMPILE_STRIP_RAW_VALUES = 1<<5,
+    XML_COMPILE_UTF8 = 1<<6,
 
     XML_COMPILE_STANDARD_RESOURCE =
-            XML_COMPILE_STRIP_COMMENTS | XML_COMPILE_ASSIGN_ATTRIBUTE_IDS
+            XML_COMPILE_STRIP_COMMENTS | XML_COMPILE_ASSIGN_ATTRIBUTE_IDS | XML_COMPILE_PARSE_VALUES
             | XML_COMPILE_STRIP_WHITESPACE | XML_COMPILE_STRIP_RAW_VALUES
 };
 
@@ -83,6 +84,8 @@
     String16 resourceName;
     String8 resPath;
     sp<AaptFile> file;
+    sp<XMLNode> xmlRoot;
+    bool needsCompiling = true;
 };
 
 class ResourceTable : public ResTable::Accessor
@@ -206,6 +209,12 @@
                              const sp<AaptFile>& file,
                              const sp<XMLNode>& root);
 
+    status_t processBundleFormat(const Bundle* bundle,
+                                 const String16& resourceName,
+                                 const sp<AaptFile>& file,
+                                 const sp<XMLNode>& parent);
+
+
     sp<AaptFile> flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
             const bool isBase);
 
@@ -586,6 +595,11 @@
                       Res_value* outValue);
     int getPublicAttributeSdkLevel(uint32_t attrId) const;
 
+    status_t processBundleFormatImpl(const Bundle* bundle,
+                                     const String16& resourceName,
+                                     const sp<AaptFile>& file,
+                                     const sp<XMLNode>& parent,
+                                     Vector<sp<XMLNode> >* namespaces);
 
     String16 mAssetsPackage;
     PackageType mPackageType;
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index dc08eb8..5b215da 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -693,6 +693,12 @@
     return mChildren;
 }
 
+
+Vector<sp<XMLNode> >& XMLNode::getChildren()
+{
+    return mChildren;
+}
+
 const String8& XMLNode::getFilename() const
 {
     return mFilename;
@@ -717,6 +723,18 @@
     return NULL;
 }
 
+bool XMLNode::removeAttribute(const String16& ns, const String16& name)
+{
+    for (size_t i = 0; i < mAttributes.size(); i++) {
+        const attribute_entry& ae(mAttributes.itemAt(i));
+        if (ae.ns == ns && ae.name == name) {
+            removeAttribute(i);
+            return true;
+        }
+    }
+    return false;
+}
+
 XMLNode::attribute_entry* XMLNode::editAttribute(const String16& ns,
         const String16& name)
 {
diff --git a/tools/aapt/XMLNode.h b/tools/aapt/XMLNode.h
index b9e5cd5..749bf9f 100644
--- a/tools/aapt/XMLNode.h
+++ b/tools/aapt/XMLNode.h
@@ -55,7 +55,7 @@
     sp<XMLNode> newCData(const String8& filename) {
         return new XMLNode(filename);
     }
-    
+
     enum type {
         TYPE_NAMESPACE,
         TYPE_ELEMENT,
@@ -70,6 +70,7 @@
     const String16& getElementNamespace() const;
     const String16& getElementName() const;
     const Vector<sp<XMLNode> >& getChildren() const;
+    Vector<sp<XMLNode> >& getChildren();
 
     const String8& getFilename() const;
     
@@ -97,6 +98,7 @@
     const Vector<attribute_entry>& getAttributes() const;
 
     const attribute_entry* getAttribute(const String16& ns, const String16& name) const;
+    bool removeAttribute(const String16& ns, const String16& name);
     
     attribute_entry* editAttribute(const String16& ns, const String16& name);
 
diff --git a/tools/aapt2/compile/Compile.cpp b/tools/aapt2/compile/Compile.cpp
index 17a658e..90e35d5 100644
--- a/tools/aapt2/compile/Compile.cpp
+++ b/tools/aapt2/compile/Compile.cpp
@@ -22,6 +22,7 @@
 #include "compile/IdAssigner.h"
 #include "compile/Png.h"
 #include "compile/XmlIdCollector.h"
+#include "flatten/Archive.h"
 #include "flatten/FileExportWriter.h"
 #include "flatten/TableFlattener.h"
 #include "flatten/XmlFlattener.h"
@@ -31,6 +32,7 @@
 #include "xml/XmlDom.h"
 #include "xml/XmlPullParser.h"
 
+#include <dirent.h>
 #include <fstream>
 #include <string>
 
@@ -90,7 +92,7 @@
     }
 
     return ResourcePathData{
-            Source{ path },
+            Source(path),
             util::utf8ToUtf16(dirStr),
             util::utf8ToUtf16(name),
             extension.toString(),
@@ -101,25 +103,79 @@
 
 struct CompileOptions {
     std::string outputPath;
+    Maybe<std::string> resDir;
     Maybe<std::u16string> product;
     bool verbose = false;
 };
 
-static std::string buildIntermediateFilename(const std::string outDir,
-                                             const ResourcePathData& data) {
+static std::string buildIntermediateFilename(const ResourcePathData& data) {
     std::stringstream name;
     name << data.resourceDir;
     if (!data.configStr.empty()) {
         name << "-" << data.configStr;
     }
     name << "_" << data.name << "." << data.extension << ".flat";
-    std::string outPath = outDir;
-    file::appendPath(&outPath, name.str());
-    return outPath;
+    return name.str();
+}
+
+static bool isHidden(const StringPiece& filename) {
+    return util::stringStartsWith<char>(filename, ".");
+}
+
+/**
+ * Walks the res directory structure, looking for resource files.
+ */
+static bool loadInputFilesFromDir(IAaptContext* context, const CompileOptions& options,
+                                  std::vector<ResourcePathData>* outPathData) {
+    const std::string& rootDir = options.resDir.value();
+    std::unique_ptr<DIR, decltype(closedir)*> d(opendir(rootDir.data()), closedir);
+    if (!d) {
+        context->getDiagnostics()->error(DiagMessage() << strerror(errno));
+        return false;
+    }
+
+    while (struct dirent* entry = readdir(d.get())) {
+        if (isHidden(entry->d_name)) {
+            continue;
+        }
+
+        std::string prefixPath = rootDir;
+        file::appendPath(&prefixPath, entry->d_name);
+
+        if (file::getFileType(prefixPath) != file::FileType::kDirectory) {
+            continue;
+        }
+
+        std::unique_ptr<DIR, decltype(closedir)*> subDir(opendir(prefixPath.data()), closedir);
+        if (!subDir) {
+            context->getDiagnostics()->error(DiagMessage() << strerror(errno));
+            return false;
+        }
+
+        while (struct dirent* leafEntry = readdir(subDir.get())) {
+            if (isHidden(leafEntry->d_name)) {
+                continue;
+            }
+
+            std::string fullPath = prefixPath;
+            file::appendPath(&fullPath, leafEntry->d_name);
+
+            std::string errStr;
+            Maybe<ResourcePathData> pathData = extractResourcePathData(fullPath, &errStr);
+            if (!pathData) {
+                context->getDiagnostics()->error(DiagMessage() << errStr);
+                return false;
+            }
+
+            outPathData->push_back(std::move(pathData.value()));
+        }
+    }
+    return true;
 }
 
 static bool compileTable(IAaptContext* context, const CompileOptions& options,
-                         const ResourcePathData& pathData, const std::string& outputPath) {
+                         const ResourcePathData& pathData, IArchiveWriter* writer,
+                         const std::string& outputPath) {
     ResourceTable table;
     {
         std::ifstream fin(pathData.source.path, std::ifstream::binary);
@@ -150,6 +206,7 @@
     // Ensure we have the compilation package at least.
     table.createPackage(context->getCompilationPackage());
 
+    // Assign an ID to any package that has resources.
     for (auto& pkg : table.packages) {
         if (!pkg->id) {
             // If no package ID was set while parsing (public identifiers), auto assign an ID.
@@ -172,23 +229,24 @@
         return false;
     }
 
-    // Build the output filename.
-    std::ofstream fout(outputPath, std::ofstream::binary);
-    if (!fout) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
+    if (!writer->startEntry(outputPath, 0)) {
+        context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to open");
         return false;
     }
 
-    // Write it to disk.
-    if (!util::writeAll(fout, buffer)) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
-        return false;
+    if (writer->writeEntry(buffer)) {
+        if (writer->finishEntry()) {
+            return true;
+        }
     }
-    return true;
+
+    context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to write");
+    return false;
 }
 
 static bool compileXml(IAaptContext* context, const CompileOptions& options,
-                       const ResourcePathData& pathData, const std::string& outputPath) {
+                       const ResourcePathData& pathData, IArchiveWriter* writer,
+                       const std::string& outputPath) {
 
     std::unique_ptr<xml::XmlResource> xmlRes;
 
@@ -214,7 +272,7 @@
         return false;
     }
 
-    xmlRes->file.name = ResourceName{ {}, *parseResourceType(pathData.resourceDir), pathData.name };
+    xmlRes->file.name = ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
     xmlRes->file.config = pathData.config;
     xmlRes->file.source = pathData.source;
 
@@ -230,25 +288,27 @@
 
     fileExportWriter.finish();
 
-    std::ofstream fout(outputPath, std::ofstream::binary);
-    if (!fout) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
+    if (!writer->startEntry(outputPath, 0)) {
+        context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to open");
         return false;
     }
 
-    // Write it to disk.
-    if (!util::writeAll(fout, buffer)) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
-        return false;
+    if (writer->writeEntry(buffer)) {
+        if (writer->finishEntry()) {
+            return true;
+        }
     }
-    return true;
+
+    context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to write");
+    return false;
 }
 
 static bool compilePng(IAaptContext* context, const CompileOptions& options,
-                       const ResourcePathData& pathData, const std::string& outputPath) {
+                       const ResourcePathData& pathData, IArchiveWriter* writer,
+                       const std::string& outputPath) {
     BigBuffer buffer(4096);
     ResourceFile resFile;
-    resFile.name = ResourceName{ {}, *parseResourceType(pathData.resourceDir), pathData.name };
+    resFile.name = ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
     resFile.config = pathData.config;
     resFile.source = pathData.source;
 
@@ -269,24 +329,27 @@
 
     fileExportWriter.finish();
 
-    std::ofstream fout(outputPath, std::ofstream::binary);
-    if (!fout) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
+    if (!writer->startEntry(outputPath, 0)) {
+        context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to open");
         return false;
     }
 
-    if (!util::writeAll(fout, buffer)) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
-        return false;
+    if (writer->writeEntry(buffer)) {
+        if (writer->finishEntry()) {
+            return true;
+        }
     }
-    return true;
+
+    context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to write");
+    return false;
 }
 
 static bool compileFile(IAaptContext* context, const CompileOptions& options,
-                        const ResourcePathData& pathData, const std::string& outputPath) {
+                        const ResourcePathData& pathData, IArchiveWriter* writer,
+                        const std::string& outputPath) {
     BigBuffer buffer(256);
     ResourceFile resFile;
-    resFile.name = ResourceName{ {}, *parseResourceType(pathData.resourceDir), pathData.name };
+    resFile.name = ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
     resFile.config = pathData.config;
     resFile.source = pathData.source;
 
@@ -299,9 +362,8 @@
         return false;
     }
 
-    std::ofstream fout(outputPath, std::ofstream::binary);
-    if (!fout) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
+    if (!writer->startEntry(outputPath, 0)) {
+        context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to open");
         return false;
     }
 
@@ -309,16 +371,17 @@
     // the buffer the entire file.
     fileExportWriter.getChunkHeader()->size =
             util::hostToDevice32(buffer.size() + f.value().getDataLength());
-    if (!util::writeAll(fout, buffer)) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
-        return false;
+
+    if (writer->writeEntry(buffer)) {
+        if (writer->writeEntry(f.value().getDataPtr(), f.value().getDataLength())) {
+            if (writer->finishEntry()) {
+                return true;
+            }
+        }
     }
 
-    if (!fout.write((const char*) f.value().getDataPtr(), f.value().getDataLength())) {
-        context->getDiagnostics()->error(DiagMessage(Source{ outputPath }) << strerror(errno));
-        return false;
-    }
-    return true;
+    context->getDiagnostics()->error(DiagMessage(outputPath) << "failed to write");
+    return false;
 }
 
 class CompileContext : public IAaptContext {
@@ -359,6 +422,7 @@
     Flags flags = Flags()
             .requiredFlag("-o", "Output path", &options.outputPath)
             .optionalFlag("--product", "Product type to compile", &product)
+            .optionalFlag("--dir", "Directory to scan for resources", &options.resDir)
             .optionalSwitch("-v", "Enables verbose logging", &options.verbose);
     if (!flags.parse("aapt2 compile", args, &std::cerr)) {
         return 1;
@@ -369,19 +433,42 @@
     }
 
     CompileContext context;
+    std::unique_ptr<IArchiveWriter> archiveWriter;
 
     std::vector<ResourcePathData> inputData;
-    inputData.reserve(flags.getArgs().size());
-
-    // Collect data from the path for each input file.
-    for (const std::string& arg : flags.getArgs()) {
-        std::string errorStr;
-        if (Maybe<ResourcePathData> pathData = extractResourcePathData(arg, &errorStr)) {
-            inputData.push_back(std::move(pathData.value()));
-        } else {
-            context.getDiagnostics()->error(DiagMessage() << errorStr << " (" << arg << ")");
+    if (options.resDir) {
+        if (!flags.getArgs().empty()) {
+            // Can't have both files and a resource directory.
+            context.getDiagnostics()->error(DiagMessage() << "files given but --dir specified");
+            flags.usage("aapt2 compile", &std::cerr);
             return 1;
         }
+
+        if (!loadInputFilesFromDir(&context, options, &inputData)) {
+            return 1;
+        }
+
+        archiveWriter = createZipFileArchiveWriter(context.getDiagnostics(), options.outputPath);
+
+    } else {
+        inputData.reserve(flags.getArgs().size());
+
+        // Collect data from the path for each input file.
+        for (const std::string& arg : flags.getArgs()) {
+            std::string errorStr;
+            if (Maybe<ResourcePathData> pathData = extractResourcePathData(arg, &errorStr)) {
+                inputData.push_back(std::move(pathData.value()));
+            } else {
+                context.getDiagnostics()->error(DiagMessage() << errorStr << " (" << arg << ")");
+                return 1;
+            }
+        }
+
+        archiveWriter = createDirectoryArchiveWriter(context.getDiagnostics(), options.outputPath);
+    }
+
+    if (!archiveWriter) {
+        return false;
     }
 
     bool error = false;
@@ -394,32 +481,34 @@
             // Overwrite the extension.
             pathData.extension = "arsc";
 
-            const std::string outputFilename = buildIntermediateFilename(
-                    options.outputPath, pathData);
-            if (!compileTable(&context, options, pathData, outputFilename)) {
+            const std::string outputFilename = buildIntermediateFilename(pathData);
+            if (!compileTable(&context, options, pathData, archiveWriter.get(), outputFilename)) {
                 error = true;
             }
 
         } else {
-            const std::string outputFilename = buildIntermediateFilename(options.outputPath,
-                                                                         pathData);
+            const std::string outputFilename = buildIntermediateFilename(pathData);
             if (const ResourceType* type = parseResourceType(pathData.resourceDir)) {
                 if (*type != ResourceType::kRaw) {
                     if (pathData.extension == "xml") {
-                        if (!compileXml(&context, options, pathData, outputFilename)) {
+                        if (!compileXml(&context, options, pathData, archiveWriter.get(),
+                                        outputFilename)) {
                             error = true;
                         }
                     } else if (pathData.extension == "png" || pathData.extension == "9.png") {
-                        if (!compilePng(&context, options, pathData, outputFilename)) {
+                        if (!compilePng(&context, options, pathData, archiveWriter.get(),
+                                        outputFilename)) {
                             error = true;
                         }
                     } else {
-                        if (!compileFile(&context, options, pathData, outputFilename)) {
+                        if (!compileFile(&context, options, pathData, archiveWriter.get(),
+                                         outputFilename)) {
                             error = true;
                         }
                     }
                 } else {
-                    if (!compileFile(&context, options, pathData, outputFilename)) {
+                    if (!compileFile(&context, options, pathData, archiveWriter.get(),
+                                     outputFilename)) {
                         error = true;
                     }
                 }
diff --git a/tools/aapt2/flatten/Archive.cpp b/tools/aapt2/flatten/Archive.cpp
index 6db13b8..3a244c0 100644
--- a/tools/aapt2/flatten/Archive.cpp
+++ b/tools/aapt2/flatten/Archive.cpp
@@ -18,7 +18,7 @@
 #include "util/Files.h"
 #include "util/StringPiece.h"
 
-#include <fstream>
+#include <cstdio>
 #include <memory>
 #include <string>
 #include <vector>
@@ -30,70 +30,85 @@
 
 struct DirectoryWriter : public IArchiveWriter {
     std::string mOutDir;
-    std::vector<std::unique_ptr<ArchiveEntry>> mEntries;
+    std::unique_ptr<FILE, decltype(fclose)*> mFile = { nullptr, fclose };
 
-    explicit DirectoryWriter(const StringPiece& outDir) : mOutDir(outDir.toString()) {
+    bool open(IDiagnostics* diag, const StringPiece& outDir) {
+        mOutDir = outDir.toString();
+        file::FileType type = file::getFileType(mOutDir);
+        if (type == file::FileType::kNonexistant) {
+            diag->error(DiagMessage() << "directory " << mOutDir << " does not exist");
+            return false;
+        } else if (type != file::FileType::kDirectory) {
+            diag->error(DiagMessage() << mOutDir << " is not a directory");
+            return false;
+        }
+        return true;
     }
 
-    ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags,
-                             const BigBuffer& buffer) override {
+    bool startEntry(const StringPiece& path, uint32_t flags) override {
+        if (mFile) {
+            return false;
+        }
+
         std::string fullPath = mOutDir;
         file::appendPath(&fullPath, path);
         file::mkdirs(file::getStem(fullPath));
 
-        std::ofstream fout(fullPath, std::ofstream::binary);
-        if (!fout) {
-            return nullptr;
+        mFile = { fopen(fullPath.data(), "wb"), fclose };
+        if (!mFile) {
+            return false;
         }
-
-        if (!util::writeAll(fout, buffer)) {
-            return nullptr;
-        }
-
-        mEntries.push_back(util::make_unique<ArchiveEntry>(fullPath, flags, buffer.size()));
-        return mEntries.back().get();
+        return true;
     }
 
-    ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags, android::FileMap* fileMap,
-                             size_t offset, size_t len) override {
-        std::string fullPath = mOutDir;
-        file::appendPath(&fullPath, path);
-        file::mkdirs(file::getStem(fullPath));
-
-        std::ofstream fout(fullPath, std::ofstream::binary);
-        if (!fout) {
-            return nullptr;
+    bool writeEntry(const BigBuffer& buffer) override {
+        if (!mFile) {
+            return false;
         }
 
-        if (!fout.write((const char*) fileMap->getDataPtr() + offset, len)) {
-            return nullptr;
+        for (const BigBuffer::Block& b : buffer) {
+            if (fwrite(b.buffer.get(), 1, b.size, mFile.get()) != b.size) {
+                mFile.reset(nullptr);
+                return false;
+            }
         }
-
-        mEntries.push_back(util::make_unique<ArchiveEntry>(fullPath, flags, len));
-        return mEntries.back().get();
+        return true;
     }
 
-    virtual ~DirectoryWriter() {
+    bool writeEntry(const void* data, size_t len) override {
+        if (fwrite(data, 1, len, mFile.get()) != len) {
+            mFile.reset(nullptr);
+            return false;
+        }
+        return true;
+    }
 
+    bool finishEntry() override {
+        if (!mFile) {
+            return false;
+        }
+        mFile.reset(nullptr);
+        return true;
     }
 };
 
 struct ZipFileWriter : public IArchiveWriter {
-    FILE* mFile;
+    std::unique_ptr<FILE, decltype(fclose)*> mFile = { nullptr, fclose };
     std::unique_ptr<ZipWriter> mWriter;
-    std::vector<std::unique_ptr<ArchiveEntry>> mEntries;
 
-    explicit ZipFileWriter(const StringPiece& path) {
-        mFile = fopen(path.data(), "w+b");
-        if (mFile) {
-            mWriter = util::make_unique<ZipWriter>(mFile);
+    bool open(IDiagnostics* diag, const StringPiece& path) {
+        mFile = { fopen(path.data(), "w+b"), fclose };
+        if (!mFile) {
+            diag->error(DiagMessage() << "failed to open " << path << ": " << strerror(errno));
+            return false;
         }
+        mWriter = util::make_unique<ZipWriter>(mFile.get());
+        return true;
     }
 
-    ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags,
-                             const BigBuffer& buffer) override {
+    bool startEntry(const StringPiece& path, uint32_t flags) override {
         if (!mWriter) {
-            return nullptr;
+            return false;
         }
 
         size_t zipFlags = 0;
@@ -107,75 +122,63 @@
 
         int32_t result = mWriter->StartEntry(path.data(), zipFlags);
         if (result != 0) {
-            return nullptr;
+            return false;
         }
+        return true;
+    }
 
+    bool writeEntry(const void* data, size_t len) override {
+        int32_t result = mWriter->WriteBytes(data, len);
+        if (result != 0) {
+            return false;
+        }
+        return true;
+    }
+
+    bool writeEntry(const BigBuffer& buffer) override {
         for (const BigBuffer::Block& b : buffer) {
-            result = mWriter->WriteBytes(reinterpret_cast<const uint8_t*>(b.buffer.get()), b.size);
+            int32_t result = mWriter->WriteBytes(b.buffer.get(), b.size);
             if (result != 0) {
-                return nullptr;
+                return false;
             }
         }
-
-        result = mWriter->FinishEntry();
-        if (result != 0) {
-            return nullptr;
-        }
-
-        mEntries.push_back(util::make_unique<ArchiveEntry>(path.toString(), flags, buffer.size()));
-        return mEntries.back().get();
+        return true;
     }
 
-    ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags, android::FileMap* fileMap,
-                             size_t offset, size_t len) override {
-        if (!mWriter) {
-            return nullptr;
-        }
-
-        size_t zipFlags = 0;
-        if (flags & ArchiveEntry::kCompress) {
-            zipFlags |= ZipWriter::kCompress;
-        }
-
-        if (flags & ArchiveEntry::kAlign) {
-            zipFlags |= ZipWriter::kAlign32;
-        }
-
-        int32_t result = mWriter->StartEntry(path.data(), zipFlags);
+    bool finishEntry() override {
+        int32_t result = mWriter->FinishEntry();
         if (result != 0) {
-            return nullptr;
+            return false;
         }
-
-        result = mWriter->WriteBytes((const char*) fileMap->getDataPtr() + offset, len);
-        if (result != 0) {
-            return nullptr;
-        }
-
-        result = mWriter->FinishEntry();
-        if (result != 0) {
-            return nullptr;
-        }
-
-        mEntries.push_back(util::make_unique<ArchiveEntry>(path.toString(), flags, len));
-        return mEntries.back().get();
+        return true;
     }
 
     virtual ~ZipFileWriter() {
         if (mWriter) {
             mWriter->Finish();
-            fclose(mFile);
         }
     }
 };
 
 } // namespace
 
-std::unique_ptr<IArchiveWriter> createDirectoryArchiveWriter(const StringPiece& path) {
-    return util::make_unique<DirectoryWriter>(path);
+std::unique_ptr<IArchiveWriter> createDirectoryArchiveWriter(IDiagnostics* diag,
+                                                             const StringPiece& path) {
+
+    std::unique_ptr<DirectoryWriter> writer = util::make_unique<DirectoryWriter>();
+    if (!writer->open(diag, path)) {
+        return {};
+    }
+    return std::move(writer);
 }
 
-std::unique_ptr<IArchiveWriter> createZipFileArchiveWriter(const StringPiece& path) {
-    return util::make_unique<ZipFileWriter>(path);
+std::unique_ptr<IArchiveWriter> createZipFileArchiveWriter(IDiagnostics* diag,
+                                                           const StringPiece& path) {
+    std::unique_ptr<ZipFileWriter> writer = util::make_unique<ZipFileWriter>();
+    if (!writer->open(diag, path)) {
+        return {};
+    }
+    return std::move(writer);
 }
 
 } // namespace aapt
diff --git a/tools/aapt2/flatten/Archive.h b/tools/aapt2/flatten/Archive.h
index c4ddeb3..6da1d2a 100644
--- a/tools/aapt2/flatten/Archive.h
+++ b/tools/aapt2/flatten/Archive.h
@@ -17,6 +17,7 @@
 #ifndef AAPT_FLATTEN_ARCHIVE_H
 #define AAPT_FLATTEN_ARCHIVE_H
 
+#include "Diagnostics.h"
 #include "util/BigBuffer.h"
 #include "util/Files.h"
 #include "util/StringPiece.h"
@@ -42,15 +43,17 @@
 struct IArchiveWriter {
     virtual ~IArchiveWriter() = default;
 
-    virtual ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags,
-                                     const BigBuffer& buffer) = 0;
-    virtual ArchiveEntry* writeEntry(const StringPiece& path, uint32_t flags,
-                                     android::FileMap* fileMap, size_t offset, size_t len) = 0;
+    virtual bool startEntry(const StringPiece& path, uint32_t flags) = 0;
+    virtual bool writeEntry(const BigBuffer& buffer) = 0;
+    virtual bool writeEntry(const void* data, size_t len) = 0;
+    virtual bool finishEntry() = 0;
 };
 
-std::unique_ptr<IArchiveWriter> createDirectoryArchiveWriter(const StringPiece& path);
+std::unique_ptr<IArchiveWriter> createDirectoryArchiveWriter(IDiagnostics* diag,
+                                                             const StringPiece& path);
 
-std::unique_ptr<IArchiveWriter> createZipFileArchiveWriter(const StringPiece& path);
+std::unique_ptr<IArchiveWriter> createZipFileArchiveWriter(IDiagnostics* diag,
+                                                           const StringPiece& path);
 
 } // namespace aapt
 
diff --git a/tools/aapt2/io/Data.h b/tools/aapt2/io/Data.h
new file mode 100644
index 0000000..9081c55
--- /dev/null
+++ b/tools/aapt2/io/Data.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef AAPT_IO_DATA_H
+#define AAPT_IO_DATA_H
+
+#include <utils/FileMap.h>
+
+#include <memory>
+
+namespace aapt {
+namespace io {
+
+/**
+ * Interface for a block of contiguous memory. An instance of this interface owns the data.
+ */
+class IData {
+public:
+    virtual ~IData() = default;
+
+    virtual const void* data() const = 0;
+    virtual size_t size() const = 0;
+};
+
+/**
+ * Implementation of IData that exposes a memory mapped file. The mmapped file is owned by this
+ * object.
+ */
+class MmappedData : public IData {
+public:
+    explicit MmappedData(android::FileMap&& map) : mMap(std::forward<android::FileMap>(map)) {
+    }
+
+    const void* data() const override {
+        return mMap.getDataPtr();
+    }
+
+    size_t size() const override {
+        return mMap.getDataLength();
+    }
+
+private:
+    android::FileMap mMap;
+};
+
+/**
+ * Implementation of IData that exposes a block of memory that was malloc'ed (new'ed). The
+ * memory is owned by this object.
+ */
+class MallocData : public IData {
+public:
+    MallocData(std::unique_ptr<const uint8_t[]> data, size_t size) :
+            mData(std::move(data)), mSize(size) {
+    }
+
+    const void* data() const override {
+        return mData.get();
+    }
+
+    size_t size() const override {
+        return mSize;
+    }
+
+private:
+    std::unique_ptr<const uint8_t[]> mData;
+    size_t mSize;
+};
+
+} // namespace io
+} // namespace aapt
+
+#endif /* AAPT_IO_DATA_H */
diff --git a/tools/aapt2/io/File.h b/tools/aapt2/io/File.h
new file mode 100644
index 0000000..9fca398
--- /dev/null
+++ b/tools/aapt2/io/File.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef AAPT_IO_FILE_H
+#define AAPT_IO_FILE_H
+
+#include "Source.h"
+#include "io/Data.h"
+
+#include <memory>
+#include <vector>
+
+namespace aapt {
+namespace io {
+
+/**
+ * Interface for a file, which could be a real file on the file system, or a file inside
+ * a ZIP archive.
+ */
+class IFile {
+public:
+    virtual ~IFile() = default;
+
+    /**
+     * Open the file and return it as a block of contiguous memory. How this occurs is
+     * implementation dependent. For example, if this is a file on the file system, it may
+     * simply mmap the contents. If this file represents a compressed file in a ZIP archive,
+     * it may need to inflate it to memory, incurring a copy.
+     *
+     * Returns nullptr on failure.
+     */
+    virtual std::unique_ptr<IData> openAsData() = 0;
+
+    /**
+     * Returns the source of this file. This is for presentation to the user and may not be a
+     * valid file system path (for example, it may contain a '@' sign to separate the files within
+     * a ZIP archive from the path to the containing ZIP archive.
+     */
+    virtual const Source& getSource() const = 0;
+};
+
+/**
+ * Interface for a collection of files, all of which share a common source. That source may
+ * simply be the filesystem, or a ZIP archive.
+ */
+class IFileCollection {
+public:
+    virtual ~IFileCollection() = default;
+
+    using const_iterator = std::vector<std::unique_ptr<IFile>>::const_iterator;
+
+    virtual const_iterator begin() const = 0;
+    virtual const_iterator end() const = 0;
+};
+
+} // namespace io
+} // namespace aapt
+
+#endif /* AAPT_IO_FILE_H */
diff --git a/tools/aapt2/io/FileSystem.h b/tools/aapt2/io/FileSystem.h
new file mode 100644
index 0000000..5dbefcc
--- /dev/null
+++ b/tools/aapt2/io/FileSystem.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef AAPT_IO_FILESYSTEM_H
+#define AAPT_IO_FILESYSTEM_H
+
+#include "io/File.h"
+#include "util/Files.h"
+
+namespace aapt {
+namespace io {
+
+/**
+ * A regular file from the file system. Uses mmap to open the data.
+ */
+class RegularFile : public IFile {
+public:
+    RegularFile(const Source& source) : mSource(source) {
+    }
+
+    std::unique_ptr<IData> openAsData() override {
+        android::FileMap map;
+        if (Maybe<android::FileMap> map = file::mmapPath(mSource.path, nullptr)) {
+            return util::make_unique<MmappedData>(std::move(map.value()));
+        }
+        return {};
+    }
+
+    const Source& getSource() const override {
+        return mSource;
+    }
+
+private:
+    Source mSource;
+};
+
+/**
+ * An IFileCollection representing the file system.
+ */
+class FileCollection : public IFileCollection {
+public:
+    /**
+     * Adds a file located at path. Returns the IFile representation of that file.
+     */
+    IFile* insertFile(const StringPiece& path) {
+        mFiles.push_back(util::make_unique<RegularFile>(Source(path)));
+        return mFiles.back().get();
+    }
+
+    const_iterator begin() const override {
+        return mFiles.begin();
+    }
+
+    const_iterator end() const override {
+        return mFiles.end();
+    }
+
+private:
+    std::vector<std::unique_ptr<IFile>> mFiles;
+};
+
+} // namespace io
+} // namespace aapt
+
+#endif // AAPT_IO_FILESYSTEM_H
diff --git a/tools/aapt2/io/ZipArchive.h b/tools/aapt2/io/ZipArchive.h
new file mode 100644
index 0000000..98afc49
--- /dev/null
+++ b/tools/aapt2/io/ZipArchive.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef AAPT_IO_ZIPARCHIVE_H
+#define AAPT_IO_ZIPARCHIVE_H
+
+#include "io/File.h"
+#include "util/StringPiece.h"
+
+#include <utils/FileMap.h>
+#include <ziparchive/zip_archive.h>
+
+namespace aapt {
+namespace io {
+
+/**
+ * An IFile representing a file within a ZIP archive. If the file is compressed, it is uncompressed
+ * and copied into memory when opened. Otherwise it is mmapped from the ZIP archive.
+ */
+class ZipFile : public IFile {
+public:
+    ZipFile(ZipArchiveHandle handle, const ZipEntry& entry, const Source& source) :
+            mZipHandle(handle), mZipEntry(entry), mSource(source) {
+    }
+
+    std::unique_ptr<IData> openAsData() override {
+        if (mZipEntry.method == kCompressStored) {
+            int fd = GetFileDescriptor(mZipHandle);
+
+            android::FileMap fileMap;
+            bool result = fileMap.create(nullptr, fd, mZipEntry.offset,
+                                         mZipEntry.uncompressed_length, true);
+            if (!result) {
+                return {};
+            }
+            return util::make_unique<MmappedData>(std::move(fileMap));
+
+        } else {
+            std::unique_ptr<uint8_t[]> data = std::unique_ptr<uint8_t[]>(
+                    new uint8_t[mZipEntry.uncompressed_length]);
+            int32_t result = ExtractToMemory(mZipHandle, &mZipEntry, data.get(),
+                                             static_cast<uint32_t>(mZipEntry.uncompressed_length));
+            if (result != 0) {
+                return {};
+            }
+            return util::make_unique<MallocData>(std::move(data), mZipEntry.uncompressed_length);
+        }
+    }
+
+    const Source& getSource() const override {
+        return mSource;
+    }
+
+private:
+    ZipArchiveHandle mZipHandle;
+    ZipEntry mZipEntry;
+    Source mSource;
+};
+
+/**
+ * An IFileCollection that represents a ZIP archive and the entries within it.
+ */
+class ZipFileCollection : public IFileCollection {
+public:
+    static std::unique_ptr<ZipFileCollection> create(const StringPiece& path,
+                                                     std::string* outError) {
+        std::unique_ptr<ZipFileCollection> collection = std::unique_ptr<ZipFileCollection>(
+                new ZipFileCollection());
+
+        int32_t result = OpenArchive(path.data(), &collection->mHandle);
+        if (result != 0) {
+            if (outError) *outError = ErrorCodeString(result);
+            return {};
+        }
+
+        ZipString suffix(".flat");
+        void* cookie = nullptr;
+        result = StartIteration(collection->mHandle, &cookie, nullptr, &suffix);
+        if (result != 0) {
+            if (outError) *outError = ErrorCodeString(result);
+            return {};
+        }
+
+        using IterationEnder = std::unique_ptr<void, decltype(EndIteration)*>;
+        IterationEnder iterationEnder(cookie, EndIteration);
+
+        ZipString zipEntryName;
+        ZipEntry zipData;
+        while ((result = Next(cookie, &zipData, &zipEntryName)) == 0) {
+            std::string nestedPath = path.toString();
+            nestedPath += "@" + std::string(reinterpret_cast<const char*>(zipEntryName.name),
+                                            zipEntryName.name_length);
+            collection->mFiles.push_back(util::make_unique<ZipFile>(collection->mHandle,
+                                                                    zipData,
+                                                                    Source(nestedPath)));
+        }
+
+        if (result != -1) {
+            if (outError) *outError = ErrorCodeString(result);
+            return {};
+        }
+        return collection;
+    }
+
+    const_iterator begin() const override {
+        return mFiles.begin();
+    }
+
+    const_iterator end() const override {
+        return mFiles.end();
+    }
+
+    ~ZipFileCollection() override {
+        if (mHandle) {
+            CloseArchive(mHandle);
+        }
+    }
+
+private:
+    ZipFileCollection() : mHandle(nullptr) {
+    }
+
+    ZipArchiveHandle mHandle;
+    std::vector<std::unique_ptr<IFile>> mFiles;
+};
+
+} // namespace io
+} // namespace aapt
+
+#endif /* AAPT_IO_ZIPARCHIVE_H */
diff --git a/tools/aapt2/link/Link.cpp b/tools/aapt2/link/Link.cpp
index 9850ae5..33d9272 100644
--- a/tools/aapt2/link/Link.cpp
+++ b/tools/aapt2/link/Link.cpp
@@ -22,6 +22,8 @@
 #include "flatten/Archive.h"
 #include "flatten/TableFlattener.h"
 #include "flatten/XmlFlattener.h"
+#include "io/FileSystem.h"
+#include "io/ZipArchive.h"
 #include "java/JavaClassGenerator.h"
 #include "java/ManifestClassGenerator.h"
 #include "java/ProguardRules.h"
@@ -39,7 +41,6 @@
 
 #include <fstream>
 #include <sys/stat.h>
-#include <utils/FileMap.h>
 #include <vector>
 
 namespace aapt {
@@ -92,7 +93,15 @@
 class LinkCommand {
 public:
     LinkCommand(const LinkOptions& options) :
-            mOptions(options), mContext(), mFinalTable() {
+            mOptions(options), mContext(), mFinalTable(), mFileCollection(nullptr) {
+        std::unique_ptr<io::FileCollection> fileCollection =
+                util::make_unique<io::FileCollection>();
+
+        // Get a pointer to the FileCollection for convenience, but it will be owned by the vector.
+        mFileCollection = fileCollection.get();
+
+        // Move it to the collection.
+        mCollections.push_back(std::move(fileCollection));
     }
 
     std::string buildResourceFileName(const ResourceFile& resFile) {
@@ -136,20 +145,9 @@
         return builder.build();
     }
 
-    /**
-     * Loads the resource table (not inside an apk) at the given path.
-     */
-    std::unique_ptr<ResourceTable> loadTable(const std::string& input) {
-        std::string errorStr;
-        Maybe<android::FileMap> map = file::mmapPath(input, &errorStr);
-        if (!map) {
-            mContext.getDiagnostics()->error(DiagMessage(input) << errorStr);
-            return {};
-        }
-
+    std::unique_ptr<ResourceTable> loadTable(const Source& source, const void* data, size_t len) {
         std::unique_ptr<ResourceTable> table = util::make_unique<ResourceTable>();
-        BinaryResourceParser parser(&mContext, table.get(), Source(input),
-                                    map.value().getDataPtr(), map.value().getDataLength());
+        BinaryResourceParser parser(&mContext, table.get(), source, data, len);
         if (!parser.parse()) {
             return {};
         }
@@ -159,90 +157,79 @@
     /**
      * Inflates an XML file from the source path.
      */
-    std::unique_ptr<xml::XmlResource> loadXml(const std::string& path) {
+    static std::unique_ptr<xml::XmlResource> loadXml(const std::string& path, IDiagnostics* diag) {
         std::ifstream fin(path, std::ifstream::binary);
         if (!fin) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << strerror(errno));
+            diag->error(DiagMessage(path) << strerror(errno));
             return {};
         }
 
-        return xml::inflate(&fin, mContext.getDiagnostics(), Source(path));
+        return xml::inflate(&fin, diag, Source(path));
     }
 
-    /**
-     * Inflates a binary XML file from the source path.
-     */
-    std::unique_ptr<xml::XmlResource> loadBinaryXmlSkipFileExport(const std::string& path) {
-        // Read header for symbol info and export info.
+    static std::unique_ptr<xml::XmlResource> loadBinaryXmlSkipFileExport(
+            const Source& source,
+            const void* data, size_t len,
+            IDiagnostics* diag) {
         std::string errorStr;
-        Maybe<android::FileMap> maybeF = file::mmapPath(path, &errorStr);
-        if (!maybeF) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
-            return {};
-        }
-
-        ssize_t offset = getWrappedDataOffset(maybeF.value().getDataPtr(),
-                                              maybeF.value().getDataLength(), &errorStr);
+        ssize_t offset = getWrappedDataOffset(data, len, &errorStr);
         if (offset < 0) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
+            diag->error(DiagMessage(source) << errorStr);
             return {};
         }
 
         std::unique_ptr<xml::XmlResource> xmlRes = xml::inflate(
-                (const uint8_t*) maybeF.value().getDataPtr() + (size_t) offset,
-                maybeF.value().getDataLength() - offset,
-                mContext.getDiagnostics(), Source(path));
+                reinterpret_cast<const uint8_t*>(data) + static_cast<size_t>(offset),
+                len - static_cast<size_t>(offset),
+                diag,
+                source);
         if (!xmlRes) {
             return {};
         }
         return xmlRes;
     }
 
-    Maybe<ResourceFile> loadFileExportHeader(const std::string& path) {
-        // Read header for symbol info and export info.
+    static std::unique_ptr<ResourceFile> loadFileExportHeader(const Source& source,
+                                                              const void* data, size_t len,
+                                                              IDiagnostics* diag) {
+        std::unique_ptr<ResourceFile> resFile = util::make_unique<ResourceFile>();
         std::string errorStr;
-        Maybe<android::FileMap> maybeF = file::mmapPath(path, &errorStr);
-        if (!maybeF) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
-            return {};
-        }
-
-        ResourceFile resFile;
-        ssize_t offset = unwrapFileExportHeader(maybeF.value().getDataPtr(),
-                                                maybeF.value().getDataLength(),
-                                                &resFile, &errorStr);
+        ssize_t offset = unwrapFileExportHeader(data, len, resFile.get(), &errorStr);
         if (offset < 0) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
+            diag->error(DiagMessage(source) << errorStr);
             return {};
         }
-        return std::move(resFile);
+        return resFile;
     }
 
-    bool copyFileToArchive(const std::string& path, const std::string& outPath, uint32_t flags,
+    bool copyFileToArchive(io::IFile* file, const std::string& outPath, uint32_t flags,
                            IArchiveWriter* writer) {
+        std::unique_ptr<io::IData> data = file->openAsData();
+        if (!data) {
+            mContext.getDiagnostics()->error(DiagMessage(file->getSource())
+                                             << "failed to open file");
+            return false;
+        }
+
         std::string errorStr;
-        Maybe<android::FileMap> maybeF = file::mmapPath(path, &errorStr);
-        if (!maybeF) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
-            return false;
-        }
-
-        ssize_t offset = getWrappedDataOffset(maybeF.value().getDataPtr(),
-                                              maybeF.value().getDataLength(),
-                                              &errorStr);
+        ssize_t offset = getWrappedDataOffset(data->data(), data->size(), &errorStr);
         if (offset < 0) {
-            mContext.getDiagnostics()->error(DiagMessage(path) << errorStr);
+            mContext.getDiagnostics()->error(DiagMessage(file->getSource()) << errorStr);
             return false;
         }
 
-        ArchiveEntry* entry = writer->writeEntry(outPath, flags, &maybeF.value(),
-                                                 offset, maybeF.value().getDataLength() - offset);
-        if (!entry) {
-            mContext.getDiagnostics()->error(
-                    DiagMessage(mOptions.outputPath) << "failed to write file " << outPath);
-            return false;
+        if (writer->startEntry(outPath, flags)) {
+            if (writer->writeEntry(reinterpret_cast<const uint8_t*>(data->data()) + offset,
+                                   data->size() - static_cast<size_t>(offset))) {
+                if (writer->finishEntry()) {
+                    return true;
+                }
+            }
         }
-        return true;
+
+        mContext.getDiagnostics()->error(
+                DiagMessage(mOptions.outputPath) << "failed to write file " << outPath);
+        return false;
     }
 
     Maybe<AppInfo> extractAppInfoFromManifest(xml::XmlResource* xmlRes) {
@@ -285,9 +272,9 @@
 
     std::unique_ptr<IArchiveWriter> makeArchiveWriter() {
         if (mOptions.outputToDirectory) {
-            return createDirectoryArchiveWriter(mOptions.outputPath);
+            return createDirectoryArchiveWriter(mContext.getDiagnostics(), mOptions.outputPath);
         } else {
-            return createZipFileArchiveWriter(mOptions.outputPath);
+            return createZipFileArchiveWriter(mContext.getDiagnostics(), mOptions.outputPath);
         }
     }
 
@@ -300,13 +287,17 @@
             return false;
         }
 
-        ArchiveEntry* entry = writer->writeEntry("resources.arsc", ArchiveEntry::kAlign, buffer);
-        if (!entry) {
-            mContext.getDiagnostics()->error(
-                    DiagMessage() << "failed to write resources.arsc to archive");
-            return false;
+        if (writer->startEntry("resources.arsc", ArchiveEntry::kAlign)) {
+            if (writer->writeEntry(buffer)) {
+                if (writer->finishEntry()) {
+                    return true;
+                }
+            }
         }
-        return true;
+
+        mContext.getDiagnostics()->error(
+                DiagMessage() << "failed to write resources.arsc to archive");
+        return false;
     }
 
     bool flattenXml(xml::XmlResource* xmlRes, const StringPiece& path, Maybe<size_t> maxSdkLevel,
@@ -320,13 +311,17 @@
             return false;
         }
 
-        ArchiveEntry* entry = writer->writeEntry(path, ArchiveEntry::kCompress, buffer);
-        if (!entry) {
-            mContext.getDiagnostics()->error(
-                    DiagMessage() << "failed to write " << path << " to archive");
-            return false;
+
+        if (writer->startEntry(path, ArchiveEntry::kCompress)) {
+            if (writer->writeEntry(buffer)) {
+                if (writer->finishEntry()) {
+                    return true;
+                }
+            }
         }
-        return true;
+        mContext.getDiagnostics()->error(
+                DiagMessage() << "failed to write " << path << " to archive");
+        return false;
     }
 
     bool writeJavaFile(ResourceTable* table, const StringPiece16& packageNameToGenerate,
@@ -412,34 +407,44 @@
         return true;
     }
 
-    bool mergeResourceTable(const std::string& input, bool override) {
+    bool mergeResourceTable(io::IFile* file, bool override) {
         if (mOptions.verbose) {
-            mContext.getDiagnostics()->note(DiagMessage() << "linking " << input);
+            mContext.getDiagnostics()->note(DiagMessage() << "linking " << file->getSource());
         }
 
-        std::unique_ptr<ResourceTable> table = loadTable(input);
+        std::unique_ptr<io::IData> data = file->openAsData();
+        if (!data) {
+            mContext.getDiagnostics()->error(DiagMessage(file->getSource())
+                                             << "failed to open file");
+            return false;
+        }
+
+        std::unique_ptr<ResourceTable> table = loadTable(file->getSource(), data->data(),
+                                                         data->size());
         if (!table) {
             return false;
         }
 
-        if (!mTableMerger->merge(Source(input), table.get(), override)) {
+        if (!mTableMerger->merge(file->getSource(), table.get(), override)) {
             return false;
         }
         return true;
     }
 
-    bool mergeCompiledFile(const std::string& input, ResourceFile&& file, bool override) {
-        if (file.name.package.empty()) {
-            file.name.package = mContext.getCompilationPackage().toString();
+    bool mergeCompiledFile(io::IFile* file, std::unique_ptr<ResourceFile> fileDesc, bool override) {
+        // Apply the package name used for this compilation phase if none was specified.
+        if (fileDesc->name.package.empty()) {
+            fileDesc->name.package = mContext.getCompilationPackage().toString();
         }
 
-        ResourceNameRef resName = file.name;
-
-        Maybe<ResourceName> mangledName = mContext.getNameMangler()->mangleName(file.name);
+        // Mangle the name if necessary.
+        ResourceNameRef resName = fileDesc->name;
+        Maybe<ResourceName> mangledName = mContext.getNameMangler()->mangleName(fileDesc->name);
         if (mangledName) {
             resName = mangledName.value();
         }
 
+        // If we are overriding resources, we supply a custom resolver function.
         std::function<int(Value*,Value*)> resolver;
         if (override) {
             resolver = [](Value* a, Value* b) -> int {
@@ -456,14 +461,14 @@
         }
 
         // Add this file to the table.
-        if (!mFinalTable.addFileReference(resName, file.config, file.source,
-                                          util::utf8ToUtf16(buildResourceFileName(file)),
+        if (!mFinalTable.addFileReference(resName, fileDesc->config, fileDesc->source,
+                                          util::utf8ToUtf16(buildResourceFileName(*fileDesc)),
                                           resolver, mContext.getDiagnostics())) {
             return false;
         }
 
         // Add the exports of this file to the table.
-        for (SourcedResourceName& exportedSymbol : file.exportedSymbols) {
+        for (SourcedResourceName& exportedSymbol : fileDesc->exportedSymbols) {
             if (exportedSymbol.name.package.empty()) {
                 exportedSymbol.name.package = mContext.getCompilationPackage().toString();
             }
@@ -477,32 +482,78 @@
             }
 
             std::unique_ptr<Id> id = util::make_unique<Id>();
-            id->setSource(file.source.withLine(exportedSymbol.line));
+            id->setSource(fileDesc->source.withLine(exportedSymbol.line));
             bool result = mFinalTable.addResourceAllowMangled(resName, {}, std::move(id),
-                    mContext.getDiagnostics());
+                                                              mContext.getDiagnostics());
             if (!result) {
                 return false;
             }
         }
 
-        mFilesToProcess.insert(FileToProcess{ std::move(file), Source(input) });
+        // Now add this file for later processing. Once the table is assigned IDs, we can compile
+        // this file.
+        mFilesToProcess.insert(FileToProcess{ std::move(fileDesc), file });
         return true;
     }
 
-    bool processFile(const std::string& input, bool override) {
-        if (util::stringEndsWith<char>(input, ".apk")) {
-            return mergeStaticLibrary(input);
-        } else if (util::stringEndsWith<char>(input, ".arsc.flat")) {
-            return mergeResourceTable(input, override);
-        } else if (Maybe<ResourceFile> maybeF = loadFileExportHeader(input)) {
-            return mergeCompiledFile(input, std::move(maybeF.value()), override);
+    /**
+     * Creates an io::IFileCollection from the ZIP archive and processes the files within.
+     */
+    bool mergeArchive(const std::string& input, bool override) {
+        std::string errorStr;
+        std::unique_ptr<io::ZipFileCollection> collection = io::ZipFileCollection::create(
+                input, &errorStr);
+        if (!collection) {
+            mContext.getDiagnostics()->error(DiagMessage(input) << errorStr);
+            return false;
+        }
+
+        bool error = false;
+        for (const std::unique_ptr<io::IFile>& file : *collection) {
+            if (!processFile(file.get(), override)) {
+                error = true;
+            }
+        }
+
+        // Make sure to move the collection into the set of IFileCollections.
+        mCollections.push_back(std::move(collection));
+        return !error;
+    }
+
+    bool processFile(const std::string& path, bool override) {
+        if (util::stringEndsWith<char>(path, ".flata")) {
+            return mergeArchive(path, override);
+        }
+
+        io::IFile* file = mFileCollection->insertFile(path);
+        return processFile(file, override);
+    }
+
+    bool processFile(io::IFile* file, bool override) {
+        const Source& src = file->getSource();
+        if (util::stringEndsWith<char>(src.path, ".arsc.flat")) {
+            return mergeResourceTable(file, override);
+        } else {
+            // Try opening the file and looking for an Export header.
+            std::unique_ptr<io::IData> data = file->openAsData();
+            if (!data) {
+                mContext.getDiagnostics()->error(DiagMessage(src) << "failed to open");
+                return false;
+            }
+
+            std::unique_ptr<ResourceFile> resourceFile = loadFileExportHeader(
+                    src, data->data(), data->size(), mContext.getDiagnostics());
+            if (resourceFile) {
+                return mergeCompiledFile(file, std::move(resourceFile), override);
+            }
         }
         return false;
     }
 
     int run(const std::vector<std::string>& inputFiles) {
         // Load the AndroidManifest.xml
-        std::unique_ptr<xml::XmlResource> manifestXml = loadXml(mOptions.manifestPath);
+        std::unique_ptr<xml::XmlResource> manifestXml = loadXml(mOptions.manifestPath,
+                                                                mContext.getDiagnostics());
         if (!manifestXml) {
             return 1;
         }
@@ -648,20 +699,30 @@
         }
 
         for (const FileToProcess& file : mFilesToProcess) {
-            if (file.file.name.type != ResourceType::kRaw &&
-                    util::stringEndsWith<char>(file.source.path, ".xml.flat")) {
+            const StringPiece path = file.file->getSource().path;
+
+            if (file.fileExport->name.type != ResourceType::kRaw &&
+                    util::stringEndsWith<char>(path, ".xml.flat")) {
                 if (mOptions.verbose) {
-                    mContext.getDiagnostics()->note(DiagMessage()
-                                                    << "linking " << file.source.path);
+                    mContext.getDiagnostics()->note(DiagMessage() << "linking " << path);
+                }
+
+                std::unique_ptr<io::IData> data = file.file->openAsData();
+                if (!data) {
+                    mContext.getDiagnostics()->error(DiagMessage(file.file->getSource())
+                                                     << "failed to open file");
+                    return 1;
                 }
 
                 std::unique_ptr<xml::XmlResource> xmlRes = loadBinaryXmlSkipFileExport(
-                        file.source.path);
+                        file.file->getSource(), data->data(), data->size(),
+                        mContext.getDiagnostics());
                 if (!xmlRes) {
                     return 1;
                 }
 
-                xmlRes->file = std::move(file.file);
+                // Move the file description over.
+                xmlRes->file = std::move(*file.fileExport);
 
                 XmlReferenceLinker xmlLinker;
                 if (xmlLinker.consume(&mContext, xmlRes.get())) {
@@ -689,12 +750,13 @@
                                                                     xmlRes->file.config,
                                                                     sdkLevel)) {
                                 xmlRes->file.config.sdkVersion = sdkLevel;
-                                if (!mFinalTable.addFileReference(xmlRes->file.name,
-                                                                  xmlRes->file.config,
-                                                                  xmlRes->file.source,
-                                                                  util::utf8ToUtf16(
-                                                                     buildResourceFileName(xmlRes->file)),
-                                                             mContext.getDiagnostics())) {
+                                bool added = mFinalTable.addFileReference(
+                                        xmlRes->file.name,
+                                        xmlRes->file.config,
+                                        xmlRes->file.source,
+                                        util::utf8ToUtf16(buildResourceFileName(xmlRes->file)),
+                                        mContext.getDiagnostics());
+                                if (!added) {
                                     error = true;
                                     continue;
                                 }
@@ -712,11 +774,10 @@
                 }
             } else {
                 if (mOptions.verbose) {
-                    mContext.getDiagnostics()->note(DiagMessage() << "copying "
-                                                    << file.source.path);
+                    mContext.getDiagnostics()->note(DiagMessage() << "copying " << path);
                 }
 
-                if (!copyFileToArchive(file.source.path, buildResourceFileName(file.file), 0,
+                if (!copyFileToArchive(file.file, buildResourceFileName(*file.fileExport), 0,
                                        archiveWriter.get())) {
                     error = true;
                 }
@@ -802,14 +863,18 @@
     ResourceTable mFinalTable;
     std::unique_ptr<TableMerger> mTableMerger;
 
+    io::FileCollection* mFileCollection;
+    std::vector<std::unique_ptr<io::IFileCollection>> mCollections;
+
     struct FileToProcess {
-        ResourceFile file;
-        Source source;
+        std::unique_ptr<ResourceFile> fileExport;
+        io::IFile* file;
     };
 
     struct FileToProcessComparator {
         bool operator()(const FileToProcess& a, const FileToProcess& b) {
-            return std::tie(a.file.name, a.file.config) < std::tie(b.file.name, b.file.config);
+            return std::tie(a.fileExport->name, a.fileExport->config) <
+                    std::tie(b.fileExport->name, b.fileExport->config);
         }
     };
 
diff --git a/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java b/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java
deleted file mode 100644
index 78aedc5..0000000
--- a/tools/layoutlib/bridge/src/android/animation/FakeAnimator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-package android.animation;
-
-/**
- * A fake implementation of Animator which doesn't do anything.
- */
-public class FakeAnimator extends Animator {
-    @Override
-    public long getStartDelay() {
-        return 0;
-    }
-
-    @Override
-    public void setStartDelay(long startDelay) {
-
-    }
-
-    @Override
-    public Animator setDuration(long duration) {
-        return this;
-    }
-
-    @Override
-    public long getDuration() {
-        return 0;
-    }
-
-    @Override
-    public void setInterpolator(TimeInterpolator value) {
-
-    }
-
-    @Override
-    public boolean isRunning() {
-        return false;
-    }
-}
diff --git a/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java b/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java
index 4603b63..54021c9 100644
--- a/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java
@@ -16,9 +16,16 @@
 
 package android.animation;
 
+import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Delegate implementing the native methods of android.animation.PropertyValuesHolder
  *
@@ -29,81 +36,161 @@
  * around to map int to instance of the delegate.
  *
  * The main goal of this class' methods are to provide a native way to access setters and getters
- * on some object. In this case we want to default to using Java reflection instead so the native
- * methods do nothing.
+ * on some object. We override these methods to use reflection since the original reflection
+ * implementation of the PropertyValuesHolder won't be able to access protected methods.
  *
  */
-/*package*/ class PropertyValuesHolder_Delegate {
+/*package*/
+@SuppressWarnings("unused")
+class PropertyValuesHolder_Delegate {
+    // This code is copied from android.animation.PropertyValuesHolder and must be kept in sync
+    // We try several different types when searching for appropriate setter/getter functions.
+    // The caller may have supplied values in a type that does not match the setter/getter
+    // functions (such as the integers 0 and 1 to represent floating point values for alpha).
+    // Also, the use of generics in constructors means that we end up with the Object versions
+    // of primitive types (Float vs. float). But most likely, the setter/getter functions
+    // will take primitive types instead.
+    // So we supply an ordered array of other types to try before giving up.
+    private static Class[] FLOAT_VARIANTS = {float.class, Float.class, double.class, int.class,
+            Double.class, Integer.class};
+    private static Class[] INTEGER_VARIANTS = {int.class, Integer.class, float.class, double.class,
+            Float.class, Double.class};
+
+    private static final Object sMethodIndexLock = new Object();
+    private static final Map<Long, Method> ID_TO_METHOD = new HashMap<Long, Method>();
+    private static final Map<String, Long> METHOD_NAME_TO_ID = new HashMap<String, Long>();
+    private static long sNextId = 1;
+
+    private static long registerMethod(Class<?> targetClass, String methodName, Class[] types,
+            int nArgs) {
+        // Encode the number of arguments in the method name
+        String methodIndexName = String.format("%1$s#%2$d", methodName, nArgs);
+        synchronized (sMethodIndexLock) {
+            Long methodId = METHOD_NAME_TO_ID.get(methodIndexName);
+
+            if (methodId != null) {
+                // The method was already registered
+                return methodId;
+            }
+
+            Class[] args = new Class[nArgs];
+            Method method = null;
+            for (Class typeVariant : types) {
+                for (int i = 0; i < nArgs; i++) {
+                    args[i] = typeVariant;
+                }
+                try {
+                    method = targetClass.getDeclaredMethod(methodName, args);
+                } catch (NoSuchMethodException ignore) {
+                }
+            }
+
+            if (method != null) {
+                methodId = sNextId++;
+                ID_TO_METHOD.put(methodId, method);
+                METHOD_NAME_TO_ID.put(methodIndexName, methodId);
+
+                return methodId;
+            }
+        }
+
+        // Method not found
+        return 0;
+    }
+
+    private static void callMethod(Object target, long methodID, Object... args) {
+        Method method = ID_TO_METHOD.get(methodID);
+        assert method != null;
+
+        try {
+            method.setAccessible(true);
+            method.invoke(target, args);
+        } catch (IllegalAccessException e) {
+            Bridge.getLog().error(null, "Unable to update property during animation", e, null);
+        } catch (InvocationTargetException e) {
+            Bridge.getLog().error(null, "Unable to update property during animation", e, null);
+        }
+    }
 
     @LayoutlibDelegate
     /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) {
-        // return 0 to force PropertyValuesHolder to use Java reflection.
-        return 0;
+        return nGetMultipleIntMethod(targetClass, methodName, 1);
     }
 
     @LayoutlibDelegate
     /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) {
-        // return 0 to force PropertyValuesHolder to use Java reflection.
-        return 0;
+        return nGetMultipleFloatMethod(targetClass, methodName, 1);
     }
 
     @LayoutlibDelegate
     /*package*/ static long nGetMultipleIntMethod(Class<?> targetClass, String methodName,
             int numParams) {
-        // TODO: return the right thing.
-        return 0;
+        return registerMethod(targetClass, methodName, INTEGER_VARIANTS, numParams);
     }
 
     @LayoutlibDelegate
     /*package*/ static long nGetMultipleFloatMethod(Class<?> targetClass, String methodName,
             int numParams) {
-        // TODO: return the right thing.
-        return 0;
+        return registerMethod(targetClass, methodName, FLOAT_VARIANTS, numParams);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) {
-        // do nothing
+        callMethod(target, methodID, arg);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) {
-        // do nothing
+        callMethod(target, methodID, arg);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallTwoIntMethod(Object target, long methodID, int arg1,
             int arg2) {
-        // do nothing
+        callMethod(target, methodID, arg1, arg2);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallFourIntMethod(Object target, long methodID, int arg1,
             int arg2, int arg3, int arg4) {
-        // do nothing
+        callMethod(target, methodID, arg1, arg2, arg3, arg4);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallMultipleIntMethod(Object target, long methodID,
             int[] args) {
-        // do nothing
+        assert args != null;
+
+        // Box parameters
+        Object[] params = new Object[args.length];
+        for (int i = 0; i < args.length; i++) {
+            params[i] = args;
+        }
+        callMethod(target, methodID, params);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallTwoFloatMethod(Object target, long methodID, float arg1,
             float arg2) {
-        // do nothing
+        callMethod(target, methodID, arg1, arg2);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallFourFloatMethod(Object target, long methodID, float arg1,
             float arg2, float arg3, float arg4) {
-        // do nothing
+        callMethod(target, methodID, arg1, arg2, arg3, arg4);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nCallMultipleFloatMethod(Object target, long methodID,
             float[] args) {
-        // do nothing
+        assert args != null;
+
+        // Box parameters
+        Object[] params = new Object[args.length];
+        for (int i = 0; i < args.length; i++) {
+            params[i] = args;
+        }
+        callMethod(target, methodID, params);
     }
 }
diff --git a/tools/layoutlib/bridge/src/android/graphics/PathMeasure_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PathMeasure_Delegate.java
index dd2978f..3c71233 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PathMeasure_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PathMeasure_Delegate.java
@@ -44,7 +44,7 @@
 
     // ---- delegate data ----
     // This governs how accurate the approximation of the Path is.
-    private static final float PRECISION = 0.002f;
+    private static final float PRECISION = 0.0002f;
 
     /**
      * Array containing the path points components. There are three components for each point:
diff --git a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
index 5f0d98b..9677aaf 100644
--- a/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/os/SystemClock_Delegate.java
@@ -18,6 +18,7 @@
 
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+import com.android.tools.layoutlib.java.System_Delegate;
 
 /**
  * Delegate implementing the native methods of android.os.SystemClock
@@ -30,9 +31,6 @@
  *
  */
 public class SystemClock_Delegate {
-    private static long sBootTime = System.currentTimeMillis();
-    private static long sBootTimeNano = System.nanoTime();
-
     /**
      * Returns milliseconds since boot, not counting time spent in deep sleep.
      * <b>Note:</b> This value may get reset occasionally (before it would
@@ -42,7 +40,7 @@
      */
     @LayoutlibDelegate
     /*package*/ static long uptimeMillis() {
-        return System.currentTimeMillis() - sBootTime;
+        return System_Delegate.currentTimeMillis() - System_Delegate.bootTimeMillis();
     }
 
     /**
@@ -52,7 +50,7 @@
      */
     @LayoutlibDelegate
     /*package*/ static long elapsedRealtime() {
-        return System.currentTimeMillis() - sBootTime;
+        return System_Delegate.currentTimeMillis() - System_Delegate.bootTimeMillis();
     }
 
     /**
@@ -62,7 +60,7 @@
      */
     @LayoutlibDelegate
     /*package*/ static long elapsedRealtimeNanos() {
-        return System.nanoTime() - sBootTimeNano;
+        return System_Delegate.nanoTime() - System_Delegate.bootTime();
     }
 
     /**
@@ -72,7 +70,7 @@
      */
     @LayoutlibDelegate
     /*package*/ static long currentThreadTimeMillis() {
-        return System.currentTimeMillis();
+        return System_Delegate.currentTimeMillis();
     }
 
     /**
@@ -84,7 +82,7 @@
      */
     @LayoutlibDelegate
     /*package*/ static long currentThreadTimeMicro() {
-        return System.currentTimeMillis() * 1000;
+        return System_Delegate.currentTimeMillis() * 1000;
     }
 
     /**
diff --git a/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java b/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
index f75ee50..01af669 100644
--- a/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/Choreographer_Delegate.java
@@ -17,6 +17,8 @@
 
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
+import java.util.concurrent.atomic.AtomicReference;
+
 /**
  * Delegate used to provide new implementation of a select few methods of {@link Choreographer}
  *
@@ -25,9 +27,41 @@
  *
  */
 public class Choreographer_Delegate {
+    static final AtomicReference<Choreographer> mInstance = new AtomicReference<Choreographer>();
+
+    @LayoutlibDelegate
+    public static Choreographer getInstance() {
+        if (mInstance.get() == null) {
+            mInstance.compareAndSet(null, Choreographer.getInstance_Original());
+        }
+
+        return mInstance.get();
+    }
 
     @LayoutlibDelegate
     public static float getRefreshRate() {
         return 60.f;
     }
+
+    @LayoutlibDelegate
+    static void scheduleVsyncLocked(Choreographer thisChoreographer) {
+        // do nothing
+    }
+
+    public static void doFrame(long frameTimeNanos) {
+        Choreographer thisChoreographer = Choreographer.getInstance();
+
+        thisChoreographer.mLastFrameTimeNanos = frameTimeNanos;
+
+        thisChoreographer.mFrameInfo.markInputHandlingStart();
+        thisChoreographer.doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos);
+
+        thisChoreographer.mFrameInfo.markAnimationsStart();
+        thisChoreographer.doCallbacks(Choreographer.CALLBACK_ANIMATION, frameTimeNanos);
+
+        thisChoreographer.mFrameInfo.markPerformTraversalsStart();
+        thisChoreographer.doCallbacks(Choreographer.CALLBACK_TRAVERSAL, frameTimeNanos);
+
+        thisChoreographer.doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos);
+    }
 }
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index 6951ede..40437fa 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -321,7 +321,7 @@
     }
 
     @Override
-    public void setAppTask(IBinder arg0, int arg1, Rect arg2, Configuration arg3)
+    public void setAppTask(IBinder arg0, int arg1, int arg2, Rect arg3, Configuration arg4)
             throws RemoteException {
         // TODO Auto-generated method stub
     }
@@ -541,4 +541,8 @@
     @Override
     public void endProlongedAnimations() {
     }
+
+    @Override
+    public void registerDockDividerVisibilityListener(IDockDividerVisibilityListener listener) {
+    }
 }
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 48ca7d8..683c4aa 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -183,7 +183,7 @@
      */
     private static LayoutLog sCurrentLog = sDefaultLog;
 
-    private static final int LAST_SUPPORTED_FEATURE = Features.RECYCLER_VIEW_ADAPTER;
+    private static final int LAST_SUPPORTED_FEATURE = Features.CHOREOGRAPHER;
 
     @Override
     public int getApiLevel() {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index feb2590..2ac212c 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -23,6 +23,7 @@
 import com.android.ide.common.rendering.api.Result;
 import com.android.ide.common.rendering.api.ViewInfo;
 import com.android.layoutlib.bridge.impl.RenderSessionImpl;
+import com.android.tools.layoutlib.java.System_Delegate;
 
 import android.view.View;
 import android.view.ViewGroup;
@@ -191,6 +192,21 @@
     }
 
     @Override
+    public void setSystemTimeNanos(long nanos) {
+        System_Delegate.setNanosTime(nanos);
+    }
+
+    @Override
+    public void setSystemBootTimeNanos(long nanos) {
+        System_Delegate.setBootTimeNanos(nanos);
+    }
+
+    @Override
+    public void setElapsedFrameTimeNanos(long nanos) {
+        mSession.setElapsedFrameTimeNanos(nanos);
+    }
+
+    @Override
     public void dispose() {
     }
 
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 0fcfa78..ff15f3b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -1438,6 +1438,14 @@
     }
 
     @Override
+    public SharedPreferences getSharedPreferences(File arg0, int arg1) {
+        if (mSharedPreferences == null) {
+            mSharedPreferences = new BridgeSharedPreferences();
+        }
+        return mSharedPreferences;
+    }
+
+    @Override
     public Drawable getWallpaper() {
         // pass
         return null;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 0ffa357..ec50cfe 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -46,6 +46,7 @@
 import com.android.layoutlib.bridge.impl.binding.FakeAdapter;
 import com.android.layoutlib.bridge.impl.binding.FakeExpandableAdapter;
 import com.android.resources.ResourceType;
+import com.android.tools.layoutlib.java.System_Delegate;
 import com.android.util.Pair;
 
 import android.animation.AnimationThread;
@@ -62,6 +63,7 @@
 import android.preference.Preference_Delegate;
 import android.view.AttachInfo_Accessor;
 import android.view.BridgeInflater;
+import android.view.Choreographer_Delegate;
 import android.view.IWindowManager;
 import android.view.IWindowManagerImpl;
 import android.view.Surface;
@@ -120,6 +122,10 @@
     private int mMeasuredScreenWidth = -1;
     private int mMeasuredScreenHeight = -1;
     private boolean mIsAlphaChannelImage;
+    /** If >= 0, a frame will be executed */
+    private long mElapsedFrameTimeNanos = -1;
+    /** True if one frame has been already executed to start the animations */
+    private boolean mFirstFrameExecuted = false;
 
     // information being returned through the API
     private BufferedImage mImage;
@@ -252,6 +258,14 @@
     }
 
     /**
+     * Sets the time for which the next frame will be selected. The time is the elapsed time from
+     * the current system nanos time. You
+     */
+    public void setElapsedFrameTimeNanos(long nanos) {
+        mElapsedFrameTimeNanos = nanos;
+    }
+
+    /**
      * Renders the scene.
      * <p>
      * {@link #acquire(long)} must have been called before this.
@@ -428,6 +442,16 @@
                     gc.dispose();
                 }
 
+                if (mElapsedFrameTimeNanos >= 0) {
+                    long initialTime = System_Delegate.nanoTime();
+                    if (!mFirstFrameExecuted) {
+                        // The first frame will initialize the animations
+                        Choreographer_Delegate.doFrame(initialTime);
+                        mFirstFrameExecuted = true;
+                    }
+                    // Second frame will move the animations
+                    Choreographer_Delegate.doFrame(initialTime + mElapsedFrameTimeNanos);
+                }
                 mViewRoot.draw(mCanvas);
             }
 
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector.png
new file mode 100644
index 0000000..9f26627
--- /dev/null
+++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector.png
Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector_1.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector_1.png
new file mode 100644
index 0000000..89009be
--- /dev/null
+++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/animated_vector_1.png
Binary files differ
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/src/main/res/layout/indeterminate_progressbar.xml b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/src/main/res/layout/indeterminate_progressbar.xml
new file mode 100644
index 0000000..70d7396
--- /dev/null
+++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/src/main/res/layout/indeterminate_progressbar.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:padding="16dp"
+              android:orientation="horizontal"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent">
+
+    <ProgressBar
+             android:layout_height="fill_parent"
+             android:layout_width="fill_parent" />
+
+</LinearLayout>
+
diff --git a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
index 9ebeebd..2dca07c 100644
--- a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
+++ b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
@@ -48,6 +48,8 @@
 import java.net.URL;
 import java.util.Arrays;
 import java.util.Comparator;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import static org.junit.Assert.fail;
 
@@ -348,16 +350,46 @@
         renderAndVerify(params, "expand_horz_layout.png");
     }
 
+    /** Test expand_layout.xml */
+    @Test
+    public void testVectorAnimation() throws ClassNotFoundException {
+        // Create the layout pull parser.
+        LayoutPullParser parser = new LayoutPullParser(APP_TEST_RES + "/layout/" +
+                "indeterminate_progressbar.xml");
+        // Create LayoutLibCallback.
+        LayoutLibTestCallback layoutLibCallback = new LayoutLibTestCallback(getLogger());
+        layoutLibCallback.initResources();
+
+        SessionParams params = getSessionParams(parser, ConfigGenerator.NEXUS_5,
+                layoutLibCallback, "Theme.Material.NoActionBar.Fullscreen", false,
+                RenderingMode.V_SCROLL, 22);
+
+        renderAndVerify(params, "animated_vector.png", TimeUnit.SECONDS.toNanos(2));
+
+        parser = new LayoutPullParser(APP_TEST_RES + "/layout/" +
+                "indeterminate_progressbar.xml");
+        params = getSessionParams(parser, ConfigGenerator.NEXUS_5,
+                layoutLibCallback, "Theme.Material.NoActionBar.Fullscreen", false,
+                RenderingMode.V_SCROLL, 22);
+        renderAndVerify(params, "animated_vector_1.png", TimeUnit.SECONDS.toNanos(3));
+    }
+
     /**
      * Create a new rendering session and test that rendering given layout on nexus 5
      * doesn't throw any exceptions and matches the provided image.
+     * <p/>If frameTimeNanos is >= 0 a frame will be executed during the rendering. The time
+     * indicates how far in the future is.
      */
-    private void renderAndVerify(SessionParams params, String goldenFileName)
+    private void renderAndVerify(SessionParams params, String goldenFileName, long frameTimeNanos)
             throws ClassNotFoundException {
         // TODO: Set up action bar handler properly to test menu rendering.
         // Create session params.
         RenderSession session = sBridge.createSession(params);
 
+        if (frameTimeNanos != -1) {
+            session.setElapsedFrameTimeNanos(frameTimeNanos);
+        }
+
         if (!session.getResult().isSuccess()) {
             getLogger().error(session.getResult().getException(),
                     session.getResult().getErrorMessage());
@@ -380,6 +412,15 @@
      * Create a new rendering session and test that rendering given layout on nexus 5
      * doesn't throw any exceptions and matches the provided image.
      */
+    private void renderAndVerify(SessionParams params, String goldenFileName)
+            throws ClassNotFoundException {
+        renderAndVerify(params, goldenFileName, -1);
+    }
+
+    /**
+     * Create a new rendering session and test that rendering given layout on nexus 5
+     * doesn't throw any exceptions and matches the provided image.
+     */
     private void renderAndVerify(String layoutFileName, String goldenFileName)
             throws ClassNotFoundException {
         // Create the layout pull parser.
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
index f6c2626..8f0ad01 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
@@ -77,6 +77,8 @@
     /** Methods to inject. FQCN of class in which method should be injected => runnable that does
      * the injection. */
     private final Map<String, ICreateInfo.InjectMethodRunnable> mInjectedMethodsMap;
+    /** A map { FQCN => set { field names } } which should be promoted to public visibility */
+    private final Map<String, Set<String>> mPromotedFields;
 
     /**
      * Creates a new generator that can generate the output JAR with the stubbed classes.
@@ -109,20 +111,8 @@
 
         // Create the map/set of methods to change to delegates
         mDelegateMethods = new HashMap<String, Set<String>>();
-        for (String signature : createInfo.getDelegateMethods()) {
-            int pos = signature.indexOf('#');
-            if (pos <= 0 || pos >= signature.length() - 1) {
-                continue;
-            }
-            String className = binaryToInternalClassName(signature.substring(0, pos));
-            String methodName = signature.substring(pos + 1);
-            Set<String> methods = mDelegateMethods.get(className);
-            if (methods == null) {
-                methods = new HashSet<String>();
-                mDelegateMethods.put(className, methods);
-            }
-            methods.add(methodName);
-        }
+        addToMap(createInfo.getDelegateMethods(), mDelegateMethods);
+
         for (String className : createInfo.getDelegateClassNatives()) {
             className = binaryToInternalClassName(className);
             Set<String> methods = mDelegateMethods.get(className);
@@ -187,10 +177,34 @@
             returnTypes.add(binaryToInternalClassName(className));
         }
 
+        mPromotedFields = new HashMap<String, Set<String>>();
+        addToMap(createInfo.getPromotedFields(), mPromotedFields);
+
         mInjectedMethodsMap = createInfo.getInjectedMethodsMap();
     }
 
     /**
+     * For each value in the array, split the value on '#' and add the parts to the map as key
+     * and value.
+     */
+    private void addToMap(String[] entries, Map<String, Set<String>> map) {
+        for (String entry : entries) {
+            int pos = entry.indexOf('#');
+            if (pos <= 0 || pos >= entry.length() - 1) {
+                return;
+            }
+            String className = binaryToInternalClassName(entry.substring(0, pos));
+            String methodOrFieldName = entry.substring(pos + 1);
+            Set<String> set = map.get(className);
+            if (set == null) {
+                set = new HashSet<String>();
+                map.put(className, set);
+            }
+            set.add(methodOrFieldName);
+        }
+    }
+
+    /**
      * Returns the list of classes that have not been renamed yet.
      * <p/>
      * The names are "internal class names" rather than FQCN, i.e. they use "/" instead "."
@@ -380,6 +394,10 @@
             }
         }
 
+        Set<String> promoteFields = mPromotedFields.get(className);
+        if (promoteFields != null && !promoteFields.isEmpty()) {
+            cv = new PromoteFieldClassAdapter(cv, promoteFields);
+        }
         cr.accept(cv, 0);
         return cw.toByteArray();
     }
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index e480ead..b571c5a 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -120,6 +120,11 @@
     }
 
     @Override
+    public String[] getPromotedFields() {
+        return PROMOTED_FIELDS;
+    }
+
+    @Override
     public Map<String, InjectMethodRunnable> getInjectedMethodsMap() {
         return INJECTED_METHODS;
     }
@@ -169,7 +174,9 @@
         "android.text.format.DateFormat#is24HourFormat",
         "android.text.Hyphenator#getSystemHyphenatorLocation",
         "android.util.Xml#newPullParser",
+        "android.view.Choreographer#getInstance",
         "android.view.Choreographer#getRefreshRate",
+        "android.view.Choreographer#scheduleVsyncLocked",
         "android.view.Display#updateDisplayInfoLocked",
         "android.view.Display#getWindowManager",
         "android.view.LayoutInflater#rInflate",
@@ -290,6 +297,10 @@
             "org.kxml2.io.KXmlParser"
         };
 
+    private final static String[] PROMOTED_FIELDS = new String[] {
+        "android.view.Choreographer#mLastFrameTimeNanos"
+    };
+
     /**
      * List of classes for which the methods returning them should be deleted.
      * The array contains a list of null terminated section starting with the name of the class
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ICreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ICreateInfo.java
index 54b1fe6..6c62423 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ICreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ICreateInfo.java
@@ -78,6 +78,13 @@
     Set<String> getExcludedClasses();
 
     /**
+     * Returns a list of fields which should be promoted to public visibility. The array values
+     * are in the form of the binary FQCN of the class containing the field and the field name
+     * separated by a '#'.
+     */
+    String[] getPromotedFields();
+
+    /**
      * Returns a map from binary FQCN className to {@link InjectMethodRunnable} which will be
      * called to inject methods into a class.
      * Can be empty but must not be null.
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/PromoteFieldClassAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/PromoteFieldClassAdapter.java
new file mode 100644
index 0000000..e4b70da
--- /dev/null
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/PromoteFieldClassAdapter.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tools.layoutlib.create;
+
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+
+import java.util.Set;
+
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ASM4;
+
+/**
+ * Promotes given fields to public visibility.
+ */
+public class PromoteFieldClassAdapter extends ClassVisitor {
+
+    private final Set<String> mFieldNames;
+    private static final int ACC_NOT_PUBLIC = ~(ACC_PRIVATE | ACC_PROTECTED);
+
+    public PromoteFieldClassAdapter(ClassVisitor cv, Set<String> fieldNames) {
+        super(ASM4, cv);
+        mFieldNames = fieldNames;
+    }
+
+    @Override
+    public FieldVisitor visitField(int access, String name, String desc, String signature,
+            Object value) {
+        if (mFieldNames.contains(name)) {
+            if ((access & ACC_PUBLIC) == 0) {
+                access = (access & ACC_NOT_PUBLIC) | ACC_PUBLIC;
+            }
+        }
+        return super.visitField(access, name, desc, signature, value);
+    }
+}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
index 0b85c48..5e47261 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
@@ -134,7 +134,33 @@
             }
         });
 
-        // Case 5: java.util.LinkedHashMap.eldest()
+        // Case 5: java.lang.System time calls
+        METHOD_REPLACERS.add(new MethodReplacer() {
+            @Override
+            public boolean isNeeded(String owner, String name, String desc, String sourceClass) {
+                return JAVA_LANG_SYSTEM.equals(owner) && name.equals("nanoTime");
+            }
+
+            @Override
+            public void replace(MethodInformation mi) {
+                mi.name = "nanoTime";
+                mi.owner = Type.getInternalName(System_Delegate.class);
+            }
+        });
+        METHOD_REPLACERS.add(new MethodReplacer() {
+            @Override
+            public boolean isNeeded(String owner, String name, String desc, String sourceClass) {
+                return JAVA_LANG_SYSTEM.equals(owner) && name.equals("currentTimeMillis");
+            }
+
+            @Override
+            public void replace(MethodInformation mi) {
+                mi.name = "currentTimeMillis";
+                mi.owner = Type.getInternalName(System_Delegate.class);
+            }
+        });
+
+        // Case 6: java.util.LinkedHashMap.eldest()
         METHOD_REPLACERS.add(new MethodReplacer() {
 
             private final String VOID_TO_MAP_ENTRY =
@@ -157,7 +183,7 @@
             }
         });
 
-        // Case 6: android.content.Context.getClassLoader() in LayoutInflater
+        // Case 7: android.content.Context.getClassLoader() in LayoutInflater
         METHOD_REPLACERS.add(new MethodReplacer() {
             // When LayoutInflater asks for a class loader, we must return the class loader that
             // cannot return app's custom views/classes. This is so that in case of any failure
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java
index 613c8d9..be93744 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java
@@ -18,12 +18,22 @@
 
 import com.android.tools.layoutlib.create.ReplaceMethodCallsAdapter;
 
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * Provides dummy implementation of methods that don't exist on the host VM.
+ * This also providers a time control that allows to set a specific system time.
  *
  * @see ReplaceMethodCallsAdapter
  */
+@SuppressWarnings("unused")
 public class System_Delegate {
+    // Current system time
+    private static AtomicLong mNanosTime = new AtomicLong(System.nanoTime());
+    // Time that the system booted up in nanos
+    private static AtomicLong mBootNanosTime = new AtomicLong(System.nanoTime());
+
     public static void log(String message) {
         // ignore.
     }
@@ -31,4 +41,28 @@
     public static void log(String message, Throwable th) {
         // ignore.
     }
+
+    public static void setNanosTime(long nanos) {
+        mNanosTime.set(nanos);
+    }
+
+    public static void setBootTimeNanos(long nanos) {
+        mBootNanosTime.set(nanos);
+    }
+
+    public static long nanoTime() {
+        return mNanosTime.get();
+    }
+
+    public static long currentTimeMillis() {
+        return TimeUnit.NANOSECONDS.toMillis(mNanosTime.get());
+    }
+
+    public static long bootTime() {
+        return mBootNanosTime.get();
+    }
+
+    public static long bootTimeMillis() {
+        return TimeUnit.NANOSECONDS.toMillis(mBootNanosTime.get());
+    }
 }
diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java
index 2c21470..8a2235b 100644
--- a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java
+++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java
@@ -138,6 +138,11 @@
             }
 
             @Override
+            public String[] getPromotedFields() {
+                return new String[0];
+            }
+
+            @Override
             public Map<String, InjectMethodRunnable> getInjectedMethodsMap() {
                 return new HashMap<String, InjectMethodRunnable>(0);
             }
@@ -213,6 +218,11 @@
             }
 
             @Override
+            public String[] getPromotedFields() {
+                return new String[0];
+            }
+
+            @Override
             public Map<String, InjectMethodRunnable> getInjectedMethodsMap() {
                 return new HashMap<String, InjectMethodRunnable>(0);
             }
@@ -296,6 +306,11 @@
             }
 
             @Override
+            public String[] getPromotedFields() {
+                return new String[0];
+            }
+
+            @Override
             public Map<String, InjectMethodRunnable> getInjectedMethodsMap() {
                 return new HashMap<String, InjectMethodRunnable>(0);
             }
@@ -374,6 +389,11 @@
             }
 
             @Override
+            public String[] getPromotedFields() {
+                return new String[0];
+            }
+
+            @Override
             public Map<String, InjectMethodRunnable> getInjectedMethodsMap() {
                 HashMap<String, InjectMethodRunnable> map =
                         new HashMap<String, InjectMethodRunnable>(1);
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index bd030e8..3fb9667 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -665,7 +665,7 @@
      * </ul>
      * @return a list of network configurations in the form of a list
      * of {@link WifiConfiguration} objects. Upon failure to fetch or
-     * when when Wi-Fi is turned off, it can be null.
+     * when Wi-Fi is turned off, it can be null.
      */
     public List<WifiConfiguration> getConfiguredNetworks() {
         try {
@@ -2173,7 +2173,7 @@
      * is idle.
      * <p>
      * Any application using a WifiLock must request the {@code android.permission.WAKE_LOCK}
-     * permission in an {@code &lt;uses-permission&gt;} element of the application's manifest.
+     * permission in an {@code <uses-permission>} element of the application's manifest.
      */
     public class WifiLock {
         private String mTag;
diff --git a/wifi/java/android/net/wifi/p2p/package.html b/wifi/java/android/net/wifi/p2p/package.html
index 94d695f..6a5e8e6 100644
--- a/wifi/java/android/net/wifi/p2p/package.html
+++ b/wifi/java/android/net/wifi/p2p/package.html
@@ -56,7 +56,7 @@
 
 <p class="note"><strong>Note:</strong> Not all Android-powered devices support Wi-Fi
 Direct. If your application uses Wi-Fi Direct, declare so with a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element in the manifest file:</p>
 <pre>
 &lt;manifest ...>
diff --git a/wifi/java/android/net/wifi/package.html b/wifi/java/android/net/wifi/package.html
index 6f0d337..b21d39d 100644
--- a/wifi/java/android/net/wifi/package.html
+++ b/wifi/java/android/net/wifi/package.html
@@ -17,7 +17,7 @@
 
 <p class="note"><strong>Note:</strong> Not all Android-powered devices provide Wi-Fi functionality.
 If your application uses Wi-Fi, declare so with a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
+href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
 element in the manifest file:</p>
 <pre>
 &lt;manifest ...>