Merge "TIF: Use per-user ContentResolver in the TvInputManagerService" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index d266f1e..aa07a97 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -105,12 +105,9 @@
     field public static final deprecated java.lang.String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE";
     field public static final java.lang.String READ_LOGS = "android.permission.READ_LOGS";
     field public static final java.lang.String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
-    field public static final deprecated java.lang.String READ_PROFILE = "android.permission.READ_PROFILE";
     field public static final java.lang.String READ_SMS = "android.permission.READ_SMS";
-    field public static final deprecated java.lang.String READ_SOCIAL_STREAM = "android.permission.READ_SOCIAL_STREAM";
     field public static final java.lang.String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
     field public static final java.lang.String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
-    field public static final java.lang.String READ_USER_DICTIONARY = "android.permission.READ_USER_DICTIONARY";
     field public static final java.lang.String READ_VOICEMAIL = "com.android.voicemail.permission.READ_VOICEMAIL";
     field public static final java.lang.String REBOOT = "android.permission.REBOOT";
     field public static final java.lang.String RECEIVE_BOOT_COMPLETED = "android.permission.RECEIVE_BOOT_COMPLETED";
@@ -152,12 +149,9 @@
     field public static final java.lang.String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
     field public static final java.lang.String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
     field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
-    field public static final deprecated java.lang.String WRITE_PROFILE = "android.permission.WRITE_PROFILE";
     field public static final java.lang.String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS";
     field public static final java.lang.String WRITE_SETTINGS = "android.permission.WRITE_SETTINGS";
-    field public static final deprecated java.lang.String WRITE_SOCIAL_STREAM = "android.permission.WRITE_SOCIAL_STREAM";
     field public static final java.lang.String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS";
-    field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission.WRITE_USER_DICTIONARY";
     field public static final java.lang.String WRITE_VOICEMAIL = "com.android.voicemail.permission.WRITE_VOICEMAIL";
   }
 
@@ -172,9 +166,7 @@
     field public static final java.lang.String PHONE = "android.permission-group.PHONE";
     field public static final java.lang.String SENSORS = "android.permission-group.SENSORS";
     field public static final java.lang.String SMS = "android.permission-group.SMS";
-    field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO";
     field public static final java.lang.String STORAGE = "android.permission-group.STORAGE";
-    field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY";
   }
 
   public final class R {
@@ -12461,6 +12453,9 @@
     method public android.graphics.drawable.Drawable loadDrawable(android.content.Context);
     method public void loadDrawableAsync(android.content.Context, android.os.Message);
     method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
+    method public android.graphics.drawable.Icon setTint(int);
+    method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
+    method public android.graphics.drawable.Icon setTintMode(android.graphics.PorterDuff.Mode);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
   }
@@ -25572,10 +25567,6 @@
     field public static final java.lang.String PHOTO_FILE_ID = "data14";
   }
 
-  public static final deprecated class ContactsContract.Contacts.StreamItems implements android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
-  }
-
   protected static abstract interface ContactsContract.ContactsColumns {
     field public static final java.lang.String CONTACT_LAST_UPDATED_TIMESTAMP = "contact_last_updated_timestamp";
     field public static final java.lang.String DISPLAY_NAME = "display_name";
@@ -25891,10 +25882,6 @@
     field public static final java.lang.String DATA_ID = "data_id";
   }
 
-  public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
-  }
-
   protected static abstract interface ContactsContract.RawContactsColumns {
     field public static final java.lang.String ACCOUNT_TYPE_AND_DATA_SET = "account_type_and_data_set";
     field public static final java.lang.String AGGREGATION_MODE = "aggregation_mode";
@@ -25965,56 +25952,6 @@
     field public static final android.net.Uri PROFILE_CONTENT_URI;
   }
 
-  public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String PHOTO = "photo";
-  }
-
-  protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
-    field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
-    field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
-    field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
-    field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
-    field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
-    field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
-    field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
-  }
-
-  public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
-    field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
-    field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
-    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
-    field public static final deprecated android.net.Uri CONTENT_URI;
-    field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
-  }
-
-  public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
-    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
-    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
-  }
-
-  protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
-    field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
-    field public static final deprecated java.lang.String COMMENTS = "comments";
-    field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
-    field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
-    field public static final deprecated java.lang.String DATA_SET = "data_set";
-    field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
-    field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
-    field public static final deprecated java.lang.String RES_ICON = "icon";
-    field public static final deprecated java.lang.String RES_LABEL = "label";
-    field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
-    field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
-    field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
-    field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
-    field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
-    field public static final deprecated java.lang.String TEXT = "text";
-    field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
-  }
-
   protected static abstract interface ContactsContract.SyncColumns implements android.provider.ContactsContract.BaseSyncColumns {
     field public static final java.lang.String ACCOUNT_NAME = "account_name";
     field public static final java.lang.String ACCOUNT_TYPE = "account_type";
@@ -36628,10 +36565,6 @@
     method public static android.animation.Animator createCircularReveal(android.view.View, int, int, float, float);
   }
 
-  public abstract deprecated class ViewAssistStructure extends android.view.ViewStructure {
-    ctor public ViewAssistStructure();
-  }
-
   public class ViewConfiguration {
     ctor public deprecated ViewConfiguration();
     method public static android.view.ViewConfiguration get(android.content.Context);
@@ -37013,7 +36946,7 @@
     ctor public ViewStructure();
     method public abstract int addChildCount(int);
     method public abstract void asyncCommit();
-    method public abstract android.view.ViewAssistStructure asyncNewChild(int);
+    method public abstract android.view.ViewStructure asyncNewChild(int);
     method public abstract int getChildCount();
     method public abstract android.os.Bundle getExtras();
     method public abstract java.lang.CharSequence getHint();
@@ -37021,7 +36954,7 @@
     method public abstract int getTextSelectionEnd();
     method public abstract int getTextSelectionStart();
     method public abstract boolean hasExtras();
-    method public abstract android.view.ViewAssistStructure newChild(int);
+    method public abstract android.view.ViewStructure newChild(int);
     method public abstract void setAccessibilityFocused(boolean);
     method public abstract void setActivated(boolean);
     method public abstract void setCheckable(boolean);
diff --git a/api/removed.txt b/api/removed.txt
index 2e6c685..7fc927b 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -117,6 +117,64 @@
     field public static final deprecated java.lang.String URL = "url";
   }
 
+  public static final deprecated class ContactsContract.Contacts.StreamItems {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
+  }
+
+  public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
+  }
+
+  public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String PHOTO = "photo";
+  }
+
+  protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
+    field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
+    field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
+    field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
+    field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
+    field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
+    field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
+    field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
+    field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
+  }
+
+  public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
+    field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
+    field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
+    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
+    field public static final deprecated android.net.Uri CONTENT_URI;
+    field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
+  }
+
+  public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
+    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
+    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
+  }
+
+  protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
+    field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
+    field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
+    field public static final deprecated java.lang.String COMMENTS = "comments";
+    field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
+    field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
+    field public static final deprecated java.lang.String DATA_SET = "data_set";
+    field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
+    field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
+    field public static final deprecated java.lang.String RES_ICON = "icon";
+    field public static final deprecated java.lang.String RES_LABEL = "label";
+    field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
+    field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
+    field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
+    field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
+    field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
+    field public static final deprecated java.lang.String TEXT = "text";
+    field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
+  }
+
   public static final class Settings.System extends android.provider.Settings.NameValueTable {
     field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
     field public static final java.lang.String VOLUME_ALARM = "volume_alarm";
diff --git a/api/system-current.txt b/api/system-current.txt
index a7c0f49..a245a3e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -156,13 +156,10 @@
     field public static final java.lang.String READ_NETWORK_USAGE_HISTORY = "android.permission.READ_NETWORK_USAGE_HISTORY";
     field public static final java.lang.String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
     field public static final java.lang.String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
-    field public static final deprecated java.lang.String READ_PROFILE = "android.permission.READ_PROFILE";
     field public static final java.lang.String READ_SEARCH_INDEXABLES = "android.permission.READ_SEARCH_INDEXABLES";
     field public static final java.lang.String READ_SMS = "android.permission.READ_SMS";
-    field public static final deprecated java.lang.String READ_SOCIAL_STREAM = "android.permission.READ_SOCIAL_STREAM";
     field public static final java.lang.String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
     field public static final java.lang.String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
-    field public static final java.lang.String READ_USER_DICTIONARY = "android.permission.READ_USER_DICTIONARY";
     field public static final java.lang.String READ_VOICEMAIL = "com.android.voicemail.permission.READ_VOICEMAIL";
     field public static final java.lang.String READ_WIFI_CREDENTIAL = "android.permission.READ_WIFI_CREDENTIAL";
     field public static final java.lang.String REAL_GET_TASKS = "android.permission.REAL_GET_TASKS";
@@ -227,12 +224,9 @@
     field public static final java.lang.String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
     field public static final java.lang.String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
     field public static final java.lang.String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE";
-    field public static final deprecated java.lang.String WRITE_PROFILE = "android.permission.WRITE_PROFILE";
     field public static final java.lang.String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS";
     field public static final java.lang.String WRITE_SETTINGS = "android.permission.WRITE_SETTINGS";
-    field public static final deprecated java.lang.String WRITE_SOCIAL_STREAM = "android.permission.WRITE_SOCIAL_STREAM";
     field public static final java.lang.String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS";
-    field public static final java.lang.String WRITE_USER_DICTIONARY = "android.permission.WRITE_USER_DICTIONARY";
     field public static final java.lang.String WRITE_VOICEMAIL = "com.android.voicemail.permission.WRITE_VOICEMAIL";
   }
 
@@ -247,9 +241,7 @@
     field public static final java.lang.String PHONE = "android.permission-group.PHONE";
     field public static final java.lang.String SENSORS = "android.permission-group.SENSORS";
     field public static final java.lang.String SMS = "android.permission-group.SMS";
-    field public static final java.lang.String SOCIAL_INFO = "android.permission-group.SOCIAL_INFO";
     field public static final java.lang.String STORAGE = "android.permission-group.STORAGE";
-    field public static final java.lang.String USER_DICTIONARY = "android.permission-group.USER_DICTIONARY";
   }
 
   public final class R {
@@ -12787,6 +12779,9 @@
     method public android.graphics.drawable.Drawable loadDrawable(android.content.Context);
     method public void loadDrawableAsync(android.content.Context, android.os.Message);
     method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
+    method public android.graphics.drawable.Icon setTint(int);
+    method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
+    method public android.graphics.drawable.Icon setTintMode(android.graphics.PorterDuff.Mode);
     method public void writeToParcel(android.os.Parcel, int);
     field public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
   }
@@ -27517,10 +27512,6 @@
     field public static final java.lang.String PHOTO_FILE_ID = "data14";
   }
 
-  public static final deprecated class ContactsContract.Contacts.StreamItems implements android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
-  }
-
   protected static abstract interface ContactsContract.ContactsColumns {
     field public static final java.lang.String CONTACT_LAST_UPDATED_TIMESTAMP = "contact_last_updated_timestamp";
     field public static final java.lang.String DISPLAY_NAME = "display_name";
@@ -27836,10 +27827,6 @@
     field public static final java.lang.String DATA_ID = "data_id";
   }
 
-  public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
-  }
-
   protected static abstract interface ContactsContract.RawContactsColumns {
     field public static final java.lang.String ACCOUNT_TYPE_AND_DATA_SET = "account_type_and_data_set";
     field public static final java.lang.String AGGREGATION_MODE = "aggregation_mode";
@@ -27910,56 +27897,6 @@
     field public static final android.net.Uri PROFILE_CONTENT_URI;
   }
 
-  public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String PHOTO = "photo";
-  }
-
-  protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
-    field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
-    field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
-    field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
-    field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
-    field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
-    field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
-    field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
-  }
-
-  public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
-    field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
-    field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
-    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
-    field public static final deprecated android.net.Uri CONTENT_URI;
-    field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
-  }
-
-  public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns android.provider.ContactsContract.StreamItemPhotosColumns {
-    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
-    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
-    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
-  }
-
-  protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
-    field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
-    field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
-    field public static final deprecated java.lang.String COMMENTS = "comments";
-    field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
-    field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
-    field public static final deprecated java.lang.String DATA_SET = "data_set";
-    field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
-    field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
-    field public static final deprecated java.lang.String RES_ICON = "icon";
-    field public static final deprecated java.lang.String RES_LABEL = "label";
-    field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
-    field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
-    field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
-    field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
-    field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
-    field public static final deprecated java.lang.String TEXT = "text";
-    field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
-  }
-
   protected static abstract interface ContactsContract.SyncColumns implements android.provider.ContactsContract.BaseSyncColumns {
     field public static final java.lang.String ACCOUNT_NAME = "account_name";
     field public static final java.lang.String ACCOUNT_TYPE = "account_type";
@@ -38909,10 +38846,6 @@
     method public static android.animation.Animator createCircularReveal(android.view.View, int, int, float, float);
   }
 
-  public abstract deprecated class ViewAssistStructure extends android.view.ViewStructure {
-    ctor public ViewAssistStructure();
-  }
-
   public class ViewConfiguration {
     ctor public deprecated ViewConfiguration();
     method public static android.view.ViewConfiguration get(android.content.Context);
@@ -39294,7 +39227,7 @@
     ctor public ViewStructure();
     method public abstract int addChildCount(int);
     method public abstract void asyncCommit();
-    method public abstract android.view.ViewAssistStructure asyncNewChild(int);
+    method public abstract android.view.ViewStructure asyncNewChild(int);
     method public abstract int getChildCount();
     method public abstract android.os.Bundle getExtras();
     method public abstract java.lang.CharSequence getHint();
@@ -39302,7 +39235,7 @@
     method public abstract int getTextSelectionEnd();
     method public abstract int getTextSelectionStart();
     method public abstract boolean hasExtras();
-    method public abstract android.view.ViewAssistStructure newChild(int);
+    method public abstract android.view.ViewStructure newChild(int);
     method public abstract void setAccessibilityFocused(boolean);
     method public abstract void setActivated(boolean);
     method public abstract void setCheckable(boolean);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 2e6c685..7fc927b 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -117,6 +117,64 @@
     field public static final deprecated java.lang.String URL = "url";
   }
 
+  public static final deprecated class ContactsContract.Contacts.StreamItems {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
+  }
+
+  public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
+  }
+
+  public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String PHOTO = "photo";
+  }
+
+  protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
+    field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
+    field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
+    field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
+    field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
+    field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
+    field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
+    field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
+    field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
+  }
+
+  public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
+    field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
+    field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
+    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
+    field public static final deprecated android.net.Uri CONTENT_URI;
+    field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
+  }
+
+  public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns {
+    field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
+    field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
+    field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
+  }
+
+  protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
+    field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
+    field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
+    field public static final deprecated java.lang.String COMMENTS = "comments";
+    field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
+    field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
+    field public static final deprecated java.lang.String DATA_SET = "data_set";
+    field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
+    field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
+    field public static final deprecated java.lang.String RES_ICON = "icon";
+    field public static final deprecated java.lang.String RES_LABEL = "label";
+    field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
+    field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
+    field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
+    field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
+    field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
+    field public static final deprecated java.lang.String TEXT = "text";
+    field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
+  }
+
   public static final class Settings.System extends android.provider.Settings.NameValueTable {
     field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
     field public static final java.lang.String VOLUME_ALARM = "volume_alarm";
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 993b53d..3001c2c 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -209,7 +209,8 @@
     /**
      * Bundle key used to supply the last time the credentials of the account
      * were authenticated successfully. Time is specified in milliseconds since
-     * epoch.
+     * epoch. Associated time is updated on successful authentication of account
+     * on adding account, confirming credentials, or updating credentials.
      */
     public static final String KEY_LAST_AUTHENTICATED_TIME = "lastAuthenticatedTime";
 
@@ -651,18 +652,25 @@
     }
 
     /**
-     * Adds an account directly to the AccountManager.  Normally used by sign-up
+     * Adds an account directly to the AccountManager. Normally used by sign-up
      * wizards associated with authenticators, not directly by applications.
-     *
+     * <p>Calling this method does not update the last authenticated timestamp,
+     * referred by {@link #KEY_LAST_AUTHENTICATED_TIME}. To update it, call
+     * {@link #notifyAccountAuthenticated(Account)} after getting success.
+     * However, if this method is called when it is triggered by addAccount() or
+     * addAccountAsUser() or similar functions, then there is no need to update
+     * timestamp manually as it is updated automatically by framework on
+     * successful completion of the mentioned functions.
      * <p>It is safe to call this method from the main thread.
      * <p>This method requires the caller to have a signature match with the
      * authenticator that owns the specified account.
      *
      * @param account The {@link Account} to add
      * @param password The password to associate with the account, null for none
-     * @param userdata String values to use for the account's userdata, null for none
+     * @param userdata String values to use for the account's userdata, null for
+     *            none
      * @return True if the account was successfully added, false if the account
-     *     already exists, the account is null, or another error occurs.
+     *         already exists, the account is null, or another error occurs.
      */
     public boolean addAccountExplicitly(Account account, String password, Bundle userdata) {
         if (account == null) throw new IllegalArgumentException("account is null");
@@ -976,17 +984,19 @@
     }
 
     /**
-     * Sets or forgets a saved password.  This modifies the local copy of the
-     * password used to automatically authenticate the user; it does
-     * not change the user's account password on the server.  Intended for use
-     * by the authenticator, not directly by applications.
-     *
+     * Sets or forgets a saved password. This modifies the local copy of the
+     * password used to automatically authenticate the user; it does not change
+     * the user's account password on the server. Intended for use by the
+     * authenticator, not directly by applications.
+     * <p>Calling this method does not update the last authenticated timestamp,
+     * referred by {@link #KEY_LAST_AUTHENTICATED_TIME}. To update it, call
+     * {@link #notifyAccountAuthenticated(Account)} after getting success.
      * <p>It is safe to call this method from the main thread.
-     *
      * <p>This method requires the caller to have a signature match with the
      * authenticator that manages the specified account.
      *
-     * @param account The account whose password is to be set. Cannot be {@code null}.
+     * @param account The account whose password is to be set. Cannot be
+     *            {@code null}.
      * @param password The password to set, null to clear the password
      */
     public void setPassword(final Account account, final String password) {
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 5a0d246..af9decc 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3586,12 +3586,19 @@
          * object.
          */
         public Notification build() {
+            if (mSmallIcon != null) {
+                mSmallIcon.convertToAshmem();
+            }
+            if (mLargeIcon != null) {
+                mLargeIcon.convertToAshmem();
+            }
             mOriginatingUserId = mContext.getUserId();
             mHasThreeLines = hasThreeLines();
 
             Notification n = buildUnstyled();
 
             if (mStyle != null) {
+                mStyle.purgeResources();
                 n = mStyle.buildStyled(n);
             }
 
@@ -3790,6 +3797,8 @@
             return wip;
         }
 
+        public void purgeResources() {}
+
         // The following methods are split out so we can re-create notification partially.
         /**
          * @hide
@@ -3901,8 +3910,18 @@
             return this;
         }
 
-        private RemoteViews makeBigContentView() {
+        @Override
+        public void purgeResources() {
+            super.purgeResources();
+            if (mPicture != null && mPicture.isMutable()) {
+                mPicture = mPicture.createAshmemBitmap();
+            }
+            if (mBigLargeIcon != null) {
+                mBigLargeIcon.convertToAshmem();
+            }
+        }
 
+        private RemoteViews makeBigContentView() {
             // Replace mLargeIcon with mBigLargeIcon if mBigLargeIconSet
             // This covers the following cases:
             //   1. mBigLargeIconSet -> mBigLargeIcon (null or non-null) applies, overrides
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index 1a04895..284dfd6 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -15,7 +15,7 @@
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
-import android.view.ViewAssistStructure;
+import android.view.ViewStructure;
 import android.view.ViewRootImpl;
 import android.view.WindowManager;
 import android.view.WindowManagerGlobal;
@@ -616,7 +616,7 @@
         }
     }
 
-    static class ViewNodeBuilder extends ViewAssistStructure {
+    static class ViewNodeBuilder extends ViewStructure {
         final AssistStructure mAssist;
         final ViewNode mNode;
         final boolean mAsync;
@@ -827,14 +827,14 @@
         }
 
         @Override
-        public ViewAssistStructure newChild(int index) {
+        public ViewStructure newChild(int index) {
             ViewNode node = new ViewNode();
             mNode.mChildren[index] = node;
             return new ViewNodeBuilder(mAssist, node, false);
         }
 
         @Override
-        public ViewAssistStructure asyncNewChild(int index) {
+        public ViewStructure asyncNewChild(int index) {
             synchronized (mAssist) {
                 ViewNode node = new ViewNode();
                 mNode.mChildren[index] = node;
@@ -849,7 +849,7 @@
             synchronized (mAssist) {
                 if (!mAsync) {
                     throw new IllegalStateException("Child " + this
-                            + " was not created with ViewAssistStructure.asyncNewChild");
+                            + " was not created with ViewStructure.asyncNewChild");
                 }
                 if (!mAssist.mPendingAsyncChildren.remove(this)) {
                     throw new IllegalStateException("Child " + this + " already committed");
diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java
index 4e7da48..04dbff2 100644
--- a/core/java/android/content/pm/PermissionInfo.java
+++ b/core/java/android/content/pm/PermissionInfo.java
@@ -109,6 +109,14 @@
     public static final int FLAG_COSTS_MONEY = 1<<0;
 
     /**
+     * Flag for {@link #protectionLevel}, corresponding
+     * to the <code>hide</code> value of
+     * {@link android.R.attr#permissionFlags}.
+     * @hide
+     */
+    public static final int PROTECTION_FLAG_HIDE = 1<<1;
+
+    /**
      * Additional flags about this permission as given by
      * {@link android.R.attr#permissionFlags}.
      */
diff --git a/core/java/android/hardware/camera2/DngCreator.java b/core/java/android/hardware/camera2/DngCreator.java
index 70afe5b..57a080b 100644
--- a/core/java/android/hardware/camera2/DngCreator.java
+++ b/core/java/android/hardware/camera2/DngCreator.java
@@ -284,6 +284,8 @@
      * {@code offset + 2 * width * height)} bytes.  The width and height of
      * the input are taken from the width and height set in the {@link DngCreator} metadata tags,
      * and will typically be equal to the width and height of
+     * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE}.  Prior to
+     * API level 23, this was always the same as
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE}.
      * The pixel layout in the input is determined from the reported color filter arrangement (CFA)
      * set in {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT}.  If insufficient
@@ -332,6 +334,8 @@
      * {@code offset + 2 * width * height)} bytes.  The width and height of
      * the input are taken from the width and height set in the {@link DngCreator} metadata tags,
      * and will typically be equal to the width and height of
+     * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE}.  Prior to
+     * API level 23, this was always the same as
      * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE}.
      * The pixel layout in the input is determined from the reported color filter arrangement (CFA)
      * set in {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT}.  If insufficient
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index aebe7f1..8ce1cbf 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -1743,6 +1743,9 @@
          *
          * @deprecated - Do not use. This will not be supported in the future. In the future,
          * cursors returned from related queries will be empty.
+         *
+         * @hide
+         * @removed
          */
         @Deprecated
         public static final class StreamItems implements StreamItemsColumns {
@@ -2831,6 +2834,9 @@
          *
          * @deprecated - Do not use. This will not be supported in the future. In the future,
          * cursors returned from related queries will be empty.
+         *
+         * @hide
+         * @removed
          */
         @Deprecated
         public static final class StreamItems implements BaseColumns, StreamItemsColumns {
@@ -3267,6 +3273,9 @@
      *
      * @deprecated - Do not use. This will not be supported in the future. In the future,
      * cursors returned from related queries will be empty.
+     *
+     * @hide
+     * @removed
      */
     @Deprecated
     public static final class StreamItems implements BaseColumns, StreamItemsColumns {
@@ -3365,6 +3374,9 @@
          *
          * @deprecated - Do not use. This will not be supported in the future. In the future,
          * cursors returned from related queries will be empty.
+         *
+         * @hide
+         * @removed
          */
         @Deprecated
         public static final class StreamItemPhotos
@@ -3415,6 +3427,9 @@
      * @see ContactsContract.StreamItems
      * @deprecated - Do not use. This will not be supported in the future. In the future,
      * cursors returned from related queries will be empty.
+     *
+     * @hide
+     * @removed
      */
     @Deprecated
     protected interface StreamItemsColumns {
@@ -3805,6 +3820,9 @@
      *
      * @deprecated - Do not use. This will not be supported in the future. In the future,
      * cursors returned from related queries will be empty.
+     *
+     * @hide
+     * @removed
      */
     @Deprecated
     public static final class StreamItemPhotos implements BaseColumns, StreamItemPhotosColumns {
@@ -3843,6 +3861,9 @@
      * @see ContactsContract.StreamItemPhotos
      * @deprecated - Do not use. This will not be supported in the future. In the future,
      * cursors returned from related queries will be empty.
+     *
+     * @hide
+     * @removed
      */
     @Deprecated
     protected interface StreamItemPhotosColumns {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 92dae2e..502a6bc 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -21041,6 +21041,9 @@
             if (sUseBrokenMakeMeasureSpec) {
                 return size + mode;
             } else {
+                if (size < 0) {
+                    throw new IllegalArgumentException("Measure spec size must be >= 0");
+                }
                 return (size & ~MODE_MASK) | (mode & MODE_MASK);
             }
         }
diff --git a/core/java/android/view/ViewAssistStructure.java b/core/java/android/view/ViewAssistStructure.java
deleted file mode 100644
index a66d93c..0000000
--- a/core/java/android/view/ViewAssistStructure.java
+++ /dev/null
@@ -1,24 +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 android.view;
-
-/**
- * @deprecated Temporary until old apps can move off this.
- */
-@Deprecated
-public abstract class ViewAssistStructure extends ViewStructure {
-}
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index 3572f1e..9ab0ace 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -221,7 +221,7 @@
      * children at <var>index</var>.
      * @return Returns an fresh {@link ViewStructure} ready to be filled in.
      */
-    public abstract ViewAssistStructure newChild(int index);
+    public abstract ViewStructure newChild(int index);
 
     /**
      * Like {@link #newChild}, but allows the caller to asynchronously populate the returned
@@ -231,7 +231,7 @@
      * population is done.
      * @return Returns an fresh {@link ViewStructure} ready to be filled in.
      */
-    public abstract ViewAssistStructure asyncNewChild(int index);
+    public abstract ViewStructure asyncNewChild(int index);
 
     /**
      * Call when done populating a {@link ViewStructure} returned by
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 15ed5bd..0abd200 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -23,6 +23,8 @@
 import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
 import static android.view.WindowManager.LayoutParams.*;
 
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
 import android.app.ActivityManagerNative;
 import android.app.SearchManager;
 import android.os.UserHandle;
@@ -2216,6 +2218,7 @@
         private OnPreDrawListener mFloatingToolbarPreDrawListener;
         private View mFloatingActionModeOriginatingView;
         private FloatingToolbar mFloatingToolbar;
+        private ObjectAnimator mFadeAnim;
 
         // View added at runtime to draw under the status bar area
         private View mStatusGuard;
@@ -3345,6 +3348,7 @@
         }
 
         private ActionMode createStandaloneActionMode(ActionMode.Callback callback) {
+            endOnGoingFadeAnimation();
             cleanupPrimaryActionMode();
             if (mPrimaryActionModeView == null) {
                 if (isFloating()) {
@@ -3384,6 +3388,32 @@
                             mPrimaryActionModePopup.showAtLocation(
                                     mPrimaryActionModeView.getApplicationWindowToken(),
                                     Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
+                            endOnGoingFadeAnimation();
+                            mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA,
+                                    0f, 1f);
+                            mFadeAnim.addListener(new Animator.AnimatorListener() {
+                                @Override
+                                public void onAnimationStart(Animator animation) {
+                                    mPrimaryActionModeView.setVisibility(VISIBLE);
+                                }
+
+                                @Override
+                                public void onAnimationEnd(Animator animation) {
+                                    mPrimaryActionModeView.setAlpha(1f);
+                                    mFadeAnim = null;
+                                }
+
+                                @Override
+                                public void onAnimationCancel(Animator animation) {
+
+                                }
+
+                                @Override
+                                public void onAnimationRepeat(Animator animation) {
+
+                                }
+                            });
+                            mFadeAnim.start();
                         }
                     };
                 } else {
@@ -3404,13 +3434,44 @@
             return null;
         }
 
+        private void endOnGoingFadeAnimation() {
+            if (mFadeAnim != null) {
+                mFadeAnim.end();
+            }
+        }
+
         private void setHandledPrimaryActionMode(ActionMode mode) {
+            endOnGoingFadeAnimation();
             mPrimaryActionMode = mode;
             mPrimaryActionMode.invalidate();
             mPrimaryActionModeView.initForMode(mPrimaryActionMode);
-            mPrimaryActionModeView.setVisibility(View.VISIBLE);
             if (mPrimaryActionModePopup != null) {
                 post(mShowPrimaryActionModePopup);
+            } else {
+                mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA, 0f, 1f);
+                mFadeAnim.addListener(new Animator.AnimatorListener() {
+                    @Override
+                    public void onAnimationStart(Animator animation) {
+                        mPrimaryActionModeView.setVisibility(View.VISIBLE);
+                    }
+
+                    @Override
+                    public void onAnimationEnd(Animator animation) {
+                        mPrimaryActionModeView.setAlpha(1f);
+                        mFadeAnim = null;
+                    }
+
+                    @Override
+                    public void onAnimationCancel(Animator animation) {
+
+                    }
+
+                    @Override
+                    public void onAnimationRepeat(Animator animation) {
+
+                    }
+                });
+                mFadeAnim.start();
             }
             mPrimaryActionModeView.sendAccessibilityEvent(
                     AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
@@ -3473,13 +3534,40 @@
                 if (mode == mPrimaryActionMode) {
                     if (mPrimaryActionModePopup != null) {
                         removeCallbacks(mShowPrimaryActionModePopup);
-                        mPrimaryActionModePopup.dismiss();
-                    } else if (mPrimaryActionModeView != null) {
-                        mPrimaryActionModeView.setVisibility(GONE);
                     }
                     if (mPrimaryActionModeView != null) {
-                        mPrimaryActionModeView.removeAllViews();
+                        endOnGoingFadeAnimation();
+                        mFadeAnim = ObjectAnimator.ofFloat(mPrimaryActionModeView, View.ALPHA,
+                                1f, 0f);
+                        mFadeAnim.addListener(new Animator.AnimatorListener() {
+                                    @Override
+                                    public void onAnimationStart(Animator animation) {
+
+                                    }
+
+                                    @Override
+                                    public void onAnimationEnd(Animator animation) {
+                                        mPrimaryActionModeView.setVisibility(GONE);
+                                        if (mPrimaryActionModePopup != null) {
+                                            mPrimaryActionModePopup.dismiss();
+                                        }
+                                        mPrimaryActionModeView.removeAllViews();
+                                        mFadeAnim = null;
+                                    }
+
+                                    @Override
+                                    public void onAnimationCancel(Animator animation) {
+
+                                    }
+
+                                    @Override
+                                    public void onAnimationRepeat(Animator animation) {
+
+                                    }
+                                });
+                        mFadeAnim.start();
                     }
+
                     mPrimaryActionMode = null;
                 } else if (mode == mFloatingActionMode) {
                     cleanupFloatingActionModeViews();
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index 9b5fb3a..2116da0 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -175,24 +175,24 @@
 static jboolean clipRect(JNIEnv*, jobject, jlong canvasHandle, jfloat l, jfloat t,
                          jfloat r, jfloat b, jint opHandle) {
     SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
-    bool emptyClip = get_canvas(canvasHandle)->clipRect(l, t, r, b, op);
-    return emptyClip ? JNI_FALSE : JNI_TRUE;
+    bool nonEmptyClip = get_canvas(canvasHandle)->clipRect(l, t, r, b, op);
+    return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
 }
 
 static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle, jlong pathHandle,
                          jint opHandle) {
     SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
     SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
-    bool emptyClip = get_canvas(canvasHandle)->clipPath(path, op);
-    return emptyClip ? JNI_FALSE : JNI_TRUE;
+    bool nonEmptyClip = get_canvas(canvasHandle)->clipPath(path, op);
+    return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
 }
 
 static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle, jlong deviceRgnHandle,
                            jint opHandle) {
     SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
     SkRegion::Op op = static_cast<SkRegion::Op>(opHandle);
-    bool emptyClip = get_canvas(canvasHandle)->clipRegion(deviceRgn, op);
-    return emptyClip ? JNI_FALSE : JNI_TRUE;
+    bool nonEmptyClip = get_canvas(canvasHandle)->clipRegion(deviceRgn, op);
+    return nonEmptyClip ? JNI_TRUE : JNI_FALSE;
 }
 
 static void drawColor(JNIEnv* env, jobject, jlong canvasHandle, jint color, jint modeHandle) {
diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp
index 7d8d151..995d39f 100644
--- a/core/jni/android_hardware_camera2_DngCreator.cpp
+++ b/core/jni/android_hardware_camera2_DngCreator.cpp
@@ -18,6 +18,8 @@
 #define LOG_TAG "DngCreator_JNI"
 #include <inttypes.h>
 #include <string.h>
+#include <algorithm>
+#include <memory>
 
 #include <utils/Log.h>
 #include <utils/Errors.h>
@@ -25,7 +27,6 @@
 #include <utils/RefBase.h>
 #include <utils/Vector.h>
 #include <cutils/properties.h>
-
 #include <system/camera_metadata.h>
 #include <camera/CameraMetadata.h>
 #include <img_utils/DngUtils.h>
@@ -37,15 +38,6 @@
 #include <img_utils/StripSource.h>
 
 #include "core_jni_helpers.h"
-#include <utils/Log.h>
-#include <utils/Errors.h>
-#include <utils/StrongPointer.h>
-#include <utils/RefBase.h>
-#include <utils/Vector.h>
-#include <cutils/properties.h>
-
-#include <string.h>
-#include <inttypes.h>
 
 #include "android_runtime/AndroidRuntime.h"
 #include "android_runtime/android_hardware_camera2_CameraMetadata.h"
@@ -63,6 +55,14 @@
         return; \
     }
 
+#define BAIL_IF_INVALID_R(expr, jnienv, tagId, writer) \
+    if ((expr) != OK) { \
+        jniThrowExceptionFmt(jnienv, "java/lang/IllegalArgumentException", \
+                "Invalid metadata for tag %s (%x)", (writer)->getTagName(tagId), (tagId)); \
+        return -1; \
+    }
+
+
 #define BAIL_IF_EMPTY(entry, jnienv, tagId, writer) \
     if (entry.count == 0) { \
         jniThrowExceptionFmt(jnienv, "java/lang/IllegalArgumentException", \
@@ -111,11 +111,14 @@
 class NativeContext : public LightRefBase<NativeContext> {
 
 public:
-    NativeContext();
+    NativeContext(const CameraMetadata& characteristics, const CameraMetadata& result);
     virtual ~NativeContext();
 
     TiffWriter* getWriter();
 
+    std::shared_ptr<const CameraMetadata> getCharacteristics() const;
+    std::shared_ptr<const CameraMetadata> getResult() const;
+
     uint32_t getThumbnailWidth();
     uint32_t getThumbnailHeight();
     const uint8_t* getThumbnail();
@@ -125,11 +128,16 @@
 private:
     Vector<uint8_t> mCurrentThumbnail;
     TiffWriter mWriter;
+    std::shared_ptr<CameraMetadata> mCharacteristics;
+    std::shared_ptr<CameraMetadata> mResult;
     uint32_t mThumbnailWidth;
     uint32_t mThumbnailHeight;
 };
 
-NativeContext::NativeContext() : mThumbnailWidth(0), mThumbnailHeight(0) {}
+NativeContext::NativeContext(const CameraMetadata& characteristics, const CameraMetadata& result) :
+        mCharacteristics(std::make_shared<CameraMetadata>(characteristics)),
+        mResult(std::make_shared<CameraMetadata>(result)), mThumbnailWidth(0),
+        mThumbnailHeight(0) {}
 
 NativeContext::~NativeContext() {}
 
@@ -137,6 +145,14 @@
     return &mWriter;
 }
 
+std::shared_ptr<const CameraMetadata> NativeContext::getCharacteristics() const {
+    return mCharacteristics;
+}
+
+std::shared_ptr<const CameraMetadata> NativeContext::getResult() const {
+    return mResult;
+}
+
 uint32_t NativeContext::getThumbnailWidth() {
     return mThumbnailWidth;
 }
@@ -626,25 +642,92 @@
 // End of DirectStripSource
 // ----------------------------------------------------------------------------
 
-static bool validateDngHeader(JNIEnv* env, TiffWriter* writer, jint width, jint height) {
-    bool hasThumbnail = writer->hasIfd(TIFF_IFD_SUB1);
+/**
+ * Given a buffer crop rectangle relative to the pixel array size, and the active array crop
+ * rectangle for the camera characteristics, set the default crop rectangle in the TiffWriter
+ * relative to the buffer crop rectangle origin.
+ */
+static status_t calculateAndSetCrop(JNIEnv* env, const CameraMetadata& characteristics,
+        uint32_t bufXMin, uint32_t bufYMin, uint32_t bufWidth, uint32_t bufHeight,
+        TiffWriter* writer) {
 
+    camera_metadata_ro_entry entry =
+            characteristics.find(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE);
+    uint32_t xmin = static_cast<uint32_t>(entry.data.i32[0]);
+    uint32_t ymin = static_cast<uint32_t>(entry.data.i32[1]);
+    uint32_t width = static_cast<uint32_t>(entry.data.i32[2]);
+    uint32_t height = static_cast<uint32_t>(entry.data.i32[3]);
+
+    uint32_t aLeft = xmin;
+    uint32_t aTop = ymin;
+    uint32_t aRight = xmin + width;
+    uint32_t aBottom = ymin + height;
+
+    const uint32_t margin = 8; // Default margin recommended by Adobe for interpolation.
+
+    uint32_t bLeft = bufXMin + margin;
+    uint32_t bTop = bufYMin + margin;
+    uint32_t bRight = bufXMin + bufWidth - margin;
+    uint32_t bBottom = bufYMin + bufHeight - margin;
+
+    uint32_t defaultCropOrigin[] = {std::max(aLeft, bLeft), std::max(aTop, bTop)};
+    uint32_t defaultCropSize[] = {std::min(aRight, bRight) - defaultCropOrigin[0],
+            std::min(aBottom, bBottom) - defaultCropOrigin[1]};
+
+    BAIL_IF_INVALID_R(writer->addEntry(TAG_DEFAULTCROPORIGIN, 2, defaultCropOrigin,
+            TIFF_IFD_0), env, TAG_DEFAULTCROPORIGIN, writer);
+    BAIL_IF_INVALID_R(writer->addEntry(TAG_DEFAULTCROPSIZE, 2, defaultCropSize,
+            TIFF_IFD_0), env, TAG_DEFAULTCROPSIZE, writer);
+
+    return OK;
+}
+
+static bool validateDngHeader(JNIEnv* env, TiffWriter* writer,
+        const CameraMetadata& characteristics, jint width, jint height) {
     // TODO: handle lens shading map, etc. conversions for other raw buffer sizes.
-    uint32_t metadataWidth = *(writer->getEntry(TAG_IMAGEWIDTH, (hasThumbnail) ? TIFF_IFD_SUB1 :
-            TIFF_IFD_0)->getData<uint32_t>());
-    uint32_t metadataHeight = *(writer->getEntry(TAG_IMAGELENGTH, (hasThumbnail) ? TIFF_IFD_SUB1 :
-            TIFF_IFD_0)->getData<uint32_t>());
-
-    if (width < 0 || metadataWidth != static_cast<uint32_t>(width)) {
+    if (width <= 0) {
         jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException", \
-                        "Metadata width %d doesn't match image width %d", metadataWidth, width);
+                        "Image width %d is invalid", width);
         return false;
     }
 
-    if (height < 0 || metadataHeight != static_cast<uint32_t>(height)) {
+    if (height <= 0) {
         jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException", \
-                        "Metadata height %d doesn't match image height %d",
-                        metadataHeight, height);
+                        "Image height %d is invalid", height);
+        return false;
+    }
+
+    camera_metadata_ro_entry preCorrectionEntry =
+            characteristics.find(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
+    camera_metadata_ro_entry pixelArrayEntry =
+            characteristics.find(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE);
+
+    int pWidth = static_cast<int>(pixelArrayEntry.data.i32[0]);
+    int pHeight = static_cast<int>(pixelArrayEntry.data.i32[1]);
+    int cWidth = static_cast<int>(preCorrectionEntry.data.i32[2]);
+    int cHeight = static_cast<int>(preCorrectionEntry.data.i32[3]);
+
+    bool matchesPixelArray = (pWidth == width && pHeight == height);
+    bool matchesPreCorrectionArray = (cWidth == width && cHeight == height);
+
+    if (matchesPixelArray) {
+        if (calculateAndSetCrop(env, characteristics, 0, 0, static_cast<uint32_t>(pWidth),
+                static_cast<uint32_t>(pHeight), writer) != OK) {
+            return false;
+        }
+    } else if (matchesPreCorrectionArray) {
+        if (calculateAndSetCrop(env, characteristics,
+                static_cast<uint32_t>(preCorrectionEntry.data.i32[0]),
+                static_cast<uint32_t>(preCorrectionEntry.data.i32[1]),
+                static_cast<uint32_t>(preCorrectionEntry.data.i32[2]),
+                static_cast<uint32_t>(preCorrectionEntry.data.i32[3]), writer) != OK) {
+            return false;
+        }
+    } else {
+        jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException", \
+                        "Image dimensions (w=%d,h=%d) are invalid, must match either the pixel "
+                        "array size (w=%d, h=%d) or the pre-correction array size (w=%d, h=%d)",
+                        width, height, pWidth, pHeight, cWidth, cHeight);
         return false;
     }
 
@@ -854,7 +937,7 @@
         return;
     }
 
-    sp<NativeContext> nativeContext = new NativeContext();
+    sp<NativeContext> nativeContext = new NativeContext(characteristics, results);
     TiffWriter* writer = nativeContext->getWriter();
 
     writer->addIfd(TIFF_IFD_0);
@@ -906,7 +989,7 @@
     {
         // Set dimensions
         camera_metadata_entry entry =
-                characteristics.find(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE);
+                characteristics.find(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
         BAIL_IF_EMPTY(entry, env, TAG_IMAGEWIDTH, writer);
         uint32_t width = static_cast<uint32_t>(entry.data.i32[2]);
         uint32_t height = static_cast<uint32_t>(entry.data.i32[3]);
@@ -1356,16 +1439,16 @@
     }
 
     {
-        // Setup default crop + crop origin tags
-        uint32_t margin = 8; // Default margin recommended by Adobe for interpolation.
-        uint32_t dimensionLimit = 128; // Smallest image dimension crop margin from.
-        if (imageWidth >= dimensionLimit && imageHeight >= dimensionLimit) {
-            uint32_t defaultCropOrigin[] = {margin, margin};
-            uint32_t defaultCropSize[] = {imageWidth - 2 * margin, imageHeight - 2 * margin};
-            BAIL_IF_INVALID(writer->addEntry(TAG_DEFAULTCROPORIGIN, 2, defaultCropOrigin,
-                    TIFF_IFD_0), env, TAG_DEFAULTCROPORIGIN, writer);
-            BAIL_IF_INVALID(writer->addEntry(TAG_DEFAULTCROPSIZE, 2, defaultCropSize,
-                    TIFF_IFD_0), env, TAG_DEFAULTCROPSIZE, writer);
+        // Set dimensions
+        camera_metadata_entry entry =
+                characteristics.find(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
+        BAIL_IF_EMPTY(entry, env, TAG_DEFAULTCROPSIZE, writer);
+        uint32_t xmin = static_cast<uint32_t>(entry.data.i32[0]);
+        uint32_t ymin = static_cast<uint32_t>(entry.data.i32[1]);
+        uint32_t width = static_cast<uint32_t>(entry.data.i32[2]);
+        uint32_t height = static_cast<uint32_t>(entry.data.i32[3]);
+        if (calculateAndSetCrop(env, characteristics, xmin, ymin, width, height, writer) != OK) {
+            return;
         }
     }
 
@@ -1874,7 +1957,7 @@
     }
 
     // Validate DNG header
-    if (!validateDngHeader(env, writer, width, height)) {
+    if (!validateDngHeader(env, writer, *(context->getCharacteristics()), width, height)) {
         return;
     }
 
@@ -1978,7 +2061,7 @@
     }
 
     // Validate DNG header
-    if (!validateDngHeader(env, writer, width, height)) {
+    if (!validateDngHeader(env, writer, *(context->getCharacteristics()), width, height)) {
         return;
     }
 
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index 2ee9283..0f5ba83f 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -230,9 +230,11 @@
 
 static void android_os_Parcel_writeInt(JNIEnv* env, jclass clazz, jlong nativePtr, jint val) {
     Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
-    const status_t err = parcel->writeInt32(val);
-    if (err != NO_ERROR) {
-        signalExceptionForError(env, clazz, err);
+    if (parcel != NULL) {
+        const status_t err = parcel->writeInt32(val);
+        if (err != NO_ERROR) {
+            signalExceptionForError(env, clazz, err);
+        }
     }
 }
 
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c51c061..9637cf5 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -349,20 +349,6 @@
         android:description="@string/permdesc_writeContacts"
         android:protectionLevel="dangerous" />
 
-    <!-- @deprecated No longer enforced. This was last enforced in API version 22. -->
-    <permission android:name="android.permission.READ_PROFILE"
-        android:permissionGroup="android.permission-group.CONTACTS"
-        android:label="@string/permlab_readProfile"
-        android:description="@string/permdesc_readProfile"
-        android:protectionLevel="dangerous" />
-
-    <!-- @deprecated No longer enforced. This was last enforced in API version 22. -->
-    <permission android:name="android.permission.WRITE_PROFILE"
-        android:permissionGroup="android.permission-group.CONTACTS"
-        android:label="@string/permlab_writeProfile"
-        android:description="@string/permdesc_writeProfile"
-        android:protectionLevel="dangerous" />
-
     <!-- ====================================================================== -->
     <!-- Permissions for accessing user's calendar                              -->
     <!-- ====================================================================== -->
@@ -511,42 +497,6 @@
         android:description="@string/permdesc_sdcardWrite"
         android:protectionLevel="dangerous" />
 
-    <!-- =============================================================== -->
-    <!-- Permissions for accessing social info                           -->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user's social connections,
-         such as contacts, call logs, social stream, etc.  This includes
-         both reading and writing of this data (which should generally be
-         expressed as two distinct permissions). -->
-
-    <permission-group android:name="android.permission-group.SOCIAL_INFO"
-        android:label="@string/permgrouplab_socialInfo"
-        android:icon="@drawable/perm_group_social_info"
-        android:description="@string/permgroupdesc_socialInfo"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="1200" />
-
-    <!-- Allows an application to read from the user's social stream.
-         @deprecated This functionality will be unsupported in the future; cursors returned
-         will be empty. Please do not use. -->
-    <permission android:name="android.permission.READ_SOCIAL_STREAM"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_readSocialStream"
-        android:description="@string/permdesc_readSocialStream" />
-
-    <!-- Allows an application to write (but not read) the user's
-         social stream data.
-         @deprecated This functionality will be unsupported in the future; cursors returned
-         will be empty. Please do not use. -->
-    <permission android:name="android.permission.WRITE_SOCIAL_STREAM"
-        android:permissionGroup="android.permission-group.SOCIAL_INFO"
-        android:protectionLevel="dangerous"
-        android:label="@string/permlab_writeSocialStream"
-        android:description="@string/permdesc_writeSocialStream" />
-
     <!-- ====================================================================== -->
     <!-- Permissions for accessing the device location                          -->
     <!-- ====================================================================== -->
@@ -741,7 +691,41 @@
         android:protectionLevel="normal" />
 
     <!-- ====================================================================== -->
-    <!-- INSTALLTIME PERMISSIONS                                                -->
+    <!-- REMOVED PERMISSIONS                                                    -->
+    <!-- ====================================================================== -->
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.READ_PROFILE"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.WRITE_PROFILE"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.READ_SOCIAL_STREAM"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.WRITE_SOCIAL_STREAM"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.READ_USER_DICTIONARY"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- @hide We need to keep this around for backwards compatibility -->
+    <permission android:name="android.permission.WRITE_USER_DICTIONARY"
+        android:protectionLevel="normal"
+        android:permissionFlags="hide"/>
+
+    <!-- ====================================================================== -->
+    <!-- INSTALL PERMISSIONS                                                    -->
     <!-- ====================================================================== -->
 
     <!-- ================================== -->
@@ -780,36 +764,6 @@
         android:protectionLevel="signature|system" />
 
     <!-- =============================================================== -->
-    <!-- Permissions for accessing the user dictionary-->
-    <!-- =============================================================== -->
-    <eat-comment />
-
-    <!-- Used for permissions that provide access to the user
-         calendar to create / view events.-->
-    <permission-group android:name="android.permission-group.USER_DICTIONARY"
-        android:label="@string/permgrouplab_dictionary"
-        android:icon="@drawable/perm_group_user_dictionary"
-        android:description="@string/permgroupdesc_dictionary"
-        android:permissionGroupFlags="personalInfo"
-        android:priority="1100" />
-
-    <!-- Allows an application to read the user dictionary. This should
-         really only be required by an IME, or a dictionary editor like
-         the Settings app. -->
-    <permission android:name="android.permission.READ_USER_DICTIONARY"
-        android:permissionGroup="android.permission-group.USER_DICTIONARY"
-        android:label="@string/permlab_readDictionary"
-        android:description="@string/permdesc_readDictionary"
-        android:protectionLevel="dangerous"/>
-
-    <!-- Allows an application to write to the user dictionary. -->
-    <permission android:name="android.permission.WRITE_USER_DICTIONARY"
-        android:permissionGroup="android.permission-group.USER_DICTIONARY"
-        android:label="@string/permlab_writeDictionary"
-        android:description="@string/permdesc_writeDictionary"
-        android:protectionLevel="normal"/>
-
-    <!-- =============================================================== -->
     <!-- Permissions for setting the device alarm                        -->
     <!-- =============================================================== -->
     <eat-comment />
diff --git a/core/res/res/drawable-hdpi/perm_group_storage.png b/core/res/res/drawable-hdpi/perm_group_storage.png
deleted file mode 100644
index 598e1cc..0000000
--- a/core/res/res/drawable-hdpi/perm_group_storage.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/perm_group_user_dictionary.png b/core/res/res/drawable-hdpi/perm_group_user_dictionary.png
deleted file mode 100644
index 62fbcdc..0000000
--- a/core/res/res/drawable-hdpi/perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/perm_group_user_dictionary_write.png b/core/res/res/drawable-hdpi/perm_group_user_dictionary_write.png
deleted file mode 100644
index c62dd4c..0000000
--- a/core/res/res/drawable-hdpi/perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/perm_group_storage.png b/core/res/res/drawable-mdpi/perm_group_storage.png
deleted file mode 100644
index b7a06fb..0000000
--- a/core/res/res/drawable-mdpi/perm_group_storage.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/perm_group_user_dictionary.png b/core/res/res/drawable-mdpi/perm_group_user_dictionary.png
deleted file mode 100644
index a303dc1..0000000
--- a/core/res/res/drawable-mdpi/perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/perm_group_user_dictionary_write.png b/core/res/res/drawable-mdpi/perm_group_user_dictionary_write.png
deleted file mode 100644
index 2fc40564..0000000
--- a/core/res/res/drawable-mdpi/perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/perm_group_storage.png b/core/res/res/drawable-xhdpi/perm_group_storage.png
deleted file mode 100644
index a2d4d5e..0000000
--- a/core/res/res/drawable-xhdpi/perm_group_storage.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/perm_group_user_dictionary.png b/core/res/res/drawable-xhdpi/perm_group_user_dictionary.png
deleted file mode 100644
index 35d7d5f..0000000
--- a/core/res/res/drawable-xhdpi/perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/perm_group_user_dictionary_write.png b/core/res/res/drawable-xhdpi/perm_group_user_dictionary_write.png
deleted file mode 100644
index 74e25ac..0000000
--- a/core/res/res/drawable-xhdpi/perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary.png b/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary.png
deleted file mode 100644
index 8c2cd17..0000000
--- a/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary_write.png b/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary_write.png
deleted file mode 100644
index 121d6cf..0000000
--- a/core/res/res/drawable-xxhdpi/ic_perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/perm_group_storage.png b/core/res/res/drawable-xxhdpi/perm_group_storage.png
deleted file mode 100644
index 837211e..0000000
--- a/core/res/res/drawable-xxhdpi/perm_group_storage.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/perm_group_user_dictionary.png b/core/res/res/drawable-xxhdpi/perm_group_user_dictionary.png
deleted file mode 100644
index 5b6ea3b..0000000
--- a/core/res/res/drawable-xxhdpi/perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/perm_group_user_dictionary_write.png b/core/res/res/drawable-xxhdpi/perm_group_user_dictionary_write.png
deleted file mode 100644
index d92e719..0000000
--- a/core/res/res/drawable-xxhdpi/perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxxhdpi/perm_group_storage.png b/core/res/res/drawable-xxxhdpi/perm_group_storage.png
deleted file mode 100644
index 918b3ed..0000000
--- a/core/res/res/drawable-xxxhdpi/perm_group_storage.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary.png b/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary.png
deleted file mode 100644
index 32942ca..0000000
--- a/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary_write.png b/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary_write.png
deleted file mode 100644
index 343551f..0000000
--- a/core/res/res/drawable-xxxhdpi/perm_group_user_dictionary_write.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/perm_group_storage.xml b/core/res/res/drawable/perm_group_storage.xml
index 11078d3..65da1f1 100644
--- a/core/res/res/drawable/perm_group_storage.xml
+++ b/core/res/res/drawable/perm_group_storage.xml
@@ -14,8 +14,8 @@
     limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="48dp"
-        android:height="48dp"
+        android:width="24dp"
+        android:height="24dp"
         android:viewportWidth="48.0"
         android:viewportHeight="48.0">
     <path
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index f31c1d6..3cb4d7c 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -231,6 +231,9 @@
              may cost the user money.  Such permissions may be highlighted
              when shown to the user with this additional information.  -->
         <flag name="costsMoney" value="0x0001" />
+        <!-- Additional flag from base permission type: this permission is hidden
+             and should not show in the UI. -->
+        <flag name="hide" value="0x2" />
     </attr>
 
     <!-- Specified the name of a group that this permission is associated
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index ea0d349..246e43a33 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -554,11 +554,6 @@
     <string name="permgroupdesc_location">access this device\'s location</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_socialInfo">Your social information</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_socialInfo">Direct access to information about your contacts and social connections.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_calendar">Calendar</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgroupdesc_calendar">access your calendar</string>
@@ -573,16 +568,6 @@
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgroupdesc_storage">access photos, media, and files on your device</string>
 
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_dictionary">User Dictionary</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_dictionary">Read or write words in user dictionary.</string>
-
-    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgrouplab_bookmarks">Bookmarks and History</string>
-    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permgroupdesc_bookmarks">Direct access to bookmarks and browser history.</string>
-
     <!-- Title of a category of application permissioncds, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_microphone">Microphone</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
@@ -901,23 +886,6 @@
     <string name="permdesc_writeCallLog" product="default">Allows the app to modify your phone\'s call log, including data about incoming and outgoing calls.
         Malicious apps may use this to erase or modify your call log.</string>
 
-
-    <!-- Title of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=30] -->
-    <string name="permlab_readProfile">read your own contact card</string>
-    <!-- Description of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=NONE] -->
-    <string name="permdesc_readProfile" product="default">Allows the app to read
-     personal profile information stored on your device, such as your name and
-     contact information. This means the app can identify you and may send your
-     profile information to others.</string>
-
-    <!-- Title of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=30] -->
-    <string name="permlab_writeProfile">modify your own contact card</string>
-    <!-- Description of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=NONE] -->
-    <string name="permdesc_writeProfile" product="default">Allows the app to
-      change or add to personal profile information stored on your device, such
-      as your name and contact information.  This means the app can identify you
-      and may send your profile information to others.</string>
-
     <!-- Title of the body sensors permission, listed so the user can decide whether to allow the application to access body sensor data. [CHAR LIMIT=30] -->
     <string name="permlab_bodySensors">body sensors (like heart rate monitors)
     </string>
@@ -925,23 +893,6 @@
     <string name="permdesc_bodySensors" product="default">Allows the app to access data from sensors
     that monitor your physical condition, such as your heart rate.</string>
 
-    <!-- Title of the read social stream permission, listed so the user can decide whether to allow the application to read information from the user's social stream. [CHAR LIMIT=30] -->
-    <string name="permlab_readSocialStream" product="default">read your social stream</string>
-    <string name="permdesc_readSocialStream" product="default">Allows the app
-      to access and sync social updates from you and your friends. Be careful
-      when sharing information -- this allows the app to read communications
-      between you and your friends on social networks, regardless of
-      confidentiality. Note: this permission may not be enforced on all social
-      networks.</string>
-
-    <!-- Title of the write social stream permission, listed so the user can decide whether to allow the application to write information to the user's social stream. [CHAR LIMIT=30] -->
-    <string name="permlab_writeSocialStream" product="default">write to your social stream</string>
-    <string name="permdesc_writeSocialStream" product="default">Allows the app to
-     display social updates from your friends.  Be careful when sharing
-     information -- this allows the app to produce messages that may appear to
-     come from a friend. Note: this permission may not be enforced on all social
-     networks.</string>
-
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readCalendar">read calendar events plus confidential information</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1285,18 +1236,6 @@
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_readSyncStats">Allows an app to read the sync stats for an account, including the history of sync events and how much data is synced. </string>
 
-    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_readDictionary">read terms you added to the dictionary</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_readDictionary">Allows the app to read all words,
-       names and phrases that the user may have stored in the user dictionary.</string>
-
-    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_writeDictionary">add words to user-defined dictionary</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_writeDictionary">Allows the app to write new words into the
-      user dictionary.</string>
-
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=30] -->
     <string name="permlab_sdcardRead" product="nosdcard">read the contents of your USB storage</string>
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
diff --git a/docs/html/about/versions/android-4.0.3.jd b/docs/html/about/versions/android-4.0.3.jd
index 5fa8547..4c2ccb9 100644
--- a/docs/html/about/versions/android-4.0.3.jd
+++ b/docs/html/about/versions/android-4.0.3.jd
@@ -78,19 +78,19 @@
 stream along with photos for each.</p>
 
 <p>The database table that contains an individual contact’s social stream is
-defined by {@link android.provider.ContactsContract.StreamItems}, the Uri for
+defined by android.provider.ContactsContract.StreamItems, the Uri for
 which is nested within the {@link android.provider.ContactsContract.RawContacts}
 directory to which the stream items belong. Each social stream table includes
 several columns for metadata about each stream item, such as an icon
 representing the source (an avatar), a label for the item, the primary text
 content, comments about the item (such as responses from other people), and
 more. Photos associated with a stream are stored in another table, defined by
-{@link android.provider.ContactsContract.StreamItemPhotos}, which is available
-as a sub-directory of the {@link android.provider.ContactsContract.StreamItems}
+android.provider.ContactsContract.StreamItemPhotos, which is available
+as a sub-directory of the android.provider.ContactsContract.StreamItems
 Uri.</p>
 
-<p>See {@link android.provider.ContactsContract.StreamItems} and
-{@link android.provider.ContactsContract.StreamItemPhotos} for more information.</p>
+<p>See android.provider.ContactsContract.StreamItems and
+android.provider.ContactsContract.StreamItemPhotos for more information.</p>
 
 <p>To read or write social stream items for a contact, an application must
 request permission from the user by declaring <code>&lt;uses-permission
@@ -272,8 +272,8 @@
 
 <p>The following are new permissions:</p>
 <ul>
-<li>{@link android.Manifest.permission#READ_SOCIAL_STREAM} and 
-{@link android.Manifest.permission#WRITE_SOCIAL_STREAM}: Allow a sync
+<li>android.Manifest.permission#READ_SOCIAL_STREAM and
+android.Manifest.permission#WRITE_SOCIAL_STREAM: Allow a sync
 adapter to read and write social stream data to a contact in the shared
 Contacts Provider.</li>
 </ul>
diff --git a/docs/html/about/versions/android-4.0.jd b/docs/html/about/versions/android-4.0.jd
index 6c4ccb4..cc1d1c7 100644
--- a/docs/html/about/versions/android-4.0.jd
+++ b/docs/html/about/versions/android-4.0.jd
@@ -108,9 +108,9 @@
 the table at {@link android.provider.ContactsContract.Profile#CONTENT_RAW_CONTACTS_URI}. Raw
 contacts in this table are then aggregated into the single user-visible profile labeled "Me".</p>
 
-<p>Adding a new raw contact for the profile requires the {@link
-android.Manifest.permission#WRITE_PROFILE} permission. Likewise, in order to read from the profile
-table, you must request the {@link android.Manifest.permission#READ_PROFILE} permission. However,
+<p>Adding a new raw contact for the profile requires the
+android.Manifest.permission#WRITE_PROFILE permission. Likewise, in order to read from the profile
+table, you must request the android.Manifest.permission#READ_PROFILE permission. However,
 most apps should not need to read the user profile, even when contributing data to the
 profile. Reading the user profile is a sensitive permission and you should expect users to be
 skeptical of apps that request it.</p>
@@ -1638,9 +1638,9 @@
 android.service.textservice.SpellCheckerService} must require this permission for itself.</li>
 <li>{@link android.Manifest.permission#BIND_VPN_SERVICE}: A service that implements {@link
 android.net.VpnService} must require this permission for itself.</li>
-<li>{@link android.Manifest.permission#READ_PROFILE}: Provides read access to the {@link
+<li>android.Manifest.permission#READ_PROFILE: Provides read access to the {@link
 android.provider.ContactsContract.Profile} provider.</li>
-<li>{@link android.Manifest.permission#WRITE_PROFILE}: Provides write access to the {@link
+<li>android.Manifest.permission#WRITE_PROFILE: Provides write access to the {@link
 android.provider.ContactsContract.Profile} provider.</li>
 </ul>
 
diff --git a/docs/html/about/versions/android-4.1.jd b/docs/html/about/versions/android-4.1.jd
index 76b90ac..f8770fa 100644
--- a/docs/html/about/versions/android-4.1.jd
+++ b/docs/html/about/versions/android-4.1.jd
@@ -871,7 +871,7 @@
 automatically get read access as well.  There is a new developer option to turn on read access
 restriction, for developers to test their applications against how Android will behave in the
 future.</dd>
-  <dt>{@link android.Manifest.permission#READ_USER_DICTIONARY}</dt>
+  <dt>android.Manifest.permission.READ_USER_DICTIONARY</dt>
     <dd>Allows an application to read the user dictionary. This should only be required by an
 IME, or a dictionary editor like the Settings app.</dd>
   <dt>{@link android.Manifest.permission#READ_CALL_LOG}</dt>
@@ -879,7 +879,7 @@
       incoming and outgoing calls.</dd>
   <dt>{@link android.Manifest.permission#WRITE_CALL_LOG}</dt>
     <dd>Allows an application to modify the system's call log stored on your phone</dd>
-  <dt>{@link android.Manifest.permission#WRITE_USER_DICTIONARY}</dt>
+  <dt>android.Manifest.permission.WRITE_USER_DICTIONARY</dt>
     <dd>Allows an application to write to the user's word dictionary.</dd>
 </dl>
 
diff --git a/docs/html/guide/topics/providers/contacts-provider.jd b/docs/html/guide/topics/providers/contacts-provider.jd
index e3b998a..2b14558 100644
--- a/docs/html/guide/topics/providers/contacts-provider.jd
+++ b/docs/html/guide/topics/providers/contacts-provider.jd
@@ -57,7 +57,7 @@
     <li>{@link android.provider.ContactsContract.Contacts}</li>
     <li>{@link android.provider.ContactsContract.RawContacts}</li>
     <li>{@link android.provider.ContactsContract.Data}</li>
-    <li>{@link android.provider.ContactsContract.StreamItems}</li>
+    <li>android.provider.ContactsContract.StreamItems</li>
 </ol>
 <h2>Related Samples</h2>
 <ol>
@@ -606,13 +606,13 @@
     Access to the user profile requires special permissions. In addition to the
     {@link android.Manifest.permission#READ_CONTACTS} and
     {@link android.Manifest.permission#WRITE_CONTACTS} permissions needed to read and write, access
-    to the user profile requires the {@link android.Manifest.permission#READ_PROFILE} and
-    {@link android.Manifest.permission#WRITE_PROFILE} permissions for read and write access,
+    to the user profile requires the android.Manifest.permission#READ_PROFILE and
+    android.Manifest.permission#WRITE_PROFILE permissions for read and write access,
     respectively.
 </p>
 <p>
     Remember that you should consider a user's profile to be sensitive. The permission
-    {@link android.Manifest.permission#READ_PROFILE} allows you to access the device user's
+    android.Manifest.permission#READ_PROFILE allows you to access the device user's
     personally-identifying data. Make sure to tell the user why
     you need user profile access permissions in the description of your application.
 </p>
@@ -1826,8 +1826,8 @@
     </dl>
 <h2 id="SocialStream">Social Stream Data</h2>
 <p>
-    The {@link android.provider.ContactsContract.StreamItems} and
-    {@link android.provider.ContactsContract.StreamItemPhotos} tables
+    The android.provider.ContactsContract.StreamItems and
+    android.provider.ContactsContract.StreamItemPhotos tables
     manage incoming data from social networks. You can write a sync adapter that adds stream data
     from your own network to these tables, or you can read stream data from these tables and
     display it in your own application, or both. With these features, your social networking
@@ -1836,7 +1836,7 @@
 <h3 id="StreamText">Social stream text</h3>
 <p>
     Stream items are always associated with a raw contact. The
-    {@link android.provider.ContactsContract.StreamItemsColumns#RAW_CONTACT_ID} links to the
+    android.provider.ContactsContract.StreamItemsColumns#RAW_CONTACT_ID links to the
     <code>_ID</code> value for the raw contact. The account type and account name of the raw
     contact are also stored in the stream item row.
 </p>
@@ -1845,14 +1845,14 @@
 </p>
 <dl>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemsColumns#ACCOUNT_TYPE}
+        android.provider.ContactsContract.StreamItemsColumns#ACCOUNT_TYPE
     </dt>
     <dd>
         <strong>Required.</strong> The user's account type for the raw contact associated with this
         stream item. Remember to set this value when you insert a stream item.
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemsColumns#ACCOUNT_NAME}
+        android.provider.ContactsContract.StreamItemsColumns#ACCOUNT_NAME
     </dt>
     <dd>
         <strong>Required.</strong> The user's account name for the raw contact associated with this
@@ -1866,30 +1866,30 @@
         insert a stream item:
         <ul>
             <li>
-                {@link android.provider.ContactsContract.StreamItemsColumns#CONTACT_ID}: The
-                {@link android.provider.BaseColumns#_ID} value of the contact that this stream
+                android.provider.ContactsContract.StreamItemsColumns#CONTACT_ID: The
+                android.provider.BaseColumns#_ID value of the contact that this stream
                 item is associated with.
             </li>
             <li>
-                {@link android.provider.ContactsContract.StreamItemsColumns#CONTACT_LOOKUP_KEY}: The
-                {@link android.provider.ContactsContract.ContactsColumns#LOOKUP_KEY} value of the
+                android.provider.ContactsContract.StreamItemsColumns#CONTACT_LOOKUP_KEY: The
+                android.provider.ContactsContract.ContactsColumns#LOOKUP_KEY value of the
                 contact this stream item is associated with.
             </li>
             <li>
-                {@link android.provider.ContactsContract.StreamItemsColumns#RAW_CONTACT_ID}: The
-                {@link android.provider.BaseColumns#_ID} value of the raw contact that this stream
+                android.provider.ContactsContract.StreamItemsColumns#RAW_CONTACT_ID: The
+                android.provider.BaseColumns#_ID value of the raw contact that this stream
                 item is associated with.
             </li>
         </ul>
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemsColumns#COMMENTS}
+        android.provider.ContactsContract.StreamItemsColumns#COMMENTS
     </dt>
     <dd>
         Optional. Stores summary information that you can display at the beginning of a stream item.
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemsColumns#TEXT}
+        android.provider.ContactsContract.StreamItemsColumns#TEXT
     </dt>
     <dd>
         The text of the stream item, either the content that was posted by the source of the item,
@@ -1899,7 +1899,7 @@
         ellipsize long content, but it will try to avoid breaking tags.
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemsColumns#TIMESTAMP}
+        android.provider.ContactsContract.StreamItemsColumns#TIMESTAMP
     </dt>
     <dd>
         A text string containing the time the stream item was inserted or updated, in the form
@@ -1910,42 +1910,42 @@
 </dl>
 <p>
     To display identifying information for your stream items, use the
-    {@link android.provider.ContactsContract.StreamItemsColumns#RES_ICON},
-    {@link android.provider.ContactsContract.StreamItemsColumns#RES_LABEL}, and
-    {@link android.provider.ContactsContract.StreamItemsColumns#RES_PACKAGE} to link to resources
+    android.provider.ContactsContract.StreamItemsColumns#RES_ICON,
+    android.provider.ContactsContract.StreamItemsColumns#RES_LABEL, and
+    android.provider.ContactsContract.StreamItemsColumns#RES_PACKAGE to link to resources
     in your application.
 </p>
 <p>
-    The {@link android.provider.ContactsContract.StreamItems} table also contains the columns
-    {@link android.provider.ContactsContract.StreamItemsColumns#SYNC1} through
-    {@link android.provider.ContactsContract.StreamItemsColumns#SYNC4} for the exclusive use of
+    The android.provider.ContactsContract.StreamItems table also contains the columns
+    android.provider.ContactsContract.StreamItemsColumns#SYNC1 through
+    android.provider.ContactsContract.StreamItemsColumns#SYNC4 for the exclusive use of
     sync adapters.
 </p>
 <h3 id="StreamPhotos">Social stream photos</h3>
 <p>
-   The {@link android.provider.ContactsContract.StreamItemPhotos} table stores photos associated
+   The android.provider.ContactsContract.StreamItemPhotos table stores photos associated
    with a stream item. The table's
-   {@link android.provider.ContactsContract.StreamItemPhotosColumns#STREAM_ITEM_ID} column
+   android.provider.ContactsContract.StreamItemPhotosColumns#STREAM_ITEM_ID column
    links to values in the {@link android.provider.BaseColumns#_ID} column of
-   {@link android.provider.ContactsContract.StreamItems} table. Photo references are stored in the
+   android.provider.ContactsContract.StreamItems table. Photo references are stored in the
    table in these columns:
 </p>
 <dl>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemPhotos#PHOTO} column (a BLOB).
+        android.provider.ContactsContract.StreamItemPhotos#PHOTO column (a BLOB).
     </dt>
     <dd>
         A binary representation of the photo, resized by the provider for storage and display.
         This column is available for backwards compatibility with previous versions of the Contacts
         Provider that used it for storing photos. However, in the current version
         you should not use this column to store photos. Instead, use
-        either {@link android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_FILE_ID} or
-        {@link android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_URI} (both of
+        either android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_FILE_ID or
+        android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_URI (both of
         which are described in the following points) to store photos in a file. This column now
         contains a thumbnail of the photo, which is available for reading.
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_FILE_ID}
+        android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_FILE_ID
     </dt>
     <dd>
         A numeric identifier of a photo for a raw contact. Append this value to the constant
@@ -1955,7 +1955,7 @@
         openAssetFileDescriptor()} to get a handle to the photo file.
     </dd>
     <dt>
-        {@link android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_URI}
+        android.provider.ContactsContract.StreamItemPhotosColumns#PHOTO_URI
     </dt>
     <dd>
         A content URI pointing directly to the photo file for the photo represented by this row.
@@ -1970,27 +1970,27 @@
     <ul>
         <li>
             These tables require additional access permissions. To read from them, your application
-            must have the permission {@link android.Manifest.permission#READ_SOCIAL_STREAM}. To
+            must have the permission android.Manifest.permission#READ_SOCIAL_STREAM. To
             modify them, your application must have the permission
-            {@link android.Manifest.permission#WRITE_SOCIAL_STREAM}.
+            android.Manifest.permission#WRITE_SOCIAL_STREAM.
         </li>
         <li>
-            For the {@link android.provider.ContactsContract.StreamItems} table, the number of rows
+            For the android.provider.ContactsContract.StreamItems table, the number of rows
             stored for each raw contact is limited. Once this limit is reached,
             the Contacts Provider makes space for new stream item rows by automatically deleting
             the rows having the oldest
-            {@link android.provider.ContactsContract.StreamItemsColumns#TIMESTAMP}. To get the
+            android.provider.ContactsContract.StreamItemsColumns#TIMESTAMP. To get the
             limit, issue a query to the content URI
-            {@link android.provider.ContactsContract.StreamItems#CONTENT_LIMIT_URI}. You can leave
+            android.provider.ContactsContract.StreamItems#CONTENT_LIMIT_URI. You can leave
             all the arguments other than the content URI set to <code>null</code>. The query
             returns a Cursor containing a single row, with the single column
-            {@link android.provider.ContactsContract.StreamItems#MAX_ITEMS}.
+            android.provider.ContactsContract.StreamItems#MAX_ITEMS.
         </li>
     </ul>
 
 <p>
-    The class {@link android.provider.ContactsContract.StreamItems.StreamItemPhotos} defines a
-    sub-table of {@link android.provider.ContactsContract.StreamItemPhotos} containing the photo
+    The class android.provider.ContactsContract.StreamItems.StreamItemPhotos defines a
+    sub-table of android.provider.ContactsContract.StreamItemPhotos containing the photo
     rows for a single stream item.
 </p>
 <h3 id="SocialStreamInteraction">Social stream interactions</h3>
@@ -2003,8 +2003,8 @@
         <li>
             By syncing your social networking service to the Contacts Provider with a sync
             adapter, you can retrieve recent activity for a user's contacts and store it in
-            the {@link android.provider.ContactsContract.StreamItems} and
-            {@link android.provider.ContactsContract.StreamItemPhotos} tables for later use.
+            the android.provider.ContactsContract.StreamItems and
+            android.provider.ContactsContract.StreamItemPhotos tables for later use.
         </li>
         <li>
             Besides regular synchronization, you can trigger your sync adapter to retrieve
@@ -2356,6 +2356,6 @@
 </p>
 <p>
     Social stream data for a person may also include photos. These are stored in the
-    {@link android.provider.ContactsContract.StreamItemPhotos} table, which is described in more
+    android.provider.ContactsContract.StreamItemPhotos table, which is described in more
     detail in the section <a href="#StreamPhotos">Social stream photos</a>.
 </p>
diff --git a/graphics/java/android/graphics/PorterDuff.java b/graphics/java/android/graphics/PorterDuff.java
index dcccf35..2bbbff3 100644
--- a/graphics/java/android/graphics/PorterDuff.java
+++ b/graphics/java/android/graphics/PorterDuff.java
@@ -67,4 +67,38 @@
          */
         public final int nativeInt;
     }
+
+    /**
+     * @hide
+     */
+    public static final int modeToInt(Mode mode) {
+        return mode.nativeInt;
+    }
+
+    /**
+     * @hide
+     */
+    public static final Mode intToMode(int val) {
+        switch (val) {
+            default:
+            case  0: return Mode.CLEAR;
+            case  1: return Mode.SRC;
+            case  2: return Mode.DST;
+            case  3: return Mode.SRC_OVER;
+            case  4: return Mode.DST_OVER;
+            case  5: return Mode.SRC_IN;
+            case  6: return Mode.DST_IN;
+            case  7: return Mode.SRC_OUT;
+            case  8: return Mode.DST_OUT;
+            case  9: return Mode.SRC_ATOP;
+            case 10: return Mode.DST_ATOP;
+            case 11: return Mode.XOR;
+            case 16: return Mode.DARKEN;
+            case 17: return Mode.LIGHTEN;
+            case 13: return Mode.MULTIPLY;
+            case 14: return Mode.SCREEN;
+            case 12: return Mode.ADD;
+            case 15: return Mode.OVERLAY;
+        }
+    }
 }
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index 85db6a1..7c9b30b 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -16,13 +16,16 @@
 
 package android.graphics.drawable;
 
+import android.annotation.ColorInt;
 import android.annotation.DrawableRes;
+import android.content.res.ColorStateList;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.PorterDuff;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Handler;
@@ -67,6 +70,10 @@
 
     private final int mType;
 
+    private ColorStateList mTintList;
+    static final PorterDuff.Mode DEFAULT_TINT_MODE = Drawable.DEFAULT_TINT_MODE; // SRC_IN
+    private PorterDuff.Mode mTintMode = DEFAULT_TINT_MODE;
+
     // To avoid adding unnecessary overhead, we have a few basic objects that get repurposed
     // based on the value of mType.
 
@@ -109,6 +116,10 @@
         return (Bitmap) mObj1;
     }
 
+    private void setBitmap(Bitmap b) {
+        mObj1 = b;
+    }
+
     /**
      * @return The length of the compressed bitmap byte array held by this {@link #TYPE_DATA} Icon.
      * @hide
@@ -254,6 +265,19 @@
      * @return A fresh instance of a drawable for this image, yours to keep.
      */
     public Drawable loadDrawable(Context context) {
+        final Drawable result = loadDrawableInner(context);
+        if (result != null && (mTintList != null || mTintMode != DEFAULT_TINT_MODE)) {
+            result.mutate();
+            result.setTintList(mTintList);
+            result.setTintMode(mTintMode);
+        }
+        return result;
+    }
+
+    /**
+     * Do the heavy lifting of loading the drawable, but stop short of applying any tint.
+     */
+    private Drawable loadDrawableInner(Context context) {
         switch (mType) {
             case TYPE_BITMAP:
                 return new BitmapDrawable(context.getResources(), getBitmap());
@@ -347,6 +371,16 @@
     }
 
     /**
+     * Puts the memory used by this instance into Ashmem memory, if possible.
+     * @hide
+     */
+    public void convertToAshmem() {
+        if (mType == TYPE_BITMAP && getBitmap().isMutable()) {
+            setBitmap(getBitmap().createAshmemBitmap());
+        }
+    }
+
+    /**
      * Writes a serialized version of an Icon to the specified stream.
      *
      * @param stream The stream on which to serialize the Icon.
@@ -466,7 +500,7 @@
             throw new IllegalArgumentException("Bitmap must not be null.");
         }
         final Icon rep = new Icon(TYPE_BITMAP);
-        rep.mObj1 = bits;
+        rep.setBitmap(bits);
         return rep;
     }
 
@@ -518,6 +552,38 @@
     }
 
     /**
+     * Store a color to use whenever this Icon is drawn.
+     *
+     * @param tint a color, as in {@link Drawable#setTint(int)}
+     * @return this same object, for use in chained construction
+     */
+    public Icon setTint(@ColorInt int tint) {
+        return setTintList(ColorStateList.valueOf(tint));
+    }
+
+    /**
+     * Store a color to use whenever this Icon is drawn.
+     *
+     * @param tintList as in {@link Drawable#setTintList(ColorStateList)}, null to remove tint
+     * @return this same object, for use in chained construction
+     */
+    public Icon setTintList(ColorStateList tintList) {
+        mTintList = tintList;
+        return this;
+    }
+
+    /**
+     * Store a blending mode to use whenever this Icon is drawn.
+     *
+     * @param mode a blending mode, as in {@link Drawable#setTintMode(PorterDuff.Mode)}, may be null
+     * @return this same object, for use in chained construction
+     */
+    public Icon setTintMode(PorterDuff.Mode mode) {
+        mTintMode = mode;
+        return this;
+    }
+
+    /**
      * Create an Icon pointing to an image file specified by path.
      *
      * @param path A path to a file that contains compressed bitmap data of
@@ -558,6 +624,15 @@
                 sb.append(" uri=").append(getUriString());
                 break;
         }
+        if (mTintList != null) {
+            sb.append(" tint=");
+            String sep = "";
+            for (int c : mTintList.getColors()) {
+                sb.append(String.format("%s0x%08x", sep, c));
+                sep = "|";
+            }
+        }
+        if (mTintMode != DEFAULT_TINT_MODE) sb.append(" mode=").append(mTintMode);
         sb.append(")");
         return sb.toString();
     }
@@ -603,31 +678,39 @@
                 throw new RuntimeException("invalid "
                         + this.getClass().getSimpleName() + " type in parcel: " + mType);
         }
+        if (in.readInt() == 1) {
+            mTintList = ColorStateList.CREATOR.createFromParcel(in);
+        }
+        mTintMode = PorterDuff.intToMode(in.readInt());
     }
 
     @Override
     public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(mType);
         switch (mType) {
             case TYPE_BITMAP:
                 final Bitmap bits = getBitmap();
-                dest.writeInt(TYPE_BITMAP);
                 getBitmap().writeToParcel(dest, flags);
                 break;
             case TYPE_RESOURCE:
-                dest.writeInt(TYPE_RESOURCE);
                 dest.writeString(getResPackage());
                 dest.writeInt(getResId());
                 break;
             case TYPE_DATA:
-                dest.writeInt(TYPE_DATA);
                 dest.writeInt(getDataLength());
                 dest.writeBlob(getDataBytes(), getDataOffset(), getDataLength());
                 break;
             case TYPE_URI:
-                dest.writeInt(TYPE_URI);
                 dest.writeString(getUriString());
                 break;
         }
+        if (mTintList == null) {
+            dest.writeInt(0);
+        } else {
+            dest.writeInt(1);
+            mTintList.writeToParcel(dest, flags);
+        }
+        dest.writeInt(PorterDuff.modeToInt(mTintMode));
     }
 
     public static final Parcelable.Creator<Icon> CREATOR
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index a323065..6cf66cd 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -419,12 +419,12 @@
 bool SkiaCanvas::clipRect(float left, float top, float right, float bottom, SkRegion::Op op) {
     SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
     mCanvas->clipRect(rect, op);
-    return mCanvas->isClipEmpty();
+    return !mCanvas->isClipEmpty();
 }
 
 bool SkiaCanvas::clipPath(const SkPath* path, SkRegion::Op op) {
     mCanvas->clipPath(*path, op);
-    return mCanvas->isClipEmpty();
+    return !mCanvas->isClipEmpty();
 }
 
 bool SkiaCanvas::clipRegion(const SkRegion* region, SkRegion::Op op) {
@@ -438,7 +438,7 @@
     } else {
         mCanvas->clipRect(SkRect::MakeEmpty(), op);
     }
-    return mCanvas->isClipEmpty();
+    return !mCanvas->isClipEmpty();
 }
 
 // ----------------------------------------------------------------------------
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
index fe148da..c541bca 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
@@ -186,6 +186,9 @@
         }
 
         if (!mState.restored) {
+            // In this case, we set the activity title in AsyncTask.onPostExecute().  To prevent
+            // talkback from reading aloud the default title, we clear it here.
+            setTitle("");
             if (mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) {
                 final Uri rootUri = getIntent().getData();
                 new RestoreRootTask(rootUri).executeOnExecutor(getCurrentExecutor());
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index b33b10b..25f8872 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -19,6 +19,7 @@
 import android.Manifest;
 import android.app.ActivityManager;
 import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothProfile;
 import android.bluetooth.IBluetooth;
 import android.bluetooth.IBluetoothCallback;
@@ -114,6 +115,13 @@
     private static final int SERVICE_IBLUETOOTH = 1;
     private static final int SERVICE_IBLUETOOTHGATT = 2;
 
+    private static final String[] DEVICE_TYPE_NAMES = new String[] {
+            "???",
+            "BR/EDR",
+            "LE",
+            "DUAL"
+        };
+
     private final Context mContext;
     private static int mBleAppCount = 0;
 
@@ -1801,6 +1809,14 @@
         } else {
             ParcelFileDescriptor pfd = null;
             try {
+                writer.println("Bonded devices:");
+                for (BluetoothDevice device : mBluetooth.getBondedDevices()) {
+                    writer.println("  " + device.getAddress() +
+                            " [" + DEVICE_TYPE_NAMES[device.getType()] + "] " +
+                            device.getName());
+                }
+                writer.flush();
+
                 pfd = ParcelFileDescriptor.dup(fd);
                 mBluetooth.dump(pfd);
             } catch (RemoteException re) {
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 5436ce0..c5ea8bc 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -27,11 +27,10 @@
 import android.content.pm.UserInfo;
 import static android.Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE;
 import static android.content.Context.USER_SERVICE;
-import static android.Manifest.permission.READ_PROFILE;
+import static android.Manifest.permission.READ_CONTACTS;
 import android.database.sqlite.SQLiteDatabase;
 import android.os.Binder;
 import android.os.IBinder;
-import android.os.Process;
 import android.os.RemoteException;
 import android.os.storage.IMountService;
 import android.os.ServiceManager;
@@ -264,12 +263,12 @@
     private final void checkReadPermission(String requestedKey, int userId) {
         final int callingUid = Binder.getCallingUid();
 
-        for (int i = 0; i < READ_PROFILE_PROTECTED_SETTINGS.length; i++) {
-            String key = READ_PROFILE_PROTECTED_SETTINGS[i];
-            if (key.equals(requestedKey) && mContext.checkCallingOrSelfPermission(READ_PROFILE)
+        for (int i = 0; i < READ_CONTACTS_PROTECTED_SETTINGS.length; i++) {
+            String key = READ_CONTACTS_PROTECTED_SETTINGS[i];
+            if (key.equals(requestedKey) && mContext.checkCallingOrSelfPermission(READ_CONTACTS)
                     != PackageManager.PERMISSION_GRANTED) {
                 throw new SecurityException("uid=" + callingUid
-                        + " needs permission " + READ_PROFILE + " to read "
+                        + " needs permission " + READ_CONTACTS + " to read "
                         + requestedKey + " for user " + userId);
             }
         }
@@ -722,8 +721,8 @@
         Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED
     };
 
-    // Reading these settings needs the profile permission
-    private static final String[] READ_PROFILE_PROTECTED_SETTINGS = new String[] {
+    // Reading these settings needs the contacts permission
+    private static final String[] READ_CONTACTS_PROTECTED_SETTINGS = new String[] {
         Secure.LOCK_SCREEN_OWNER_INFO_ENABLED,
         Secure.LOCK_SCREEN_OWNER_INFO
     };
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 3456dbc..50d311f 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1591,13 +1591,6 @@
             try {
                 final ContentValues values = new ContentValues();
                 values.put(ACCOUNTS_PASSWORD, password);
-                long time = 0;
-                // Only set current time, if it is a valid password. For clear password case, it
-                // should not be set.
-                if (password != null) {
-                    time = System.currentTimeMillis();
-                }
-                values.put(ACCOUNTS_LAST_AUTHENTICATE_TIME_EPOCH_MILLIS, time);
                 final long accountId = getAccountIdLocked(db, account);
                 if (accountId >= 0) {
                     final String[] argsAccountId = {String.valueOf(accountId)};
@@ -2130,7 +2123,7 @@
         try {
             new Session(accounts, response, accountType, expectActivityLaunch,
                     true /* stripAuthTokenFromResult */, null /* accountName */,
-                    false /* authDetailsRequired */) {
+                    false /* authDetailsRequired */, true /* updateLastAuthenticationTime */) {
                 @Override
                 public void run() throws RemoteException {
                     mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures,
@@ -2207,7 +2200,7 @@
         try {
             new Session(accounts, response, accountType, expectActivityLaunch,
                     true /* stripAuthTokenFromResult */, null /* accountName */,
-                    false /* authDetailsRequired */) {
+                    false /* authDetailsRequired */, true /* updateLastAuthenticationTime */) {
                 @Override
                 public void run() throws RemoteException {
                     mAuthenticator.addAccount(this, mAccountType, authTokenType, requiredFeatures,
@@ -2940,14 +2933,14 @@
             if (result != null) {
                 boolean isSuccessfulConfirmCreds = result.getBoolean(
                         AccountManager.KEY_BOOLEAN_RESULT, false);
-                boolean isSuccessfulUpdateCreds =
+                boolean isSuccessfulUpdateCredsOrAddAccount =
                         result.containsKey(AccountManager.KEY_ACCOUNT_NAME)
                         && result.containsKey(AccountManager.KEY_ACCOUNT_TYPE);
                 // We should only update lastAuthenticated time, if
                 // mUpdateLastAuthenticatedTime is true and the confirmRequest
                 // or updateRequest was successful
                 boolean needUpdate = mUpdateLastAuthenticatedTime
-                        && (isSuccessfulConfirmCreds || isSuccessfulUpdateCreds);
+                        && (isSuccessfulConfirmCreds || isSuccessfulUpdateCredsOrAddAccount);
                 if (needUpdate || mAuthDetailsRequired) {
                     boolean accountPresent = isAccountPresentForCaller(mAccountName, mAccountType);
                     if (needUpdate && accountPresent) {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 47d3bde..0dc4076 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -3099,10 +3099,13 @@
                         || mContext.getResources().getBoolean(
                                 com.android.internal.R.bool.config_safe_media_volume_enabled);
 
+                boolean safeMediaVolumeBypass =
+                        SystemProperties.getBoolean("audio.safemedia.bypass", false);
+
                 // The persisted state is either "disabled" or "active": this is the state applied
                 // next time we boot and cannot be "inactive"
                 int persistedState;
-                if (safeMediaVolumeEnabled) {
+                if (safeMediaVolumeEnabled && !safeMediaVolumeBypass) {
                     persistedState = SAFE_MEDIA_VOLUME_ACTIVE;
                     // The state can already be "inactive" here if the user has forced it before
                     // the 30 seconds timeout for forced configuration. In this case we don't reset
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 79dac14..93e1f18 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5381,10 +5381,16 @@
     }
 
     private boolean wakeUp(long wakeTime, boolean wakeInTheaterMode) {
-        if (!wakeInTheaterMode && isTheaterModeEnabled()) {
+        final boolean theaterModeEnabled = isTheaterModeEnabled();
+        if (!wakeInTheaterMode && theaterModeEnabled) {
             return false;
         }
 
+        if (theaterModeEnabled) {
+            Settings.Global.putInt(mContext.getContentResolver(),
+                    Settings.Global.THEATER_MODE_ON, 0);
+        }
+
         mPowerManager.wakeUp(wakeTime);
         return true;
     }