Merge "Fix a bug in querying showing state for action bars"
diff --git a/Android.mk b/Android.mk
index 966c64d..48415b3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -157,6 +157,7 @@
 	core/java/android/net/INetworkManagementEventObserver.aidl \
 	core/java/android/net/INetworkPolicyListener.aidl \
 	core/java/android/net/INetworkPolicyManager.aidl \
+	core/java/android/net/INetworkScoreCache.aidl \
 	core/java/android/net/INetworkScoreService.aidl \
 	core/java/android/net/INetworkStatsService.aidl \
 	core/java/android/net/INetworkStatsSession.aidl \
diff --git a/api/current.txt b/api/current.txt
index f6d976e..3f6b297 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -491,7 +491,7 @@
     field public static final int editTextStyle = 16842862; // 0x101006e
     field public static final deprecated int editable = 16843115; // 0x101016b
     field public static final int editorExtras = 16843300; // 0x1010224
-    field public static final int elevation = 16843852; // 0x101044c
+    field public static final int elevation = 16843853; // 0x101044d
     field public static final int ellipsize = 16842923; // 0x10100ab
     field public static final int ems = 16843096; // 0x1010158
     field public static final int enabled = 16842766; // 0x101000e
@@ -501,9 +501,9 @@
     field public static final int entries = 16842930; // 0x10100b2
     field public static final int entryValues = 16843256; // 0x10101f8
     field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d
-    field public static final int excludeClass = 16843854; // 0x101044e
+    field public static final int excludeClass = 16843855; // 0x101044f
     field public static final int excludeFromRecents = 16842775; // 0x1010017
-    field public static final int excludeId = 16843853; // 0x101044d
+    field public static final int excludeId = 16843854; // 0x101044e
     field public static final int exitFadeDuration = 16843533; // 0x101030d
     field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052
     field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053
@@ -598,7 +598,7 @@
     field public static final int headerBackground = 16843055; // 0x101012f
     field public static final int headerDividersEnabled = 16843310; // 0x101022e
     field public static final int height = 16843093; // 0x1010155
-    field public static final int hideOnContentScroll = 16843855; // 0x101044f
+    field public static final int hideOnContentScroll = 16843856; // 0x1010450
     field public static final int hint = 16843088; // 0x1010150
     field public static final int homeAsUpIndicator = 16843531; // 0x101030b
     field public static final int homeLayout = 16843549; // 0x101031d
@@ -1052,6 +1052,7 @@
     field public static final int sspPattern = 16843749; // 0x10103e5
     field public static final int sspPrefix = 16843748; // 0x10103e4
     field public static final int stackFromBottom = 16843005; // 0x10100fd
+    field public static final int stackViewStyle = 16843851; // 0x101044b
     field public static final int starStyle = 16842882; // 0x1010082
     field public static final int startColor = 16843165; // 0x101019d
     field public static final int startDelay = 16843746; // 0x10103e2
@@ -1109,7 +1110,7 @@
     field public static final int switchMinWidth = 16843632; // 0x1010370
     field public static final int switchPadding = 16843633; // 0x1010371
     field public static final int switchPreferenceStyle = 16843629; // 0x101036d
-    field public static final int switchStyle = 16843851; // 0x101044b
+    field public static final int switchStyle = 16843852; // 0x101044c
     field public static final int switchTextAppearance = 16843630; // 0x101036e
     field public static final int switchTextOff = 16843628; // 0x101036c
     field public static final int switchTextOn = 16843627; // 0x101036b
@@ -1856,52 +1857,52 @@
     field public static final int TextAppearance_Large_Inverse = 16973891; // 0x1030043
     field public static final int TextAppearance_Medium = 16973892; // 0x1030044
     field public static final int TextAppearance_Medium_Inverse = 16973893; // 0x1030045
-    field public static final int TextAppearance_Quantum = 16974346; // 0x103020a
-    field public static final int TextAppearance_Quantum_Body1 = 16974538; // 0x10302ca
-    field public static final int TextAppearance_Quantum_Body2 = 16974537; // 0x10302c9
-    field public static final int TextAppearance_Quantum_Button = 16974541; // 0x10302cd
-    field public static final int TextAppearance_Quantum_Caption = 16974539; // 0x10302cb
-    field public static final int TextAppearance_Quantum_DialogWindowTitle = 16974347; // 0x103020b
-    field public static final int TextAppearance_Quantum_Display1 = 16974533; // 0x10302c5
-    field public static final int TextAppearance_Quantum_Display2 = 16974532; // 0x10302c4
-    field public static final int TextAppearance_Quantum_Display3 = 16974531; // 0x10302c3
-    field public static final int TextAppearance_Quantum_Display4 = 16974530; // 0x10302c2
-    field public static final int TextAppearance_Quantum_Headline = 16974534; // 0x10302c6
-    field public static final int TextAppearance_Quantum_Inverse = 16974348; // 0x103020c
-    field public static final int TextAppearance_Quantum_Large = 16974349; // 0x103020d
-    field public static final int TextAppearance_Quantum_Large_Inverse = 16974350; // 0x103020e
-    field public static final int TextAppearance_Quantum_Medium = 16974351; // 0x103020f
-    field public static final int TextAppearance_Quantum_Medium_Inverse = 16974352; // 0x1030210
-    field public static final int TextAppearance_Quantum_Menu = 16974540; // 0x10302cc
-    field public static final int TextAppearance_Quantum_SearchResult_Subtitle = 16974353; // 0x1030211
-    field public static final int TextAppearance_Quantum_SearchResult_Title = 16974354; // 0x1030212
-    field public static final int TextAppearance_Quantum_Small = 16974355; // 0x1030213
-    field public static final int TextAppearance_Quantum_Small_Inverse = 16974356; // 0x1030214
-    field public static final int TextAppearance_Quantum_Subhead = 16974536; // 0x10302c8
-    field public static final int TextAppearance_Quantum_Title = 16974535; // 0x10302c7
-    field public static final int TextAppearance_Quantum_Widget = 16974358; // 0x1030216
-    field public static final int TextAppearance_Quantum_Widget_ActionBar_Menu = 16974359; // 0x1030217
-    field public static final int TextAppearance_Quantum_Widget_ActionBar_Subtitle = 16974360; // 0x1030218
-    field public static final int TextAppearance_Quantum_Widget_ActionBar_Subtitle_Inverse = 16974361; // 0x1030219
-    field public static final int TextAppearance_Quantum_Widget_ActionBar_Title = 16974362; // 0x103021a
-    field public static final int TextAppearance_Quantum_Widget_ActionBar_Title_Inverse = 16974363; // 0x103021b
-    field public static final int TextAppearance_Quantum_Widget_ActionMode_Subtitle = 16974364; // 0x103021c
-    field public static final int TextAppearance_Quantum_Widget_ActionMode_Subtitle_Inverse = 16974365; // 0x103021d
-    field public static final int TextAppearance_Quantum_Widget_ActionMode_Title = 16974366; // 0x103021e
-    field public static final int TextAppearance_Quantum_Widget_ActionMode_Title_Inverse = 16974367; // 0x103021f
-    field public static final int TextAppearance_Quantum_Widget_Button = 16974368; // 0x1030220
-    field public static final int TextAppearance_Quantum_Widget_DropDownHint = 16974369; // 0x1030221
-    field public static final int TextAppearance_Quantum_Widget_DropDownItem = 16974370; // 0x1030222
-    field public static final int TextAppearance_Quantum_Widget_EditText = 16974371; // 0x1030223
-    field public static final int TextAppearance_Quantum_Widget_IconMenu_Item = 16974372; // 0x1030224
-    field public static final int TextAppearance_Quantum_Widget_PopupMenu = 16974373; // 0x1030225
-    field public static final int TextAppearance_Quantum_Widget_PopupMenu_Large = 16974374; // 0x1030226
-    field public static final int TextAppearance_Quantum_Widget_PopupMenu_Small = 16974375; // 0x1030227
-    field public static final int TextAppearance_Quantum_Widget_TabWidget = 16974376; // 0x1030228
-    field public static final int TextAppearance_Quantum_Widget_TextView = 16974377; // 0x1030229
-    field public static final int TextAppearance_Quantum_Widget_TextView_PopupMenu = 16974378; // 0x103022a
-    field public static final int TextAppearance_Quantum_Widget_TextView_SpinnerItem = 16974379; // 0x103022b
-    field public static final int TextAppearance_Quantum_WindowTitle = 16974357; // 0x1030215
+    field public static final int TextAppearance_Quantum = 16974352; // 0x1030210
+    field public static final int TextAppearance_Quantum_Body1 = 16974546; // 0x10302d2
+    field public static final int TextAppearance_Quantum_Body2 = 16974545; // 0x10302d1
+    field public static final int TextAppearance_Quantum_Button = 16974549; // 0x10302d5
+    field public static final int TextAppearance_Quantum_Caption = 16974547; // 0x10302d3
+    field public static final int TextAppearance_Quantum_DialogWindowTitle = 16974353; // 0x1030211
+    field public static final int TextAppearance_Quantum_Display1 = 16974541; // 0x10302cd
+    field public static final int TextAppearance_Quantum_Display2 = 16974540; // 0x10302cc
+    field public static final int TextAppearance_Quantum_Display3 = 16974539; // 0x10302cb
+    field public static final int TextAppearance_Quantum_Display4 = 16974538; // 0x10302ca
+    field public static final int TextAppearance_Quantum_Headline = 16974542; // 0x10302ce
+    field public static final int TextAppearance_Quantum_Inverse = 16974354; // 0x1030212
+    field public static final int TextAppearance_Quantum_Large = 16974355; // 0x1030213
+    field public static final int TextAppearance_Quantum_Large_Inverse = 16974356; // 0x1030214
+    field public static final int TextAppearance_Quantum_Medium = 16974357; // 0x1030215
+    field public static final int TextAppearance_Quantum_Medium_Inverse = 16974358; // 0x1030216
+    field public static final int TextAppearance_Quantum_Menu = 16974548; // 0x10302d4
+    field public static final int TextAppearance_Quantum_SearchResult_Subtitle = 16974359; // 0x1030217
+    field public static final int TextAppearance_Quantum_SearchResult_Title = 16974360; // 0x1030218
+    field public static final int TextAppearance_Quantum_Small = 16974361; // 0x1030219
+    field public static final int TextAppearance_Quantum_Small_Inverse = 16974362; // 0x103021a
+    field public static final int TextAppearance_Quantum_Subhead = 16974544; // 0x10302d0
+    field public static final int TextAppearance_Quantum_Title = 16974543; // 0x10302cf
+    field public static final int TextAppearance_Quantum_Widget = 16974364; // 0x103021c
+    field public static final int TextAppearance_Quantum_Widget_ActionBar_Menu = 16974365; // 0x103021d
+    field public static final int TextAppearance_Quantum_Widget_ActionBar_Subtitle = 16974366; // 0x103021e
+    field public static final int TextAppearance_Quantum_Widget_ActionBar_Subtitle_Inverse = 16974367; // 0x103021f
+    field public static final int TextAppearance_Quantum_Widget_ActionBar_Title = 16974368; // 0x1030220
+    field public static final int TextAppearance_Quantum_Widget_ActionBar_Title_Inverse = 16974369; // 0x1030221
+    field public static final int TextAppearance_Quantum_Widget_ActionMode_Subtitle = 16974370; // 0x1030222
+    field public static final int TextAppearance_Quantum_Widget_ActionMode_Subtitle_Inverse = 16974371; // 0x1030223
+    field public static final int TextAppearance_Quantum_Widget_ActionMode_Title = 16974372; // 0x1030224
+    field public static final int TextAppearance_Quantum_Widget_ActionMode_Title_Inverse = 16974373; // 0x1030225
+    field public static final int TextAppearance_Quantum_Widget_Button = 16974374; // 0x1030226
+    field public static final int TextAppearance_Quantum_Widget_DropDownHint = 16974375; // 0x1030227
+    field public static final int TextAppearance_Quantum_Widget_DropDownItem = 16974376; // 0x1030228
+    field public static final int TextAppearance_Quantum_Widget_EditText = 16974377; // 0x1030229
+    field public static final int TextAppearance_Quantum_Widget_IconMenu_Item = 16974378; // 0x103022a
+    field public static final int TextAppearance_Quantum_Widget_PopupMenu = 16974379; // 0x103022b
+    field public static final int TextAppearance_Quantum_Widget_PopupMenu_Large = 16974380; // 0x103022c
+    field public static final int TextAppearance_Quantum_Widget_PopupMenu_Small = 16974381; // 0x103022d
+    field public static final int TextAppearance_Quantum_Widget_TabWidget = 16974382; // 0x103022e
+    field public static final int TextAppearance_Quantum_Widget_TextView = 16974383; // 0x103022f
+    field public static final int TextAppearance_Quantum_Widget_TextView_PopupMenu = 16974384; // 0x1030230
+    field public static final int TextAppearance_Quantum_Widget_TextView_SpinnerItem = 16974385; // 0x1030231
+    field public static final int TextAppearance_Quantum_WindowTitle = 16974363; // 0x103021b
     field public static final int TextAppearance_Small = 16973894; // 0x1030046
     field public static final int TextAppearance_Small_Inverse = 16973895; // 0x1030047
     field public static final int TextAppearance_StatusBar_EventContent = 16973927; // 0x1030067
@@ -1996,34 +1997,34 @@
     field public static final int Theme_NoTitleBar_Fullscreen = 16973831; // 0x1030007
     field public static final int Theme_NoTitleBar_OverlayActionModes = 16973930; // 0x103006a
     field public static final int Theme_Panel = 16973913; // 0x1030059
-    field public static final int Theme_Quantum = 16974380; // 0x103022c
-    field public static final int Theme_Quantum_Dialog = 16974381; // 0x103022d
-    field public static final int Theme_Quantum_DialogWhenLarge = 16974385; // 0x1030231
-    field public static final int Theme_Quantum_DialogWhenLarge_NoActionBar = 16974386; // 0x1030232
-    field public static final int Theme_Quantum_Dialog_MinWidth = 16974382; // 0x103022e
-    field public static final int Theme_Quantum_Dialog_NoActionBar = 16974383; // 0x103022f
-    field public static final int Theme_Quantum_Dialog_NoActionBar_MinWidth = 16974384; // 0x1030230
-    field public static final int Theme_Quantum_InputMethod = 16974387; // 0x1030233
-    field public static final int Theme_Quantum_Light = 16974395; // 0x103023b
-    field public static final int Theme_Quantum_Light_DarkActionBar = 16974396; // 0x103023c
-    field public static final int Theme_Quantum_Light_Dialog = 16974397; // 0x103023d
-    field public static final int Theme_Quantum_Light_DialogWhenLarge = 16974401; // 0x1030241
-    field public static final int Theme_Quantum_Light_DialogWhenLarge_NoActionBar = 16974402; // 0x1030242
-    field public static final int Theme_Quantum_Light_Dialog_MinWidth = 16974398; // 0x103023e
-    field public static final int Theme_Quantum_Light_Dialog_NoActionBar = 16974399; // 0x103023f
-    field public static final int Theme_Quantum_Light_Dialog_NoActionBar_MinWidth = 16974400; // 0x1030240
-    field public static final int Theme_Quantum_Light_NoActionBar = 16974403; // 0x1030243
-    field public static final int Theme_Quantum_Light_NoActionBar_Fullscreen = 16974404; // 0x1030244
-    field public static final int Theme_Quantum_Light_NoActionBar_Overscan = 16974405; // 0x1030245
-    field public static final int Theme_Quantum_Light_NoActionBar_TranslucentDecor = 16974406; // 0x1030246
-    field public static final int Theme_Quantum_Light_Panel = 16974407; // 0x1030247
-    field public static final int Theme_Quantum_NoActionBar = 16974388; // 0x1030234
-    field public static final int Theme_Quantum_NoActionBar_Fullscreen = 16974389; // 0x1030235
-    field public static final int Theme_Quantum_NoActionBar_Overscan = 16974390; // 0x1030236
-    field public static final int Theme_Quantum_NoActionBar_TranslucentDecor = 16974391; // 0x1030237
-    field public static final int Theme_Quantum_Panel = 16974392; // 0x1030238
-    field public static final int Theme_Quantum_Wallpaper = 16974393; // 0x1030239
-    field public static final int Theme_Quantum_Wallpaper_NoTitleBar = 16974394; // 0x103023a
+    field public static final int Theme_Quantum = 16974386; // 0x1030232
+    field public static final int Theme_Quantum_Dialog = 16974387; // 0x1030233
+    field public static final int Theme_Quantum_DialogWhenLarge = 16974391; // 0x1030237
+    field public static final int Theme_Quantum_DialogWhenLarge_NoActionBar = 16974392; // 0x1030238
+    field public static final int Theme_Quantum_Dialog_MinWidth = 16974388; // 0x1030234
+    field public static final int Theme_Quantum_Dialog_NoActionBar = 16974389; // 0x1030235
+    field public static final int Theme_Quantum_Dialog_NoActionBar_MinWidth = 16974390; // 0x1030236
+    field public static final int Theme_Quantum_InputMethod = 16974393; // 0x1030239
+    field public static final int Theme_Quantum_Light = 16974401; // 0x1030241
+    field public static final int Theme_Quantum_Light_DarkActionBar = 16974402; // 0x1030242
+    field public static final int Theme_Quantum_Light_Dialog = 16974403; // 0x1030243
+    field public static final int Theme_Quantum_Light_DialogWhenLarge = 16974407; // 0x1030247
+    field public static final int Theme_Quantum_Light_DialogWhenLarge_NoActionBar = 16974408; // 0x1030248
+    field public static final int Theme_Quantum_Light_Dialog_MinWidth = 16974404; // 0x1030244
+    field public static final int Theme_Quantum_Light_Dialog_NoActionBar = 16974405; // 0x1030245
+    field public static final int Theme_Quantum_Light_Dialog_NoActionBar_MinWidth = 16974406; // 0x1030246
+    field public static final int Theme_Quantum_Light_NoActionBar = 16974409; // 0x1030249
+    field public static final int Theme_Quantum_Light_NoActionBar_Fullscreen = 16974410; // 0x103024a
+    field public static final int Theme_Quantum_Light_NoActionBar_Overscan = 16974411; // 0x103024b
+    field public static final int Theme_Quantum_Light_NoActionBar_TranslucentDecor = 16974412; // 0x103024c
+    field public static final int Theme_Quantum_Light_Panel = 16974413; // 0x103024d
+    field public static final int Theme_Quantum_NoActionBar = 16974394; // 0x103023a
+    field public static final int Theme_Quantum_NoActionBar_Fullscreen = 16974395; // 0x103023b
+    field public static final int Theme_Quantum_NoActionBar_Overscan = 16974396; // 0x103023c
+    field public static final int Theme_Quantum_NoActionBar_TranslucentDecor = 16974397; // 0x103023d
+    field public static final int Theme_Quantum_Panel = 16974398; // 0x103023e
+    field public static final int Theme_Quantum_Wallpaper = 16974399; // 0x103023f
+    field public static final int Theme_Quantum_Wallpaper_NoTitleBar = 16974400; // 0x1030240
     field public static final int Theme_Translucent = 16973839; // 0x103000f
     field public static final int Theme_Translucent_NoTitleBar = 16973840; // 0x1030010
     field public static final int Theme_Translucent_NoTitleBar_Fullscreen = 16973841; // 0x1030011
@@ -2080,8 +2081,8 @@
     field public static final int Widget_DeviceDefault_DropDownItem_Spinner = 16974178; // 0x1030162
     field public static final int Widget_DeviceDefault_EditText = 16974154; // 0x103014a
     field public static final int Widget_DeviceDefault_ExpandableListView = 16974155; // 0x103014b
-    field public static final int Widget_DeviceDefault_FastScroll = 16974344; // 0x1030208
-    field public static final int Widget_DeviceDefault_FragmentBreadCrumbs = 16974339; // 0x1030203
+    field public static final int Widget_DeviceDefault_FastScroll = 16974346; // 0x103020a
+    field public static final int Widget_DeviceDefault_FragmentBreadCrumbs = 16974347; // 0x103020b
     field public static final int Widget_DeviceDefault_GridView = 16974156; // 0x103014c
     field public static final int Widget_DeviceDefault_HorizontalScrollView = 16974171; // 0x103015b
     field public static final int Widget_DeviceDefault_ImageButton = 16974157; // 0x103014d
@@ -2115,8 +2116,8 @@
     field public static final int Widget_DeviceDefault_Light_DropDownItem_Spinner = 16974233; // 0x1030199
     field public static final int Widget_DeviceDefault_Light_EditText = 16974206; // 0x103017e
     field public static final int Widget_DeviceDefault_Light_ExpandableListView = 16974207; // 0x103017f
-    field public static final int Widget_DeviceDefault_Light_FastScroll = 16974345; // 0x1030209
-    field public static final int Widget_DeviceDefault_Light_FragmentBreadCrumbs = 16974340; // 0x1030204
+    field public static final int Widget_DeviceDefault_Light_FastScroll = 16974349; // 0x103020d
+    field public static final int Widget_DeviceDefault_Light_FragmentBreadCrumbs = 16974350; // 0x103020e
     field public static final int Widget_DeviceDefault_Light_GridView = 16974208; // 0x1030180
     field public static final int Widget_DeviceDefault_Light_HorizontalScrollView = 16974226; // 0x1030192
     field public static final int Widget_DeviceDefault_Light_ImageButton = 16974209; // 0x1030181
@@ -2140,6 +2141,7 @@
     field public static final int Widget_DeviceDefault_Light_ScrollView = 16974225; // 0x1030191
     field public static final int Widget_DeviceDefault_Light_SeekBar = 16974220; // 0x103018c
     field public static final int Widget_DeviceDefault_Light_Spinner = 16974227; // 0x1030193
+    field public static final int Widget_DeviceDefault_Light_StackView = 16974351; // 0x103020f
     field public static final int Widget_DeviceDefault_Light_Tab = 16974237; // 0x103019d
     field public static final int Widget_DeviceDefault_Light_TabWidget = 16974229; // 0x1030195
     field public static final int Widget_DeviceDefault_Light_TextView = 16974202; // 0x103017a
@@ -2163,6 +2165,7 @@
     field public static final int Widget_DeviceDefault_ScrollView = 16974170; // 0x103015a
     field public static final int Widget_DeviceDefault_SeekBar = 16974165; // 0x1030155
     field public static final int Widget_DeviceDefault_Spinner = 16974172; // 0x103015c
+    field public static final int Widget_DeviceDefault_StackView = 16974348; // 0x103020c
     field public static final int Widget_DeviceDefault_Tab = 16974189; // 0x103016d
     field public static final int Widget_DeviceDefault_TabWidget = 16974174; // 0x103015e
     field public static final int Widget_DeviceDefault_TextView = 16974150; // 0x1030146
@@ -2173,7 +2176,7 @@
     field public static final int Widget_DropDownItem_Spinner = 16973868; // 0x103002c
     field public static final int Widget_EditText = 16973859; // 0x1030023
     field public static final int Widget_ExpandableListView = 16973860; // 0x1030024
-    field public static final int Widget_FastScroll = 16974341; // 0x1030205
+    field public static final int Widget_FastScroll = 16974337; // 0x1030201
     field public static final int Widget_FragmentBreadCrumbs = 16973961; // 0x1030089
     field public static final int Widget_Gallery = 16973877; // 0x1030035
     field public static final int Widget_GridView = 16973874; // 0x1030032
@@ -2205,8 +2208,8 @@
     field public static final int Widget_Holo_DropDownItem_Spinner = 16973995; // 0x10300ab
     field public static final int Widget_Holo_EditText = 16973971; // 0x1030093
     field public static final int Widget_Holo_ExpandableListView = 16973972; // 0x1030094
-    field public static final int Widget_Holo_FastScroll = 16974342; // 0x1030206
-    field public static final int Widget_Holo_FragmentBreadCrumbs = 16974337; // 0x1030201
+    field public static final int Widget_Holo_FastScroll = 16974339; // 0x1030203
+    field public static final int Widget_Holo_FragmentBreadCrumbs = 16974340; // 0x1030204
     field public static final int Widget_Holo_GridView = 16973973; // 0x1030095
     field public static final int Widget_Holo_HorizontalScrollView = 16973988; // 0x10300a4
     field public static final int Widget_Holo_ImageButton = 16973974; // 0x1030096
@@ -2227,7 +2230,7 @@
     field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974119; // 0x1030127
     field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb
     field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6
-    field public static final int Widget_Holo_Light_Button_Borderless = 16974542; // 0x10302ce
+    field public static final int Widget_Holo_Light_Button_Borderless = 16974342; // 0x1030206
     field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974107; // 0x103011b
     field public static final int Widget_Holo_Light_Button_Inset = 16974008; // 0x10300b8
     field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7
@@ -2242,7 +2245,7 @@
     field public static final int Widget_Holo_Light_EditText = 16974014; // 0x10300be
     field public static final int Widget_Holo_Light_ExpandableListView = 16974015; // 0x10300bf
     field public static final int Widget_Holo_Light_FastScroll = 16974343; // 0x1030207
-    field public static final int Widget_Holo_Light_FragmentBreadCrumbs = 16974338; // 0x1030202
+    field public static final int Widget_Holo_Light_FragmentBreadCrumbs = 16974344; // 0x1030208
     field public static final int Widget_Holo_Light_GridView = 16974016; // 0x10300c0
     field public static final int Widget_Holo_Light_HorizontalScrollView = 16974034; // 0x10300d2
     field public static final int Widget_Holo_Light_ImageButton = 16974017; // 0x10300c1
@@ -2266,6 +2269,7 @@
     field public static final int Widget_Holo_Light_ScrollView = 16974033; // 0x10300d1
     field public static final int Widget_Holo_Light_SeekBar = 16974028; // 0x10300cc
     field public static final int Widget_Holo_Light_Spinner = 16974035; // 0x10300d3
+    field public static final int Widget_Holo_Light_StackView = 16974345; // 0x1030209
     field public static final int Widget_Holo_Light_Tab = 16974052; // 0x10300e4
     field public static final int Widget_Holo_Light_TabWidget = 16974037; // 0x10300d5
     field public static final int Widget_Holo_Light_TextView = 16974010; // 0x10300ba
@@ -2289,6 +2293,7 @@
     field public static final int Widget_Holo_ScrollView = 16973987; // 0x10300a3
     field public static final int Widget_Holo_SeekBar = 16973982; // 0x103009e
     field public static final int Widget_Holo_Spinner = 16973989; // 0x10300a5
+    field public static final int Widget_Holo_StackView = 16974341; // 0x1030205
     field public static final int Widget_Holo_Tab = 16974051; // 0x10300e3
     field public static final int Widget_Holo_TabWidget = 16973991; // 0x10300a7
     field public static final int Widget_Holo_TextView = 16973967; // 0x103008f
@@ -2312,133 +2317,136 @@
     field public static final int Widget_ProgressBar_Large_Inverse = 16973916; // 0x103005c
     field public static final int Widget_ProgressBar_Small = 16973854; // 0x103001e
     field public static final int Widget_ProgressBar_Small_Inverse = 16973917; // 0x103005d
-    field public static final int Widget_Quantum = 16974408; // 0x1030248
-    field public static final int Widget_Quantum_ActionBar = 16974409; // 0x1030249
-    field public static final int Widget_Quantum_ActionBar_Solid = 16974410; // 0x103024a
-    field public static final int Widget_Quantum_ActionBar_TabBar = 16974411; // 0x103024b
-    field public static final int Widget_Quantum_ActionBar_TabText = 16974412; // 0x103024c
-    field public static final int Widget_Quantum_ActionBar_TabView = 16974413; // 0x103024d
-    field public static final int Widget_Quantum_ActionButton = 16974414; // 0x103024e
-    field public static final int Widget_Quantum_ActionButton_CloseMode = 16974415; // 0x103024f
-    field public static final int Widget_Quantum_ActionButton_Overflow = 16974416; // 0x1030250
-    field public static final int Widget_Quantum_ActionButton_TextButton = 16974417; // 0x1030251
-    field public static final int Widget_Quantum_ActionMode = 16974418; // 0x1030252
-    field public static final int Widget_Quantum_AutoCompleteTextView = 16974419; // 0x1030253
-    field public static final int Widget_Quantum_Button = 16974420; // 0x1030254
-    field public static final int Widget_Quantum_ButtonBar = 16974426; // 0x103025a
-    field public static final int Widget_Quantum_ButtonBar_AlertDialog = 16974427; // 0x103025b
-    field public static final int Widget_Quantum_Button_Borderless = 16974421; // 0x1030255
-    field public static final int Widget_Quantum_Button_Borderless_Small = 16974422; // 0x1030256
-    field public static final int Widget_Quantum_Button_Inset = 16974423; // 0x1030257
-    field public static final int Widget_Quantum_Button_Paper = 16974526; // 0x10302be
-    field public static final int Widget_Quantum_Button_Paper_Color = 16974527; // 0x10302bf
-    field public static final int Widget_Quantum_Button_Small = 16974424; // 0x1030258
-    field public static final int Widget_Quantum_Button_Toggle = 16974425; // 0x1030259
-    field public static final int Widget_Quantum_CalendarView = 16974428; // 0x103025c
-    field public static final int Widget_Quantum_CheckedTextView = 16974429; // 0x103025d
-    field public static final int Widget_Quantum_CompoundButton_CheckBox = 16974430; // 0x103025e
-    field public static final int Widget_Quantum_CompoundButton_RadioButton = 16974431; // 0x103025f
-    field public static final int Widget_Quantum_CompoundButton_Star = 16974432; // 0x1030260
-    field public static final int Widget_Quantum_DatePicker = 16974433; // 0x1030261
-    field public static final int Widget_Quantum_DropDownItem = 16974434; // 0x1030262
-    field public static final int Widget_Quantum_DropDownItem_Spinner = 16974435; // 0x1030263
-    field public static final int Widget_Quantum_EditText = 16974436; // 0x1030264
-    field public static final int Widget_Quantum_ExpandableListView = 16974437; // 0x1030265
-    field public static final int Widget_Quantum_FastScroll = 16974438; // 0x1030266
-    field public static final int Widget_Quantum_FragmentBreadCrumbs = 16974439; // 0x1030267
-    field public static final int Widget_Quantum_GridView = 16974440; // 0x1030268
-    field public static final int Widget_Quantum_HorizontalScrollView = 16974441; // 0x1030269
-    field public static final int Widget_Quantum_ImageButton = 16974442; // 0x103026a
-    field public static final int Widget_Quantum_Light = 16974467; // 0x1030283
-    field public static final int Widget_Quantum_Light_ActionBar = 16974468; // 0x1030284
-    field public static final int Widget_Quantum_Light_ActionBar_Solid = 16974469; // 0x1030285
-    field public static final int Widget_Quantum_Light_ActionBar_TabBar = 16974470; // 0x1030286
-    field public static final int Widget_Quantum_Light_ActionBar_TabText = 16974471; // 0x1030287
-    field public static final int Widget_Quantum_Light_ActionBar_TabView = 16974472; // 0x1030288
-    field public static final int Widget_Quantum_Light_ActionButton = 16974473; // 0x1030289
-    field public static final int Widget_Quantum_Light_ActionButton_CloseMode = 16974474; // 0x103028a
-    field public static final int Widget_Quantum_Light_ActionButton_Overflow = 16974475; // 0x103028b
-    field public static final int Widget_Quantum_Light_ActionMode = 16974476; // 0x103028c
-    field public static final int Widget_Quantum_Light_AutoCompleteTextView = 16974477; // 0x103028d
-    field public static final int Widget_Quantum_Light_Button = 16974478; // 0x103028e
-    field public static final int Widget_Quantum_Light_ButtonBar = 16974483; // 0x1030293
-    field public static final int Widget_Quantum_Light_ButtonBar_AlertDialog = 16974484; // 0x1030294
-    field public static final int Widget_Quantum_Light_Button_Borderless_Small = 16974479; // 0x103028f
-    field public static final int Widget_Quantum_Light_Button_Inset = 16974480; // 0x1030290
-    field public static final int Widget_Quantum_Light_Button_Paper = 16974528; // 0x10302c0
-    field public static final int Widget_Quantum_Light_Button_Paper_Color = 16974529; // 0x10302c1
-    field public static final int Widget_Quantum_Light_Button_Small = 16974481; // 0x1030291
-    field public static final int Widget_Quantum_Light_Button_Toggle = 16974482; // 0x1030292
-    field public static final int Widget_Quantum_Light_CalendarView = 16974485; // 0x1030295
-    field public static final int Widget_Quantum_Light_CheckedTextView = 16974486; // 0x1030296
-    field public static final int Widget_Quantum_Light_CompoundButton_CheckBox = 16974487; // 0x1030297
-    field public static final int Widget_Quantum_Light_CompoundButton_RadioButton = 16974488; // 0x1030298
-    field public static final int Widget_Quantum_Light_CompoundButton_Star = 16974489; // 0x1030299
-    field public static final int Widget_Quantum_Light_DropDownItem = 16974490; // 0x103029a
-    field public static final int Widget_Quantum_Light_DropDownItem_Spinner = 16974491; // 0x103029b
-    field public static final int Widget_Quantum_Light_EditText = 16974492; // 0x103029c
-    field public static final int Widget_Quantum_Light_ExpandableListView = 16974493; // 0x103029d
-    field public static final int Widget_Quantum_Light_FastScroll = 16974494; // 0x103029e
-    field public static final int Widget_Quantum_Light_FragmentBreadCrumbs = 16974495; // 0x103029f
-    field public static final int Widget_Quantum_Light_GridView = 16974496; // 0x10302a0
-    field public static final int Widget_Quantum_Light_HorizontalScrollView = 16974497; // 0x10302a1
-    field public static final int Widget_Quantum_Light_ImageButton = 16974498; // 0x10302a2
-    field public static final int Widget_Quantum_Light_ListPopupWindow = 16974499; // 0x10302a3
-    field public static final int Widget_Quantum_Light_ListView = 16974500; // 0x10302a4
-    field public static final int Widget_Quantum_Light_ListView_DropDown = 16974501; // 0x10302a5
-    field public static final int Widget_Quantum_Light_MediaRouteButton = 16974502; // 0x10302a6
-    field public static final int Widget_Quantum_Light_PopupMenu = 16974503; // 0x10302a7
-    field public static final int Widget_Quantum_Light_PopupWindow = 16974504; // 0x10302a8
-    field public static final int Widget_Quantum_Light_ProgressBar = 16974505; // 0x10302a9
-    field public static final int Widget_Quantum_Light_ProgressBar_Horizontal = 16974506; // 0x10302aa
-    field public static final int Widget_Quantum_Light_ProgressBar_Inverse = 16974507; // 0x10302ab
-    field public static final int Widget_Quantum_Light_ProgressBar_Large = 16974508; // 0x10302ac
-    field public static final int Widget_Quantum_Light_ProgressBar_Large_Inverse = 16974509; // 0x10302ad
-    field public static final int Widget_Quantum_Light_ProgressBar_Small = 16974510; // 0x10302ae
-    field public static final int Widget_Quantum_Light_ProgressBar_Small_Inverse = 16974511; // 0x10302af
-    field public static final int Widget_Quantum_Light_ProgressBar_Small_Title = 16974512; // 0x10302b0
-    field public static final int Widget_Quantum_Light_RatingBar = 16974513; // 0x10302b1
-    field public static final int Widget_Quantum_Light_RatingBar_Indicator = 16974514; // 0x10302b2
-    field public static final int Widget_Quantum_Light_RatingBar_Small = 16974515; // 0x10302b3
-    field public static final int Widget_Quantum_Light_ScrollView = 16974516; // 0x10302b4
-    field public static final int Widget_Quantum_Light_SeekBar = 16974517; // 0x10302b5
-    field public static final int Widget_Quantum_Light_SegmentedButton = 16974518; // 0x10302b6
-    field public static final int Widget_Quantum_Light_Spinner = 16974519; // 0x10302b7
-    field public static final int Widget_Quantum_Light_Tab = 16974520; // 0x10302b8
-    field public static final int Widget_Quantum_Light_TabWidget = 16974521; // 0x10302b9
-    field public static final int Widget_Quantum_Light_TextView = 16974522; // 0x10302ba
-    field public static final int Widget_Quantum_Light_TextView_SpinnerItem = 16974523; // 0x10302bb
-    field public static final int Widget_Quantum_Light_WebTextView = 16974524; // 0x10302bc
-    field public static final int Widget_Quantum_Light_WebView = 16974525; // 0x10302bd
-    field public static final int Widget_Quantum_ListPopupWindow = 16974443; // 0x103026b
-    field public static final int Widget_Quantum_ListView = 16974444; // 0x103026c
-    field public static final int Widget_Quantum_ListView_DropDown = 16974445; // 0x103026d
-    field public static final int Widget_Quantum_MediaRouteButton = 16974446; // 0x103026e
-    field public static final int Widget_Quantum_PopupMenu = 16974447; // 0x103026f
-    field public static final int Widget_Quantum_PopupWindow = 16974448; // 0x1030270
-    field public static final int Widget_Quantum_ProgressBar = 16974449; // 0x1030271
-    field public static final int Widget_Quantum_ProgressBar_Horizontal = 16974450; // 0x1030272
-    field public static final int Widget_Quantum_ProgressBar_Large = 16974451; // 0x1030273
-    field public static final int Widget_Quantum_ProgressBar_Small = 16974452; // 0x1030274
-    field public static final int Widget_Quantum_ProgressBar_Small_Title = 16974453; // 0x1030275
-    field public static final int Widget_Quantum_RatingBar = 16974454; // 0x1030276
-    field public static final int Widget_Quantum_RatingBar_Indicator = 16974455; // 0x1030277
-    field public static final int Widget_Quantum_RatingBar_Small = 16974456; // 0x1030278
-    field public static final int Widget_Quantum_ScrollView = 16974457; // 0x1030279
-    field public static final int Widget_Quantum_SeekBar = 16974458; // 0x103027a
-    field public static final int Widget_Quantum_SegmentedButton = 16974459; // 0x103027b
-    field public static final int Widget_Quantum_Spinner = 16974460; // 0x103027c
-    field public static final int Widget_Quantum_Tab = 16974461; // 0x103027d
-    field public static final int Widget_Quantum_TabWidget = 16974462; // 0x103027e
-    field public static final int Widget_Quantum_TextView = 16974463; // 0x103027f
-    field public static final int Widget_Quantum_TextView_SpinnerItem = 16974464; // 0x1030280
-    field public static final int Widget_Quantum_WebTextView = 16974465; // 0x1030281
-    field public static final int Widget_Quantum_WebView = 16974466; // 0x1030282
+    field public static final int Widget_Quantum = 16974414; // 0x103024e
+    field public static final int Widget_Quantum_ActionBar = 16974415; // 0x103024f
+    field public static final int Widget_Quantum_ActionBar_Solid = 16974416; // 0x1030250
+    field public static final int Widget_Quantum_ActionBar_TabBar = 16974417; // 0x1030251
+    field public static final int Widget_Quantum_ActionBar_TabText = 16974418; // 0x1030252
+    field public static final int Widget_Quantum_ActionBar_TabView = 16974419; // 0x1030253
+    field public static final int Widget_Quantum_ActionButton = 16974420; // 0x1030254
+    field public static final int Widget_Quantum_ActionButton_CloseMode = 16974421; // 0x1030255
+    field public static final int Widget_Quantum_ActionButton_Overflow = 16974422; // 0x1030256
+    field public static final int Widget_Quantum_ActionMode = 16974423; // 0x1030257
+    field public static final int Widget_Quantum_AutoCompleteTextView = 16974424; // 0x1030258
+    field public static final int Widget_Quantum_Button = 16974425; // 0x1030259
+    field public static final int Widget_Quantum_ButtonBar = 16974433; // 0x1030261
+    field public static final int Widget_Quantum_ButtonBar_AlertDialog = 16974434; // 0x1030262
+    field public static final int Widget_Quantum_Button_Borderless = 16974426; // 0x103025a
+    field public static final int Widget_Quantum_Button_Borderless_Small = 16974427; // 0x103025b
+    field public static final int Widget_Quantum_Button_Inset = 16974428; // 0x103025c
+    field public static final int Widget_Quantum_Button_Paper = 16974431; // 0x103025f
+    field public static final int Widget_Quantum_Button_Paper_Color = 16974432; // 0x1030260
+    field public static final int Widget_Quantum_Button_Small = 16974429; // 0x103025d
+    field public static final int Widget_Quantum_Button_Toggle = 16974430; // 0x103025e
+    field public static final int Widget_Quantum_CalendarView = 16974435; // 0x1030263
+    field public static final int Widget_Quantum_CheckedTextView = 16974436; // 0x1030264
+    field public static final int Widget_Quantum_CompoundButton_CheckBox = 16974437; // 0x1030265
+    field public static final int Widget_Quantum_CompoundButton_RadioButton = 16974438; // 0x1030266
+    field public static final int Widget_Quantum_CompoundButton_Star = 16974439; // 0x1030267
+    field public static final int Widget_Quantum_DatePicker = 16974440; // 0x1030268
+    field public static final int Widget_Quantum_DropDownItem = 16974441; // 0x1030269
+    field public static final int Widget_Quantum_DropDownItem_Spinner = 16974442; // 0x103026a
+    field public static final int Widget_Quantum_EditText = 16974443; // 0x103026b
+    field public static final int Widget_Quantum_ExpandableListView = 16974444; // 0x103026c
+    field public static final int Widget_Quantum_FastScroll = 16974445; // 0x103026d
+    field public static final int Widget_Quantum_FragmentBreadCrumbs = 16974446; // 0x103026e
+    field public static final int Widget_Quantum_GridView = 16974447; // 0x103026f
+    field public static final int Widget_Quantum_HorizontalScrollView = 16974448; // 0x1030270
+    field public static final int Widget_Quantum_ImageButton = 16974449; // 0x1030271
+    field public static final int Widget_Quantum_Light = 16974475; // 0x103028b
+    field public static final int Widget_Quantum_Light_ActionBar = 16974476; // 0x103028c
+    field public static final int Widget_Quantum_Light_ActionBar_Solid = 16974477; // 0x103028d
+    field public static final int Widget_Quantum_Light_ActionBar_TabBar = 16974478; // 0x103028e
+    field public static final int Widget_Quantum_Light_ActionBar_TabText = 16974479; // 0x103028f
+    field public static final int Widget_Quantum_Light_ActionBar_TabView = 16974480; // 0x1030290
+    field public static final int Widget_Quantum_Light_ActionButton = 16974481; // 0x1030291
+    field public static final int Widget_Quantum_Light_ActionButton_CloseMode = 16974482; // 0x1030292
+    field public static final int Widget_Quantum_Light_ActionButton_Overflow = 16974483; // 0x1030293
+    field public static final int Widget_Quantum_Light_ActionMode = 16974484; // 0x1030294
+    field public static final int Widget_Quantum_Light_AutoCompleteTextView = 16974485; // 0x1030295
+    field public static final int Widget_Quantum_Light_Button = 16974486; // 0x1030296
+    field public static final int Widget_Quantum_Light_ButtonBar = 16974494; // 0x103029e
+    field public static final int Widget_Quantum_Light_ButtonBar_AlertDialog = 16974495; // 0x103029f
+    field public static final int Widget_Quantum_Light_Button_Borderless = 16974487; // 0x1030297
+    field public static final int Widget_Quantum_Light_Button_Borderless_Small = 16974488; // 0x1030298
+    field public static final int Widget_Quantum_Light_Button_Inset = 16974489; // 0x1030299
+    field public static final int Widget_Quantum_Light_Button_Paper = 16974492; // 0x103029c
+    field public static final int Widget_Quantum_Light_Button_Paper_Color = 16974493; // 0x103029d
+    field public static final int Widget_Quantum_Light_Button_Small = 16974490; // 0x103029a
+    field public static final int Widget_Quantum_Light_Button_Toggle = 16974491; // 0x103029b
+    field public static final int Widget_Quantum_Light_CalendarView = 16974496; // 0x10302a0
+    field public static final int Widget_Quantum_Light_CheckedTextView = 16974497; // 0x10302a1
+    field public static final int Widget_Quantum_Light_CompoundButton_CheckBox = 16974498; // 0x10302a2
+    field public static final int Widget_Quantum_Light_CompoundButton_RadioButton = 16974499; // 0x10302a3
+    field public static final int Widget_Quantum_Light_CompoundButton_Star = 16974500; // 0x10302a4
+    field public static final int Widget_Quantum_Light_DropDownItem = 16974501; // 0x10302a5
+    field public static final int Widget_Quantum_Light_DropDownItem_Spinner = 16974502; // 0x10302a6
+    field public static final int Widget_Quantum_Light_EditText = 16974503; // 0x10302a7
+    field public static final int Widget_Quantum_Light_ExpandableListView = 16974504; // 0x10302a8
+    field public static final int Widget_Quantum_Light_FastScroll = 16974505; // 0x10302a9
+    field public static final int Widget_Quantum_Light_FragmentBreadCrumbs = 16974506; // 0x10302aa
+    field public static final int Widget_Quantum_Light_GridView = 16974507; // 0x10302ab
+    field public static final int Widget_Quantum_Light_HorizontalScrollView = 16974508; // 0x10302ac
+    field public static final int Widget_Quantum_Light_ImageButton = 16974509; // 0x10302ad
+    field public static final int Widget_Quantum_Light_ListPopupWindow = 16974510; // 0x10302ae
+    field public static final int Widget_Quantum_Light_ListView = 16974511; // 0x10302af
+    field public static final int Widget_Quantum_Light_ListView_DropDown = 16974512; // 0x10302b0
+    field public static final int Widget_Quantum_Light_MediaRouteButton = 16974513; // 0x10302b1
+    field public static final int Widget_Quantum_Light_PopupMenu = 16974514; // 0x10302b2
+    field public static final int Widget_Quantum_Light_PopupWindow = 16974515; // 0x10302b3
+    field public static final int Widget_Quantum_Light_ProgressBar = 16974516; // 0x10302b4
+    field public static final int Widget_Quantum_Light_ProgressBar_Horizontal = 16974517; // 0x10302b5
+    field public static final int Widget_Quantum_Light_ProgressBar_Inverse = 16974518; // 0x10302b6
+    field public static final int Widget_Quantum_Light_ProgressBar_Large = 16974519; // 0x10302b7
+    field public static final int Widget_Quantum_Light_ProgressBar_Large_Inverse = 16974520; // 0x10302b8
+    field public static final int Widget_Quantum_Light_ProgressBar_Small = 16974521; // 0x10302b9
+    field public static final int Widget_Quantum_Light_ProgressBar_Small_Inverse = 16974522; // 0x10302ba
+    field public static final int Widget_Quantum_Light_ProgressBar_Small_Title = 16974523; // 0x10302bb
+    field public static final int Widget_Quantum_Light_RatingBar = 16974524; // 0x10302bc
+    field public static final int Widget_Quantum_Light_RatingBar_Indicator = 16974525; // 0x10302bd
+    field public static final int Widget_Quantum_Light_RatingBar_Small = 16974526; // 0x10302be
+    field public static final int Widget_Quantum_Light_ScrollView = 16974527; // 0x10302bf
+    field public static final int Widget_Quantum_Light_SeekBar = 16974528; // 0x10302c0
+    field public static final int Widget_Quantum_Light_SegmentedButton = 16974529; // 0x10302c1
+    field public static final int Widget_Quantum_Light_Spinner = 16974531; // 0x10302c3
+    field public static final int Widget_Quantum_Light_StackView = 16974530; // 0x10302c2
+    field public static final int Widget_Quantum_Light_Tab = 16974532; // 0x10302c4
+    field public static final int Widget_Quantum_Light_TabWidget = 16974533; // 0x10302c5
+    field public static final int Widget_Quantum_Light_TextView = 16974534; // 0x10302c6
+    field public static final int Widget_Quantum_Light_TextView_SpinnerItem = 16974535; // 0x10302c7
+    field public static final int Widget_Quantum_Light_WebTextView = 16974536; // 0x10302c8
+    field public static final int Widget_Quantum_Light_WebView = 16974537; // 0x10302c9
+    field public static final int Widget_Quantum_ListPopupWindow = 16974450; // 0x1030272
+    field public static final int Widget_Quantum_ListView = 16974451; // 0x1030273
+    field public static final int Widget_Quantum_ListView_DropDown = 16974452; // 0x1030274
+    field public static final int Widget_Quantum_MediaRouteButton = 16974453; // 0x1030275
+    field public static final int Widget_Quantum_PopupMenu = 16974454; // 0x1030276
+    field public static final int Widget_Quantum_PopupWindow = 16974455; // 0x1030277
+    field public static final int Widget_Quantum_ProgressBar = 16974456; // 0x1030278
+    field public static final int Widget_Quantum_ProgressBar_Horizontal = 16974457; // 0x1030279
+    field public static final int Widget_Quantum_ProgressBar_Large = 16974458; // 0x103027a
+    field public static final int Widget_Quantum_ProgressBar_Small = 16974459; // 0x103027b
+    field public static final int Widget_Quantum_ProgressBar_Small_Title = 16974460; // 0x103027c
+    field public static final int Widget_Quantum_RatingBar = 16974461; // 0x103027d
+    field public static final int Widget_Quantum_RatingBar_Indicator = 16974462; // 0x103027e
+    field public static final int Widget_Quantum_RatingBar_Small = 16974463; // 0x103027f
+    field public static final int Widget_Quantum_ScrollView = 16974464; // 0x1030280
+    field public static final int Widget_Quantum_SeekBar = 16974465; // 0x1030281
+    field public static final int Widget_Quantum_SegmentedButton = 16974466; // 0x1030282
+    field public static final int Widget_Quantum_Spinner = 16974468; // 0x1030284
+    field public static final int Widget_Quantum_StackView = 16974467; // 0x1030283
+    field public static final int Widget_Quantum_Tab = 16974469; // 0x1030285
+    field public static final int Widget_Quantum_TabWidget = 16974470; // 0x1030286
+    field public static final int Widget_Quantum_TextView = 16974471; // 0x1030287
+    field public static final int Widget_Quantum_TextView_SpinnerItem = 16974472; // 0x1030288
+    field public static final int Widget_Quantum_WebTextView = 16974473; // 0x1030289
+    field public static final int Widget_Quantum_WebView = 16974474; // 0x103028a
     field public static final int Widget_RatingBar = 16973857; // 0x1030021
     field public static final int Widget_ScrollView = 16973869; // 0x103002d
     field public static final int Widget_SeekBar = 16973856; // 0x1030020
     field public static final int Widget_Spinner = 16973864; // 0x1030028
     field public static final int Widget_Spinner_DropDown = 16973955; // 0x1030083
+    field public static final int Widget_StackView = 16974338; // 0x1030202
     field public static final int Widget_TabWidget = 16973876; // 0x1030034
     field public static final int Widget_TextView = 16973858; // 0x1030022
     field public static final int Widget_TextView_PopupMenu = 16973865; // 0x1030029
@@ -12279,7 +12287,6 @@
     method public static boolean isValidType(int);
     field public static final int ADDR_AUDIO_SYSTEM = 5; // 0x5
     field public static final int ADDR_BROADCAST = 15; // 0xf
-    field public static final int ADDR_FREE_USE = 14; // 0xe
     field public static final int ADDR_INVALID = -1; // 0xffffffff
     field public static final int ADDR_PLAYBACK_1 = 4; // 0x4
     field public static final int ADDR_PLAYBACK_2 = 8; // 0x8
@@ -12289,6 +12296,7 @@
     field public static final int ADDR_RECORDER_3 = 9; // 0x9
     field public static final int ADDR_RESERVED_1 = 12; // 0xc
     field public static final int ADDR_RESERVED_2 = 13; // 0xd
+    field public static final int ADDR_SPECIFIC_USE = 14; // 0xe
     field public static final int ADDR_TUNER_1 = 3; // 0x3
     field public static final int ADDR_TUNER_2 = 6; // 0x6
     field public static final int ADDR_TUNER_3 = 7; // 0x7
@@ -12386,6 +12394,17 @@
     method public void onMessageReceived(android.hardware.hdmi.HdmiCecMessage);
   }
 
+  public final class HdmiCecDeviceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getDeviceType();
+    method public java.lang.String getDisplayName();
+    method public int getLogicalAddress();
+    method public int getPhysicalAddress();
+    method public int getVendorId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator CREATOR;
+  }
+
   public final class HdmiCecManager {
     method public android.hardware.hdmi.HdmiCecClient getClient(int, android.hardware.hdmi.HdmiCecClient.Listener);
   }
@@ -30825,10 +30844,11 @@
   public class ViewConfiguration {
     ctor public deprecated ViewConfiguration();
     method public static android.view.ViewConfiguration get(android.content.Context);
+    method public long getDeviceGlobalActionKeyTimeout();
     method public static int getDoubleTapTimeout();
     method public static deprecated int getEdgeSlop();
     method public static deprecated int getFadingEdgeLength();
-    method public static long getGlobalActionKeyTimeout();
+    method public static deprecated long getGlobalActionKeyTimeout();
     method public static int getJumpTapTimeout();
     method public static int getKeyRepeatDelay();
     method public static int getKeyRepeatTimeout();
@@ -32904,6 +32924,7 @@
     method public boolean getMediaPlaybackRequiresUserGesture();
     method public synchronized int getMinimumFontSize();
     method public synchronized int getMinimumLogicalFontSize();
+    method public abstract int getMixedContentMode();
     method public deprecated synchronized android.webkit.WebSettings.PluginState getPluginState();
     method public synchronized java.lang.String getSansSerifFontFamily();
     method public boolean getSaveFormData();
@@ -32948,6 +32969,7 @@
     method public void setMediaPlaybackRequiresUserGesture(boolean);
     method public synchronized void setMinimumFontSize(int);
     method public synchronized void setMinimumLogicalFontSize(int);
+    method public abstract void setMixedContentMode(int);
     method public void setNeedInitialFocus(boolean);
     method public deprecated synchronized void setPluginState(android.webkit.WebSettings.PluginState);
     method public deprecated synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
@@ -32969,6 +32991,9 @@
     field public static final int LOAD_DEFAULT = -1; // 0xffffffff
     field public static final deprecated int LOAD_NORMAL = 0; // 0x0
     field public static final int LOAD_NO_CACHE = 2; // 0x2
+    field public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0; // 0x0
+    field public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2; // 0x2
+    field public static final int MIXED_CONTENT_NEVER_ALLOW = 1; // 0x1
   }
 
   public static final class WebSettings.LayoutAlgorithm extends java.lang.Enum {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index fe532bf..a4b2651 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -473,14 +473,14 @@
         registerService(NOTIFICATION_SERVICE, new ServiceFetcher() {
                 public Object createService(ContextImpl ctx) {
                     final Context outerContext = ctx.getOuterContext();
+                    // TODO: Why are we not just using the theme attribute
+                    // that defines the dialog theme?
                     return new NotificationManager(
                         new ContextThemeWrapper(outerContext,
-                                Resources.selectSystemTheme(0,
+                                outerContext.getResources().selectSystemTheme(0,
                                         outerContext.getApplicationInfo().targetSdkVersion,
-                                        com.android.internal.R.style.Theme_Dialog,
-                                        com.android.internal.R.style.Theme_Holo_Dialog,
-                                        com.android.internal.R.style.Theme_DeviceDefault_Dialog,
-                                        com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog)),
+                                        com.android.internal.R.array.system_theme_sdks,
+                                        com.android.internal.R.array.system_theme_dialog_styles)),
                         ctx.mMainThread.getHandler());
                 }});
 
@@ -731,7 +731,7 @@
     @Override
     public Resources.Theme getTheme() {
         if (mTheme == null) {
-            mThemeResource = Resources.selectDefaultTheme(mThemeResource,
+            mThemeResource = mResources.selectDefaultTheme(mThemeResource,
                     getOuterContext().getApplicationInfo().targetSdkVersion);
             mTheme = mResources.newTheme();
             mTheme.applyStyle(mThemeResource, true);
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java
index 5cf61a8..ce5306f 100644
--- a/core/java/android/app/StatusBarManager.java
+++ b/core/java/android/app/StatusBarManager.java
@@ -60,6 +60,7 @@
             | DISABLE_SEARCH;
 
     public static final int NAVIGATION_HINT_BACK_ALT      = 1 << 0;
+    public static final int NAVIGATION_HINT_IME_SHOWN     = 1 << 1;
 
     public static final int WINDOW_STATUS_BAR = 1;
     public static final int WINDOW_NAVIGATION_BAR = 2;
diff --git a/core/java/android/app/task/TaskParams.java b/core/java/android/app/task/TaskParams.java
index 429281c..e2eafd8 100644
--- a/core/java/android/app/task/TaskParams.java
+++ b/core/java/android/app/task/TaskParams.java
@@ -32,8 +32,7 @@
     private final IBinder mCallback;
 
     /**
-     * @return The unique id of this task, specified at creation time using
-     * {@link android.content.Task.Builder#Builder(int, Class)}.
+     * @return The unique id of this task, specified at creation time.
      */
     public int getTaskId() {
         return taskId;
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 4879c23..1331777 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -137,42 +137,45 @@
 
     /**
      * Returns the most appropriate default theme for the specified target SDK version.
-     * <ul>
-     * <li>Below API 11: Gingerbread
-     * <li>APIs 11 thru 14: Holo
-     * <li>APIs 14 thru XX: Device default dark
-     * <li>API XX and above: Device default light with dark action bar
-     * </ul>
      *
      * @param curTheme The current theme, or 0 if not specified.
      * @param targetSdkVersion The target SDK version.
      * @return A theme resource identifier
      * @hide
      */
-    public static int selectDefaultTheme(int curTheme, int targetSdkVersion) {
+    public int selectDefaultTheme(int curTheme, int targetSdkVersion) {
         return selectSystemTheme(curTheme, targetSdkVersion,
-                com.android.internal.R.style.Theme,
-                com.android.internal.R.style.Theme_Holo,
-                com.android.internal.R.style.Theme_DeviceDefault,
-                com.android.internal.R.style.Theme_DeviceDefault_Light_DarkActionBar);
+                com.android.internal.R.array.system_theme_sdks,
+                com.android.internal.R.array.system_theme_styles);
     }
 
-    /** @hide */
-    public static int selectSystemTheme(int curTheme, int targetSdkVersion, int orig, int holo,
-            int dark, int deviceDefault) {
+    /**
+     * Returns the most appropriate default theme for the specified target SDK version.
+     *
+     * @param curTheme The current theme, or 0 if not specified.
+     * @param targetSdkVersion The target SDK version.
+     * @param sdkArrayId Identifier for integer array resource containing
+     *        sorted minimum SDK versions. First entry must be 0.
+     * @param themeArrayId Identifier for array resource containing the
+     *        default themes that map to SDK versions.
+     * @return A theme resource identifier
+     * @hide
+     */
+    public int selectSystemTheme(
+            int curTheme, int targetSdkVersion, int sdkArrayId, int themeArrayId) {
         if (curTheme != 0) {
             return curTheme;
         }
-        if (targetSdkVersion < Build.VERSION_CODES.HONEYCOMB) {
-            return orig;
+
+        final int[] targetSdks = getIntArray(sdkArrayId);
+        final TypedArray defaultThemes = obtainTypedArray(themeArrayId);
+        for (int i = targetSdks.length - 1; i > 0; i--) {
+            if (targetSdkVersion >= targetSdks[i]) {
+                return defaultThemes.getResourceId(i, 0);
+            }
         }
-        if (targetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
-            return holo;
-        }
-        if (targetSdkVersion < Build.VERSION_CODES.CUR_DEVELOPMENT) {
-            return dark;
-        }
-        return deviceDefault;
+
+        return defaultThemes.getResourceId(0, 0);
     }
 
     /**
@@ -2308,8 +2311,8 @@
      */
     private Drawable loadDrawableForCookie(TypedValue value, int id, Theme theme) {
         if (value.string == null) {
-            throw new NotFoundException(
-                    "Resource is not a Drawable (color or path): " + value);
+            throw new NotFoundException("Resource \"" + getResourceName(id) + "\" ("
+                    + Integer.toHexString(id) + ")  is not a Drawable (color or path): " + value);
         }
 
         final String file = value.string.toString();
diff --git a/core/java/android/hardware/camera2/impl/CameraDevice.java b/core/java/android/hardware/camera2/impl/CameraDevice.java
index 40a7905..988f8f9 100644
--- a/core/java/android/hardware/camera2/impl/CameraDevice.java
+++ b/core/java/android/hardware/camera2/impl/CameraDevice.java
@@ -647,7 +647,7 @@
                  * should have arrived. The following line checks whether this holds.
                  */
                 if (frameNumber != mCompletedFrameNumber + 1) {
-                    throw new AssertionError(String.format(
+                    Log.e(TAG, String.format(
                             "result frame number %d comes out of order, should be %d + 1",
                             frameNumber, mCompletedFrameNumber));
                 }
diff --git a/core/java/android/hardware/hdmi/HdmiCec.java b/core/java/android/hardware/hdmi/HdmiCec.java
index 8578a32..eafaed6 100644
--- a/core/java/android/hardware/hdmi/HdmiCec.java
+++ b/core/java/android/hardware/hdmi/HdmiCec.java
@@ -85,7 +85,7 @@
     public static final int ADDR_RESERVED_2 = 13;
 
     /** Logical address for TV other than the one assigned with {@link #ADDR_TV} */
-    public static final int ADDR_FREE_USE = 14;
+    public static final int ADDR_SPECIFIC_USE = 14;
 
     /** Logical address for devices to which address cannot be allocated */
     public static final int ADDR_UNREGISTERED = 15;
@@ -179,6 +179,7 @@
         DEVICE_RECORDER,  // ADDR_RECORDER_3
         DEVICE_TUNER,  // ADDR_TUNER_4
         DEVICE_PLAYBACK,  // ADDR_PLAYBACK_3
+        DEVICE_TV,  // ADDR_SPECIFIC_USE
     };
 
     private static final String[] DEFAULT_NAMES = {
@@ -194,6 +195,7 @@
         "Recorder_3",
         "Tuner_4",
         "Playback_3",
+        "Secondary_TV",
     };
 
     private HdmiCec() { }  // Prevents instantiation.
@@ -221,9 +223,7 @@
      * @return true if the given address is valid
      */
     public static boolean isValidAddress(int address) {
-        // TODO: We leave out the address 'free use(14)' for now. Check this later
-        //       again to make sure it is a valid address for communication.
-        return (ADDR_TV <= address && address <= ADDR_PLAYBACK_3);
+        return (ADDR_TV <= address && address <= ADDR_SPECIFIC_USE);
     }
 
     /**
diff --git a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
new file mode 100644
index 0000000..9698445
--- /dev/null
+++ b/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.hdmi;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A class to encapsulate device information for HDMI-CEC. This container
+ * include basic information such as logical address, physical address and
+ * device type, and additional information like vendor id and osd name.
+ */
+public final class HdmiCecDeviceInfo implements Parcelable {
+    // Logical address, phsical address, device type, vendor id and display name
+    // are immutable value.
+    private final int mLogicalAddress;
+    private final int mPhysicalAddress;
+    private final int mDeviceType;
+    private final int mVendorId;
+    private final String mDisplayName;
+
+
+    /**
+     * A helper class to deserialize {@link HdmiCecDeviceInfo} for a parcel.
+     */
+    public static final Parcelable.Creator<HdmiCecDeviceInfo> CREATOR =
+            new Parcelable.Creator<HdmiCecDeviceInfo>() {
+                @Override
+                public HdmiCecDeviceInfo createFromParcel(Parcel source) {
+                    int logicalAddress = source.readInt();
+                    int physicalAddress = source.readInt();
+                    int deviceType = source.readInt();
+                    int vendorId = source.readInt();
+                    String displayName = source.readString();
+                    return new HdmiCecDeviceInfo(logicalAddress, physicalAddress, deviceType,
+                            vendorId, displayName);
+                }
+
+                @Override
+                public HdmiCecDeviceInfo[] newArray(int size) {
+                    return new HdmiCecDeviceInfo[size];
+                }
+            };
+
+    /**
+     * Constructor.
+     *
+     * @param logicalAddress logical address of HDMI-Cec device.
+     *                       For more details, refer {@link HdmiCec}
+     * @param physicalAddress physical address of HDMI-Cec device
+     * @param deviceType type of device. For more details, refer {@link HdmiCec}
+     * @param vendorId vendor id of device. It's used for vendor specific command
+     * @param displayName name of device
+     * @hide
+     */
+    public HdmiCecDeviceInfo(int logicalAddress, int physicalAddress, int deviceType,
+            int vendorId, String displayName) {
+        mLogicalAddress = logicalAddress;
+        mPhysicalAddress = physicalAddress;
+        mDeviceType = deviceType;
+        mDisplayName = displayName;
+        mVendorId = vendorId;
+    }
+
+    /**
+     * Return the logical address of the device. It can have 0-15 values.
+     * For more details, refer constants between {@link HdmiCec#ADDR_TV}
+     * and {@link HdmiCec#ADDR_UNREGISTERED}.
+     */
+    public int getLogicalAddress() {
+        return mLogicalAddress;
+    }
+
+    /**
+     * Return the physical address of the device.
+     */
+    public int getPhysicalAddress() {
+        return mPhysicalAddress;
+    }
+
+    /**
+     * Return type of the device. For more details, refer constants between
+     * {@link HdmiCec#DEVICE_TV} and {@link HdmiCec#DEVICE_INACTIVE}.
+     */
+    public int getDeviceType() {
+        return mDeviceType;
+    }
+
+    /**
+     * Return display (OSD) name of the device.
+     */
+    public String getDisplayName() {
+        return mDisplayName;
+    }
+
+    /**
+     * Return vendor id of the device. Vendor id is used to distinguish devices
+     * built by other manufactures. This is required for vendor-specific command
+     * on CEC standard.
+     */
+    public int getVendorId() {
+        return mVendorId;
+    }
+
+    /**
+     * Describe the kinds of special objects contained in this Parcelable's
+     * marshalled representation.
+     */
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    /**
+     * Serialize this object into a {@link Parcel}.
+     *
+     * @param dest The Parcel in which the object should be written.
+     * @param flags Additional flags about how the object should be written.
+     *        May be 0 or {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
+     */
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(mLogicalAddress);
+        dest.writeInt(mPhysicalAddress);
+        dest.writeInt(mDeviceType);
+        dest.writeInt(mVendorId);
+        dest.writeString(mDisplayName);
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer s = new StringBuffer();
+        s.append("logical_address: ").append(mLogicalAddress).append(", ");
+        s.append("physical_address: ").append(mPhysicalAddress).append(", ");
+        s.append("device_type: ").append(mDeviceType).append(", ");
+        s.append("vendor_id: ").append(mVendorId).append(", ");
+        s.append("display_name: ").append(mDisplayName);
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof HdmiCecDeviceInfo)) {
+            return false;
+        }
+
+        HdmiCecDeviceInfo other = (HdmiCecDeviceInfo) obj;
+        return mLogicalAddress == other.mLogicalAddress
+                && mPhysicalAddress == other.mPhysicalAddress
+                && mDeviceType == other.mDeviceType
+                && mVendorId == other.mVendorId
+                && mDisplayName.equals(other.mDisplayName);
+    }
+}
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 505ef9c..e6dbcd0 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -654,13 +654,11 @@
         return false;
     }
 
-    @Override public void onCreate() {
-        mTheme = Resources.selectSystemTheme(mTheme,
-                getApplicationInfo().targetSdkVersion,
-                android.R.style.Theme_InputMethod,
-                android.R.style.Theme_Holo_InputMethod,
-                android.R.style.Theme_DeviceDefault_InputMethod,
-                android.R.style.Theme_DeviceDefault_InputMethod);
+    @Override
+    public void onCreate() {
+        mTheme = getResources().selectSystemTheme(mTheme, getApplicationInfo().targetSdkVersion,
+                com.android.internal.R.array.system_theme_sdks,
+                com.android.internal.R.array.system_theme_ime_styles);
         super.setTheme(mTheme);
         super.onCreate();
         mImm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
diff --git a/core/java/android/net/INetworkScoreCache.aidl b/core/java/android/net/INetworkScoreCache.aidl
new file mode 100644
index 0000000..35601ce
--- /dev/null
+++ b/core/java/android/net/INetworkScoreCache.aidl
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net;
+
+import android.net.ScoredNetwork;
+
+/**
+ * A service which stores a subset of scored networks from the active network scorer.
+ *
+ * <p>To be implemented by network subsystems (e.g. Wi-Fi). NetworkScoreService will propagate
+ * scores down to each subsystem depending on the network type. Implementations may register for
+ * a given network type by calling NetworkScoreManager.registerNetworkSubsystem.
+ *
+ * <p>A proper implementation should throw SecurityException whenever the caller is not privileged.
+ * It may request scores by calling NetworkScoreManager#requestScores(NetworkKey[]); a call to
+ * updateScores may follow but may not depending on the active scorer's implementation, and in
+ * general this method may be called at any time.
+ *
+ * <p>Implementations should also override dump() so that "adb shell dumpsys network_score" includes
+ * the current scores for each network for debugging purposes.
+ * @hide
+ */
+interface INetworkScoreCache
+{
+    void updateScores(in List<ScoredNetwork> networks);
+
+    void clearScores();
+}
+
diff --git a/core/java/android/net/INetworkScoreService.aidl b/core/java/android/net/INetworkScoreService.aidl
index a72d9a0..626bd2a 100644
--- a/core/java/android/net/INetworkScoreService.aidl
+++ b/core/java/android/net/INetworkScoreService.aidl
@@ -16,6 +16,7 @@
 
 package android.net;
 
+import android.net.INetworkScoreCache;
 import android.net.ScoredNetwork;
 
 /**
@@ -34,8 +35,7 @@
     /**
      * Clear all scores.
      * @return whether the clear was successful.
-     * @throws SecurityException if the caller is neither the current active scorer nor the scorer
-     * manager.
+     * @throws SecurityException if the caller is neither the current active scorer nor the system.
      */
     boolean clearScores();
 
@@ -43,7 +43,19 @@
      * Set the active scorer and clear existing scores.
      * @param packageName the package name of the new scorer to use.
      * @return true if the operation succeeded, or false if the new package is not a valid scorer.
-     * @throws SecurityException if the caller is not the scorer manager.
+     * @throws SecurityException if the caller is not the system.
      */
     boolean setActiveScorer(in String packageName);
+
+    /**
+     * Register a network subsystem for scoring.
+     *
+     * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}.
+     * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores.
+     * @throws SecurityException if the caller is not the system.
+     * @throws IllegalArgumentException if a score cache is already registed for this type.
+     * @hide
+     */
+    void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache);
+
 }
diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java
index 6dd56d9..352512e 100644
--- a/core/java/android/net/NetworkScoreManager.java
+++ b/core/java/android/net/NetworkScoreManager.java
@@ -19,6 +19,7 @@
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.content.Context;
+import android.content.Intent;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -101,7 +102,7 @@
      * determine the current scorer and offer the user the ability to select a different scorer via
      * the {@link #ACTION_CHANGE_ACTIVE} intent.
      * @return the full package name of the current active scorer, or null if there is no active
-     *     scorer.
+     *         scorer.
      */
     public String getActiveScorerPackage() {
         return NetworkScorerAppManager.getActiveScorer(mContext);
@@ -151,8 +152,8 @@
      *
      * @return true if the operation succeeded, or false if the new package is not a valid scorer.
      * @throws SecurityException if the caller does not hold the
-     *      {@link android.Manifest.permission#BROADCAST_SCORE_NETWORKS} permission indicating that
-     *      it can manage scorer applications.
+     *         {@link android.Manifest.permission#BROADCAST_SCORE_NETWORKS} permission indicating
+     *         that it can manage scorer applications.
      * @hide
      */
     public boolean setActiveScorer(String packageName) throws SecurityException {
@@ -162,4 +163,44 @@
             return false;
         }
     }
+
+    /**
+     * Request scoring for networks.
+     *
+     * <p>Note that this is just a helper method to assemble the broadcast, and will run in the
+     * calling process.
+     *
+     * @return true if the broadcast was sent, or false if there is no active scorer.
+     * @throws SecurityException if the caller does not hold the
+     *         {@link android.Manifest.permission#BROADCAST_SCORE_NETWORKS} permission.
+     * @hide
+     */
+    public boolean requestScores(NetworkKey[] networks) throws SecurityException {
+        String activeScorer = getActiveScorerPackage();
+        if (activeScorer == null) {
+            return false;
+        }
+        Intent intent = new Intent(ACTION_SCORE_NETWORKS);
+        intent.setPackage(activeScorer);
+        intent.putExtra(EXTRA_NETWORKS_TO_SCORE, networks);
+        mContext.sendBroadcast(intent);
+        return true;
+    }
+
+    /**
+     * Register a network score cache.
+     *
+     * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}.
+     * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores.
+     * @throws SecurityException if the caller does not hold the
+     *         {@link android.Manifest.permission#BROADCAST_SCORE_NETWORKS} permission.
+     * @throws IllegalArgumentException if a score cache is already registered for this type.
+     * @hide
+     */
+    public void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache) {
+        try {
+            mService.registerNetworkScoreCache(networkType, scoreCache);
+        } catch (RemoteException e) {
+        }
+    }
 }
diff --git a/core/java/android/net/RssiCurve.java b/core/java/android/net/RssiCurve.java
index 33e81c2..dd744d3 100644
--- a/core/java/android/net/RssiCurve.java
+++ b/core/java/android/net/RssiCurve.java
@@ -98,6 +98,27 @@
     }
 
     /**
+     * Lookup the score for a given RSSI value.
+     *
+     * @param rssi The RSSI to lookup. If the RSSI falls below the start of the curve, the score at
+     *         the start of the curve will be returned. If it falls after the end of the curve, the
+     *         score at the end of the curve will be returned.
+     * @return the score for the given RSSI.
+     */
+    public byte lookupScore(int rssi) {
+        int index = (rssi - start) / bucketWidth;
+
+        // Snap the index to the closest bucket if it falls outside the curve.
+        if (index < 0) {
+            index = 0;
+        } else if (index > rssiBuckets.length - 1) {
+            index = rssiBuckets.length - 1;
+        }
+
+        return rssiBuckets[index];
+    }
+
+    /**
      * Determine if two RSSI curves are defined in the same way.
      *
      * <p>Note that two curves can be equivalent but defined differently, e.g. if one bucket in one
diff --git a/core/java/android/service/notification/Condition.java b/core/java/android/service/notification/Condition.java
index dd8b34d..aa724f0 100644
--- a/core/java/android/service/notification/Condition.java
+++ b/core/java/android/service/notification/Condition.java
@@ -41,16 +41,25 @@
     public static final int FLAG_RELEVANT_ALWAYS = 1 << 1;
 
     public final Uri id;
-    public String caption;
-    public int state;
-    public int flags;
+    public final String summary;
+    public final String line1;
+    public final String line2;
+    public final int icon;
+    public final int state;
+    public final int flags;
 
-    public Condition(Uri id, String caption, int state, int flags) {
+    public Condition(Uri id, String summary, String line1, String line2, int icon,
+            int state, int flags) {
         if (id == null) throw new IllegalArgumentException("id is required");
-        if (caption == null) throw new IllegalArgumentException("caption is required");
+        if (summary == null) throw new IllegalArgumentException("summary is required");
+        if (line1 == null) throw new IllegalArgumentException("line1 is required");
+        if (line2 == null) throw new IllegalArgumentException("line2 is required");
         if (!isValidState(state)) throw new IllegalArgumentException("state is invalid: " + state);
         this.id = id;
-        this.caption = caption;
+        this.summary = summary;
+        this.line1 = line1;
+        this.line2 = line2;
+        this.icon = icon;
         this.state = state;
         this.flags = flags;
     }
@@ -58,6 +67,9 @@
     private Condition(Parcel source) {
         this((Uri)source.readParcelable(Condition.class.getClassLoader()),
                 source.readString(),
+                source.readString(),
+                source.readString(),
+                source.readInt(),
                 source.readInt(),
                 source.readInt());
     }
@@ -69,7 +81,10 @@
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeParcelable(id, 0);
-        dest.writeString(caption);
+        dest.writeString(summary);
+        dest.writeString(line1);
+        dest.writeString(line2);
+        dest.writeInt(icon);
         dest.writeInt(state);
         dest.writeInt(this.flags);
     }
@@ -78,7 +93,10 @@
     public String toString() {
         return new StringBuilder(Condition.class.getSimpleName()).append('[')
             .append("id=").append(id)
-            .append(",caption=").append(caption)
+            .append(",summary=").append(summary)
+            .append(",line1=").append(line1)
+            .append(",line2=").append(line2)
+            .append(",icon=").append(icon)
             .append(",state=").append(stateToString(state))
             .append(",flags=").append(flags)
             .append(']').toString();
@@ -106,14 +124,17 @@
         if (o == this) return true;
         final Condition other = (Condition) o;
         return Objects.equals(other.id, id)
-                && Objects.equals(other.caption, caption)
+                && Objects.equals(other.summary, summary)
+                && Objects.equals(other.line1, line1)
+                && Objects.equals(other.line2, line2)
+                && other.icon == icon
                 && other.state == state
                 && other.flags == flags;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, caption, state, flags);
+        return Objects.hash(id, summary, line1, line2, icon, state, flags);
     }
 
     @Override
diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java
index 0afbde9..ba1c4b6 100644
--- a/core/java/android/view/ContextThemeWrapper.java
+++ b/core/java/android/view/ContextThemeWrapper.java
@@ -96,7 +96,7 @@
             return mTheme;
         }
 
-        mThemeResource = Resources.selectDefaultTheme(mThemeResource,
+        mThemeResource = getResources().selectDefaultTheme(mThemeResource,
                 getApplicationInfo().targetSdkVersion);
         initializeTheme();
 
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index e19bda9..b9ed801 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -21,13 +21,16 @@
 import android.os.Message;
 import android.os.Trace;
 import android.widget.FrameLayout;
+
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.util.Xml;
 
 import java.io.IOException;
@@ -61,7 +64,8 @@
  * @see Context#getSystemService
  */
 public abstract class LayoutInflater {
-    private final boolean DEBUG = false;
+    private static final String TAG = LayoutInflater.class.getSimpleName();
+    private static final boolean DEBUG = false;
 
     /**
      * This field should be made private, so it is hidden from the SDK.
@@ -395,8 +399,13 @@
      *         the inflated XML file.
      */
     public View inflate(int resource, ViewGroup root, boolean attachToRoot) {
-        if (DEBUG) System.out.println("INFLATING from resource: " + resource);
-        XmlResourceParser parser = getContext().getResources().getLayout(resource);
+        final Resources res = getContext().getResources();
+        if (DEBUG) {
+            Log.d(TAG, "INFLATING from resource: \"" + res.getResourceName(resource) + "\" ("
+                    + Integer.toHexString(resource) + ")");
+        }
+
+        final XmlResourceParser parser = res.getLayout(resource);
         try {
             return inflate(parser, root, attachToRoot);
         } finally {
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 48a5bd5..20ef429 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -234,6 +234,7 @@
     private final int mOverscrollDistance;
     private final int mOverflingDistance;
     private final boolean mFadingMarqueeEnabled;
+    private final long mGlobalActionsKeyTimeout;
 
     private boolean sHasPermanentMenuKey;
     private boolean sHasPermanentMenuKeySet;
@@ -261,6 +262,7 @@
         mOverscrollDistance = OVERSCROLL_DISTANCE;
         mOverflingDistance = OVERFLING_DISTANCE;
         mFadingMarqueeEnabled = true;
+        mGlobalActionsKeyTimeout = GLOBAL_ACTIONS_KEY_TIMEOUT;
     }
 
     /**
@@ -342,6 +344,8 @@
                 com.android.internal.R.dimen.config_viewMinFlingVelocity);
         mMaximumFlingVelocity = res.getDimensionPixelSize(
                 com.android.internal.R.dimen.config_viewMaxFlingVelocity);
+        mGlobalActionsKeyTimeout = res.getInteger(
+                com.android.internal.R.integer.config_globalActionsKeyTimeout);
     }
 
     /**
@@ -698,12 +702,24 @@
      *
      * @return how long a user needs to press the relevant key to bring up
      *   the global actions dialog.
+     * @deprecated use getDeviceGlobalActionKeyTimeout
      */
     public static long getGlobalActionKeyTimeout() {
         return GLOBAL_ACTIONS_KEY_TIMEOUT;
     }
 
     /**
+     * The amount of time a user needs to press the relevant key to bring up
+     * the global actions dialog.
+     *
+     * @return how long a user needs to press the relevant key to bring up
+     *   the global actions dialog.
+     */
+    public long getDeviceGlobalActionKeyTimeout() {
+        return mGlobalActionsKeyTimeout;
+    }
+
+    /**
      * The amount of friction applied to scrolls and flings.
      *
      * @return A scalar dimensionless value representing the coefficient of
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index beebeb1..db87394 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2588,10 +2588,6 @@
      * @param canvas The canvas on which to draw.
      */
     private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
-        if (!mAttachInfo.mHasWindowFocus) {
-            return;
-        }
-
         final AccessibilityManager manager = AccessibilityManager.getInstance(mView.mContext);
         if (!manager.isEnabled() || !manager.isTouchExplorationEnabled()) {
             return;
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index c524611..4fde1e4 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -443,8 +443,6 @@
     public final int OFF_BECAUSE_OF_USER = 2;
     /** Screen turned off because of timeout */
     public final int OFF_BECAUSE_OF_TIMEOUT = 3;
-    /** Screen turned off because of proximity sensor */
-    public final int OFF_BECAUSE_OF_PROX_SENSOR = 4;
 
     /** @hide */
     @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
@@ -900,23 +898,23 @@
     public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
     
     /**
-     * Called after the screen turns off.
+     * Called when the device is going to sleep.
      *
      * @param why {@link #OFF_BECAUSE_OF_USER} or
      * {@link #OFF_BECAUSE_OF_TIMEOUT}.
      */
-    public void screenTurnedOff(int why);
+    public void goingToSleep(int why);
 
     public interface ScreenOnListener {
         void onScreenOn();
     }
 
     /**
-     * Called when the power manager would like to turn the screen on.
+     * Called when the device is waking up.
      * Must call back on the listener to tell it when the higher-level system
      * is ready for the screen to go on (i.e. the lock screen is shown).
      */
-    public void screenTurningOn(ScreenOnListener screenOnListener);
+    public void wakingUp(ScreenOnListener screenOnListener);
 
     /**
      * Return whether the screen is about to turn on or is currently on.
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 98ef66e..7c32c5b 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -171,6 +171,38 @@
     }
 
     /**
+     * Used with {@link #setMixedContentMode}
+     *
+     * In this mode, the WebView will allow a secure origin to load content from any other origin,
+     * even if that origin is insecure. This is the least secure mode of operation for the WebView,
+     * and where possible apps should not set this mode.
+     */
+    public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0;
+
+    /**
+     * Used with {@link #setMixedContentMode}
+     *
+     * In this mode, the WebView will not allow a secure origin to load content from an insecure
+     * origin. This is the preferred and most secure mode of operation for the WebView and apps are
+     * strongly advised to use this mode.
+     */
+    public static final int MIXED_CONTENT_NEVER_ALLOW = 1;
+
+    /**
+     * Used with {@link #setMixedContentMode}
+     *
+     * In this mode, the WebView will attempt to be compatible with the approach of a modern web
+     * browser with regard to mixed content. Some insecure content may be allowed to be loaded by
+     * a secure origin and other types of content will be blocked. The types of content are allowed
+     * or blocked may change release to release and are not explicitly defined.
+     *
+     * This mode is intended to be used by apps that are not in control of the content that they
+     * render but desire to operate in a reasonably secure environment. For highest security, apps
+     * are recommended to use {@link #MIXED_CONTENT_NEVER_ALLOW}.
+     */
+    public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2;
+
+    /**
      * Hidden constructor to prevent clients from creating a new settings
      * instance or deriving the class.
      *
@@ -1403,4 +1435,29 @@
     public int getCacheMode() {
         throw new MustOverrideException();
     }
+
+    /**
+     * Configures the WebView's behavior when a secure origin attempts to load a resource from an
+     * insecure origin.
+     *
+     * By default, apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below default
+     * to {@link #MIXED_CONTENT_ALWAYS_ALLOW}. Apps targeting
+     * {@link android.os.Build.VERSION_CODES#L} default to {@link #MIXED_CONTENT_NEVER_ALLOW}.
+     *
+     * The preferred and most secure mode of operation for the WebView is
+     * {@link #MIXED_CONTENT_NEVER_ALLOW} and use of {@link #MIXED_CONTENT_ALWAYS_ALLOW} is
+     * strongly discouraged.
+     *
+     * @param mode The mixed content mode to use. One of {@link #MIXED_CONTENT_NEVER_ALLOW},
+     *     {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
+     */
+    public abstract void setMixedContentMode(int mode);
+
+    /**
+     * Gets the current behavior of the WebView with regard to loading insecure content from a
+     * secure origin.
+     * @return The current setting, one of {@link #MIXED_CONTENT_NEVER_ALLOW},
+     *     {@link #MIXED_CONTENT_NEVER_ALLOW} or {@link #MIXED_CONTENT_COMPATIBILITY_MODE}.
+     */
+    public abstract int getMixedContentMode();
 }
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 33a6df6..107ae4f 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -287,11 +287,12 @@
      * from where the event is dispatched. It gives the host application a chance
      * to handle the unhandled input events.
      *
-     * Note that if the event is a {@link MotionEvent}, then it's lifetime is only that of the
-     * function call. If the WebViewClient wishes to use the event beyond that, then it <i>must</i>
-     * create a copy of the event.
+     * Note that if the event is a {@link android.view.MotionEvent}, then it's lifetime is only
+     * that of the function call. If the WebViewClient wishes to use the event beyond that, then it
+     * <i>must</i> create a copy of the event.
      *
-     * It is the responsibility of overriders of this method to call {@link onUnhandledKeyEvent}
+     * It is the responsibility of overriders of this method to call
+     * {@link #onUnhandledKeyEvent(WebView, KeyEvent)}
      * when appropriate if they wish to continue receiving events through it.
      *
      * @param view The WebView that is initiating the callback.
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index becda67..0966be3 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -110,6 +110,7 @@
      * @see #setTranscriptMode(int)
      */
     public static final int TRANSCRIPT_MODE_DISABLED = 0;
+
     /**
      * The list will automatically scroll to the bottom when a data set change
      * notification is received and only if the last item is already visible
@@ -118,6 +119,7 @@
      * @see #setTranscriptMode(int)
      */
     public static final int TRANSCRIPT_MODE_NORMAL = 1;
+
     /**
      * The list will automatically scroll to the bottom, no matter what items
      * are currently visible.
@@ -2489,8 +2491,30 @@
         }
     }
 
+    /**
+     * Positions the selector in a way that mimics keyboard focus. If the
+     * selector drawable supports hotspots, this manages the focus hotspot.
+     */
+    void positionSelectorLikeFocus(int position, View sel) {
+        positionSelector(position, sel);
+
+        final Drawable selector = mSelector;
+        if (selector != null && selector.supportsHotspots() && position != INVALID_POSITION) {
+            final Rect bounds = mSelectorRect;
+            final float x = bounds.exactCenterX();
+            final float y = bounds.exactCenterY();
+            selector.setHotspot(R.attr.state_focused, x, y);
+        }
+    }
+
     void positionSelector(int position, View sel) {
         if (position != INVALID_POSITION) {
+            if (mSelectorPosition != position) {
+                final Drawable selector = mSelector;
+                if (selector != null && selector.supportsHotspots()) {
+                    selector.clearHotspots();
+                }
+            }
             mSelectorPosition = position;
         }
 
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index b47177a..10ec105 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1565,7 +1565,7 @@
 
             // Ensure that keyboard focus starts from the last touched position.
             setSelectedPositionInt(position);
-            positionSelector(position, child);
+            positionSelectorLikeFocus(position, child);
 
             // Refresh the drawable state to reflect the new pressed state,
             // which will also update the selector state.
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 5de67c8..eeb8015 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -2564,7 +2564,7 @@
 
         if (needToRedraw) {
             if (selectedView != null) {
-                positionSelector(selectedPos, selectedView);
+                positionSelectorLikeFocus(selectedPos, selectedView);
                 mSelectedTop = selectedView.getTop();
             }
             if (!awakenScrollBars()) {
diff --git a/core/java/com/android/internal/widget/SwipeDismissLayout.java b/core/java/com/android/internal/widget/SwipeDismissLayout.java
index 467d42e..674d084 100644
--- a/core/java/com/android/internal/widget/SwipeDismissLayout.java
+++ b/core/java/com/android/internal/widget/SwipeDismissLayout.java
@@ -35,7 +35,7 @@
 public class SwipeDismissLayout extends FrameLayout {
     private static final String TAG = "SwipeDismissLayout";
 
-    private static final float TRANSLATION_MIN_ALPHA = 0.5f;
+    private static final float DISMISS_MIN_PROGRESS = 0.6f;
 
     public interface OnDismissedListener {
         void onDismissed(SwipeDismissLayout layout);
@@ -77,6 +77,8 @@
     private OnDismissedListener mDismissedListener;
     private OnSwipeProgressChangedListener mProgressListener;
 
+    private float mLastX;
+
     public SwipeDismissLayout(Context context) {
         super(context);
         init(context);
@@ -95,7 +97,7 @@
     private void init(Context context) {
         ViewConfiguration vc = ViewConfiguration.get(getContext());
         mSlop = vc.getScaledTouchSlop();
-        mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
+        mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
         mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
         mAnimationTime = getContext().getResources().getInteger(
                 android.R.integer.config_shortAnimTime);
@@ -193,8 +195,8 @@
 
             case MotionEvent.ACTION_MOVE:
                 mVelocityTracker.addMovement(ev);
+                mLastX = ev.getRawX();
                 updateSwiping(ev);
-                updateDismiss(ev);
                 if (mSwiping) {
                     setProgress(ev.getRawX() - mDownX);
                     break;
@@ -256,20 +258,16 @@
             float absVelocityX = Math.abs(velocityX);
             float absVelocityY = Math.abs(mVelocityTracker.getYVelocity());
 
-            if (deltaX > getWidth() / 2) {
-                mDismissed = true;
-            } else if (absVelocityX >= mMinFlingVelocity
-                    && absVelocityX <= mMaxFlingVelocity
-                    && absVelocityY < absVelocityX / 2
-                    && velocityX > 0
-                    && deltaX > 0) {
+            if (deltaX > (getWidth() * DISMISS_MIN_PROGRESS) &&
+                    absVelocityX < mMinFlingVelocity && 
+                    ev.getRawX() >= mLastX) {
                 mDismissed = true;
             }
         }
         // Check if the user tried to undo this.
         if (mDismissed && mSwiping) {
             // Check if the user's finger is actually back
-            if (deltaX < getWidth() / 2) {
+            if (deltaX < (getWidth() * DISMISS_MIN_PROGRESS)) {
                 mDismissed = false;
             }
         }
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index d8faaf3..09bdc61 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -393,13 +393,46 @@
                                                         jshortArray javaAudioData,
                                                         jint offsetInShorts, jint sizeInShorts) {
 
-    jint read = android_media_AudioRecord_readInByteArray(env, thiz,
-                                                        (jbyteArray) javaAudioData,
-                                                        offsetInShorts*2, sizeInShorts*2);
-    if (read > 0) {
-        read /= 2;
+    jshort* recordBuff = NULL;
+    // get the audio recorder from which we'll read new audio samples
+    sp<AudioRecord> lpRecorder = getAudioRecord(env, thiz);
+    if (lpRecorder == NULL) {
+        ALOGE("Unable to retrieve AudioRecord object, can't record");
+        return 0;
     }
-    return read;
+
+    if (!javaAudioData) {
+        ALOGE("Invalid Java array to store recorded audio, can't record");
+        return 0;
+    }
+
+    // get the pointer to where we'll record the audio
+    // NOTE: We may use GetPrimitiveArrayCritical() when the JNI implementation changes in such
+    // a way that it becomes much more efficient. When doing so, we will have to prevent the
+    // AudioSystem callback to be called while in critical section (in case of media server
+    // process crash for instance)
+    recordBuff = (jshort *)env->GetShortArrayElements(javaAudioData, NULL);
+
+    if (recordBuff == NULL) {
+        ALOGE("Error retrieving destination for recorded audio data, can't record");
+        return 0;
+    }
+
+    // read the new audio data from the native AudioRecord object
+    const size_t recorderBuffSize = lpRecorder->frameCount()*lpRecorder->frameSize();
+    const size_t sizeInBytes = sizeInShorts * sizeof(short);
+    ssize_t readSize = lpRecorder->read(recordBuff + offsetInShorts * sizeof(short),
+                                        sizeInBytes > recorderBuffSize ?
+                                            recorderBuffSize : sizeInBytes);
+
+    env->ReleaseShortArrayElements(javaAudioData, recordBuff, 0);
+
+    if (readSize < 0) {
+        readSize = AUDIORECORD_ERROR_INVALID_OPERATION;
+    } else {
+        readSize /= sizeof(short);
+    }
+    return (jint) readSize;
 }
 
 // ----------------------------------------------------------------------------
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 162d0c4..da752752 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -637,14 +637,43 @@
                                                   jshortArray javaAudioData,
                                                   jint offsetInShorts, jint sizeInShorts,
                                                   jint javaAudioFormat) {
-    jint written = android_media_AudioTrack_write_byte(env, thiz,
-                                                 (jbyteArray) javaAudioData,
-                                                 offsetInShorts*2, sizeInShorts*2,
-                                                 javaAudioFormat,
-                                                 JNI_TRUE /*blocking write, legacy behavior*/);
-    if (written > 0) {
-        written /= 2;
+
+    //ALOGV("android_media_AudioTrack_write_short(offset=%d, sizeInShorts=%d) called",
+    //    offsetInShorts, sizeInShorts);
+    sp<AudioTrack> lpTrack = getAudioTrack(env, thiz);
+    if (lpTrack == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException",
+            "Unable to retrieve AudioTrack pointer for write()");
+        return 0;
     }
+
+    // get the pointer for the audio data from the java array
+    // NOTE: We may use GetPrimitiveArrayCritical() when the JNI implementation changes in such
+    // a way that it becomes much more efficient. When doing so, we will have to prevent the
+    // AudioSystem callback to be called while in critical section (in case of media server
+    // process crash for instance)
+    jshort* cAudioData = NULL;
+    if (javaAudioData) {
+        cAudioData = (jshort *)env->GetShortArrayElements(javaAudioData, NULL);
+        if (cAudioData == NULL) {
+            ALOGE("Error retrieving source of audio data to play, can't play");
+            return 0; // out of memory or no data to load
+        }
+    } else {
+        ALOGE("NULL java array of audio data to play, can't play");
+        return 0;
+    }
+    jint written = writeToTrack(lpTrack, javaAudioFormat, (jbyte *)cAudioData,
+                                offsetInShorts * sizeof(short), sizeInShorts * sizeof(short),
+            true /*blocking write, legacy behavior*/);
+    env->ReleaseShortArrayElements(javaAudioData, cAudioData, 0);
+
+    if (written > 0) {
+        written /= sizeof(short);
+    }
+    //ALOGV("write wrote %d (tried %d) shorts in the native AudioTrack with offset %d",
+    //     (int)written, (int)(sizeInShorts), (int)offsetInShorts);
+
     return written;
 }
 
diff --git a/core/res/res/layout/alert_dialog_micro.xml b/core/res/res/layout/alert_dialog_micro.xml
new file mode 100644
index 0000000..f8eb46c
--- /dev/null
+++ b/core/res/res/layout/alert_dialog_micro.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/parentPanel"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout android:id="@+id/topPanel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+        <View android:id="@+id/titleDividerTop"
+            android:layout_width="match_parent"
+            android:layout_height="2dip"
+            android:visibility="gone"
+            android:background="@android:color/holo_blue_light" />
+        <LinearLayout android:id="@+id/title_template"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:gravity="center_vertical|start"
+            android:minHeight="@dimen/alert_dialog_title_height"
+            android:layout_marginStart="16dip"
+            android:layout_marginEnd="16dip">
+            <ImageView android:id="@+id/icon"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:paddingEnd="8dip"
+                android:src="@null" />
+            <com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
+                style="?android:attr/windowTitleStyle"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAlignment="viewStart" />
+        </LinearLayout>
+        <View android:id="@+id/titleDivider"
+            android:layout_width="match_parent"
+            android:layout_height="2dip"
+            android:visibility="gone"
+            android:background="@android:color/holo_blue_light" />
+        <!-- If the client uses a customTitle, it will be added here. -->
+    </LinearLayout>
+
+    <LinearLayout android:id="@+id/contentPanel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:minHeight="64dp">
+        <ScrollView android:id="@+id/scrollView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:clipToPadding="false">
+            <TextView android:id="@+id/message"
+                style="?android:attr/textAppearanceMedium"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingStart="16dip"
+                android:paddingEnd="16dip"
+                android:paddingTop="8dip"
+                android:paddingBottom="8dip"/>
+        </ScrollView>
+    </LinearLayout>
+
+    <FrameLayout android:id="@+id/customPanel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:minHeight="64dp">
+        <FrameLayout android:id="@+android:id/custom"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+    </FrameLayout>
+
+    <LinearLayout android:id="@+id/buttonPanel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="@dimen/alert_dialog_button_bar_height"
+        android:orientation="vertical"
+        android:divider="?android:attr/dividerHorizontal"
+        android:showDividers="beginning"
+        android:dividerPadding="0dip">
+        <LinearLayout
+            style="?android:attr/buttonBarStyle"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:layoutDirection="locale"
+            android:measureWithLargestChild="true">
+            <Button android:id="@+id/button2"
+                android:layout_width="wrap_content"
+                android:layout_gravity="start"
+                android:layout_weight="1"
+                android:maxLines="2"
+                style="?android:attr/buttonBarButtonStyle"
+                android:textSize="14sp"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                android:layout_height="wrap_content" />
+            <Button android:id="@+id/button3"
+                android:layout_width="wrap_content"
+                android:layout_gravity="center_horizontal"
+                android:layout_weight="1"
+                android:maxLines="2"
+                style="?android:attr/buttonBarButtonStyle"
+                android:textSize="14sp"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                android:layout_height="wrap_content" />
+            <Button android:id="@+id/button1"
+                android:layout_width="wrap_content"
+                android:layout_gravity="end"
+                android:layout_weight="1"
+                android:maxLines="2"
+                android:minHeight="@dimen/alert_dialog_button_bar_height"
+                style="?android:attr/buttonBarButtonStyle"
+                android:textSize="14sp"
+                android:layout_height="wrap_content" />
+        </LinearLayout>
+     </LinearLayout>
+</LinearLayout>
diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml
index e71fa4a..44e258d 100644
--- a/core/res/res/values-watch/config.xml
+++ b/core/res/res/values-watch/config.xml
@@ -32,7 +32,7 @@
     <dimen name="config_viewConfigurationTouchSlop">4dp</dimen>
 
     <!-- Minimum velocity to initiate a fling, as measured in dips per second. -->
-    <dimen name="config_viewMinFlingVelocity">50dp</dimen>
+    <dimen name="config_viewMinFlingVelocity">500dp</dimen>
 
     <!-- Maximum velocity to initiate a fling, as measured in dips per second. -->
     <dimen name="config_viewMaxFlingVelocity">8000dp</dimen>
diff --git a/core/res/res/values-watch/themes.xml b/core/res/res/values-watch/themes.xml
new file mode 100644
index 0000000..9447d9cb
--- /dev/null
+++ b/core/res/res/values-watch/themes.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="Theme.Dialog.Alert" parent="Theme.Micro.Dialog.Alert" />
+    <style name="Theme.Dialog.AppError" parent="Theme.Micro.Dialog.AppError" />
+    <style name="Theme.Holo.Dialog.Alert" parent="Theme.Micro.Dialog.Alert" />
+    <style name="Theme.Holo.Light.Dialog.Alert" parent="Theme.Micro.Dialog.Alert" />
+</resources>
diff --git a/core/res/res/values-watch/themes_device_defaults.xml b/core/res/res/values-watch/themes_device_defaults.xml
new file mode 100644
index 0000000..705143c
--- /dev/null
+++ b/core/res/res/values-watch/themes_device_defaults.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="Theme.DeviceDefault" parent="Theme.Micro" />
+    <style name="Theme.DeviceDefault.NoActionBar" parent="Theme.Micro" />
+    <style name="Theme.DeviceDefault.Dialog" parent="Theme.Micro.Dialog" />
+    <style name="Theme.DeviceDefault.Dialog.Alert" parent="Theme.Micro.Dialog.Alert" />
+    <style name="Theme.DeviceDefault.Light" parent="Theme.Micro.Light" />
+    <style name="Theme.DeviceDefault.Light.NoActionBar" parent="Theme.Micro.Light" />
+    <style name="Theme.DeviceDefault.Light.DarkActionBar" parent="Theme.Micro.Light" />
+    <style name="Theme.DeviceDefault.Light.Dialog" parent="Theme.Micro.Dialog" />
+    <style name="Theme.DeviceDefault.Light.Dialog.Alert" parent="Theme.Micro.Dialog.Alert" />
+
+</resources>
+
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index f01f10e..305ba28 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -348,4 +348,43 @@
         <item>中文 (繁體)</item>
     </string-array>
 
+    <!-- Used by callers to Resources.selectSystemTheme(). Defines the minimum
+         targetSdkVersion required for the theme style at a given index.
+         NOTE: Must be sorted in ascending order. -->
+    <integer-array name="system_theme_sdks">
+        <item>0</item>
+        <item>11</item>
+        <item>14</item>
+        <item>21</item>
+    </integer-array>
+
+    <!-- Used by Resources.selectDefaultTheme(). Defines the default theme style
+         for the targetSdkVersion at a given index (see system_theme_sdks).
+         NOTE: Must match number of entries in system_theme_sdks. -->
+    <array name="system_theme_styles">
+        <item>@style/Theme</item>
+        <item>@style/Theme.Holo</item>
+        <item>@style/Theme.DeviceDefault</item>
+        <item>@style/Theme.DeviceDefault.Light.DarkActionBar</item>
+    </array>
+
+    <!-- Used by ContextImpl for notifications. Defines the default dialog theme
+         style for the targetSdkVersion at a given index (see system_theme_sdks).
+         NOTE: Must match number of entries in system_theme_sdks. -->
+    <array name="system_theme_dialog_styles">
+        <item>@style/Theme</item>
+        <item>@style/Theme.Holo.Dialog</item>
+        <item>@style/Theme.DeviceDefault.Dialog</item>
+        <item>@style/Theme.DeviceDefault.Light.Dialog</item>
+    </array>
+
+    <!-- Used by InputMethodService.onCreate(). Defines the default IME theme
+         style for the targetSdkVersion at a given index (see system_theme_sdks).
+         NOTE: Must match number of entries in system_theme_sdks. -->
+    <array name="system_theme_ime_styles">
+        <item>@style/Theme.InputMethod</item>
+        <item>@style/Theme.Holo.InputMethod</item>
+        <item>@style/Theme.DeviceDefault.InputMethod</item>
+        <item>@style/Theme.DeviceDefault.InputMethod</item>
+    </array>
 </resources>
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index d0c455b..441fd94 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -148,6 +148,8 @@
     <color name="link_text_holo_dark">#5c5cff</color>
     <color name="link_text_holo_light">#0000ee</color>
 
+    <color name="micro_text_light">#434343</color>
+
     <!-- Group buttons -->
     <eat-comment />
     <color name="group_button_dialog_pressed_holo_dark">#46c5c1ff</color>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 624ed73..f39155b 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1212,6 +1212,9 @@
     <!-- Maximum velocity to initiate a fling, as measured in dips per second. -->
     <dimen name="config_viewMaxFlingVelocity">8000dp</dimen>
 
+    <!-- Amount of time in ms the user needs to press the relevant key to bring up the global actions dialog -->
+    <integer name="config_globalActionsKeyTimeout">500</integer>
+
     <!-- Maximum number of grid columns permitted in the ResolverActivity
          used for picking activities to handle an intent. -->
     <integer name="config_maxResolverActivityColumns">2</integer>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index d4b3f0d..22c2b050 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2162,6 +2162,7 @@
   <public type="attr" name="windowAllowExitTransitionOverlap" />
   <public type="attr" name="windowAllowEnterTransitionOverlap" />
   <public type="attr" name="sessionService" />
+  <public type="attr" name="stackViewStyle" />
   <public type="attr" name="switchStyle" />
   <public type="attr" name="elevation" />
   <public type="attr" name="excludeId" />
@@ -2181,15 +2182,25 @@
 
   <public-padding type="style" name="l_resource_pad" end="0x01030200" />
 
-  <public type="style" name="Widget.Holo.FragmentBreadCrumbs" />
-  <public type="style" name="Widget.Holo.Light.FragmentBreadCrumbs" />
-  <public type="style" name="Widget.DeviceDefault.FragmentBreadCrumbs" />
-  <public type="style" name="Widget.DeviceDefault.Light.FragmentBreadCrumbs" />
   <public type="style" name="Widget.FastScroll" />
+  <public type="style" name="Widget.StackView" />
+
   <public type="style" name="Widget.Holo.FastScroll" />
+  <public type="style" name="Widget.Holo.FragmentBreadCrumbs" />
+  <public type="style" name="Widget.Holo.StackView" />
+
+  <public type="style" name="Widget.Holo.Light.Button.Borderless" />
   <public type="style" name="Widget.Holo.Light.FastScroll" />
+  <public type="style" name="Widget.Holo.Light.FragmentBreadCrumbs" />
+  <public type="style" name="Widget.Holo.Light.StackView" />
+
   <public type="style" name="Widget.DeviceDefault.FastScroll" />
+  <public type="style" name="Widget.DeviceDefault.FragmentBreadCrumbs" />
+  <public type="style" name="Widget.DeviceDefault.StackView" />
+
   <public type="style" name="Widget.DeviceDefault.Light.FastScroll" />
+  <public type="style" name="Widget.DeviceDefault.Light.FragmentBreadCrumbs" />
+  <public type="style" name="Widget.DeviceDefault.Light.StackView" />
 
   <public type="style" name="TextAppearance.Quantum" />
   <public type="style" name="TextAppearance.Quantum.DialogWindowTitle" />
@@ -2266,7 +2277,6 @@
   <public type="style" name="Widget.Quantum.ActionButton" />
   <public type="style" name="Widget.Quantum.ActionButton.CloseMode" />
   <public type="style" name="Widget.Quantum.ActionButton.Overflow" />
-  <public type="style" name="Widget.Quantum.ActionButton.TextButton" />
   <public type="style" name="Widget.Quantum.ActionMode" />
   <public type="style" name="Widget.Quantum.AutoCompleteTextView" />
   <public type="style" name="Widget.Quantum.Button" />
@@ -2275,6 +2285,8 @@
   <public type="style" name="Widget.Quantum.Button.Inset" />
   <public type="style" name="Widget.Quantum.Button.Small" />
   <public type="style" name="Widget.Quantum.Button.Toggle" />
+  <public type="style" name="Widget.Quantum.Button.Paper" />
+  <public type="style" name="Widget.Quantum.Button.Paper.Color" />
   <public type="style" name="Widget.Quantum.ButtonBar" />
   <public type="style" name="Widget.Quantum.ButtonBar.AlertDialog" />
   <public type="style" name="Widget.Quantum.CalendarView" />
@@ -2309,6 +2321,7 @@
   <public type="style" name="Widget.Quantum.ScrollView" />
   <public type="style" name="Widget.Quantum.SeekBar" />
   <public type="style" name="Widget.Quantum.SegmentedButton" />
+  <public type="style" name="Widget.Quantum.StackView" />
   <public type="style" name="Widget.Quantum.Spinner" />
   <public type="style" name="Widget.Quantum.Tab" />
   <public type="style" name="Widget.Quantum.TabWidget" />
@@ -2329,10 +2342,13 @@
   <public type="style" name="Widget.Quantum.Light.ActionMode" />
   <public type="style" name="Widget.Quantum.Light.AutoCompleteTextView" />
   <public type="style" name="Widget.Quantum.Light.Button" />
+  <public type="style" name="Widget.Quantum.Light.Button.Borderless" />
   <public type="style" name="Widget.Quantum.Light.Button.Borderless.Small" />
   <public type="style" name="Widget.Quantum.Light.Button.Inset" />
   <public type="style" name="Widget.Quantum.Light.Button.Small" />
   <public type="style" name="Widget.Quantum.Light.Button.Toggle" />
+  <public type="style" name="Widget.Quantum.Light.Button.Paper" />
+  <public type="style" name="Widget.Quantum.Light.Button.Paper.Color" />
   <public type="style" name="Widget.Quantum.Light.ButtonBar" />
   <public type="style" name="Widget.Quantum.Light.ButtonBar.AlertDialog" />
   <public type="style" name="Widget.Quantum.Light.CalendarView" />
@@ -2369,6 +2385,7 @@
   <public type="style" name="Widget.Quantum.Light.ScrollView" />
   <public type="style" name="Widget.Quantum.Light.SeekBar" />
   <public type="style" name="Widget.Quantum.Light.SegmentedButton" />
+  <public type="style" name="Widget.Quantum.Light.StackView" />
   <public type="style" name="Widget.Quantum.Light.Spinner" />
   <public type="style" name="Widget.Quantum.Light.Tab" />
   <public type="style" name="Widget.Quantum.Light.TabWidget" />
@@ -2377,12 +2394,6 @@
   <public type="style" name="Widget.Quantum.Light.WebTextView" />
   <public type="style" name="Widget.Quantum.Light.WebView" />
 
-  <public type="style" name="Widget.Quantum.Button.Paper" />
-  <public type="style" name="Widget.Quantum.Button.Paper.Color" />
-
-  <public type="style" name="Widget.Quantum.Light.Button.Paper" />
-  <public type="style" name="Widget.Quantum.Light.Button.Paper.Color" />
-
   <public type="style" name="TextAppearance.Quantum.Display4" />
   <public type="style" name="TextAppearance.Quantum.Display3" />
   <public type="style" name="TextAppearance.Quantum.Display2" />
@@ -2396,8 +2407,6 @@
   <public type="style" name="TextAppearance.Quantum.Menu" />
   <public type="style" name="TextAppearance.Quantum.Button" />
 
-  <public type="style" name="Widget.Holo.Light.Button.Borderless" />
-
   <public-padding type="interpolator" name="l_resource_pad" end="0x010c0010" />
 
   <!-- An interpolator which accelerates fast but decelerates slowly. -->
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index fc0fccc..37716f7 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -397,6 +397,11 @@
         <item name="android:disabledAlpha">?android:attr/disabledAlpha</item>
     </style>
 
+    <style name="Widget.StackView">
+        <item name="android:resOutColor">@android:color/holo_blue_light</item>
+        <item name="android:clickColor">@android:color/holo_blue_light</item>
+    </style>
+
     <style name="Widget.ProgressBar">
         <item name="android:indeterminateOnly">true</item>
         <item name="android:indeterminateDrawable">@android:drawable/progress_medium_white</item>
@@ -1609,11 +1614,6 @@
         <item name="android:minWidth">64dip</item>
     </style>
 
-    <style name="Widget.Holo.StackView">
-        <item name="android:resOutColor">@android:color/holo_blue_light</item>
-        <item name="android:clickColor">@android:color/holo_blue_light</item>
-    </style>
-
     <style name="Widget.Holo.Button.Borderless">
         <item name="android:background">?android:attr/selectableItemBackground</item>
         <item name="android:paddingStart">4dip</item>
@@ -1645,6 +1645,11 @@
         <item name="android:minHeight">48dip</item>
     </style>
 
+    <style name="Widget.Holo.StackView">
+        <item name="android:resOutColor">@android:color/holo_blue_light</item>
+        <item name="android:clickColor">@android:color/holo_blue_light</item>
+    </style>
+
     <style name="Holo.ButtonBar" parent="ButtonBar">
         <item name="android:paddingTop">0dip</item>
         <item name="android:paddingStart">0dip</item>
@@ -2099,6 +2104,11 @@
         <item name="android:minHeight">48dip</item>
     </style>
 
+    <style name="Widget.Holo.Light.StackView">
+        <item name="android:resOutColor">@android:color/holo_blue_light</item>
+        <item name="android:clickColor">@android:color/holo_blue_light</item>
+    </style>
+
     <style name="Holo.Light.ButtonBar" parent="Holo.ButtonBar">
     </style>
 
diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml
index 629b2b7..60e06ce 100644
--- a/core/res/res/values/styles_device_defaults.xml
+++ b/core/res/res/values/styles_device_defaults.xml
@@ -72,7 +72,7 @@
     <style name="Widget.DeviceDefault.PopupMenu" parent="Widget.Quantum.PopupMenu"/>
     <style name="Widget.DeviceDefault.ActionButton" parent="Widget.Quantum.ActionButton"/>
     <style name="Widget.DeviceDefault.ActionButton.Overflow" parent="Widget.Quantum.ActionButton.Overflow"/>
-    <style name="Widget.DeviceDefault.ActionButton.TextButton" parent="Widget.Quantum.ActionButton.TextButton"/>
+    <style name="Widget.DeviceDefault.ActionButton.TextButton" parent="Widget.Quantum.ActionButton"/>
     <style name="Widget.DeviceDefault.ActionMode" parent="Widget.Quantum.ActionMode"/>
     <style name="Widget.DeviceDefault.ActionButton.CloseMode" parent="Widget.Quantum.ActionButton.CloseMode"/>
     <style name="Widget.DeviceDefault.ActionBar" parent="Widget.Quantum.ActionBar"/>
@@ -97,6 +97,7 @@
     <style name="Widget.DeviceDefault.ImageWell" parent="Widget.Quantum.ImageWell"/>
     <style name="Widget.DeviceDefault.KeyboardView" parent="Widget.Quantum.KeyboardView"/>
     <style name="Widget.DeviceDefault.ListView.White" parent="Widget.Quantum.ListView.White"/>
+    <style name="Widget.DeviceDefault.MediaRouteButton" parent="Widget.Quantum.MediaRouteButton" />
     <style name="Widget.DeviceDefault.NumberPicker" parent="Widget.Quantum.NumberPicker"/>
     <style name="Widget.DeviceDefault.PreferenceFrameLayout" parent="Widget.Quantum.PreferenceFrameLayout"/>
     <style name="Widget.DeviceDefault.ProgressBar.Inverse" parent="Widget.Quantum.ProgressBar.Inverse"/>
@@ -114,11 +115,13 @@
     <style name="Widget.DeviceDefault.TextSuggestionsPopupWindow" parent="Widget.Quantum.TextSuggestionsPopupWindow"/>
     <style name="Widget.DeviceDefault.TextView.ListSeparator" parent="Widget.Quantum.TextView.ListSeparator"/>
     <style name="Widget.DeviceDefault.TimePicker" parent="Widget.Quantum.TimePicker"/>
+
     <style name="Widget.DeviceDefault.Light" parent="Widget.Quantum.Light"/>
     <style name="Widget.DeviceDefault.Light.Button" parent="Widget.Quantum.Light.Button"/>
     <style name="Widget.DeviceDefault.Light.Button.Small" parent="Widget.Quantum.Light.Button.Small"/>
     <style name="Widget.DeviceDefault.Light.Button.Inset" parent="Widget.Quantum.Light.Button.Inset"/>
     <style name="Widget.DeviceDefault.Light.Button.Toggle" parent="Widget.Quantum.Light.Button.Toggle"/>
+    <style name="Widget.DeviceDefault.Light.StackView" parent="Widget.Quantum.Light.StackView"/>
     <style name="Widget.DeviceDefault.Light.TextView" parent="Widget.Quantum.Light.TextView"/>
     <style name="Widget.DeviceDefault.Light.CheckedTextView" parent="Widget.Quantum.Light.CheckedTextView"/>
     <style name="Widget.DeviceDefault.Light.AutoCompleteTextView" parent="Widget.Quantum.Light.AutoCompleteTextView"/>
@@ -131,6 +134,7 @@
     <style name="Widget.DeviceDefault.Light.GridView" parent="Widget.Quantum.Light.GridView"/>
     <style name="Widget.DeviceDefault.Light.ImageButton" parent="Widget.Quantum.Light.ImageButton"/>
     <style name="Widget.DeviceDefault.Light.ListView" parent="Widget.Quantum.Light.ListView"/>
+    <style name="Widget.DeviceDefault.Light.MediaRouteButton" parent="Widget.Quantum.Light.MediaRouteButton" />
     <style name="Widget.DeviceDefault.Light.PopupWindow" parent="Widget.Quantum.Light.PopupWindow"/>
     <style name="Widget.DeviceDefault.Light.ProgressBar" parent="Widget.Quantum.Light.ProgressBar"/>
     <style name="Widget.DeviceDefault.Light.ProgressBar.Horizontal" parent="Widget.Quantum.Light.ProgressBar.Horizontal"/>
@@ -195,7 +199,6 @@
     <style name="Widget.DeviceDefault.Light.TimePicker" parent="Widget.Quantum.Light.TimePicker"/>
     <style name="Widget.DeviceDefault.Light.TextSuggestionsPopupWindow" parent="Widget.Quantum.Light.TextSuggestionsPopupWindow"/>
 
-
     <!-- Text Appearance Styles -->
     <style name="TextAppearance.DeviceDefault" parent="TextAppearance.Quantum"/>
     <style name="TextAppearance.DeviceDefault.Inverse" parent="TextAppearance.Quantum.Inverse"/>
@@ -207,6 +210,8 @@
     <style name="TextAppearance.DeviceDefault.Small.Inverse" parent="TextAppearance.Quantum.Small.Inverse"/>
     <style name="TextAppearance.DeviceDefault.SearchResult.Title" parent="TextAppearance.Quantum.SearchResult.Title"/>
     <style name="TextAppearance.DeviceDefault.SearchResult.Subtitle" parent="TextAppearance.Quantum.SearchResult.Subtitle"/>
+    <style name="TextAppearance.DeviceDefault.TimePicker.TimeLabel" parent="TextAppearance.Quantum.TimePicker.TimeLabel"/>
+    <style name="TextAppearance.DeviceDefault.TimePicker.AmPmLabel" parent="TextAppearance.Quantum.TimePicker.AmPmLabel"/>
     <style name="TextAppearance.DeviceDefault.Widget" parent="TextAppearance.Quantum.Widget"/>
     <style name="TextAppearance.DeviceDefault.Widget.Button" parent="TextAppearance.Quantum.Widget.Button"/>
     <style name="TextAppearance.DeviceDefault.Widget.IconMenu.Item" parent="TextAppearance.Quantum.Widget.IconMenu.Item"/>
@@ -235,20 +240,6 @@
     <!-- @deprecated Action bars are now themed using the inheritable android:theme attribute. -->
     <style name="TextAppearance.DeviceDefault.Widget.ActionMode.Subtitle.Inverse" parent="TextAppearance.Quantum.Widget.ActionMode.Subtitle.Inverse"/>
     <style name="TextAppearance.DeviceDefault.Widget.ActionBar.Menu" parent="TextAppearance.Quantum.Widget.ActionBar.Menu"/>
-    <style name="TextAppearance.DeviceDefault.Light" parent="TextAppearance.Quantum.Light"/>
-    <style name="TextAppearance.DeviceDefault.Light.Inverse" parent="TextAppearance.Quantum.Light.Inverse"/>
-    <style name="TextAppearance.DeviceDefault.Light.Large" parent="TextAppearance.Quantum.Light.Large"/>
-    <style name="TextAppearance.DeviceDefault.Light.Large.Inverse" parent="TextAppearance.Quantum.Light.Large.Inverse"/>
-    <style name="TextAppearance.DeviceDefault.Light.Medium" parent="TextAppearance.Quantum.Light.Medium"/>
-    <style name="TextAppearance.DeviceDefault.Light.Medium.Inverse" parent="TextAppearance.Quantum.Light.Medium.Inverse"/>
-    <style name="TextAppearance.DeviceDefault.Light.SearchResult.Subtitle" parent="TextAppearance.Quantum.Light.SearchResult.Subtitle"/>
-    <style name="TextAppearance.DeviceDefault.Light.SearchResult.Title" parent="TextAppearance.Quantum.Light.SearchResult.Title"/>
-    <style name="TextAppearance.DeviceDefault.Light.Small" parent="TextAppearance.Quantum.Light.Small"/>
-    <style name="TextAppearance.DeviceDefault.Light.Small.Inverse" parent="TextAppearance.Quantum.Light.Small.Inverse"/>
-    <style name="TextAppearance.DeviceDefault.Light.Widget.Button" parent="TextAppearance.Quantum.Light.Widget.Button"/>
-    <style name="TextAppearance.DeviceDefault.Light.Widget.PopupMenu.Large" parent="TextAppearance.Quantum.Light.Widget.PopupMenu.Large"/>
-    <style name="TextAppearance.DeviceDefault.Light.Widget.PopupMenu.Small" parent="TextAppearance.Quantum.Light.Widget.PopupMenu.Small"/>
-
 
     <!-- Preference Styles -->
     <style name="Preference.DeviceDefault" parent="Preference.Quantum"/>
@@ -262,7 +253,6 @@
     <style name="Preference.DeviceDefault.RingtonePreference" parent="Preference.Quantum.RingtonePreference"/>
     <style name="Preference.DeviceDefault.SwitchPreference" parent="Preference.Quantum.SwitchPreference"/>
 
-
     <!-- AlertDialog Styles -->
     <style name="AlertDialog.DeviceDefault" parent="AlertDialog.Quantum"/>
     <style name="AlertDialog.DeviceDefault.Light" parent="AlertDialog.Quantum.Light"/>
@@ -271,32 +261,20 @@
     <style name="Animation.DeviceDefault.Activity" parent="Animation.Quantum.Activity"/>
     <style name="Animation.DeviceDefault.Dialog" parent="Animation.Quantum.Dialog"/>
 
-
     <!-- DialogWindowTitle Styles -->
     <style name="DialogWindowTitle.DeviceDefault" parent="DialogWindowTitle.Quantum"/>
     <style name="DialogWindowTitle.DeviceDefault.Light" parent="DialogWindowTitle.Quantum.Light"/>
 
-
     <!-- WindowTitle Styles -->
     <style name="WindowTitle.DeviceDefault" parent="WindowTitle.Quantum"/>
     <style name="WindowTitleBackground.DeviceDefault" parent="WindowTitleBackground.Quantum"/>
 
-
     <!-- Other Styles -->
     <style name="DeviceDefault.ButtonBar" parent="Widget.Quantum.ButtonBar"/>
     <style name="DeviceDefault.ButtonBar.AlertDialog" parent="Widget.Quantum.ButtonBar.AlertDialog"/>
     <style name="DeviceDefault.SegmentedButton" parent="Widget.Quantum.SegmentedButton"/>
+
     <style name="DeviceDefault.Light.ButtonBar" parent="Widget.Quantum.Light.ButtonBar"/>
     <style name="DeviceDefault.Light.ButtonBar.AlertDialog" parent="Widget.Quantum.Light.ButtonBar.AlertDialog"/>
     <style name="DeviceDefault.Light.SegmentedButton" parent="Widget.Quantum.Light.SegmentedButton"/>
-
-    <style name="Widget.DeviceDefault.MediaRouteButton" parent="Widget.Quantum.MediaRouteButton" />
-    <style name="Widget.DeviceDefault.Light.MediaRouteButton" parent="Widget.Quantum.Light.MediaRouteButton" />
-
-    <style name="TextAppearance.DeviceDefault.TimePicker.TimeLabel" parent="TextAppearance.Quantum.TimePicker.TimeLabel"/>
-    <style name="TextAppearance.DeviceDefault.Light.TimePicker.TimeLabel" parent="TextAppearance.Quantum.Light.TimePicker.TimeLabel"/>
-    <style name="TextAppearance.DeviceDefault.TimePicker.AmPmLabel" parent="TextAppearance.Quantum.TimePicker.AmPmLabel"/>
-    <style name="TextAppearance.DeviceDefault.Light.TimePicker.AmPmLabel" parent="TextAppearance.Quantum.Light.TimePicker.AmPmLabel"/>
-    <style name="Theme.DeviceDefault.Dialog.TimePicker" parent="Theme.Quantum.Dialog.TimePicker"/>
-    <style name="Theme.DeviceDefault.Light.Dialog.TimePicker" parent="Theme.Quantum.Light.Dialog.TimePicker"/>
 </resources>
diff --git a/core/res/res/values/styles_micro.xml b/core/res/res/values/styles_micro.xml
index 52d90bc..bdaa49d 100644
--- a/core/res/res/values/styles_micro.xml
+++ b/core/res/res/values/styles_micro.xml
@@ -14,21 +14,44 @@
      limitations under the License.
 -->
 <resources>
+    <style name="AlertDialog.Micro" parent="AlertDialog.Holo.Light">
+        <item name="layout">@layout/alert_dialog_micro</item>
+    </style>
+
+    <style name="DialogWindowTitle.Micro">
+        <item name="maxLines">1</item>
+        <item name="scrollHorizontally">true</item>
+        <item name="textAppearance">@style/TextAppearance.Micro.DialogWindowTitle</item>
+    </style>
+
+    <style name="TextAppearance.Micro" parent="TextAppearance.Holo">
+        <item name="textSize">20sp</item>
+        <item name="fontFamily">sans-serif-condensed-light</item>
+        <item name="textColor">@color/micro_text_light</item>
+    </style>
+
+    <style name="TextAppearance.Micro.DialogWindowTitle" parent="TextAppearance.Holo.DialogWindowTitle">
+        <item name="textSize">20sp</item>
+        <item name="fontFamily">sans-serif-condensed-light</item>
+        <item name="textColor">@color/micro_text_light</item>
+    </style>
+
     <style name="Widget.Micro" parent="Widget.Holo" />
 
     <style name="Widget.Micro.TextView">
-        <item name="android:fontFamily">sans-serif-condensed</item>
+        <item name="fontFamily">sans-serif-condensed</item>
     </style>
 
     <style name="Widget.Micro.NumberPicker">
-        <item name="android:internalLayout">@android:layout/number_picker_with_selector_wheel_micro</item>
-        <item name="android:solidColor">@android:color/transparent</item>
-        <item name="android:selectionDivider">@android:drawable/numberpicker_selection_divider</item>
-        <item name="android:selectionDividerHeight">0dip</item>
-        <item name="android:selectionDividersDistance">104dip</item>
-        <item name="android:internalMinWidth">64dip</item>
-        <item name="android:internalMaxHeight">180dip</item>
-        <item name="virtualButtonPressedDrawable">?android:attr/selectableItemBackground</item>
-        <item name="android:descendantFocusability">blocksDescendants</item>
+        <item name="internalLayout">@layout/number_picker_with_selector_wheel_micro</item>
+        <item name="solidColor">@color/transparent</item>
+        <item name="selectionDivider">@drawable/numberpicker_selection_divider</item>
+        <item name="selectionDividerHeight">0dip</item>
+        <item name="selectionDividersDistance">104dip</item>
+        <item name="internalMinWidth">64dip</item>
+        <item name="internalMaxHeight">180dip</item>
+        <item name="virtualButtonPressedDrawable">?attr/selectableItemBackground</item>
+        <item name="descendantFocusability">blocksDescendants</item>
     </style>
+
 </resources>
diff --git a/core/res/res/values/styles_quantum.xml b/core/res/res/values/styles_quantum.xml
index 57f2443..23172c1 100644
--- a/core/res/res/values/styles_quantum.xml
+++ b/core/res/res/values/styles_quantum.xml
@@ -351,40 +351,6 @@
         <item name="textStyle">bold</item>
     </style>
 
-    <!-- Light text styles -->
-    <style name="TextAppearance.Quantum.Light" parent="TextAppearance.Quantum"/>
-    <style name="TextAppearance.Quantum.Light.Inverse" parent="TextAppearance.Quantum.Inverse"/>
-    <style name="TextAppearance.Quantum.Light.Large" parent="TextAppearance.Quantum.Large"/>
-    <style name="TextAppearance.Quantum.Light.Large.Inverse" parent="TextAppearance.Quantum.Large.Inverse"/>
-    <style name="TextAppearance.Quantum.Light.Medium" parent="TextAppearance.Quantum.Medium"/>
-    <style name="TextAppearance.Quantum.Light.Medium.Inverse" parent="TextAppearance.Quantum.Medium.Inverse"/>
-    <style name="TextAppearance.Quantum.Light.Small" parent="TextAppearance.Quantum.Small"/>
-    <style name="TextAppearance.Quantum.Light.Small.Inverse" parent="TextAppearance.Quantum.Small.Inverse"/>
-    <style name="TextAppearance.Quantum.Light.SearchResult" parent="TextAppearance.Quantum.SearchResult"/>
-    <style name="TextAppearance.Quantum.Light.SearchResult.Title" parent="TextAppearance.Quantum.SearchResult.Title"/>
-    <style name="TextAppearance.Quantum.Light.SearchResult.Subtitle" parent="TextAppearance.Quantum.SearchResult.Subtitle"/>
-    <style name="TextAppearance.Quantum.Light.Widget" parent="TextAppearance.Quantum.Widget"/>
-    <style name="TextAppearance.Quantum.Light.Widget.Button" parent="TextAppearance.Quantum.Widget.Button"/>
-    <style name="TextAppearance.Quantum.Light.Widget.EditText" parent="TextAppearance.Quantum.Widget.EditText"/>
-    <style name="TextAppearance.Quantum.Light.Widget.Switch" parent="TextAppearance.Quantum.Widget.Switch"/>
-    <style name="TextAppearance.Quantum.Light.Widget.PopupMenu" parent="TextAppearance.Quantum.Widget.PopupMenu"/>
-    <style name="TextAppearance.Quantum.Light.Widget.PopupMenu.Large" parent="TextAppearance.Quantum.Widget.PopupMenu.Large"/>
-    <style name="TextAppearance.Quantum.Light.Widget.PopupMenu.Small" parent="TextAppearance.Quantum.Widget.PopupMenu.Small"/>
-    <style name="TextAppearance.Quantum.Light.Widget.DropDownHint" parent="TextAppearance.Quantum.Widget.DropDownHint"/>
-    <style name="TextAppearance.Quantum.Light.Widget.ActionMode.Title" parent="TextAppearance.Quantum.Widget.ActionMode.Title"/>
-    <style name="TextAppearance.Quantum.Light.Widget.ActionMode.Subtitle" parent="TextAppearance.Quantum.Widget.ActionMode.Subtitle"/>
-    <style name="TextAppearance.Quantum.Light.WindowTitle" parent="TextAppearance.Quantum.WindowTitle"/>
-    <style name="TextAppearance.Quantum.Light.DialogWindowTitle" parent="TextAppearance.Quantum.DialogWindowTitle"/>
-    <style name="TextAppearance.Quantum.Light.CalendarViewWeekDayView" parent="TextAppearance.Quantum.CalendarViewWeekDayView"/>
-
-    <style name="TextAppearance.Quantum.Light.TimePicker.TimeLabel" parent="TextAppearance.Quantum.TimePicker.TimeLabel">
-        <item name="textColor">?attr/textColorSecondary</item>
-    </style>
-
-    <style name="TextAppearance.Quantum.Light.TimePicker.AmPmLabel" parent="TextAppearance.Quantum.TimePicker.AmPmLabel">
-        <item name="textColor">?attr/textColorSecondary</item>
-    </style>
-
     <!-- Widget Styles -->
 
     <style name="Quantum"/>
@@ -743,8 +709,6 @@
         <item name="scaleType">center</item>
     </style>
 
-    <style name="Widget.Quantum.ActionButton.TextButton" parent="Widget.Quantum.ButtonBar"/>
-
     <style name="Widget.Quantum.ActionBar.TabView" parent="Widget.ActionBar.TabView">
         <item name="background">@drawable/tab_indicator_quantum</item>
         <item name="paddingStart">16dip</item>
@@ -842,6 +806,7 @@
         <item name="background">@drawable/btn_group_holo_light</item>
     </style>
 
+    <style name="Widget.Quantum.Light.StackView" parent="Widget.Quantum.StackView"/>
     <style name="Widget.Quantum.Light.TextView" parent="Widget.Quantum.TextView"/>
     <style name="Widget.Quantum.Light.TextView.ListSeparator" parent="Widget.Quantum.TextView.ListSeparator"/>
     <style name="Widget.Quantum.Light.TextView.SpinnerItem" parent="Widget.Quantum.TextView.SpinnerItem"/>
@@ -861,7 +826,7 @@
     <style name="Widget.Quantum.Light.CompoundButton.Star" parent="Widget.Quantum.CompoundButton.Star"/>
 
     <style name="Widget.Quantum.Light.CompoundButton.Switch" parent="Widget.Quantum.CompoundButton.Switch">
-        <item name="switchTextAppearance">@style/TextAppearance.Quantum.Light.Widget.Switch</item>
+        <item name="switchTextAppearance">@style/TextAppearance.Quantum.Widget.Switch</item>
     </style>
 
     <style name="Widget.Quantum.Light.ListView.DropDown" parent="Widget.Quantum.ListView.DropDown"/>
@@ -880,7 +845,7 @@
         <item name="unfocusedMonthDateColor">#7F08002B</item>
         <item name="weekNumberColor">#7F080021</item>
         <item name="weekSeparatorLineColor">#7F08002A</item>
-        <item name="weekDayTextAppearance">@style/TextAppearance.Quantum.Light.CalendarViewWeekDayView</item>
+        <item name="weekDayTextAppearance">@style/TextAppearance.Quantum.CalendarViewWeekDayView</item>
     </style>
 
     <style name="Widget.Quantum.Light.NumberPicker" parent="Widget.Quantum.NumberPicker"/>
@@ -1058,7 +1023,7 @@
     </style>
 
     <style name="DialogWindowTitle.Quantum.Light">
-        <item name="textAppearance">@style/TextAppearance.Quantum.Light.DialogWindowTitle</item>
+        <item name="textAppearance">@style/TextAppearance.Quantum.DialogWindowTitle</item>
     </style>
 
 </resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index e92d8c6..7c6a91a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -232,7 +232,6 @@
   <java-symbol type="attr" name="preferenceFrameLayoutStyle" />
   <java-symbol type="attr" name="searchDialogTheme" />
   <java-symbol type="attr" name="searchViewSearchIcon" />
-  <java-symbol type="attr" name="stackViewStyle" />
   <java-symbol type="attr" name="textAppearanceAutoCorrectionSuggestion" />
   <java-symbol type="attr" name="textAppearanceEasyCorrectSuggestion" />
   <java-symbol type="attr" name="textAppearanceMisspelledSuggestion" />
@@ -1626,6 +1625,7 @@
   <java-symbol type="string" name="wifi_display_notification_connected_message" />
   <java-symbol type="string" name="wifi_display_notification_disconnect" />
   <java-symbol type="style" name="Theme.Dialog.AppError" />
+  <java-symbol type="style" name="Theme.Micro.Dialog.Alert" />
   <java-symbol type="style" name="Theme.Toast" />
   <java-symbol type="xml" name="storage_list" />
   <java-symbol type="bool" name="config_dreamsSupported" />
@@ -1649,6 +1649,7 @@
   <java-symbol type="id" name="resolver_list" />
   <java-symbol type="id" name="button_once" />
   <java-symbol type="id" name="button_always" />
+  <java-symbol type="integer" name="config_globalActionsKeyTimeout" />
   <java-symbol type="integer" name="config_maxResolverActivityColumns" />
   <java-symbol type="array" name="config_notificationScorers" />
 
@@ -1861,5 +1862,9 @@
   <java-symbol type="id" name="icon_frame" />
   <java-symbol type="style" name="Animation.VolumePanel" />
   <java-symbol type="transition" name="no_transition" />
+  <java-symbol type="array" name="system_theme_sdks" />
+  <java-symbol type="array" name="system_theme_styles" />
+  <java-symbol type="array" name="system_theme_dialog_styles" />
+  <java-symbol type="array" name="system_theme_ime_styles" />
 
 </resources>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 0ce5094..80c10dd 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -51,139 +51,139 @@
           -->
     <style name="Theme.DeviceDefault" parent="Theme.Quantum" >
         <!-- Text styles -->
-        <item name="textAppearance">@android:style/TextAppearance.DeviceDefault</item>
-        <item name="textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Inverse</item>
+        <item name="textAppearance">@style/TextAppearance.DeviceDefault</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.DeviceDefault.Inverse</item>
 
-        <item name="textAppearanceLarge">@android:style/TextAppearance.DeviceDefault.Large</item>
-        <item name="textAppearanceMedium">@android:style/TextAppearance.DeviceDefault.Medium</item>
-        <item name="textAppearanceSmall">@android:style/TextAppearance.DeviceDefault.Small</item>
-        <item name="textAppearanceLargeInverse">@android:style/TextAppearance.DeviceDefault.Large.Inverse</item>
-        <item name="textAppearanceMediumInverse">@android:style/TextAppearance.DeviceDefault.Medium.Inverse</item>
-        <item name="textAppearanceSmallInverse">@android:style/TextAppearance.DeviceDefault.Small.Inverse</item>
-        <item name="textAppearanceSearchResultTitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Title</item>
-        <item name="textAppearanceSearchResultSubtitle">@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle</item>
+        <item name="textAppearanceLarge">@style/TextAppearance.DeviceDefault.Large</item>
+        <item name="textAppearanceMedium">@style/TextAppearance.DeviceDefault.Medium</item>
+        <item name="textAppearanceSmall">@style/TextAppearance.DeviceDefault.Small</item>
+        <item name="textAppearanceLargeInverse">@style/TextAppearance.DeviceDefault.Large.Inverse</item>
+        <item name="textAppearanceMediumInverse">@style/TextAppearance.DeviceDefault.Medium.Inverse</item>
+        <item name="textAppearanceSmallInverse">@style/TextAppearance.DeviceDefault.Small.Inverse</item>
+        <item name="textAppearanceSearchResultTitle">@style/TextAppearance.DeviceDefault.SearchResult.Title</item>
+        <item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.DeviceDefault.SearchResult.Subtitle</item>
 
-        <item name="textAppearanceButton">@android:style/TextAppearance.DeviceDefault.Widget.Button</item>
+        <item name="textAppearanceButton">@style/TextAppearance.DeviceDefault.Widget.Button</item>
 
-        <item name="textAppearanceLargePopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large</item>
-        <item name="textAppearanceSmallPopupMenu">@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small</item>
+        <item name="textAppearanceLargePopupMenu">@style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large</item>
+        <item name="textAppearanceSmallPopupMenu">@style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small</item>
 
         <!-- Button styles -->
-        <item name="buttonStyle">@android:style/Widget.DeviceDefault.Button</item>
+        <item name="buttonStyle">@style/Widget.DeviceDefault.Button</item>
 
-        <item name="buttonStyleSmall">@android:style/Widget.DeviceDefault.Button.Small</item>
-        <item name="buttonStyleInset">@android:style/Widget.DeviceDefault.Button.Inset</item>
+        <item name="buttonStyleSmall">@style/Widget.DeviceDefault.Button.Small</item>
+        <item name="buttonStyleInset">@style/Widget.DeviceDefault.Button.Inset</item>
 
-        <item name="buttonStyleToggle">@android:style/Widget.DeviceDefault.Button.Toggle</item>
-        <item name="switchStyle">@android:style/Widget.DeviceDefault.CompoundButton.Switch</item>
+        <item name="buttonStyleToggle">@style/Widget.DeviceDefault.Button.Toggle</item>
+        <item name="switchStyle">@style/Widget.DeviceDefault.CompoundButton.Switch</item>
 
-        <item name="borderlessButtonStyle">@android:style/Widget.DeviceDefault.Button.Borderless</item>
+        <item name="borderlessButtonStyle">@style/Widget.DeviceDefault.Button.Borderless</item>
 
-        <item name="listSeparatorTextViewStyle">@android:style/Widget.DeviceDefault.TextView.ListSeparator</item>
+        <item name="listSeparatorTextViewStyle">@style/Widget.DeviceDefault.TextView.ListSeparator</item>
 
         <!-- Window attributes -->
-        <item name="windowTitleStyle">@android:style/WindowTitle.DeviceDefault</item>
-        <item name="windowTitleBackgroundStyle">@android:style/WindowTitleBackground.DeviceDefault</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.DeviceDefault.Activity</item>
+        <item name="windowTitleStyle">@style/WindowTitle.DeviceDefault</item>
+        <item name="windowTitleBackgroundStyle">@style/WindowTitleBackground.DeviceDefault</item>
+        <item name="windowAnimationStyle">@style/Animation.DeviceDefault.Activity</item>
 
         <!-- Dialog attributes -->
-        <item name="dialogTheme">@android:style/Theme.DeviceDefault.Dialog</item>
+        <item name="dialogTheme">@style/Theme.DeviceDefault.Dialog</item>
 
         <!-- AlertDialog attributes -->
-        <item name="alertDialogTheme">@android:style/Theme.DeviceDefault.Dialog.Alert</item>
-        <item name="alertDialogStyle">@android:style/AlertDialog.DeviceDefault</item>
+        <item name="alertDialogTheme">@style/Theme.DeviceDefault.Dialog.Alert</item>
+        <item name="alertDialogStyle">@style/AlertDialog.DeviceDefault</item>
 
         <!-- Presentation attributes -->
-        <item name="presentationTheme">@android:style/Theme.DeviceDefault.Dialog.Presentation</item>
+        <item name="presentationTheme">@style/Theme.DeviceDefault.Dialog.Presentation</item>
 
         <!-- Text selection handle attributes -->
-        <item name="textSelectHandleWindowStyle">@android:style/Widget.DeviceDefault.TextSelectHandle</item>
-        <item name="textSuggestionsWindowStyle">@android:style/Widget.DeviceDefault.TextSuggestionsPopupWindow</item>
+        <item name="textSelectHandleWindowStyle">@style/Widget.DeviceDefault.TextSelectHandle</item>
+        <item name="textSuggestionsWindowStyle">@style/Widget.DeviceDefault.TextSuggestionsPopupWindow</item>
 
         <!-- Widget styles -->
-        <item name="absListViewStyle">@android:style/Widget.DeviceDefault.AbsListView</item>
-        <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.AutoCompleteTextView</item>
-        <item name="checkboxStyle">@android:style/Widget.DeviceDefault.CompoundButton.CheckBox</item>
-        <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.CheckedTextView</item>
-        <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.ListView.DropDown</item>
-        <item name="editTextStyle">@android:style/Widget.DeviceDefault.EditText</item>
-        <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.ExpandableListView</item>
-        <item name="expandableListViewWhiteStyle">@android:style/Widget.DeviceDefault.ExpandableListView.White</item>
-        <item name="galleryStyle">@android:style/Widget.DeviceDefault.Gallery</item>
-        <item name="gestureOverlayViewStyle">@android:style/Widget.DeviceDefault.GestureOverlayView</item>
-        <item name="gridViewStyle">@android:style/Widget.DeviceDefault.GridView</item>
-        <item name="imageButtonStyle">@android:style/Widget.DeviceDefault.ImageButton</item>
-        <item name="imageWellStyle">@android:style/Widget.DeviceDefault.ImageWell</item>
-        <item name="listViewStyle">@android:style/Widget.DeviceDefault.ListView</item>
-        <item name="listViewWhiteStyle">@android:style/Widget.DeviceDefault.ListView.White</item>
-        <item name="popupWindowStyle">@android:style/Widget.DeviceDefault.PopupWindow</item>
-        <item name="progressBarStyle">@android:style/Widget.DeviceDefault.ProgressBar</item>
-        <item name="progressBarStyleHorizontal">@android:style/Widget.DeviceDefault.ProgressBar.Horizontal</item>
-        <item name="progressBarStyleSmall">@android:style/Widget.DeviceDefault.ProgressBar.Small</item>
-        <item name="progressBarStyleSmallTitle">@android:style/Widget.DeviceDefault.ProgressBar.Small.Title</item>
-        <item name="progressBarStyleLarge">@android:style/Widget.DeviceDefault.ProgressBar.Large</item>
-        <item name="progressBarStyleInverse">@android:style/Widget.DeviceDefault.ProgressBar.Inverse</item>
-        <item name="progressBarStyleSmallInverse">@android:style/Widget.DeviceDefault.ProgressBar.Small.Inverse</item>
-        <item name="progressBarStyleLargeInverse">@android:style/Widget.DeviceDefault.ProgressBar.Large.Inverse</item>
-        <item name="seekBarStyle">@android:style/Widget.DeviceDefault.SeekBar</item>
-        <item name="ratingBarStyle">@android:style/Widget.DeviceDefault.RatingBar</item>
-        <item name="ratingBarStyleIndicator">@android:style/Widget.DeviceDefault.RatingBar.Indicator</item>
-        <item name="ratingBarStyleSmall">@android:style/Widget.DeviceDefault.RatingBar.Small</item>
-        <item name="radioButtonStyle">@android:style/Widget.DeviceDefault.CompoundButton.RadioButton</item>
-        <item name="scrollViewStyle">@android:style/Widget.DeviceDefault.ScrollView</item>
-        <item name="horizontalScrollViewStyle">@android:style/Widget.DeviceDefault.HorizontalScrollView</item>
-        <item name="dropDownSpinnerStyle">@android:style/Widget.DeviceDefault.Spinner.DropDown</item>
-        <item name="starStyle">@android:style/Widget.DeviceDefault.CompoundButton.Star</item>
-        <item name="tabWidgetStyle">@android:style/Widget.DeviceDefault.TabWidget</item>
-        <item name="textViewStyle">@android:style/Widget.DeviceDefault.TextView</item>
-        <item name="webTextViewStyle">@android:style/Widget.DeviceDefault.WebTextView</item>
-        <item name="webViewStyle">@android:style/Widget.DeviceDefault.WebView</item>
-        <item name="dropDownItemStyle">@android:style/Widget.DeviceDefault.DropDownItem</item>
-        <item name="spinnerDropDownItemStyle">@android:style/Widget.DeviceDefault.DropDownItem.Spinner</item>
-        <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.TextView.SpinnerItem</item>
-        <item name="dropDownHintAppearance">@android:style/TextAppearance.DeviceDefault.Widget.DropDownHint</item>
-        <item name="keyboardViewStyle">@android:style/Widget.DeviceDefault.KeyboardView</item>
-        <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item>
-        <item name="quickContactBadgeStyleWindowMedium">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowMedium</item>
-        <item name="quickContactBadgeStyleWindowLarge">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowLarge</item>
-        <item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowSmall</item>
-        <item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowMedium</item>
-        <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowLarge</item>
-        <item name="listPopupWindowStyle">@android:style/Widget.DeviceDefault.ListPopupWindow</item>
-        <item name="popupMenuStyle">@android:style/Widget.DeviceDefault.PopupMenu</item>
-        <item name="stackViewStyle">@android:style/Widget.DeviceDefault.StackView</item>
+        <item name="absListViewStyle">@style/Widget.DeviceDefault.AbsListView</item>
+        <item name="autoCompleteTextViewStyle">@style/Widget.DeviceDefault.AutoCompleteTextView</item>
+        <item name="checkboxStyle">@style/Widget.DeviceDefault.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@style/Widget.DeviceDefault.CheckedTextView</item>
+        <item name="dropDownListViewStyle">@style/Widget.DeviceDefault.ListView.DropDown</item>
+        <item name="editTextStyle">@style/Widget.DeviceDefault.EditText</item>
+        <item name="expandableListViewStyle">@style/Widget.DeviceDefault.ExpandableListView</item>
+        <item name="expandableListViewWhiteStyle">@style/Widget.DeviceDefault.ExpandableListView.White</item>
+        <item name="galleryStyle">@style/Widget.DeviceDefault.Gallery</item>
+        <item name="gestureOverlayViewStyle">@style/Widget.DeviceDefault.GestureOverlayView</item>
+        <item name="gridViewStyle">@style/Widget.DeviceDefault.GridView</item>
+        <item name="imageButtonStyle">@style/Widget.DeviceDefault.ImageButton</item>
+        <item name="imageWellStyle">@style/Widget.DeviceDefault.ImageWell</item>
+        <item name="listViewStyle">@style/Widget.DeviceDefault.ListView</item>
+        <item name="listViewWhiteStyle">@style/Widget.DeviceDefault.ListView.White</item>
+        <item name="popupWindowStyle">@style/Widget.DeviceDefault.PopupWindow</item>
+        <item name="progressBarStyle">@style/Widget.DeviceDefault.ProgressBar</item>
+        <item name="progressBarStyleHorizontal">@style/Widget.DeviceDefault.ProgressBar.Horizontal</item>
+        <item name="progressBarStyleSmall">@style/Widget.DeviceDefault.ProgressBar.Small</item>
+        <item name="progressBarStyleSmallTitle">@style/Widget.DeviceDefault.ProgressBar.Small.Title</item>
+        <item name="progressBarStyleLarge">@style/Widget.DeviceDefault.ProgressBar.Large</item>
+        <item name="progressBarStyleInverse">@style/Widget.DeviceDefault.ProgressBar.Inverse</item>
+        <item name="progressBarStyleSmallInverse">@style/Widget.DeviceDefault.ProgressBar.Small.Inverse</item>
+        <item name="progressBarStyleLargeInverse">@style/Widget.DeviceDefault.ProgressBar.Large.Inverse</item>
+        <item name="seekBarStyle">@style/Widget.DeviceDefault.SeekBar</item>
+        <item name="ratingBarStyle">@style/Widget.DeviceDefault.RatingBar</item>
+        <item name="ratingBarStyleIndicator">@style/Widget.DeviceDefault.RatingBar.Indicator</item>
+        <item name="ratingBarStyleSmall">@style/Widget.DeviceDefault.RatingBar.Small</item>
+        <item name="radioButtonStyle">@style/Widget.DeviceDefault.CompoundButton.RadioButton</item>
+        <item name="scrollViewStyle">@style/Widget.DeviceDefault.ScrollView</item>
+        <item name="horizontalScrollViewStyle">@style/Widget.DeviceDefault.HorizontalScrollView</item>
+        <item name="dropDownSpinnerStyle">@style/Widget.DeviceDefault.Spinner.DropDown</item>
+        <item name="starStyle">@style/Widget.DeviceDefault.CompoundButton.Star</item>
+        <item name="tabWidgetStyle">@style/Widget.DeviceDefault.TabWidget</item>
+        <item name="textViewStyle">@style/Widget.DeviceDefault.TextView</item>
+        <item name="webTextViewStyle">@style/Widget.DeviceDefault.WebTextView</item>
+        <item name="webViewStyle">@style/Widget.DeviceDefault.WebView</item>
+        <item name="dropDownItemStyle">@style/Widget.DeviceDefault.DropDownItem</item>
+        <item name="spinnerDropDownItemStyle">@style/Widget.DeviceDefault.DropDownItem.Spinner</item>
+        <item name="spinnerItemStyle">@style/Widget.DeviceDefault.TextView.SpinnerItem</item>
+        <item name="dropDownHintAppearance">@style/TextAppearance.DeviceDefault.Widget.DropDownHint</item>
+        <item name="keyboardViewStyle">@style/Widget.DeviceDefault.KeyboardView</item>
+        <item name="quickContactBadgeStyleWindowSmall">@style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item>
+        <item name="quickContactBadgeStyleWindowMedium">@style/Widget.DeviceDefault.QuickContactBadge.WindowMedium</item>
+        <item name="quickContactBadgeStyleWindowLarge">@style/Widget.DeviceDefault.QuickContactBadge.WindowLarge</item>
+        <item name="quickContactBadgeStyleSmallWindowSmall">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowSmall</item>
+        <item name="quickContactBadgeStyleSmallWindowMedium">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowMedium</item>
+        <item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowLarge</item>
+        <item name="listPopupWindowStyle">@style/Widget.DeviceDefault.ListPopupWindow</item>
+        <item name="popupMenuStyle">@style/Widget.DeviceDefault.PopupMenu</item>
+        <item name="stackViewStyle">@style/Widget.DeviceDefault.StackView</item>
 
         <!-- Preference styles -->
-        <item name="preferenceScreenStyle">@android:style/Preference.DeviceDefault.PreferenceScreen</item>
-        <item name="preferenceCategoryStyle">@android:style/Preference.DeviceDefault.Category</item>
-        <item name="preferenceStyle">@android:style/Preference.DeviceDefault</item>
-        <item name="preferenceInformationStyle">@android:style/Preference.DeviceDefault.Information</item>
-        <item name="checkBoxPreferenceStyle">@android:style/Preference.DeviceDefault.CheckBoxPreference</item>
-        <item name="switchPreferenceStyle">@android:style/Preference.DeviceDefault.SwitchPreference</item>
-        <item name="yesNoPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item>
-        <item name="dialogPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference</item>
-        <item name="editTextPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item>
-        <item name="ringtonePreferenceStyle">@android:style/Preference.DeviceDefault.RingtonePreference</item>
+        <item name="preferenceScreenStyle">@style/Preference.DeviceDefault.PreferenceScreen</item>
+        <item name="preferenceCategoryStyle">@style/Preference.DeviceDefault.Category</item>
+        <item name="preferenceStyle">@style/Preference.DeviceDefault</item>
+        <item name="preferenceInformationStyle">@style/Preference.DeviceDefault.Information</item>
+        <item name="checkBoxPreferenceStyle">@style/Preference.DeviceDefault.CheckBoxPreference</item>
+        <item name="switchPreferenceStyle">@style/Preference.DeviceDefault.SwitchPreference</item>
+        <item name="yesNoPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item>
+        <item name="dialogPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference</item>
+        <item name="editTextPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item>
+        <item name="ringtonePreferenceStyle">@style/Preference.DeviceDefault.RingtonePreference</item>
 
         <!-- Action bar styles -->
-        <item name="actionDropDownStyle">@android:style/Widget.DeviceDefault.Spinner.DropDown.ActionBar</item>
-        <item name="actionButtonStyle">@android:style/Widget.DeviceDefault.ActionButton</item>
-        <item name="actionOverflowButtonStyle">@android:style/Widget.DeviceDefault.ActionButton.Overflow</item>
+        <item name="actionDropDownStyle">@style/Widget.DeviceDefault.Spinner.DropDown.ActionBar</item>
+        <item name="actionButtonStyle">@style/Widget.DeviceDefault.ActionButton</item>
+        <item name="actionOverflowButtonStyle">@style/Widget.DeviceDefault.ActionButton.Overflow</item>
         <item name="actionBarTabStyle">@style/Widget.DeviceDefault.ActionBar.TabView</item>
         <item name="actionBarTabBarStyle">@style/Widget.DeviceDefault.ActionBar.TabBar</item>
         <item name="actionBarTabTextStyle">@style/Widget.DeviceDefault.ActionBar.TabText</item>
         <item name="actionModeStyle">@style/Widget.DeviceDefault.ActionMode</item>
         <item name="actionModeCloseButtonStyle">@style/Widget.DeviceDefault.ActionButton.CloseMode</item>
-        <item name="actionBarStyle">@android:style/Widget.DeviceDefault.ActionBar</item>
-        <item name="actionModePopupWindowStyle">@android:style/Widget.DeviceDefault.PopupWindow.ActionMode</item>
+        <item name="actionBarStyle">@style/Widget.DeviceDefault.ActionBar</item>
+        <item name="actionModePopupWindowStyle">@style/Widget.DeviceDefault.PopupWindow.ActionMode</item>
 
-        <item name="buttonBarStyle">@android:style/DeviceDefault.ButtonBar</item>
-        <item name="segmentedButtonStyle">@android:style/DeviceDefault.SegmentedButton</item>
+        <item name="buttonBarStyle">@style/DeviceDefault.ButtonBar</item>
+        <item name="segmentedButtonStyle">@style/DeviceDefault.SegmentedButton</item>
 
         <item name="searchDialogTheme">@style/Theme.DeviceDefault.SearchBar</item>
 
         <!-- PreferenceFrameLayout attributes -->
-        <item name="preferenceFrameLayoutStyle">@android:style/Widget.DeviceDefault.PreferenceFrameLayout</item>
+        <item name="preferenceFrameLayoutStyle">@style/Widget.DeviceDefault.PreferenceFrameLayout</item>
 
         <!-- NumberPicker style-->
         <item name="numberPickerStyle">@style/Widget.DeviceDefault.NumberPicker</item>
@@ -201,165 +201,240 @@
         <item name="timePickerHeaderAmPmLabelTextAppearance">@style/TextAppearance.DeviceDefault.TimePicker.AmPmLabel</item>
 
         <!-- TimePicker dialog theme -->
-        <item name="timePickerDialogTheme">@android:style/Theme.DeviceDefault.Dialog.TimePicker</item>
+        <item name="timePickerDialogTheme">@style/Theme.DeviceDefault.Dialog.TimePicker</item>
 
         <!-- DatePicker style -->
         <item name="datePickerStyle">@style/Widget.DeviceDefault.DatePicker</item>
 
-        <item name="mediaRouteButtonStyle">@android:style/Widget.DeviceDefault.MediaRouteButton</item>
+        <item name="mediaRouteButtonStyle">@style/Widget.DeviceDefault.MediaRouteButton</item>
     </style>
 
     <!-- Variant of {@link #Theme_DeviceDefault} with no action bar -->
-    <style name="Theme.DeviceDefault.NoActionBar" parent="Theme.Quantum.NoActionBar" >
-    </style>
+    <style name="Theme.DeviceDefault.NoActionBar" parent="Theme.Quantum.NoActionBar"  />
 
     <!-- Variant of {@link #Theme_DeviceDefault} with no action bar and no status bar.  This theme
          sets {@link android.R.attr#windowFullscreen} to true.  -->
-    <style name="Theme.DeviceDefault.NoActionBar.Fullscreen" parent="Theme.Quantum.NoActionBar.Fullscreen" >
-    </style>
+    <style name="Theme.DeviceDefault.NoActionBar.Fullscreen" parent="Theme.Quantum.NoActionBar.Fullscreen"  />
 
     <!-- Variant of {@link #Theme_DeviceDefault} with no action bar and no status bar and
     extending in to overscan region.  This theme
     sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan}
     to true. -->
-    <style name="Theme.DeviceDefault.NoActionBar.Overscan" parent="Theme.Quantum.NoActionBar.Overscan" >
-    </style>
+    <style name="Theme.DeviceDefault.NoActionBar.Overscan" parent="Theme.Quantum.NoActionBar.Overscan"  />
 
     <!-- Variant of {@link #Theme_DeviceDefault} that has no title bar and translucent
          system decor.  This theme sets {@link android.R.attr#windowTranslucentStatus} and
          {@link android.R.attr#windowTranslucentNavigation} to true. -->
-    <style name="Theme.DeviceDefault.NoActionBar.TranslucentDecor" parent="Theme.Quantum.NoActionBar.TranslucentDecor" >
+    <style name="Theme.DeviceDefault.NoActionBar.TranslucentDecor" parent="Theme.Quantum.NoActionBar.TranslucentDecor"  />
+
+    <!-- DeviceDefault theme for dialog windows and activities. This changes the window to be
+    floating (not fill the entire screen), and puts a frame around its contents. You can set this
+    theme on an activity if you would like to make an activity that looks like a Dialog. -->
+    <style name="Theme.DeviceDefault.Dialog" parent="Theme.Quantum.Dialog" >
+        <item name="windowTitleStyle">@style/DialogWindowTitle.DeviceDefault</item>
+        <item name="windowAnimationStyle">@style/Animation.DeviceDefault.Dialog</item>
+
+        <item name="buttonBarStyle">@style/DeviceDefault.ButtonBar.AlertDialog</item>
+        <item name="borderlessButtonStyle">@style/Widget.DeviceDefault.Button.Borderless.Small</item>
+
+        <item name="textAppearance">@style/TextAppearance.DeviceDefault</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.DeviceDefault.Inverse</item>
     </style>
 
+    <!-- Variant of {@link #Theme_DeviceDefault_Dialog} that has a nice minimum width for a
+    regular dialog. -->
+    <style name="Theme.DeviceDefault.Dialog.MinWidth" parent="Theme.Quantum.Dialog.MinWidth" />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Dialog} without an action bar -->
+    <style name="Theme.DeviceDefault.Dialog.NoActionBar" parent="Theme.Quantum.Dialog.NoActionBar" />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Dialog_NoActionBar} that has a nice minimum width
+    for a regular dialog. -->
+    <style name="Theme.DeviceDefault.Dialog.NoActionBar.MinWidth" parent="Theme.Quantum.Dialog.NoActionBar.MinWidth" />
+
+    <!-- Variant of Theme.DeviceDefault.Dialog that has a fixed size. -->
+    <style name="Theme.DeviceDefault.Dialog.FixedSize">
+        <item name="windowFixedWidthMajor">@dimen/dialog_fixed_width_major</item>
+        <item name="windowFixedWidthMinor">@dimen/dialog_fixed_width_minor</item>
+        <item name="windowFixedHeightMajor">@dimen/dialog_fixed_height_major</item>
+        <item name="windowFixedHeightMinor">@dimen/dialog_fixed_height_minor</item>
+    </style>
+
+    <!-- Variant of Theme.DeviceDefault.Dialog.NoActionBar that has a fixed size. -->
+    <style name="Theme.DeviceDefault.Dialog.NoActionBar.FixedSize">
+        <item name="windowFixedWidthMajor">@dimen/dialog_fixed_width_major</item>
+        <item name="windowFixedWidthMinor">@dimen/dialog_fixed_width_minor</item>
+        <item name="windowFixedHeightMajor">@dimen/dialog_fixed_height_major</item>
+        <item name="windowFixedHeightMinor">@dimen/dialog_fixed_height_minor</item>
+    </style>
+
+    <!-- DeviceDefault theme for a window that will be displayed either full-screen on smaller
+    screens (small, normal) or as a dialog on larger screens (large, xlarge). -->
+    <style name="Theme.DeviceDefault.DialogWhenLarge" parent="Theme.Quantum.DialogWhenLarge"  />
+
+    <!-- DeviceDefault theme for a window without an action bar that will be displayed either
+    full-screen on smaller screens (small, normal) or as a dialog on larger screens (large,
+    xlarge). -->
+    <style name="Theme.DeviceDefault.DialogWhenLarge.NoActionBar" parent="Theme.Quantum.DialogWhenLarge.NoActionBar"  />
+
+    <!-- DeviceDefault theme for a presentation window on a secondary display. -->
+    <style name="Theme.DeviceDefault.Dialog.Presentation" parent="Theme.Quantum.Dialog.Presentation" />
+
+    <style name="Theme.DeviceDefault.Dialog.TimePicker" parent="Theme.Quantum.Dialog.TimePicker"/>
+
+    <!-- DeviceDefault theme for panel windows. This removes all extraneous window
+    decorations, so you basically have an empty rectangle in which to place your content. It makes
+    the window floating, with a transparent background, and turns off dimming behind the window. -->
+    <style name="Theme.DeviceDefault.Panel" parent="Theme.Quantum.Panel"  />
+
+    <!-- DeviceDefault theme for windows that want to have the user's selected wallpaper appear
+    behind them. -->
+    <style name="Theme.DeviceDefault.Wallpaper" parent="Theme.Quantum.Wallpaper"  />
+
+    <!-- DeviceDefault theme for windows that want to have the user's selected wallpaper appear
+    behind them and without an action bar. -->
+    <style name="Theme.DeviceDefault.Wallpaper.NoTitleBar" parent="Theme.Quantum.Wallpaper.NoTitleBar"  />
+
+    <!-- DeviceDefault style for input methods, which is used by the
+         {@link android.inputmethodservice.InputMethodService} class.-->
+    <style name="Theme.DeviceDefault.InputMethod" parent="Theme.Quantum.InputMethod"  />
+
+    <style name="Theme.DeviceDefault.Dialog.Alert" parent="Theme.Quantum.Dialog.Alert">
+        <item name="windowTitleStyle">@style/DialogWindowTitle.DeviceDefault</item>
+    </style>
+
+    <style name="Theme.DeviceDefault.SearchBar" parent="Theme.Quantum.SearchBar" />
+    <style name="Theme.DeviceDefault.Dialog.NoFrame" parent="Theme.Quantum.Dialog.NoFrame" />
+
     <!-- Variant of {@link #Theme_DeviceDefault} with a light-colored style -->
     <style name="Theme.DeviceDefault.Light" parent="Theme.Quantum.Light" >
         <!-- Text styles -->
-        <item name="textAppearance">@android:style/TextAppearance.DeviceDefault.Light</item>
-        <item name="textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Light.Inverse</item>
+        <item name="textAppearance">@style/TextAppearance.DeviceDefault</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.DeviceDefault.Inverse</item>
 
-        <item name="textAppearanceLarge">@android:style/TextAppearance.DeviceDefault.Light.Large</item>
-        <item name="textAppearanceMedium">@android:style/TextAppearance.DeviceDefault.Light.Medium</item>
-        <item name="textAppearanceSmall">@android:style/TextAppearance.DeviceDefault.Light.Small</item>
-        <item name="textAppearanceLargeInverse">@android:style/TextAppearance.DeviceDefault.Light.Large.Inverse</item>
-        <item name="textAppearanceMediumInverse">@android:style/TextAppearance.DeviceDefault.Light.Medium.Inverse</item>
-        <item name="textAppearanceSmallInverse">@android:style/TextAppearance.DeviceDefault.Light.Small.Inverse</item>
-        <item name="textAppearanceSearchResultTitle">@android:style/TextAppearance.DeviceDefault.Light.SearchResult.Title</item>
-        <item name="textAppearanceSearchResultSubtitle">@android:style/TextAppearance.DeviceDefault.Light.SearchResult.Subtitle</item>
+        <item name="textAppearanceLarge">@style/TextAppearance.DeviceDefault.Large</item>
+        <item name="textAppearanceMedium">@style/TextAppearance.DeviceDefault.Medium</item>
+        <item name="textAppearanceSmall">@style/TextAppearance.DeviceDefault.Small</item>
+        <item name="textAppearanceLargeInverse">@style/TextAppearance.DeviceDefault.Large.Inverse</item>
+        <item name="textAppearanceMediumInverse">@style/TextAppearance.DeviceDefault.Medium.Inverse</item>
+        <item name="textAppearanceSmallInverse">@style/TextAppearance.DeviceDefault.Small.Inverse</item>
+        <item name="textAppearanceSearchResultTitle">@style/TextAppearance.DeviceDefault.SearchResult.Title</item>
+        <item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.DeviceDefault.SearchResult.Subtitle</item>
 
-        <item name="textAppearanceButton">@android:style/TextAppearance.DeviceDefault.Light.Widget.Button</item>
+        <item name="textAppearanceButton">@style/TextAppearance.DeviceDefault.Widget.Button</item>
 
-        <item name="textAppearanceLargePopupMenu">@android:style/TextAppearance.DeviceDefault.Light.Widget.PopupMenu.Large</item>
-        <item name="textAppearanceSmallPopupMenu">@android:style/TextAppearance.DeviceDefault.Light.Widget.PopupMenu.Small</item>
+        <item name="textAppearanceLargePopupMenu">@style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large</item>
+        <item name="textAppearanceSmallPopupMenu">@style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small</item>
 
         <!-- Button styles -->
-        <item name="buttonStyle">@android:style/Widget.DeviceDefault.Light.Button</item>
+        <item name="buttonStyle">@style/Widget.DeviceDefault.Light.Button</item>
 
-        <item name="buttonStyleSmall">@android:style/Widget.DeviceDefault.Light.Button.Small</item>
-        <item name="buttonStyleInset">@android:style/Widget.DeviceDefault.Light.Button.Inset</item>
+        <item name="buttonStyleSmall">@style/Widget.DeviceDefault.Light.Button.Small</item>
+        <item name="buttonStyleInset">@style/Widget.DeviceDefault.Light.Button.Inset</item>
 
-        <item name="buttonStyleToggle">@android:style/Widget.DeviceDefault.Light.Button.Toggle</item>
+        <item name="buttonStyleToggle">@style/Widget.DeviceDefault.Light.Button.Toggle</item>
 
-        <item name="borderlessButtonStyle">@android:style/Widget.DeviceDefault.Light.Button.Borderless</item>
+        <item name="borderlessButtonStyle">@style/Widget.DeviceDefault.Light.Button.Borderless</item>
 
-        <item name="listSeparatorTextViewStyle">@android:style/Widget.DeviceDefault.Light.TextView.ListSeparator</item>
+        <item name="listSeparatorTextViewStyle">@style/Widget.DeviceDefault.Light.TextView.ListSeparator</item>
 
-        <item name="windowTitleStyle">@android:style/WindowTitle.DeviceDefault</item>
-        <item name="windowTitleBackgroundStyle">@android:style/WindowTitleBackground.DeviceDefault</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.DeviceDefault.Activity</item>
+        <item name="windowTitleStyle">@style/WindowTitle.DeviceDefault</item>
+        <item name="windowTitleBackgroundStyle">@style/WindowTitleBackground.DeviceDefault</item>
+        <item name="windowAnimationStyle">@style/Animation.DeviceDefault.Activity</item>
 
         <!-- Dialog attributes -->
-        <item name="dialogTheme">@android:style/Theme.DeviceDefault.Light.Dialog</item>
+        <item name="dialogTheme">@style/Theme.DeviceDefault.Light.Dialog</item>
 
         <!-- AlertDialog attributes -->
-        <item name="alertDialogTheme">@android:style/Theme.DeviceDefault.Light.Dialog.Alert</item>
-        <item name="alertDialogStyle">@android:style/AlertDialog.DeviceDefault.Light</item>
+        <item name="alertDialogTheme">@style/Theme.DeviceDefault.Light.Dialog.Alert</item>
+        <item name="alertDialogStyle">@style/AlertDialog.DeviceDefault.Light</item>
 
         <!-- Presentation attributes -->
-        <item name="presentationTheme">@android:style/Theme.DeviceDefault.Light.Dialog.Presentation</item>
+        <item name="presentationTheme">@style/Theme.DeviceDefault.Light.Dialog.Presentation</item>
 
         <!-- Text selection handle attributes -->
-        <item name="textSelectHandleWindowStyle">@android:style/Widget.DeviceDefault.TextSelectHandle</item>
-        <item name="textSuggestionsWindowStyle">@android:style/Widget.DeviceDefault.Light.TextSuggestionsPopupWindow</item>
+        <item name="textSelectHandleWindowStyle">@style/Widget.DeviceDefault.TextSelectHandle</item>
+        <item name="textSuggestionsWindowStyle">@style/Widget.DeviceDefault.Light.TextSuggestionsPopupWindow</item>
 
         <!-- Widget styles -->
-        <item name="absListViewStyle">@android:style/Widget.DeviceDefault.Light.AbsListView</item>
-        <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.Light.AutoCompleteTextView</item>
-        <item name="checkboxStyle">@android:style/Widget.DeviceDefault.Light.CompoundButton.CheckBox</item>
-        <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.Light.CheckedTextView</item>
-        <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.Light.ListView.DropDown</item>
-        <item name="editTextStyle">@android:style/Widget.DeviceDefault.Light.EditText</item>
-        <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView</item>
-        <item name="expandableListViewWhiteStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView.White</item>
-        <item name="galleryStyle">@android:style/Widget.DeviceDefault.Light.Gallery</item>
-        <item name="gestureOverlayViewStyle">@android:style/Widget.DeviceDefault.Light.GestureOverlayView</item>
-        <item name="gridViewStyle">@android:style/Widget.DeviceDefault.Light.GridView</item>
-        <item name="imageButtonStyle">@android:style/Widget.DeviceDefault.Light.ImageButton</item>
-        <item name="imageWellStyle">@android:style/Widget.DeviceDefault.Light.ImageWell</item>
-        <item name="listViewStyle">@android:style/Widget.DeviceDefault.Light.ListView</item>
-        <item name="listViewWhiteStyle">@android:style/Widget.DeviceDefault.Light.ListView.White</item>
-        <item name="popupWindowStyle">@android:style/Widget.DeviceDefault.Light.PopupWindow</item>
-        <item name="progressBarStyle">@android:style/Widget.DeviceDefault.Light.ProgressBar</item>
-        <item name="progressBarStyleHorizontal">@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal</item>
-        <item name="progressBarStyleSmall">@android:style/Widget.DeviceDefault.Light.ProgressBar.Small</item>
-        <item name="progressBarStyleSmallTitle">@android:style/Widget.DeviceDefault.Light.ProgressBar.Small.Title</item>
-        <item name="progressBarStyleLarge">@android:style/Widget.DeviceDefault.Light.ProgressBar.Large</item>
-        <item name="progressBarStyleInverse">@android:style/Widget.DeviceDefault.Light.ProgressBar.Inverse</item>
-        <item name="progressBarStyleSmallInverse">@android:style/Widget.DeviceDefault.Light.ProgressBar.Small.Inverse</item>
-        <item name="progressBarStyleLargeInverse">@android:style/Widget.DeviceDefault.Light.ProgressBar.Large.Inverse</item>
-        <item name="seekBarStyle">@android:style/Widget.DeviceDefault.Light.SeekBar</item>
-        <item name="ratingBarStyle">@android:style/Widget.DeviceDefault.Light.RatingBar</item>
-        <item name="ratingBarStyleIndicator">@android:style/Widget.DeviceDefault.Light.RatingBar.Indicator</item>
-        <item name="ratingBarStyleSmall">@android:style/Widget.DeviceDefault.Light.RatingBar.Small</item>
-        <item name="radioButtonStyle">@android:style/Widget.DeviceDefault.Light.CompoundButton.RadioButton</item>
-        <item name="scrollViewStyle">@android:style/Widget.DeviceDefault.Light.ScrollView</item>
-        <item name="horizontalScrollViewStyle">@android:style/Widget.DeviceDefault.Light.HorizontalScrollView</item>
-        <item name="dropDownSpinnerStyle">@android:style/Widget.DeviceDefault.Light.Spinner.DropDown</item>
-        <item name="starStyle">@android:style/Widget.DeviceDefault.Light.CompoundButton.Star</item>
-        <item name="tabWidgetStyle">@android:style/Widget.DeviceDefault.Light.TabWidget</item>
-        <item name="textViewStyle">@android:style/Widget.DeviceDefault.Light.TextView</item>
-        <item name="webTextViewStyle">@android:style/Widget.DeviceDefault.Light.WebTextView</item>
-        <item name="webViewStyle">@android:style/Widget.DeviceDefault.Light.WebView</item>
-        <item name="dropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem</item>
-        <item name="spinnerDropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem.Spinner</item>
-        <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.Light.TextView.SpinnerItem</item>
-        <item name="dropDownHintAppearance">@android:style/TextAppearance.DeviceDefault.Widget.DropDownHint</item>
-        <item name="keyboardViewStyle">@android:style/Widget.DeviceDefault.KeyboardView</item>
-        <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item>
-        <item name="quickContactBadgeStyleWindowMedium">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowMedium</item>
-        <item name="quickContactBadgeStyleWindowLarge">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowLarge</item>
-        <item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowSmall</item>
-        <item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowMedium</item>
-        <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowLarge</item>
-        <item name="listPopupWindowStyle">@android:style/Widget.DeviceDefault.Light.ListPopupWindow</item>
-        <item name="popupMenuStyle">@android:style/Widget.DeviceDefault.Light.PopupMenu</item>
-        <item name="stackViewStyle">@android:style/Widget.DeviceDefault.StackView</item>
+        <item name="absListViewStyle">@style/Widget.DeviceDefault.Light.AbsListView</item>
+        <item name="autoCompleteTextViewStyle">@style/Widget.DeviceDefault.Light.AutoCompleteTextView</item>
+        <item name="checkboxStyle">@style/Widget.DeviceDefault.Light.CompoundButton.CheckBox</item>
+        <item name="checkedTextViewStyle">@style/Widget.DeviceDefault.Light.CheckedTextView</item>
+        <item name="dropDownListViewStyle">@style/Widget.DeviceDefault.Light.ListView.DropDown</item>
+        <item name="editTextStyle">@style/Widget.DeviceDefault.Light.EditText</item>
+        <item name="expandableListViewStyle">@style/Widget.DeviceDefault.Light.ExpandableListView</item>
+        <item name="expandableListViewWhiteStyle">@style/Widget.DeviceDefault.Light.ExpandableListView.White</item>
+        <item name="galleryStyle">@style/Widget.DeviceDefault.Light.Gallery</item>
+        <item name="gestureOverlayViewStyle">@style/Widget.DeviceDefault.Light.GestureOverlayView</item>
+        <item name="gridViewStyle">@style/Widget.DeviceDefault.Light.GridView</item>
+        <item name="imageButtonStyle">@style/Widget.DeviceDefault.Light.ImageButton</item>
+        <item name="imageWellStyle">@style/Widget.DeviceDefault.Light.ImageWell</item>
+        <item name="listViewStyle">@style/Widget.DeviceDefault.Light.ListView</item>
+        <item name="listViewWhiteStyle">@style/Widget.DeviceDefault.Light.ListView.White</item>
+        <item name="popupWindowStyle">@style/Widget.DeviceDefault.Light.PopupWindow</item>
+        <item name="progressBarStyle">@style/Widget.DeviceDefault.Light.ProgressBar</item>
+        <item name="progressBarStyleHorizontal">@style/Widget.DeviceDefault.Light.ProgressBar.Horizontal</item>
+        <item name="progressBarStyleSmall">@style/Widget.DeviceDefault.Light.ProgressBar.Small</item>
+        <item name="progressBarStyleSmallTitle">@style/Widget.DeviceDefault.Light.ProgressBar.Small.Title</item>
+        <item name="progressBarStyleLarge">@style/Widget.DeviceDefault.Light.ProgressBar.Large</item>
+        <item name="progressBarStyleInverse">@style/Widget.DeviceDefault.Light.ProgressBar.Inverse</item>
+        <item name="progressBarStyleSmallInverse">@style/Widget.DeviceDefault.Light.ProgressBar.Small.Inverse</item>
+        <item name="progressBarStyleLargeInverse">@style/Widget.DeviceDefault.Light.ProgressBar.Large.Inverse</item>
+        <item name="seekBarStyle">@style/Widget.DeviceDefault.Light.SeekBar</item>
+        <item name="ratingBarStyle">@style/Widget.DeviceDefault.Light.RatingBar</item>
+        <item name="ratingBarStyleIndicator">@style/Widget.DeviceDefault.Light.RatingBar.Indicator</item>
+        <item name="ratingBarStyleSmall">@style/Widget.DeviceDefault.Light.RatingBar.Small</item>
+        <item name="radioButtonStyle">@style/Widget.DeviceDefault.Light.CompoundButton.RadioButton</item>
+        <item name="scrollViewStyle">@style/Widget.DeviceDefault.Light.ScrollView</item>
+        <item name="horizontalScrollViewStyle">@style/Widget.DeviceDefault.Light.HorizontalScrollView</item>
+        <item name="dropDownSpinnerStyle">@style/Widget.DeviceDefault.Light.Spinner.DropDown</item>
+        <item name="starStyle">@style/Widget.DeviceDefault.Light.CompoundButton.Star</item>
+        <item name="tabWidgetStyle">@style/Widget.DeviceDefault.Light.TabWidget</item>
+        <item name="textViewStyle">@style/Widget.DeviceDefault.Light.TextView</item>
+        <item name="webTextViewStyle">@style/Widget.DeviceDefault.Light.WebTextView</item>
+        <item name="webViewStyle">@style/Widget.DeviceDefault.Light.WebView</item>
+        <item name="dropDownItemStyle">@style/Widget.DeviceDefault.Light.DropDownItem</item>
+        <item name="spinnerDropDownItemStyle">@style/Widget.DeviceDefault.Light.DropDownItem.Spinner</item>
+        <item name="spinnerItemStyle">@style/Widget.DeviceDefault.Light.TextView.SpinnerItem</item>
+        <item name="dropDownHintAppearance">@style/TextAppearance.DeviceDefault.Widget.DropDownHint</item>
+        <item name="keyboardViewStyle">@style/Widget.DeviceDefault.KeyboardView</item>
+        <item name="quickContactBadgeStyleWindowSmall">@style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item>
+        <item name="quickContactBadgeStyleWindowMedium">@style/Widget.DeviceDefault.QuickContactBadge.WindowMedium</item>
+        <item name="quickContactBadgeStyleWindowLarge">@style/Widget.DeviceDefault.QuickContactBadge.WindowLarge</item>
+        <item name="quickContactBadgeStyleSmallWindowSmall">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowSmall</item>
+        <item name="quickContactBadgeStyleSmallWindowMedium">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowMedium</item>
+        <item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.DeviceDefault.QuickContactBadgeSmall.WindowLarge</item>
+        <item name="listPopupWindowStyle">@style/Widget.DeviceDefault.Light.ListPopupWindow</item>
+        <item name="popupMenuStyle">@style/Widget.DeviceDefault.Light.PopupMenu</item>
+        <item name="stackViewStyle">@style/Widget.DeviceDefault.Light.StackView</item>
 
         <!-- Preference styles -->
-        <item name="preferenceScreenStyle">@android:style/Preference.DeviceDefault.PreferenceScreen</item>
-        <item name="preferenceCategoryStyle">@android:style/Preference.DeviceDefault.Category</item>
-        <item name="preferenceStyle">@android:style/Preference.DeviceDefault</item>
-        <item name="preferenceInformationStyle">@android:style/Preference.DeviceDefault.Information</item>
-        <item name="checkBoxPreferenceStyle">@android:style/Preference.DeviceDefault.CheckBoxPreference</item>
-        <item name="switchPreferenceStyle">@android:style/Preference.DeviceDefault.SwitchPreference</item>
-        <item name="yesNoPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item>
-        <item name="dialogPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference</item>
-        <item name="editTextPreferenceStyle">@android:style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item>
-        <item name="ringtonePreferenceStyle">@android:style/Preference.DeviceDefault.RingtonePreference</item>
+        <item name="preferenceScreenStyle">@style/Preference.DeviceDefault.PreferenceScreen</item>
+        <item name="preferenceCategoryStyle">@style/Preference.DeviceDefault.Category</item>
+        <item name="preferenceStyle">@style/Preference.DeviceDefault</item>
+        <item name="preferenceInformationStyle">@style/Preference.DeviceDefault.Information</item>
+        <item name="checkBoxPreferenceStyle">@style/Preference.DeviceDefault.CheckBoxPreference</item>
+        <item name="switchPreferenceStyle">@style/Preference.DeviceDefault.SwitchPreference</item>
+        <item name="yesNoPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item>
+        <item name="dialogPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference</item>
+        <item name="editTextPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item>
+        <item name="ringtonePreferenceStyle">@style/Preference.DeviceDefault.RingtonePreference</item>
 
         <!-- Action bar styles -->
-        <item name="actionDropDownStyle">@android:style/Widget.DeviceDefault.Light.Spinner.DropDown.ActionBar</item>
-        <item name="actionButtonStyle">@android:style/Widget.DeviceDefault.Light.ActionButton</item>
-        <item name="actionOverflowButtonStyle">@android:style/Widget.DeviceDefault.Light.ActionButton.Overflow</item>
+        <item name="actionDropDownStyle">@style/Widget.DeviceDefault.Light.Spinner.DropDown.ActionBar</item>
+        <item name="actionButtonStyle">@style/Widget.DeviceDefault.Light.ActionButton</item>
+        <item name="actionOverflowButtonStyle">@style/Widget.DeviceDefault.Light.ActionButton.Overflow</item>
         <item name="actionBarTabStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabView</item>
         <item name="actionBarTabBarStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabBar</item>
         <item name="actionBarTabTextStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabText</item>
         <item name="actionModeStyle">@style/Widget.DeviceDefault.Light.ActionMode</item>
         <item name="actionModeCloseButtonStyle">@style/Widget.DeviceDefault.Light.ActionButton.CloseMode</item>
-        <item name="actionBarStyle">@android:style/Widget.DeviceDefault.Light.ActionBar</item>
-        <item name="actionModePopupWindowStyle">@android:style/Widget.DeviceDefault.Light.PopupWindow.ActionMode</item>
+        <item name="actionBarStyle">@style/Widget.DeviceDefault.Light.ActionBar</item>
+        <item name="actionModePopupWindowStyle">@style/Widget.DeviceDefault.Light.PopupWindow.ActionMode</item>
 
-        <item name="buttonBarStyle">@android:style/DeviceDefault.Light.ButtonBar</item>
-        <item name="segmentedButtonStyle">@android:style/DeviceDefault.Light.SegmentedButton</item>
+        <item name="buttonBarStyle">@style/DeviceDefault.Light.ButtonBar</item>
+        <item name="segmentedButtonStyle">@style/DeviceDefault.Light.SegmentedButton</item>
 
         <item name="searchDialogTheme">@style/Theme.DeviceDefault.Light.SearchBar</item>
 
@@ -373,216 +448,117 @@
         <item name="timePickerStyle">@style/Widget.DeviceDefault.Light.TimePicker</item>
 
         <!-- TimePicker Header time label text appearance -->
-        <item name="timePickerHeaderTimeLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.TimePicker.TimeLabel</item>
+        <item name="timePickerHeaderTimeLabelTextAppearance">@style/TextAppearance.DeviceDefault.TimePicker.TimeLabel</item>
 
         <!-- TimePicker Header am pm label text appearance -->
-        <item name="timePickerHeaderAmPmLabelTextAppearance">@style/TextAppearance.DeviceDefault.Light.TimePicker.AmPmLabel</item>
+        <item name="timePickerHeaderAmPmLabelTextAppearance">@style/TextAppearance.DeviceDefault.TimePicker.AmPmLabel</item>
 
         <!-- TimePicker dialog theme -->
-        <item name="timePickerDialogTheme">@android:style/Theme.DeviceDefault.Light.Dialog.TimePicker</item>
+        <item name="timePickerDialogTheme">@style/Theme.DeviceDefault.Light.Dialog.TimePicker</item>
 
         <!-- DatePicker style -->
         <item name="datePickerStyle">@style/Widget.DeviceDefault.Light.DatePicker</item>
 
-        <item name="mediaRouteButtonStyle">@android:style/Widget.DeviceDefault.Light.MediaRouteButton</item>
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar -->
-    <style name="Theme.DeviceDefault.Light.NoActionBar" parent="Theme.Quantum.Light.NoActionBar" >
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar and no status bar.
-         This theme sets {@link android.R.attr#windowFullscreen} to true.  -->
-    <style name="Theme.DeviceDefault.Light.NoActionBar.Fullscreen" parent="Theme.Quantum.Light.NoActionBar.Fullscreen" >
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar and no status bar
-    and extending in to overscan region.  This theme
-    sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan}
-    to true. -->
-    <style name="Theme.DeviceDefault.Light.NoActionBar.Overscan"
-           parent="Theme.Quantum.Light.NoActionBar.Overscan" >
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light} that has no title bar and translucent
-         system decor.  This theme sets {@link android.R.attr#windowTranslucentStatus} and
-         {@link android.R.attr#windowTranslucentNavigation} to true. -->
-    <style name="Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor"
-           parent="Theme.Quantum.Light.NoActionBar.TranslucentDecor" >
-    </style>
-    <!-- DeviceDefault theme for dialog windows and activities. This changes the window to be
-    floating (not fill the entire screen), and puts a frame around its contents. You can set this
-    theme on an activity if you would like to make an activity that looks like a Dialog. -->
-    <style name="Theme.DeviceDefault.Dialog" parent="Theme.Quantum.Dialog" >
-        <item name="android:windowTitleStyle">@android:style/DialogWindowTitle.DeviceDefault</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.DeviceDefault.Dialog</item>
-
-        <item name="android:buttonBarStyle">@android:style/DeviceDefault.ButtonBar.AlertDialog</item>
-        <item name="borderlessButtonStyle">@android:style/Widget.DeviceDefault.Button.Borderless.Small</item>
-
-        <item name="textAppearance">@android:style/TextAppearance.DeviceDefault</item>
-        <item name="textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Inverse</item>
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Dialog} that has a nice minimum width for a
-    regular dialog. -->
-    <style name="Theme.DeviceDefault.Dialog.MinWidth" parent="Theme.Quantum.Dialog.MinWidth" >
-
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Dialog} without an action bar -->
-    <style name="Theme.DeviceDefault.Dialog.NoActionBar" parent="Theme.Quantum.Dialog.NoActionBar" >
-
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Dialog_NoActionBar} that has a nice minimum width
-    for a regular dialog. -->
-    <style name="Theme.DeviceDefault.Dialog.NoActionBar.MinWidth" parent="Theme.Quantum.Dialog.NoActionBar.MinWidth" >
-
+        <item name="mediaRouteButtonStyle">@style/Widget.DeviceDefault.Light.MediaRouteButton</item>
     </style>
 
-    <!-- Variant of Theme.DeviceDefault.Dialog that has a fixed size. -->
-    <style name="Theme.DeviceDefault.Dialog.FixedSize">
-        <item name="windowFixedWidthMajor">@android:dimen/dialog_fixed_width_major</item>
-        <item name="windowFixedWidthMinor">@android:dimen/dialog_fixed_width_minor</item>
-        <item name="windowFixedHeightMajor">@android:dimen/dialog_fixed_height_major</item>
-        <item name="windowFixedHeightMinor">@android:dimen/dialog_fixed_height_minor</item>
-    </style>
-
-    <!-- Variant of Theme.DeviceDefault.Dialog.NoActionBar that has a fixed size. -->
-    <style name="Theme.DeviceDefault.Dialog.NoActionBar.FixedSize">
-        <item name="windowFixedWidthMajor">@android:dimen/dialog_fixed_width_major</item>
-        <item name="windowFixedWidthMinor">@android:dimen/dialog_fixed_width_minor</item>
-        <item name="windowFixedHeightMajor">@android:dimen/dialog_fixed_height_major</item>
-        <item name="windowFixedHeightMinor">@android:dimen/dialog_fixed_height_minor</item>
-    </style>
-
-    <!-- DeviceDefault light theme for dialog windows and activities. This changes the window to be
-    floating (not fill the entire screen), and puts a frame around its contents. You can set this
-    theme on an activity if you would like to make an activity that looks like a Dialog.-->
-    <style name="Theme.DeviceDefault.Light.Dialog" parent="Theme.Quantum.Light.Dialog" >
-        <item name="android:windowTitleStyle">@android:style/DialogWindowTitle.DeviceDefault.Light</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.DeviceDefault.Dialog</item>
-
-        <item name="android:buttonBarStyle">@android:style/DeviceDefault.Light.ButtonBar.AlertDialog</item>
-        <item name="borderlessButtonStyle">@android:style/Widget.DeviceDefault.Light.Button.Borderless.Small</item>
-
-        <item name="textAppearance">@android:style/TextAppearance.DeviceDefault.Light</item>
-        <item name="textAppearanceInverse">@android:style/TextAppearance.DeviceDefault.Light.Inverse</item>
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog} that has a nice minimum width for a
-    regular dialog. -->
-    <style name="Theme.DeviceDefault.Light.Dialog.MinWidth" parent="Theme.Quantum.Light.Dialog.MinWidth" >
-
-    </style>
-     <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog} without an action bar -->
-    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar" parent="Theme.Quantum.Light.Dialog.NoActionBar" >
-
-    </style>
-    <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog_NoActionBar} that has a nice minimum
-    width for a regular dialog. -->
-    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar.MinWidth" parent="Theme.Quantum.Light.Dialog.NoActionBar.MinWidth" >
-
-    </style>
-
-    <!-- Variant of Theme.DeviceDefault.Dialog that has a fixed size. -->
-    <style name="Theme.DeviceDefault.Light.Dialog.FixedSize">
-        <item name="windowFixedWidthMajor">@android:dimen/dialog_fixed_width_major</item>
-        <item name="windowFixedWidthMinor">@android:dimen/dialog_fixed_width_minor</item>
-        <item name="windowFixedHeightMajor">@android:dimen/dialog_fixed_height_major</item>
-        <item name="windowFixedHeightMinor">@android:dimen/dialog_fixed_height_minor</item>
-    </style>
-
-    <!-- Variant of Theme.DeviceDefault.Dialog.NoActionBar that has a fixed size. -->
-    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar.FixedSize">
-        <item name="windowFixedWidthMajor">@android:dimen/dialog_fixed_width_major</item>
-        <item name="windowFixedWidthMinor">@android:dimen/dialog_fixed_width_minor</item>
-        <item name="windowFixedHeightMajor">@android:dimen/dialog_fixed_height_major</item>
-        <item name="windowFixedHeightMinor">@android:dimen/dialog_fixed_height_minor</item>
-    </style>
-
-    <!-- DeviceDefault theme for a window that will be displayed either full-screen on smaller
-    screens (small, normal) or as a dialog on larger screens (large, xlarge). -->
-    <style name="Theme.DeviceDefault.DialogWhenLarge" parent="Theme.Quantum.DialogWhenLarge" >
-
-    </style>
-    <!-- DeviceDefault theme for a window without an action bar that will be displayed either
-    full-screen on smaller screens (small, normal) or as a dialog on larger screens (large,
-    xlarge). -->
-    <style name="Theme.DeviceDefault.DialogWhenLarge.NoActionBar" parent="Theme.Quantum.DialogWhenLarge.NoActionBar" >
-
-    </style>
-    <!-- DeviceDefault light theme for a window that will be displayed either full-screen on smaller
-    screens (small, normal) or as a dialog on larger screens (large, xlarge). -->
-    <style name="Theme.DeviceDefault.Light.DialogWhenLarge" parent="Theme.Quantum.Light.DialogWhenLarge" >
-
-    </style>
-    <!-- DeviceDefault light theme for a window without an action bar that will be displayed either
-    full-screen on smaller screens (small, normal) or as a dialog on larger screens (large,
-    xlarge). -->
-    <style name="Theme.DeviceDefault.Light.DialogWhenLarge.NoActionBar" parent="Theme.Quantum.Light.DialogWhenLarge.NoActionBar" >
-
-    </style>
-
-    <!-- DeviceDefault theme for a presentation window on a secondary display. -->
-    <style name="Theme.DeviceDefault.Dialog.Presentation" parent="Theme.Quantum.Dialog.Presentation">
-    </style>
-
-    <!-- DeviceDefault light theme for a presentation window on a secondary display. -->
-    <style name="Theme.DeviceDefault.Light.Dialog.Presentation" parent="Theme.Quantum.Light.Dialog.Presentation">
-    </style>
-
-    <!-- DeviceDefault theme for panel windows. This removes all extraneous window
-    decorations, so you basically have an empty rectangle in which to place your content. It makes
-    the window floating, with a transparent background, and turns off dimming behind the window. -->
-    <style name="Theme.DeviceDefault.Panel" parent="Theme.Quantum.Panel" >
-
-    </style>
-    <!-- DeviceDefault light theme for panel windows. This removes all extraneous window
-    decorations, so you basically have an empty rectangle in which to place your content. It makes
-    the window floating, with a transparent background, and turns off dimming behind the window. -->
-    <style name="Theme.DeviceDefault.Light.Panel" parent="Theme.Quantum.Light.Panel" >
-
-    </style>
-    <!-- DeviceDefault theme for windows that want to have the user's selected wallpaper appear
-    behind them. -->
-    <style name="Theme.DeviceDefault.Wallpaper" parent="Theme.Quantum.Wallpaper" >
-
-    </style>
-    <!-- DeviceDefault theme for windows that want to have the user's selected wallpaper appear
-    behind them and without an action bar. -->
-    <style name="Theme.DeviceDefault.Wallpaper.NoTitleBar" parent="Theme.Quantum.Wallpaper.NoTitleBar" >
-
-    </style>
-    <!-- DeviceDefault style for input methods, which is used by the
-         {@link android.inputmethodservice.InputMethodService} class.-->
-    <style name="Theme.DeviceDefault.InputMethod" parent="Theme.Quantum.InputMethod" >
-
-    </style>
     <!-- Variant of the DeviceDefault (light) theme that has a solid (opaque) action bar with an
     inverse color profile. -->
     <style name="Theme.DeviceDefault.Light.DarkActionBar" parent="Theme.Quantum.Light.DarkActionBar" >
-        <item name="android:actionBarStyle">@android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse</item>
-
-        <item name="actionDropDownStyle">@android:style/Widget.DeviceDefault.Spinner.DropDown.ActionBar</item>
-        <item name="actionButtonStyle">@android:style/Widget.DeviceDefault.ActionButton</item>
-        <item name="actionOverflowButtonStyle">@android:style/Widget.DeviceDefault.ActionButton.Overflow</item>
+        <item name="actionBarStyle">@style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse</item>
+        <item name="actionDropDownStyle">@style/Widget.DeviceDefault.Spinner.DropDown.ActionBar</item>
+        <item name="actionButtonStyle">@style/Widget.DeviceDefault.ActionButton</item>
+        <item name="actionOverflowButtonStyle">@style/Widget.DeviceDefault.ActionButton.Overflow</item>
         <item name="actionBarTabStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabView.Inverse</item>
         <item name="actionBarTabBarStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabBar.Inverse</item>
         <item name="actionBarTabTextStyle">@style/Widget.DeviceDefault.Light.ActionBar.TabText.Inverse</item>
         <item name="actionModeStyle">@style/Widget.DeviceDefault.Light.ActionMode.Inverse</item>
         <item name="actionModeCloseButtonStyle">@style/Widget.DeviceDefault.ActionButton.CloseMode</item>
-        <item name="actionModePopupWindowStyle">@android:style/Widget.DeviceDefault.PopupWindow.ActionMode</item>
-
+        <item name="actionModePopupWindowStyle">@style/Widget.DeviceDefault.PopupWindow.ActionMode</item>
     </style>
 
-    <style name="Theme.DeviceDefault.Dialog.Alert" parent="Theme.Quantum.Dialog.Alert">
-        <item name="windowTitleStyle">@android:style/DialogWindowTitle.DeviceDefault</item>
+    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar -->
+    <style name="Theme.DeviceDefault.Light.NoActionBar" parent="Theme.Quantum.Light.NoActionBar"  />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar and no status bar.
+         This theme sets {@link android.R.attr#windowFullscreen} to true.  -->
+    <style name="Theme.DeviceDefault.Light.NoActionBar.Fullscreen" parent="Theme.Quantum.Light.NoActionBar.Fullscreen"  />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Light} with no action bar and no status bar
+    and extending in to overscan region.  This theme
+    sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan}
+    to true. -->
+    <style name="Theme.DeviceDefault.Light.NoActionBar.Overscan" parent="Theme.Quantum.Light.NoActionBar.Overscan" />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Light} that has no title bar and translucent
+         system decor.  This theme sets {@link android.R.attr#windowTranslucentStatus} and
+         {@link android.R.attr#windowTranslucentNavigation} to true. -->
+    <style name="Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor" parent="Theme.Quantum.Light.NoActionBar.TranslucentDecor" />
+
+    <!-- DeviceDefault light theme for dialog windows and activities. This changes the window to be
+    floating (not fill the entire screen), and puts a frame around its contents. You can set this
+    theme on an activity if you would like to make an activity that looks like a Dialog.-->
+    <style name="Theme.DeviceDefault.Light.Dialog" parent="Theme.Quantum.Light.Dialog" >
+        <item name="windowTitleStyle">@style/DialogWindowTitle.DeviceDefault.Light</item>
+        <item name="windowAnimationStyle">@style/Animation.DeviceDefault.Dialog</item>
+
+        <item name="buttonBarStyle">@style/DeviceDefault.Light.ButtonBar.AlertDialog</item>
+        <item name="borderlessButtonStyle">@style/Widget.DeviceDefault.Light.Button.Borderless.Small</item>
+
+        <item name="textAppearance">@style/TextAppearance.DeviceDefault</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.DeviceDefault.Inverse</item>
     </style>
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog} that has a nice minimum width for a
+    regular dialog. -->
+    <style name="Theme.DeviceDefault.Light.Dialog.MinWidth" parent="Theme.Quantum.Light.Dialog.MinWidth" />
+
+     <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog} without an action bar -->
+    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar" parent="Theme.Quantum.Light.Dialog.NoActionBar" />
+
+    <!-- Variant of {@link #Theme_DeviceDefault_Light_Dialog_NoActionBar} that has a nice minimum
+    width for a regular dialog. -->
+    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar.MinWidth" parent="Theme.Quantum.Light.Dialog.NoActionBar.MinWidth" />
+
+    <!-- Variant of Theme.DeviceDefault.Dialog that has a fixed size. -->
+    <style name="Theme.DeviceDefault.Light.Dialog.FixedSize">
+        <item name="windowFixedWidthMajor">@dimen/dialog_fixed_width_major</item>
+        <item name="windowFixedWidthMinor">@dimen/dialog_fixed_width_minor</item>
+        <item name="windowFixedHeightMajor">@dimen/dialog_fixed_height_major</item>
+        <item name="windowFixedHeightMinor">@dimen/dialog_fixed_height_minor</item>
+    </style>
+
+    <!-- Variant of Theme.DeviceDefault.Dialog.NoActionBar that has a fixed size. -->
+    <style name="Theme.DeviceDefault.Light.Dialog.NoActionBar.FixedSize">
+        <item name="windowFixedWidthMajor">@dimen/dialog_fixed_width_major</item>
+        <item name="windowFixedWidthMinor">@dimen/dialog_fixed_width_minor</item>
+        <item name="windowFixedHeightMajor">@dimen/dialog_fixed_height_major</item>
+        <item name="windowFixedHeightMinor">@dimen/dialog_fixed_height_minor</item>
+    </style>
+
+    <!-- DeviceDefault light theme for a window that will be displayed either full-screen on smaller
+    screens (small, normal) or as a dialog on larger screens (large, xlarge). -->
+    <style name="Theme.DeviceDefault.Light.DialogWhenLarge" parent="Theme.Quantum.Light.DialogWhenLarge"  />
+
+    <!-- DeviceDefault light theme for a window without an action bar that will be displayed either
+    full-screen on smaller screens (small, normal) or as a dialog on larger screens (large,
+    xlarge). -->
+    <style name="Theme.DeviceDefault.Light.DialogWhenLarge.NoActionBar" parent="Theme.Quantum.Light.DialogWhenLarge.NoActionBar"  />
+
+    <!-- DeviceDefault light theme for a presentation window on a secondary display. -->
+    <style name="Theme.DeviceDefault.Light.Dialog.Presentation" parent="Theme.Quantum.Light.Dialog.Presentation" />
+
+    <style name="Theme.DeviceDefault.Light.Dialog.TimePicker" parent="Theme.Quantum.Light.Dialog.TimePicker"/>
+
+    <!-- DeviceDefault light theme for panel windows. This removes all extraneous window
+    decorations, so you basically have an empty rectangle in which to place your content. It makes
+    the window floating, with a transparent background, and turns off dimming behind the window. -->
+    <style name="Theme.DeviceDefault.Light.Panel" parent="Theme.Quantum.Light.Panel"  />
+
     <style name="Theme.DeviceDefault.Light.Dialog.Alert" parent="Theme.Quantum.Light.Dialog.Alert">
-        <item name="windowTitleStyle">@android:style/DialogWindowTitle.DeviceDefault.Light</item>
-    </style>
-    <style name="Theme.DeviceDefault.SearchBar" parent="Theme.Quantum.SearchBar">
-
-    </style>
-    <style name="Theme.DeviceDefault.Light.SearchBar" parent="Theme.Quantum.Light.SearchBar">
-
+        <item name="windowTitleStyle">@style/DialogWindowTitle.DeviceDefault.Light</item>
     </style>
 
-    <style name="Theme.DeviceDefault.Dialog.NoFrame" parent="Theme.Quantum.Dialog.NoFrame">
-    </style>
+    <style name="Theme.DeviceDefault.Light.SearchBar" parent="Theme.Quantum.Light.SearchBar" />
 
 </resources>
diff --git a/core/res/res/values/themes_micro.xml b/core/res/res/values/themes_micro.xml
index f51b8df..39df700 100644
--- a/core/res/res/values/themes_micro.xml
+++ b/core/res/res/values/themes_micro.xml
@@ -15,20 +15,51 @@
 -->
 <resources>
     <style name="Theme.Micro" parent="Theme.Holo.NoActionBar">
-        <item name="textViewStyle">@android:style/Widget.Micro.TextView</item>
-        <item name="numberPickerStyle">@android:style/Widget.Micro.NumberPicker</item>
-        <item name="windowAnimationStyle">@android:style/Animation.SwipeDismiss</item>
+        <item name="alertDialogTheme">@style/Theme.Micro.Dialog.Alert</item>
+        <item name="alertDialogStyle">@style/AlertDialog.Micro</item>
+        <item name="dialogTheme">@style/Theme.Micro.Dialog</item>
+        <item name="textViewStyle">@style/Widget.Micro.TextView</item>
+
+        <item name="numberPickerStyle">@style/Widget.Micro.NumberPicker</item>
+        <item name="windowAnimationStyle">@style/Animation.SwipeDismiss</item>
         <item name="windowIsFloating">false</item>
         <item name="windowIsTranslucent">true</item>
         <item name="windowSwipeToDismiss">true</item>
 	</style>
 
     <style name="Theme.Micro.Light" parent="Theme.Holo.Light.NoActionBar">
-        <item name="textViewStyle">@android:style/Widget.Micro.TextView</item>
-        <item name="numberPickerStyle">@android:style/Widget.Micro.NumberPicker</item>
-        <item name="windowAnimationStyle">@android:style/Animation.SwipeDismiss</item>
+        <item name="alertDialogTheme">@style/Theme.Micro.Dialog.Alert</item>
+        <item name="alertDialogStyle">@style/AlertDialog.Micro</item>
+        <item name="dialogTheme">@style/Theme.Micro.Dialog</item>
+        <item name="textViewStyle">@style/Widget.Micro.TextView</item>
+        <item name="numberPickerStyle">@style/Widget.Micro.NumberPicker</item>
+        <item name="windowAnimationStyle">@style/Animation.SwipeDismiss</item>
         <item name="windowIsFloating">false</item>
         <item name="windowIsTranslucent">true</item>
         <item name="windowSwipeToDismiss">true</item>
     </style>
+
+    <style name="Theme.Micro.Dialog" parent="Theme.Holo.Light.Dialog">
+        <item name="windowTitleStyle">@android:style/DialogWindowTitle.Micro</item>
+        <item name="windowIsFloating">false</item>
+        <item name="windowFullscreen">true</item>
+        <item name="textAppearance">@style/TextAppearance.Micro</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.Micro</item>
+    </style>
+
+    <style name="Theme.Micro.Dialog.Alert" parent="Theme.Holo.Light.Dialog.Alert">
+        <item name="windowTitleStyle">@style/DialogWindowTitle.Micro</item>
+        <item name="alertDialogStyle">@style/AlertDialog.Micro</item>
+        <item name="windowIsFloating">false</item>
+    </style>
+
+    <style name="Theme.Micro.Dialog.AppError" parent="Theme.Micro.Dialog">
+        <item name="windowBackground">@null</item>
+        <item name="alertDialogStyle">@style/AlertDialog.Micro</item>
+        <item name="windowOverscan">true</item>
+        <item name="windowCloseOnTouchOutside">false</item>
+        <item name="textSize">20sp</item>
+        <item name="fontFamily">sans-serif-condensed-light</item>
+        <item name="textColor">@color/micro_text_light</item>
+    </style>
 </resources>
diff --git a/core/res/res/values/themes_quantum.xml b/core/res/res/values/themes_quantum.xml
index 9f76eae..e3ac1ad 100644
--- a/core/res/res/values/themes_quantum.xml
+++ b/core/res/res/values/themes_quantum.xml
@@ -391,8 +391,8 @@
         <item name="backgroundDimAmount">0.6</item>
 
         <!-- Text styles -->
-        <item name="textAppearance">@style/TextAppearance.Quantum.Light</item>
-        <item name="textAppearanceInverse">@style/TextAppearance.Quantum.Light.Inverse</item>
+        <item name="textAppearance">@style/TextAppearance.Quantum</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.Quantum.Inverse</item>
 
         <item name="textColorPrimary">@color/primary_text_quantum_light</item>
         <item name="textColorPrimaryInverse">@color/primary_text_quantum_dark</item>
@@ -411,16 +411,16 @@
         <item name="textColorSearchUrl">@color/search_url_text_quantum_light</item>
         <item name="textColorAlertDialogListItem">@color/primary_text_quantum_light</item>
 
-        <item name="textAppearanceLarge">@style/TextAppearance.Quantum.Light.Large</item>
-        <item name="textAppearanceLargeInverse">@style/TextAppearance.Quantum.Light.Large.Inverse</item>
-        <item name="textAppearanceMedium">@style/TextAppearance.Quantum.Light.Medium</item>
-        <item name="textAppearanceMediumInverse">@style/TextAppearance.Quantum.Light.Medium.Inverse</item>
-        <item name="textAppearanceSmall">@style/TextAppearance.Quantum.Light.Small</item>
-        <item name="textAppearanceSmallInverse">@style/TextAppearance.Quantum.Light.Small.Inverse</item>
-        <item name="textAppearanceSearchResultTitle">@style/TextAppearance.Quantum.Light.SearchResult.Title</item>
-        <item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.Quantum.Light.SearchResult.Subtitle</item>
+        <item name="textAppearanceLarge">@style/TextAppearance.Quantum.Large</item>
+        <item name="textAppearanceLargeInverse">@style/TextAppearance.Quantum.Large.Inverse</item>
+        <item name="textAppearanceMedium">@style/TextAppearance.Quantum.Medium</item>
+        <item name="textAppearanceMediumInverse">@style/TextAppearance.Quantum.Medium.Inverse</item>
+        <item name="textAppearanceSmall">@style/TextAppearance.Quantum.Small</item>
+        <item name="textAppearanceSmallInverse">@style/TextAppearance.Quantum.Small.Inverse</item>
+        <item name="textAppearanceSearchResultTitle">@style/TextAppearance.Quantum.SearchResult.Title</item>
+        <item name="textAppearanceSearchResultSubtitle">@style/TextAppearance.Quantum.SearchResult.Subtitle</item>
 
-        <item name="textAppearanceButton">@style/TextAppearance.Quantum.Light.Widget.Button</item>
+        <item name="textAppearanceButton">@style/TextAppearance.Quantum.Widget.Button</item>
 
         <item name="editTextColor">?attr/textColorPrimary</item>
         <item name="editTextBackground">@drawable/edit_text_quantum</item>
@@ -430,8 +430,8 @@
         <item name="textCheckMark">@drawable/indicator_check_mark_light</item>
         <item name="textCheckMarkInverse">@drawable/indicator_check_mark_dark</item>
 
-        <item name="textAppearanceLargePopupMenu">@style/TextAppearance.Quantum.Light.Widget.PopupMenu.Large</item>
-        <item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Quantum.Light.Widget.PopupMenu.Small</item>
+        <item name="textAppearanceLargePopupMenu">@style/TextAppearance.Quantum.Widget.PopupMenu.Large</item>
+        <item name="textAppearanceSmallPopupMenu">@style/TextAppearance.Quantum.Widget.PopupMenu.Small</item>
 
         <!-- Button styles -->
         <item name="buttonStyle">@style/Widget.Quantum.Light.Button</item>
@@ -606,7 +606,7 @@
         <item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.Quantum.QuickContactBadgeSmall.WindowLarge</item>
         <item name="listPopupWindowStyle">@style/Widget.Quantum.Light.ListPopupWindow</item>
         <item name="popupMenuStyle">@style/Widget.Quantum.Light.PopupMenu</item>
-        <item name="stackViewStyle">@style/Widget.Quantum.StackView</item>
+        <item name="stackViewStyle">@style/Widget.Quantum.Light.StackView</item>
         <item name="activityChooserViewStyle">@style/Widget.Quantum.Light.ActivityChooserView</item>
         <item name="fragmentBreadCrumbsStyle">@style/Widget.Quantum.Light.FragmentBreadCrumbs</item>
 
@@ -690,10 +690,10 @@
         <item name="timePickerHeaderBackgroundColor">?attr/colorBackground</item>
 
         <!-- TimePicker Header time label text appearance -->
-        <item name="timePickerHeaderTimeLabelTextAppearance">@style/TextAppearance.Quantum.Light.TimePicker.TimeLabel</item>
+        <item name="timePickerHeaderTimeLabelTextAppearance">@style/TextAppearance.Quantum.TimePicker.TimeLabel</item>
 
         <!-- TimePicker Header am pm label text appearance -->
-        <item name="timePickerHeaderAmPmLabelTextAppearance">@style/TextAppearance.Quantum.Light.TimePicker.AmPmLabel</item>
+        <item name="timePickerHeaderAmPmLabelTextAppearance">@style/TextAppearance.Quantum.TimePicker.AmPmLabel</item>
 
         <!-- TimePicker dialog theme -->
         <item name="timePickerDialogTheme">@style/Theme.Quantum.Light.Dialog.TimePicker</item>
@@ -1031,8 +1031,8 @@
         <item name="buttonBarStyle">@style/Widget.Quantum.Light.ButtonBar.AlertDialog</item>
         <item name="borderlessButtonStyle">@style/Widget.Quantum.Light.Button.Borderless.Small</item>
 
-        <item name="textAppearance">@style/TextAppearance.Quantum.Light</item>
-        <item name="textAppearanceInverse">@style/TextAppearance.Quantum.Light.Inverse</item>
+        <item name="textAppearance">@style/TextAppearance.Quantum</item>
+        <item name="textAppearanceInverse">@style/TextAppearance.Quantum.Inverse</item>
 
         <item name="listPreferredItemPaddingLeft">16dip</item>
         <item name="listPreferredItemPaddingRight">16dip</item>
diff --git a/core/tests/coretests/src/android/net/RssiCurveTest.java b/core/tests/coretests/src/android/net/RssiCurveTest.java
new file mode 100644
index 0000000..d4438df
--- /dev/null
+++ b/core/tests/coretests/src/android/net/RssiCurveTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.net;
+
+import junit.framework.TestCase;
+
+public class RssiCurveTest extends TestCase {
+    public void testLookupScore_constantCurve() {
+        RssiCurve curve = new RssiCurve(-100, 200, new byte[] { 10 });
+        assertEquals(10, curve.lookupScore(-200));
+        assertEquals(10, curve.lookupScore(-100));
+        assertEquals(10, curve.lookupScore(0));
+        assertEquals(10, curve.lookupScore(100));
+        assertEquals(10, curve.lookupScore(200));
+    }
+
+    public void testLookupScore_changingCurve() {
+        RssiCurve curve = new RssiCurve(-100, 100, new byte[] { -10, 10 });
+        assertEquals(-10, curve.lookupScore(-200));
+        assertEquals(-10, curve.lookupScore(-100));
+        assertEquals(-10, curve.lookupScore(-50));
+        assertEquals(10, curve.lookupScore(0));
+        assertEquals(10, curve.lookupScore(50));
+        assertEquals(10, curve.lookupScore(100));
+        assertEquals(10, curve.lookupScore(200));
+    }
+}
diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd
index 92ecd24..bddb8ec 100644
--- a/docs/html/about/dashboards/index.jd
+++ b/docs/html/about/dashboards/index.jd
@@ -61,7 +61,7 @@
 </div>
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on April 1, 2014.
+<p style="clear:both"><em>Data collected during a 7-day period ending on May 1, 2014.
 <br/>Any versions with less than 0.1% distribution are not shown.</em>
 </p>
 
@@ -92,7 +92,7 @@
 </div>
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on April 1, 2014.
+<p style="clear:both"><em>Data collected during a 7-day period ending on May 1, 2014.
 <br/>Any screen configurations with less than 0.1% distribution are not shown.</em></p>
 
 
@@ -111,7 +111,7 @@
 
 
 <img alt="" style="float:right"
-src="//chart.googleapis.com/chart?chl=GL%201.1%20only%7CGL%202.0%7CGL%203.0&chf=bg%2Cs%2C00000000&chd=t%3A0.1%2C93.5%2C6.4&chco=c4df9b%2C6fad0c&chs=400x250&cht=p" />
+src="//chart.googleapis.com/chart?chs=400x250&cht=p&chd=t%3A0.1%2C87.0%2C12.9&chf=bg%2Cs%2C00000000&chl=GL%201.1%20only%7CGL%202.0%7CGL%203.0&chco=c4df9b%2C6fad0c" />
 
 <p>To declare which version of OpenGL ES your application requires, you should use the {@code
 android:glEsVersion} attribute of the <a
@@ -133,17 +133,17 @@
 </tr>
 <tr>
 <td>2.0</th>
-<td>89.4%</td>
+<td>87.0%</td>
 </tr>
 <tr>
 <td>3.0</th>
-<td>10.5%</td>
+<td>12.9%</td>
 </tr>
 </table>
 
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on April 1, 2014</em></p>
+<p style="clear:both"><em>Data collected during a 7-day period ending on May 1, 2014</em></p>
 
 
 
@@ -161,17 +161,17 @@
 var VERSION_DATA =
 [
   {
-    "chart": "//chart.googleapis.com/chart?cht=p&chs=500x250&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A1.1%2C17.8%2C0.1%2C14.3%2C61.4%2C5.3&chl=Froyo%7CGingerbread%7CHoneycomb%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat",
+    "chart": "//chart.googleapis.com/chart?chs=500x250&cht=p&chd=t%3A1.0%2C16.2%2C0.1%2C13.4%2C60.8%2C8.5&chf=bg%2Cs%2C00000000&chl=Froyo%7CGingerbread%7CHoneycomb%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat&chco=c4df9b%2C6fad0c",
     "data": [
       {
         "api": 8,
         "name": "Froyo",
-        "perc": "1.1"
+        "perc": "1.0"
       },
       {
         "api": 10,
         "name": "Gingerbread",
-        "perc": "17.8"
+        "perc": "16.2"
       },
       {
         "api": 13,
@@ -181,27 +181,27 @@
       {
         "api": 15,
         "name": "Ice Cream Sandwich",
-        "perc": "14.3"
+        "perc": "13.4"
       },
       {
         "api": 16,
         "name": "Jelly Bean",
-        "perc": "34.4"
+        "perc": "33.5"
       },
       {
         "api": 17,
         "name": "Jelly Bean",
-        "perc": "18.1"
+        "perc": "18.8"
       },
       {
         "api": 18,
         "name": "Jelly Bean",
-        "perc": "8.9"
+        "perc": "8.5"
       },
       {
         "api": 19,
         "name": "KitKat",
-        "perc": "5.3"
+        "perc": "8.5"
       }
     ]
   }
@@ -217,19 +217,19 @@
     "data": {
       "Large": {
         "hdpi": "0.6",
-        "ldpi": "0.7",
+        "ldpi": "0.6",
         "mdpi": "4.4",
-        "tvdpi": "1.5",
+        "tvdpi": "1.6",
         "xhdpi": "0.6"
       },
       "Normal": {
-        "hdpi": "33.7",
-        "mdpi": "13.2",
-        "xhdpi": "19.8",
-        "xxhdpi": "12.5"
+        "hdpi": "33.9",
+        "mdpi": "12.5",
+        "xhdpi": "19.9",
+        "xxhdpi": "13.5"
       },
       "Small": {
-        "ldpi": "8.1"
+        "ldpi": "7.5"
       },
       "Xlarge": {
         "hdpi": "0.3",
@@ -238,8 +238,8 @@
         "xhdpi": "0.3"
       }
     },
-    "densitychart": "//chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A8.9%2C21.8%2C1.5%2C34.6%2C20.7%2C12.6&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi",
-    "layoutchart": "//chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A4.9%2C7.8%2C79.3%2C8.1&chl=Xlarge%7CLarge%7CNormal%7CSmall"
+    "densitychart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chd=t%3A8.2%2C21.1%2C1.6%2C34.8%2C20.8%2C13.5&chf=bg%2Cs%2C00000000&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chco=c4df9b%2C6fad0c",
+    "layoutchart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chd=t%3A4.9%2C7.8%2C80.0%2C7.5&chf=bg%2Cs%2C00000000&chl=Xlarge%7CLarge%7CNormal%7CSmall&chco=c4df9b%2C6fad0c"
   }
 ];
 
diff --git a/docs/html/tools/device.jd b/docs/html/tools/device.jd
index ccd5903..e9caa44 100644
--- a/docs/html/tools/device.jd
+++ b/docs/html/tools/device.jd
@@ -192,6 +192,10 @@
     <td><code>12d1</code></td>
   </tr>
   <tr>
+    <td>Intel</td>
+    <td><code>8087</code></td>
+  </tr>
+  <tr>
     <td>K-Touch</td>
     <td><code>24e3</code></td>
   </tr>
diff --git a/graphics/java/android/graphics/drawable/Ripple.java b/graphics/java/android/graphics/drawable/Ripple.java
index 207834a..3446000 100644
--- a/graphics/java/android/graphics/drawable/Ripple.java
+++ b/graphics/java/android/graphics/drawable/Ripple.java
@@ -18,6 +18,7 @@
 
 import android.animation.Animator;
 import android.animation.Animator.AnimatorListener;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.animation.TimeInterpolator;
 import android.graphics.Canvas;
@@ -85,8 +86,9 @@
     /** Configured maximum ripple radius. */
     private final int mMaxInsideRadius;
 
-    private ObjectAnimator mEnter;
-    private ObjectAnimator mExit;
+    private ObjectAnimator mOuter;
+    private ObjectAnimator mInner;
+    private ObjectAnimator mAlpha;
 
     /** Maximum ripple radius. */
     private int mMaxRadius;
@@ -267,28 +269,46 @@
     public void exit() {
         mExitFinished = false;
 
-        final ObjectAnimator exit = ObjectAnimator.ofFloat(this, "innerRadius", 0, mMaxRadius);
-        exit.setAutoCancel(true);
-        exit.setDuration(EXIT_DURATION);
-        exit.setInterpolator(INTERPOLATOR);
-        exit.addListener(mAnimationListener);
+        final ObjectAnimator inner = ObjectAnimator.ofFloat(this, "innerRadius", 0, mMaxRadius);
+        inner.setAutoCancel(true);
+        inner.setDuration(EXIT_DURATION);
+        inner.setInterpolator(INTERPOLATOR);
+        inner.addListener(mAnimationListener);
 
-        if (mEnter != null && mEnter.isStarted()) {
+        if (mOuter != null && mOuter.isStarted()) {
             // If we haven't been running the enter animation for long enough,
             // delay the exit animator.
-            final int elapsed = (int) (mEnter.getAnimatedFraction() * mEnter.getDuration());
+            final int elapsed = (int) (mOuter.getAnimatedFraction() * mOuter.getDuration());
             final int delay = Math.max(0, EXIT_MIN_DELAY - elapsed);
-            exit.setStartDelay(delay);
+            inner.setStartDelay(delay);
         }
 
-        exit.start();
+        inner.start();
 
-        final ObjectAnimator fade = ObjectAnimator.ofFloat(this, "alphaMultiplier", 0);
-        fade.setAutoCancel(true);
-        fade.setDuration(EXIT_DURATION);
-        fade.start();
+        final ObjectAnimator alpha = ObjectAnimator.ofFloat(this, "alphaMultiplier", 0);
+        alpha.setAutoCancel(true);
+        alpha.setDuration(EXIT_DURATION);
+        alpha.start();
 
-        mExit = exit;
+        mInner = inner;
+        mAlpha = alpha;
+    }
+
+    /**
+     * Cancel all animations.
+     */
+    public void cancel() {
+        if (mInner != null) {
+            mInner.end();
+        }
+
+        if (mOuter != null) {
+            mOuter.cancel();
+        }
+
+        if (mAlpha != null) {
+            mAlpha.end();
+        }
     }
 
     private void invalidateSelf() {
@@ -299,47 +319,55 @@
      * Starts the enter animation.
      */
     private void enter() {
-        final ObjectAnimator enter = ObjectAnimator.ofFloat(this, "outerRadius", mMaxRadius);
-        enter.setAutoCancel(true);
-        enter.setDuration(ENTER_DURATION);
-        enter.setInterpolator(INTERPOLATOR);
-        enter.start();
+        final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerRadius", mMaxRadius);
+        outer.setAutoCancel(true);
+        outer.setDuration(ENTER_DURATION);
+        outer.setInterpolator(INTERPOLATOR);
+        outer.start();
 
-        final ObjectAnimator fade = ObjectAnimator.ofFloat(this, "alphaMultiplier", 1);
-        fade.setAutoCancel(true);
-        fade.setDuration(FADE_DURATION);
-        fade.start();
+        final ObjectAnimator alpha = ObjectAnimator.ofFloat(this, "alphaMultiplier", 1);
+        if (mPulseEnabled) {
+            alpha.addListener(new AnimatorListenerAdapter() {
+                @Override
+                public void onAnimationEnd(Animator animation) {
+                    final ObjectAnimator pulse = ObjectAnimator.ofFloat(
+                            this, "alphaMultiplier", 1, PULSE_MIN_ALPHA);
+                    pulse.setAutoCancel(true);
+                    pulse.setDuration(PULSE_DURATION + PULSE_INTERVAL);
+                    pulse.setRepeatCount(ObjectAnimator.INFINITE);
+                    pulse.setRepeatMode(ObjectAnimator.REVERSE);
+                    pulse.setStartDelay(PULSE_DELAY);
+                    pulse.start();
 
-        // TODO: Starting with a delay will still cancel the fade in.
-        if (false && mPulseEnabled) {
-            final ObjectAnimator pulse = ObjectAnimator.ofFloat(
-                    this, "alphaMultiplier", 1, PULSE_MIN_ALPHA);
-            pulse.setAutoCancel(true);
-            pulse.setDuration(PULSE_DURATION + PULSE_INTERVAL);
-            pulse.setRepeatCount(ObjectAnimator.INFINITE);
-            pulse.setRepeatMode(ObjectAnimator.REVERSE);
-            pulse.setStartDelay(PULSE_DELAY);
-            pulse.start();
+                    mAlpha = pulse;
+                }
+            });
         }
+        alpha.setAutoCancel(true);
+        alpha.setDuration(FADE_DURATION);
+        alpha.start();
 
-        mEnter = enter;
+        mOuter = outer;
+        mAlpha = alpha;
     }
 
     /**
      * Starts the outside transition animation.
      */
     private void outside() {
-        final float targetRadius = mMaxOutsideRadius;
-        final ObjectAnimator outside = ObjectAnimator.ofFloat(this, "outerRadius", targetRadius);
-        outside.setAutoCancel(true);
-        outside.setDuration(OUTSIDE_DURATION);
-        outside.setInterpolator(INTERPOLATOR);
-        outside.start();
+        final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerRadius", mMaxOutsideRadius);
+        outer.setAutoCancel(true);
+        outer.setDuration(OUTSIDE_DURATION);
+        outer.setInterpolator(INTERPOLATOR);
+        outer.start();
 
-        final ObjectAnimator fade = ObjectAnimator.ofFloat(this, "alphaMultiplier", 1);
-        fade.setAutoCancel(true);
-        fade.setDuration(FADE_DURATION);
-        fade.start();
+        final ObjectAnimator alpha = ObjectAnimator.ofFloat(this, "alphaMultiplier", 1);
+        alpha.setAutoCancel(true);
+        alpha.setDuration(FADE_DURATION);
+        alpha.start();
+
+        mOuter = outer;
+        mAlpha = alpha;
     }
 
     /**
@@ -358,27 +386,15 @@
         }
     }
 
-    private final AnimatorListener mAnimationListener = new AnimatorListener() {
-        @Override
-        public void onAnimationStart(Animator animation) {
-        }
-
-        @Override
-        public void onAnimationRepeat(Animator animation) {
-        }
-
+    private final AnimatorListener mAnimationListener = new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
-            if (animation == mExit) {
+            if (animation == mInner) {
                 mExitFinished = true;
                 mOuterRadius = 0;
                 mInnerRadius = 0;
                 mAlphaMultiplier = 1;
             }
         }
-
-        @Override
-        public void onAnimationCancel(Animator animation) {
-        }
     };
 }
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
index 9000e5a..0097183 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
@@ -380,11 +380,18 @@
 
     @Override
     public void clearHotspots() {
-        if (mRipples == null) {
-            return;
+        if (mRipples != null) {
+            mRipples.clear();
         }
 
-        mRipples.clear();
+        final int count = mAnimatingRipplesCount;
+        final Ripple[] ripples = mAnimatingRipples;
+        for (int i = 0; i < count; i++) {
+            ripples[i].cancel();
+            ripples[i] = null;
+        }
+
+        mAnimatingRipplesCount = 0;
         invalidateSelf();
     }
 
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 4513ead..0c8a823 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1787,6 +1787,11 @@
 
     /** @see AudioManager#playSoundEffect(int, float) */
     public void playSoundEffectVolume(int effectType, float volume) {
+        if (effectType >= AudioManager.NUM_SOUND_EFFECTS || effectType < 0) {
+            Log.w(TAG, "AudioService effectType value " + effectType + " out of range");
+            return;
+        }
+
         sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_QUEUE,
                 effectType, (int) (volume * 1000), null, 0);
     }
diff --git a/media/java/android/media/MediaHTTPConnection.java b/media/java/android/media/MediaHTTPConnection.java
index eb91668..d3b1520 100644
--- a/media/java/android/media/MediaHTTPConnection.java
+++ b/media/java/android/media/MediaHTTPConnection.java
@@ -28,9 +28,12 @@
 import java.net.URL;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.NoRouteToHostException;
 import java.util.HashMap;
 import java.util.Map;
 
+import static android.media.MediaPlayer.MEDIA_ERROR_UNSUPPORTED;
+
 /** @hide */
 public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
     private static final String TAG = "MediaHTTPConnection";
@@ -43,6 +46,12 @@
     private long mTotalSize = -1;
     private InputStream mInputStream = null;
 
+    private boolean mAllowCrossDomainRedirect = true;
+
+    // from com.squareup.okhttp.internal.http
+    private final static int HTTP_TEMP_REDIRECT = 307;
+    private final static int MAX_REDIRECTS = 20;
+
     public MediaHTTPConnection() {
         if (CookieHandler.getDefault() == null) {
             CookieHandler.setDefault(new CookieManager());
@@ -59,6 +68,7 @@
 
         try {
             disconnect();
+            mAllowCrossDomainRedirect = true;
             mURL = new URL(uri);
             mHeaders = convertHeaderStringToMap(headers);
         } catch (MalformedURLException e) {
@@ -68,6 +78,25 @@
         return native_getIMemory();
     }
 
+    private boolean parseBoolean(String val) {
+        try {
+            return Long.parseLong(val) != 0;
+        } catch (NumberFormatException e) {
+            return "true".equalsIgnoreCase(val) ||
+                "yes".equalsIgnoreCase(val);
+        }
+    }
+
+    /* returns true iff header is internal */
+    private boolean filterOutInternalHeaders(String key, String val) {
+        if ("android-allow-cross-domain-redirect".equalsIgnoreCase(key)) {
+            mAllowCrossDomainRedirect = parseBoolean(val);
+        } else {
+            return false;
+        }
+        return true;
+    }
+
     private Map<String, String> convertHeaderStringToMap(String headers) {
         HashMap<String, String> map = new HashMap<String, String>();
 
@@ -78,7 +107,9 @@
                 String key = pair.substring(0, colonPos);
                 String val = pair.substring(colonPos + 1);
 
-                map.put(key, val);
+                if (!filterOutInternalHeaders(key, val)) {
+                    map.put(key, val);
+                }
             }
         }
 
@@ -107,24 +138,75 @@
         teardownConnection();
 
         try {
-            mConnection = (HttpURLConnection)mURL.openConnection();
+            int response;
+            int redirectCount = 0;
 
-            if (mHeaders != null) {
-                for (Map.Entry<String, String> entry : mHeaders.entrySet()) {
+            URL url = mURL;
+            while (true) {
+                mConnection = (HttpURLConnection)url.openConnection();
+                // handle redirects ourselves if we do not allow cross-domain redirect
+                mConnection.setInstanceFollowRedirects(mAllowCrossDomainRedirect);
+
+                if (mHeaders != null) {
+                    for (Map.Entry<String, String> entry : mHeaders.entrySet()) {
+                        mConnection.setRequestProperty(
+                                entry.getKey(), entry.getValue());
+                    }
+                }
+
+                if (offset > 0) {
                     mConnection.setRequestProperty(
-                            entry.getKey(), entry.getValue());
+                            "Range", "bytes=" + offset + "-");
+                }
+
+                response = mConnection.getResponseCode();
+                if (response != HttpURLConnection.HTTP_MULT_CHOICE &&
+                        response != HttpURLConnection.HTTP_MOVED_PERM &&
+                        response != HttpURLConnection.HTTP_MOVED_TEMP &&
+                        response != HttpURLConnection.HTTP_SEE_OTHER &&
+                        response != HTTP_TEMP_REDIRECT) {
+                    // not a redirect, or redirect handled by HttpURLConnection
+                    break;
+                }
+
+                if (++redirectCount > MAX_REDIRECTS) {
+                    throw new NoRouteToHostException("Too many redirects: " + redirectCount);
+                }
+
+                String method = mConnection.getRequestMethod();
+                if (response == HTTP_TEMP_REDIRECT &&
+                        !method.equals("GET") && !method.equals("HEAD")) {
+                    // "If the 307 status code is received in response to a
+                    // request other than GET or HEAD, the user agent MUST NOT
+                    // automatically redirect the request"
+                    throw new NoRouteToHostException("Invalid redirect");
+                }
+                String location = mConnection.getHeaderField("Location");
+                if (location == null) {
+                    throw new NoRouteToHostException("Invalid redirect");
+                }
+                url = new URL(mURL /* TRICKY: don't use url! */, location);
+                if (!url.getProtocol().equals("https") &&
+                        !url.getProtocol().equals("http")) {
+                    throw new NoRouteToHostException("Unsupported protocol redirect");
+                }
+                boolean sameHost = mURL.getHost().equals(url.getHost());
+                if (!sameHost) {
+                    throw new NoRouteToHostException("Cross-domain redirects are disallowed");
+                }
+
+                if (response != HTTP_TEMP_REDIRECT) {
+                    // update effective URL, unless it is a Temporary Redirect
+                    mURL = url;
                 }
             }
 
-            if (offset > 0) {
-                mConnection.setRequestProperty(
-                        "Range", "bytes=" + offset + "-");
+            if (mAllowCrossDomainRedirect) {
+                // remember the current, potentially redirected URL if redirects
+                // were handled by HttpURLConnection
+                mURL = mConnection.getURL();
             }
 
-            int response = mConnection.getResponseCode();
-            // remember the current, possibly redirected URL
-            mURL = mConnection.getURL();
-
             if (response == HttpURLConnection.HTTP_PARTIAL) {
                 // Partial content, we cannot just use getContentLength
                 // because what we want is not just the length of the range
@@ -207,6 +289,9 @@
             }
 
             return n;
+        } catch (NoRouteToHostException e) {
+            Log.w(TAG, "readAt " + offset + " / " + size + " => " + e);
+            return MEDIA_ERROR_UNSUPPORTED;
         } catch (IOException e) {
             if (VERBOSE) {
                 Log.d(TAG, "readAt " + offset + " / " + size + " => -1");
diff --git a/media/java/android/media/session/PlaybackState.java b/media/java/android/media/session/PlaybackState.java
index 9e58ea8..26eb9c4 100644
--- a/media/java/android/media/session/PlaybackState.java
+++ b/media/java/android/media/session/PlaybackState.java
@@ -178,8 +178,7 @@
     public final static int PLAYSTATE_SKIPPING_FORWARDS = 10;
 
     /**
-     * Set this value on {@link #setPosition(long)} to indicate the position is
-     * not known for this item.
+     * Use this value for the position to indicate the position is not known.
      */
     public final static long PLAYBACK_POSITION_UNKNOWN = -1;
 
diff --git a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
index 0e2b33a..e167817 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_pin_view.xml
@@ -92,7 +92,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key1"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -101,7 +101,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key2"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -110,7 +110,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key3"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -126,7 +126,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key4"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -135,7 +135,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key5"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -144,7 +144,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key6"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -160,7 +160,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key7"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -169,7 +169,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key8"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -178,7 +178,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key9"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -199,7 +199,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key0"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -208,7 +208,7 @@
                />
            <ImageButton
                android:id="@+id/key_enter"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
diff --git a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
index 88049a7..ac798ca 100644
--- a/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_sim_puk_view.xml
@@ -93,7 +93,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key1"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -102,7 +102,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key2"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -111,7 +111,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key3"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -127,7 +127,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key4"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -136,7 +136,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key5"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -145,7 +145,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key6"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -161,7 +161,7 @@
            >
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key7"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -170,7 +170,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key8"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -179,7 +179,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key9"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -200,7 +200,7 @@
                />
            <view class="com.android.keyguard.NumPadKey"
                android:id="@+id/key0"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
@@ -209,7 +209,7 @@
                />
            <ImageButton
                android:id="@+id/key_enter"
-               style="@style/Widget.Button.NumPadKey"
+               style="@style/Widget.Button.NumPadKey.Sim"
                android:layout_width="0px"
                android:layout_height="match_parent"
                android:layout_weight="1"
diff --git a/packages/Keyguard/res/values/styles.xml b/packages/Keyguard/res/values/styles.xml
index b54ac50..5ab00d2 100644
--- a/packages/Keyguard/res/values/styles.xml
+++ b/packages/Keyguard/res/values/styles.xml
@@ -33,6 +33,10 @@
         <item name="android:paddingLeft">20dp</item>
         <item name="android:paddingRight">6dp</item>
     </style>
+    <style name="Widget.Button.NumPadKey.Sim" >
+        <item name="android:paddingTop">3dp</item>
+        <item name="android:paddingBottom">4dp</item>
+    </style>
     <style name="TextAppearance.NumPadKey"
             parent="@android:style/TextAppearance">
         <item name="android:textSize">34dp</item>
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 862931e..7be4cec 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -168,9 +168,9 @@
 
     /**
      * Called when the screen turns off
-     * @param why {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER},
-     *   {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT} or
-     *   {@link WindowManagerPolicy#OFF_BECAUSE_OF_PROX_SENSOR}.
+     * @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_ADMIN},
+     * {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, or
+     * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}.
      */
     public void onScreenTurnedOff(int why) { }
 
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png
new file mode 100644
index 0000000..369c88d
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_ime_switcher_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png
new file mode 100644
index 0000000..7d97eb5
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_ime_switcher_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png
new file mode 100644
index 0000000..900801a
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_ime_switcher_default.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png b/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png
new file mode 100644
index 0000000..6c8222e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_ime_switcher_default.png
Binary files differ
diff --git a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
index aa7256b..5f12706 100644
--- a/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-ldrtl/navigation_bar.xml
@@ -43,7 +43,7 @@
 
             <!-- navigation controls -->
             <View
-                android:layout_width="40dp"
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
                 android:layout_weight="0"
                 android:visibility="invisible"
@@ -88,16 +88,29 @@
                 systemui:glowBackground="@drawable/ic_sysbar_highlight"
                 android:contentDescription="@string/accessibility_recent"
                 />
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_width="@dimen/navigation_menu_key_width"
+            <FrameLayout
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
-                android:src="@drawable/ic_sysbar_menu"
-                systemui:keyCode="82"
-                android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight"
-                />
+                android:layout_weight="0" >
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/menu"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:contentDescription="@string/accessibility_menu"
+                    android:src="@drawable/ic_sysbar_menu"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                    systemui:keyCode="82" />
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+            </FrameLayout>
         </LinearLayout>
 
         <!-- lights out layout to match exactly -->
@@ -187,16 +200,29 @@
             >
             
             <!-- navigation controls -->
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_height="40dp"
-                android:layout_width="match_parent"
-                android:src="@drawable/ic_sysbar_menu_land"
-                systemui:keyCode="82"
-                android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
-                />
+            <FrameLayout
+                android:layout_width="@dimen/navigation_extra_key_width"
+                android:layout_height="match_parent"
+                android:layout_weight="0" >
+                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+                    android:layout_height="@dimen/navigation_extra_key_width"
+                    android:layout_width="match_parent"
+                    android:src="@drawable/ic_sysbar_menu_land"
+                    systemui:keyCode="82"
+                    android:layout_weight="0"
+                    android:visibility="invisible"
+                    android:contentDescription="@string/accessibility_menu"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_height="@dimen/navigation_extra_key_width"
+                    android:layout_width="match_parent"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+            </FrameLayout>
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                 android:layout_height="80dp"
                 android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index b9ad799..6a2e3c6 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -42,7 +42,7 @@
 
             <!-- navigation controls -->
             <View
-                android:layout_width="48dp"
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
                 android:layout_weight="0"
                 android:layout_marginStart="2dp"
@@ -85,17 +85,32 @@
                 android:layout_height="match_parent"
                 android:layout_weight="1"
                 />
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_width="48dp"
+            <FrameLayout
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
-                android:src="@drawable/ic_sysbar_menu"
-                android:layout_marginEnd="2dp"
-                systemui:keyCode="82"
                 android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight"
-                />
+                android:layout_marginEnd="2dp" >
+                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:src="@drawable/ic_sysbar_menu"
+                    android:layout_marginEnd="2dp"
+                    systemui:keyCode="82"
+                    android:visibility="invisible"
+                    android:contentDescription="@string/accessibility_menu"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                    />
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:layout_marginEnd="2dp"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+            </FrameLayout>
         </LinearLayout>
 
         <!-- lights out layout to match exactly -->
@@ -184,7 +199,7 @@
 
             <!-- navigation controls -->
             <View
-                android:layout_width="48dp"
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
                 android:layout_weight="0"
                 android:layout_marginStart="2dp"
@@ -227,17 +242,32 @@
                 android:layout_height="match_parent"
                 android:layout_weight="1"
                 />
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_width="48dp"
+            <FrameLayout
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
                 android:layout_marginEnd="2dp"
-                android:src="@drawable/ic_sysbar_menu"
-                systemui:keyCode="82"
-                android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight"
-                />
+                android:layout_weight="0" >
+                <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:layout_marginEnd="2dp"
+                    android:src="@drawable/ic_sysbar_menu"
+                    systemui:keyCode="82"
+                    android:visibility="invisible"
+                    android:contentDescription="@string/accessibility_menu"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                    />
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:layout_marginEnd="2dp"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    android:scaleType="centerInside"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+            </FrameLayout>
         </LinearLayout>
 
         <!-- lights out layout to match exactly -->
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 2398849..7470409 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -88,16 +88,31 @@
                 systemui:glowBackground="@drawable/ic_sysbar_highlight"
                 android:contentDescription="@string/accessibility_recent"
                 />
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_width="@dimen/navigation_menu_key_width"
+            <FrameLayout
+                android:layout_width="@dimen/navigation_extra_key_width"
                 android:layout_height="match_parent"
-                android:src="@drawable/ic_sysbar_menu"
-                systemui:keyCode="82"
-                android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight"
-                />
+                android:layout_weight="0" >
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/menu"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:contentDescription="@string/accessibility_menu"
+                    android:src="@drawable/ic_sysbar_menu"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                    systemui:keyCode="82" />
+
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_width="@dimen/navigation_extra_key_width"
+                    android:layout_height="match_parent"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+            </FrameLayout>
+
         </LinearLayout>
 
         <!-- lights out layout to match exactly -->
@@ -190,18 +205,33 @@
             android:id="@+id/nav_buttons"
             android:animateLayoutChanges="true"
             >
-            
+
             <!-- navigation controls -->
-            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
-                android:layout_height="40dp"
-                android:layout_width="match_parent"
-                android:src="@drawable/ic_sysbar_menu_land"
-                systemui:keyCode="82"
+            <FrameLayout
                 android:layout_weight="0"
-                android:visibility="invisible"
-                android:contentDescription="@string/accessibility_menu"
-                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
-                />
+                android:layout_width="match_parent"
+                android:layout_height="40dp" >
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/ime_switcher"
+                    android:layout_width="match_parent"
+                    android:layout_height="40dp"
+                    android:contentDescription="@string/accessibility_ime_switch_button"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_ime_switcher_default"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight" />
+
+                <com.android.systemui.statusbar.policy.KeyButtonView
+                    android:id="@+id/menu"
+                    android:layout_width="match_parent"
+                    android:layout_height="40dp"
+                    android:contentDescription="@string/accessibility_menu"
+                    android:src="@drawable/ic_sysbar_menu_land"
+                    android:visibility="invisible"
+                    systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
+                    systemui:keyCode="82" />
+            </FrameLayout>
+
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
                 android:layout_height="80dp"
                 android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 5b5587d..92e3885 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -36,6 +36,9 @@
     <!-- Height of search panel including navigation bar height -->
     <dimen name="navbar_search_panel_height">280dip</dimen>
 
+    <!-- The width of the view containing the menu/ime navigation bar icons -->
+    <dimen name="navigation_extra_key_width">48dip</dimen>
+
     <!-- Size of application thumbnail -->
     <dimen name="status_bar_recents_thumbnail_width">200dp</dimen>
     <dimen name="status_bar_recents_thumbnail_height">177dp</dimen>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 9837d9b..2f2914c 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -128,8 +128,8 @@
     <!-- The width of the view containing non-menu status bar icons -->
     <dimen name="navigation_key_width">80dip</dimen>
 
-    <!-- The width of the view containing the menu status bar icon -->
-    <dimen name="navigation_menu_key_width">40dip</dimen>
+    <!-- The width of the view containing the menu/ime navigation bar icons -->
+    <dimen name="navigation_extra_key_width">40dip</dimen>
 
     <!-- Default distance beyond which snaps to the matching target -->
     <dimen name="navbar_search_snap_margin">40dip</dimen>
@@ -268,4 +268,7 @@
     <dimen name="quick_settings_tmp_scrim_text_size">30dp</dimen>
 
     <dimen name="notifications_top_padding">8dp</dimen>
+    
+    <!-- Minimum distance the user has to drag down to go to the full shade. -->
+    <dimen name="keyguard_drag_down_min_distance">100dp</dimen>
 </resources>
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index 61c268e..4d6d815c 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -29,17 +29,16 @@
 import android.view.ScaleGestureDetector;
 import android.view.ScaleGestureDetector.OnScaleGestureListener;
 import android.view.View;
-import android.view.View.OnClickListener;
 import android.view.ViewConfiguration;
 
-import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.ExpandableNotificationRow;
+import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.policy.ScrollAdapter;
 
-public class ExpandHelper implements Gefingerpoken, OnClickListener {
+public class ExpandHelper implements Gefingerpoken {
     public interface Callback {
-        View getChildAtRawPosition(float x, float y);
-        View getChildAtPosition(float x, float y);
+        ExpandableView getChildAtRawPosition(float x, float y);
+        ExpandableView getChildAtPosition(float x, float y);
         boolean canChildBeExpanded(View v);
         void setUserExpandedChild(View v, boolean userExpanded);
         void setUserLockedChild(View v, boolean userLocked);
@@ -48,9 +47,7 @@
     private static final String TAG = "ExpandHelper";
     protected static final boolean DEBUG = false;
     protected static final boolean DEBUG_SCALE = false;
-    protected static final boolean DEBUG_GLOW = false;
     private static final long EXPAND_DURATION = 250;
-    private static final long GLOW_DURATION = 150;
 
     // Set to false to disable focus-based gestures (spread-finger vertical pull).
     private static final boolean USE_DRAG = true;
@@ -115,7 +112,7 @@
             float focusX = detector.getFocusX();
             float focusY = detector.getFocusY();
 
-            final View underFocus = findView(focusX, focusY);
+            final ExpandableView underFocus = findView(focusX, focusY);
             startExpanding(underFocus, STRETCH);
             return mExpanding;
         }
@@ -172,24 +169,6 @@
         mPopDuration = mContext.getResources().getInteger(R.integer.blinds_pop_duration_ms);
         mPullGestureMinXSpan = mContext.getResources().getDimension(R.dimen.pull_span_min);
 
-        AnimatorListenerAdapter glowVisibilityController = new AnimatorListenerAdapter() {
-            @Override
-            public void onAnimationStart(Animator animation) {
-                View target = (View) ((ObjectAnimator) animation).getTarget();
-                if (target.getAlpha() <= 0.0f) {
-                    target.setVisibility(View.VISIBLE);
-                }
-            }
-
-            @Override
-            public void onAnimationEnd(Animator animation) {
-                View target = (View) ((ObjectAnimator) animation).getTarget();
-                if (target.getAlpha() <= 0.0f) {
-                    target.setVisibility(View.INVISIBLE);
-                }
-            }
-        };
-
         final ViewConfiguration configuration = ViewConfiguration.get(mContext);
         mTouchSlop = configuration.getScaledTouchSlop();
 
@@ -221,8 +200,8 @@
         return out;
     }
 
-    private View findView(float x, float y) {
-        View v = null;
+    private ExpandableView findView(float x, float y) {
+        ExpandableView v;
         if (mEventSource != null) {
             int[] location = new int[2];
             mEventSource.getLocationOnScreen(location);
@@ -271,15 +250,6 @@
         mScrollAdapter = adapter;
     }
 
-    private float calculateGlow(float target, float actual) {
-        // glow if overscale
-        if (DEBUG_GLOW) Log.d(TAG, "target: " + target + " actual: " + actual);
-        float stretch = Math.abs((target - actual) / mMaximumStretch);
-        float strength = 1f / (1f + (float) Math.pow(Math.E, -1 * ((8f * stretch) - 5f)));
-        if (DEBUG_GLOW) Log.d(TAG, "stretch: " + stretch + " strength: " + strength);
-        return (GLOW_BASE + strength * (1f - GLOW_BASE));
-    }
-
     @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         final int action = ev.getAction();
@@ -313,7 +283,7 @@
                 // detect a vertical pulling gesture with fingers somewhat separated
                 if (DEBUG_SCALE) Log.v(TAG, "got pull gesture (xspan=" + xspan + "px)");
 
-                final View underFocus = findView(x, y);
+                final ExpandableView underFocus = findView(x, y);
                 startExpanding(underFocus, PULL);
                 return true;
             }
@@ -328,7 +298,7 @@
                     if (yDiff > mTouchSlop) {
                         if (DEBUG) Log.v(TAG, "got venetian gesture (dy=" + yDiff + "px)");
                         mLastMotionY = y;
-                        final View underFocus = findView(x, y);
+                        final ExpandableView underFocus = findView(x, y);
                         if (startExpanding(underFocus, BLINDS)) {
                             mInitialTouchY = mLastMotionY;
                             mHasPopped = false;
@@ -394,7 +364,7 @@
 
                     final int x = (int) mSGD.getFocusX();
                     final int y = (int) mSGD.getFocusY();
-                    View underFocus = findView(x, y);
+                    ExpandableView underFocus = findView(x, y);
                     if (isFinished && underFocus != null && underFocus != mCurrView) {
                         finishExpanding(false); // @@@ needed?
                         startExpanding(underFocus, BLINDS);
@@ -432,7 +402,7 @@
     /**
      * @return True if the view is expandable, false otherwise.
      */
-    private boolean startExpanding(View v, int expandType) {
+    private boolean startExpanding(ExpandableView v, int expandType) {
         if (!(v instanceof ExpandableNotificationRow)) {
             return false;
         }
@@ -512,13 +482,6 @@
         mCurrView = v;
     }
 
-    @Override
-    public void onClick(View v) {
-        startExpanding(v, STRETCH);
-        finishExpanding(true);
-        clearView();
-    }
-
     /**
      * Use this to abort any pending expansions in progress.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index ffdb620..f812e8c 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -542,9 +542,8 @@
 
     /**
      * Called to let us know the screen was turned off.
-     * @param why either {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_USER},
-     *   {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT} or
-     *   {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_PROX_SENSOR}.
+     * @param why either {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_USER} or
+     *   {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}.
      */
     public void onScreenTurnedOff(int why) {
         synchronized (this) {
@@ -576,8 +575,6 @@
             } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
                    || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) {
                 doKeyguardLaterLocked();
-            } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR) {
-                // Do not enable the keyguard if the prox sensor forced the screen off.
             } else {
                 doKeyguardLocked(null);
             }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index 0f32dc0..1c88ea7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -16,12 +16,18 @@
 
 package com.android.systemui.statusbar;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
 import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewConfiguration;
-import android.widget.FrameLayout;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
 
 import com.android.internal.R;
 
@@ -34,7 +40,6 @@
     private static final long DOUBLETAP_TIMEOUT_MS = 1000;
 
     private boolean mDimmed;
-    private boolean mLocked;
 
     private int mBgResId = R.drawable.notification_quantum_bg;
     private int mDimmedBgResId = R.drawable.notification_quantum_bg_dim;
@@ -51,13 +56,20 @@
 
     private OnActivatedListener mOnActivatedListener;
 
+    protected Drawable mBackgroundNormal;
+    protected Drawable mBackgroundDimmed;
+    private ObjectAnimator mBackgroundAnimator;
+    private Interpolator mFastOutSlowInInterpolator;
+
     public ActivatableNotificationView(Context context, AttributeSet attrs) {
         super(context, attrs);
         mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
         updateBackgroundResource();
+        setWillNotDraw(false);
+        mFastOutSlowInInterpolator =
+                AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
     }
 
-
     private final Runnable mTapTimeoutRunnable = new Runnable() {
         @Override
         public void run() {
@@ -66,20 +78,51 @@
     };
 
     @Override
+    protected void onDraw(Canvas canvas) {
+        draw(canvas, mBackgroundNormal);
+        draw(canvas, mBackgroundDimmed);
+    }
+
+    private void draw(Canvas canvas, Drawable drawable) {
+        if (drawable != null) {
+            drawable.setBounds(0, mClipTopAmount, getWidth(), mActualHeight);
+            drawable.draw(canvas);
+        }
+    }
+
+    @Override
+    protected boolean verifyDrawable(Drawable who) {
+        return super.verifyDrawable(who) || who == mBackgroundNormal
+                || who == mBackgroundDimmed;
+    }
+
+    @Override
+    protected void drawableStateChanged() {
+        drawableStateChanged(mBackgroundNormal);
+        drawableStateChanged(mBackgroundDimmed);
+    }
+
+    private void drawableStateChanged(Drawable d) {
+        if (d != null && d.isStateful()) {
+            d.setState(getDrawableState());
+        }
+    }
+
+    @Override
     public void setOnClickListener(OnClickListener l) {
         super.setOnClickListener(l);
     }
 
     @Override
     public boolean onTouchEvent(MotionEvent event) {
-        if (mLocked) {
-            return handleTouchEventLocked(event);
+        if (mDimmed) {
+            return handleTouchEventDimmed(event);
         } else {
             return super.onTouchEvent(event);
         }
     }
 
-    private boolean handleTouchEventLocked(MotionEvent event) {
+    private boolean handleTouchEventDimmed(MotionEvent event) {
         int action = event.getActionMasked();
         switch (action) {
             case MotionEvent.ACTION_DOWN:
@@ -88,14 +131,6 @@
                 if (mDownY > getActualHeight()) {
                     return false;
                 }
-
-                // Call the listener tentatively directly, even if we don't know whether the user
-                // will stay within the touch slop, as the listener is implemented as a scale
-                // animation, which is cancellable without jarring effects when swiping away
-                // notifications.
-                if (mOnActivatedListener != null) {
-                    mOnActivatedListener.onActivated(this);
-                }
                 break;
             case MotionEvent.ACTION_MOVE:
                 if (!isWithinTouchSlop(event)) {
@@ -109,8 +144,8 @@
                         makeActive(event.getX(), event.getY());
                         postDelayed(mTapTimeoutRunnable, DOUBLETAP_TIMEOUT_MS);
                     } else {
-                        performClick();
                         makeInactive();
+                        performClick();
                     }
                 } else {
                     makeInactive();
@@ -126,8 +161,11 @@
     }
 
     private void makeActive(float x, float y) {
-        mCustomBackground.setHotspot(0, x, y);
+        mBackgroundDimmed.setHotspot(0, x, y);
         mActivated = true;
+        if (mOnActivatedListener != null) {
+            mOnActivatedListener.onActivated(this);
+        }
     }
 
     /**
@@ -136,8 +174,8 @@
     private void makeInactive() {
         if (mActivated) {
             // Make sure that we clear the hotspot from the center.
-            mCustomBackground.setHotspot(0, getWidth() / 2, getActualHeight() / 2);
-            mCustomBackground.removeHotspot(0);
+            mBackgroundDimmed.setHotspot(0, getWidth() / 2, getActualHeight() / 2);
+            mBackgroundDimmed.removeHotspot(0);
             mActivated = false;
         }
         if (mOnActivatedListener != null) {
@@ -153,23 +191,22 @@
 
     /**
      * Sets the notification as dimmed, meaning that it will appear in a more gray variant.
+     *
+     * @param dimmed Whether the notification should be dimmed.
+     * @param fade Whether an animation should be played to change the state.
      */
-    public void setDimmed(boolean dimmed) {
+    public void setDimmed(boolean dimmed, boolean fade) {
         if (mDimmed != dimmed) {
             mDimmed = dimmed;
-            updateBackgroundResource();
+            if (fade) {
+                fadeBackgroundResource();
+            } else {
+                updateBackgroundResource();
+            }
         }
     }
 
     /**
-     * Sets the notification as locked. In the locked state, the first tap will produce a quantum
-     * ripple to make the notification brighter and only the second tap will cause a click.
-     */
-    public void setLocked(boolean locked) {
-        mLocked = locked;
-    }
-
-    /**
      * Sets the resource id for the background of this notification.
      *
      * @param bgResId The background resource to use in normal state.
@@ -181,20 +218,111 @@
         updateBackgroundResource();
     }
 
+    private void fadeBackgroundResource() {
+        if (mDimmed) {
+            setBackgroundDimmed(mDimmedBgResId);
+        } else {
+            setBackgroundNormal(mBgResId);
+        }
+        int startAlpha = mDimmed ? 255 : 0;
+        int endAlpha = mDimmed ? 0 : 255;
+        int duration = NotificationActivator.ANIMATION_LENGTH_MS;
+        // Check whether there is already a background animation running.
+        if (mBackgroundAnimator != null) {
+            startAlpha = (Integer) mBackgroundAnimator.getAnimatedValue();
+            duration = (int) mBackgroundAnimator.getCurrentPlayTime();
+            mBackgroundAnimator.removeAllListeners();
+            mBackgroundAnimator.cancel();
+            if (duration <= 0) {
+                updateBackgroundResource();
+                return;
+            }
+        }
+        mBackgroundNormal.setAlpha(startAlpha);
+        mBackgroundAnimator =
+                ObjectAnimator.ofInt(mBackgroundNormal, "alpha", startAlpha, endAlpha);
+        mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
+        mBackgroundAnimator.setDuration(duration);
+        mBackgroundAnimator.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                if (mDimmed) {
+                    setBackgroundNormal(null);
+                } else {
+                    setBackgroundDimmed(null);
+                }
+                mBackgroundAnimator = null;
+            }
+        });
+        mBackgroundAnimator.start();
+    }
+
     private void updateBackgroundResource() {
-        setCustomBackgroundResource(mDimmed ? mDimmedBgResId : mBgResId);
+        if (mDimmed) {
+            setBackgroundDimmed(mDimmedBgResId);
+            mBackgroundDimmed.setAlpha(255);
+            setBackgroundNormal(null);
+        } else {
+            setBackgroundDimmed(null);
+            setBackgroundNormal(mBgResId);
+            mBackgroundNormal.setAlpha(255);
+        }
+    }
+
+    /**
+     * Sets a background drawable for the normal state. As we need to change our bounds
+     * independently of layout, we need the notion of a background independently of the regular View
+     * background..
+     */
+    private void setBackgroundNormal(Drawable backgroundNormal) {
+        if (mBackgroundNormal != null) {
+            mBackgroundNormal.setCallback(null);
+            unscheduleDrawable(mBackgroundNormal);
+        }
+        mBackgroundNormal = backgroundNormal;
+        if (mBackgroundNormal != null) {
+            mBackgroundNormal.setCallback(this);
+        }
+        invalidate();
+    }
+
+    private void setBackgroundDimmed(Drawable overlay) {
+        if (mBackgroundDimmed != null) {
+            mBackgroundDimmed.setCallback(null);
+            unscheduleDrawable(mBackgroundDimmed);
+        }
+        mBackgroundDimmed = overlay;
+        if (mBackgroundDimmed != null) {
+            mBackgroundDimmed.setCallback(this);
+        }
+        invalidate();
+    }
+
+    private void setBackgroundNormal(int drawableResId) {
+        setBackgroundNormal(getResources().getDrawable(drawableResId));
+    }
+
+    private void setBackgroundDimmed(int drawableResId) {
+        setBackgroundDimmed(getResources().getDrawable(drawableResId));
     }
 
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
-        setPivotX(getWidth()/2);
+        setPivotX(getWidth() / 2);
     }
 
     @Override
     public void setActualHeight(int actualHeight) {
         super.setActualHeight(actualHeight);
-        setPivotY(actualHeight/2);
+        invalidate();
+        setPivotY(actualHeight / 2);
+    }
+
+    @Override
+    public void setClipTopAmount(int clipTopAmount) {
+        super.setClipTopAmount(clipTopAmount);
+        invalidate();
     }
 
     public void setOnActivatedListener(OnActivatedListener onActivatedListener) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 9149e2d..edf54d1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -167,7 +167,12 @@
 
     protected int mZenMode;
 
-    protected boolean mOnKeyguard;
+    /**
+     * The {@link StatusBarState} of the status bar.
+     */
+    protected int mState;
+    protected boolean mBouncerShowing;
+
     protected NotificationOverflowContainer mKeyguardIconOverflowContainer;
 
     public boolean isDeviceProvisioned() {
@@ -1057,9 +1062,10 @@
         mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
         int n = mNotificationData.size();
         int visibleNotifications = 0;
+        boolean onKeyguard = mState == StatusBarState.KEYGUARD;
         for (int i = n-1; i >= 0; i--) {
             NotificationData.Entry entry = mNotificationData.get(i);
-            if (mOnKeyguard) {
+            if (onKeyguard) {
                 entry.row.setExpansionDisabled(true);
             } else {
                 entry.row.setExpansionDisabled(false);
@@ -1068,10 +1074,9 @@
                     entry.row.setSystemExpanded(top);
                 }
             }
-            entry.row.setDimmed(mOnKeyguard);
-            entry.row.setLocked(mOnKeyguard);
+            entry.row.setDimmed(onKeyguard, false /* fade */);
             boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
-            if (mOnKeyguard && (visibleNotifications >= maxKeyguardNotifications
+            if (onKeyguard && (visibleNotifications >= maxKeyguardNotifications
                     || !showOnKeyguard)) {
                 entry.row.setVisibility(View.GONE);
                 if (showOnKeyguard) {
@@ -1087,8 +1092,9 @@
             }
         }
 
-        if (mOnKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
+        if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
             mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE);
+            mKeyguardIconOverflowContainer.setDimmed(true /* dimmed */, false /* fade */);
         } else {
             mKeyguardIconOverflowContainer.setVisibility(View.GONE);
         }
@@ -1283,7 +1289,7 @@
             if (userChangedExpansion) {
                 boolean userExpanded = oldEntry.row.isUserExpanded();
                 newEntry.row.setUserExpanded(userExpanded);
-                newEntry.row.applyExpansionToLayout();
+                newEntry.row.notifyHeightChanged();
             }
         }
 
@@ -1398,6 +1404,17 @@
         // hook for subclasses
     }
 
+    public void setBouncerShowing(boolean bouncerShowing) {
+        mBouncerShowing = bouncerShowing;
+    }
+
+    /**
+     * @return Whether the security bouncer from Keyguard is showing.
+     */
+    public boolean isBouncerShowing() {
+        return mBouncerShowing;
+    }
+
     public void destroy() {
         if (mSearchPanelView != null) {
             mWindowManager.removeViewImmediate(mSearchPanelView);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
new file mode 100644
index 0000000..e471754
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.statusbar;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.content.Context;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+
+import com.android.systemui.ExpandHelper;
+import com.android.systemui.Gefingerpoken;
+import com.android.systemui.R;
+
+/**
+ * A utility class to enable the downward swipe on the lockscreen to go to the full shade and expand
+ * the notification where the drag started.
+ */
+public class DragDownHelper implements Gefingerpoken {
+
+    private static final float RUBBERBAND_FACTOR_EXPANDABLE = 0.5f;
+    private static final float RUBBERBAND_FACTOR_STATIC = 0.15f;
+
+    private static final int SPRING_BACK_ANIMATION_LENGTH_MS = 375;
+
+    private int mMinDragDistance;
+    private ExpandHelper.Callback mCallback;
+    private float mInitialTouchX;
+    private float mInitialTouchY;
+    private boolean mDraggingDown;
+    private float mTouchSlop;
+    private OnDragDownListener mOnDragDownListener;
+    private View mHost;
+    private final int[] mTemp2 = new int[2];
+    private boolean mDraggedFarEnough;
+    private ExpandableView mStartingChild;
+    private Interpolator mInterpolator;
+
+    public DragDownHelper(Context context, View host, ExpandHelper.Callback callback,
+            OnDragDownListener onDragDownListener) {
+        mMinDragDistance = context.getResources().getDimensionPixelSize(
+                R.dimen.keyguard_drag_down_min_distance);
+        mInterpolator =
+                AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
+        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
+        mCallback = callback;
+        mOnDragDownListener = onDragDownListener;
+        mHost = host;
+    }
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent event) {
+        final float x = event.getX();
+        final float y = event.getY();
+
+        switch (event.getActionMasked()) {
+            case MotionEvent.ACTION_DOWN:
+                mDraggedFarEnough = false;
+                mDraggingDown = false;
+                mStartingChild = null;
+                mInitialTouchY = y;
+                mInitialTouchX = x;
+                break;
+
+            case MotionEvent.ACTION_MOVE:
+                final float h = y - mInitialTouchY;
+                if (h > mTouchSlop && h > Math.abs(x - mInitialTouchX)) {
+                    mDraggingDown = true;
+                    captureStartingChild(mInitialTouchX, mInitialTouchY);
+                    mInitialTouchY = y;
+                    mInitialTouchX = x;
+                    return true;
+                }
+                break;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        if (!mDraggingDown) {
+            return false;
+        }
+        final float x = event.getX();
+        final float y = event.getY();
+
+        switch (event.getActionMasked()) {
+            case MotionEvent.ACTION_MOVE:
+                final float h = y - mInitialTouchY;
+                captureStartingChild(mInitialTouchX, mInitialTouchY);
+                if (mStartingChild != null) {
+                    handleExpansion(h, mStartingChild);
+                }
+                if (h > mMinDragDistance) {
+                    if (!mDraggedFarEnough) {
+                        mDraggedFarEnough = true;
+                        mOnDragDownListener.onThresholdReached();
+                    }
+                } else {
+                    if (mDraggedFarEnough) {
+                        mDraggedFarEnough = false;
+                        mOnDragDownListener.onReset();
+                    }
+                }
+                return true;
+            case MotionEvent.ACTION_UP:
+                if (mDraggedFarEnough) {
+                    if (mStartingChild != null) {
+                        mCallback.setUserLockedChild(mStartingChild, false);
+                    }
+                    mOnDragDownListener.onDraggedDown(mStartingChild);
+                    mDraggingDown = false;
+                } else {
+                    stopDragging();
+                    return false;
+                }
+                break;
+            case MotionEvent.ACTION_CANCEL:
+                stopDragging();
+                return false;
+        }
+        return false;
+    }
+
+    private void captureStartingChild(float x, float y) {
+        if (mStartingChild == null) {
+            mStartingChild = findView(x, y);
+            if (mStartingChild != null) {
+                mCallback.setUserLockedChild(mStartingChild, true);
+            }
+        }
+    }
+
+    private void handleExpansion(float heightDelta, ExpandableView child) {
+        if (heightDelta < 0) {
+            heightDelta = 0;
+        }
+        boolean expandable = child.isContentExpandable();
+        float rubberbandFactor = expandable
+                ? RUBBERBAND_FACTOR_EXPANDABLE
+                : RUBBERBAND_FACTOR_STATIC;
+        float rubberband = heightDelta * rubberbandFactor;
+        if (expandable && (rubberband + child.getMinHeight()) > child.getMaxHeight()) {
+            float overshoot = (rubberband + child.getMinHeight()) - child.getMaxHeight();
+            overshoot *= (1 - RUBBERBAND_FACTOR_STATIC);
+            rubberband -= overshoot;
+        }
+        child.setActualHeight((int) (child.getMinHeight() + rubberband));
+    }
+
+    private void cancelExpansion(final ExpandableView child) {
+        if (child.getActualHeight() == child.getMinHeight()) {
+            return;
+        }
+        ObjectAnimator anim = ObjectAnimator.ofInt(child, "actualHeight",
+                child.getActualHeight(), child.getMinHeight());
+        anim.setInterpolator(mInterpolator);
+        anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS);
+        anim.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                mCallback.setUserLockedChild(child, false);
+            }
+        });
+        anim.start();
+    }
+
+    private void stopDragging() {
+        if (mStartingChild != null) {
+            cancelExpansion(mStartingChild);
+        }
+        mDraggingDown = false;
+        mOnDragDownListener.onReset();
+    }
+
+    private ExpandableView findView(float x, float y) {
+        mHost.getLocationOnScreen(mTemp2);
+        x += mTemp2[0];
+        y += mTemp2[1];
+        return mCallback.getChildAtRawPosition(x, y);
+    }
+
+    public interface OnDragDownListener {
+        void onDraggedDown(View startingChild);
+        void onReset();
+        void onThresholdReached();
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 61aad6f..e5512a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -64,7 +64,7 @@
         mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
         mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded);
 
-        mActivator = new NotificationActivator(this);
+        mActivator = new NotificationActivator(this, this);
     }
 
     @Override
@@ -137,7 +137,7 @@
      */
     public void setSystemExpanded(boolean expand) {
         mIsSystemExpanded = expand;
-        applyExpansionToLayout();
+        notifyHeightChanged();
     }
 
     /**
@@ -145,7 +145,7 @@
      */
     public void setExpansionDisabled(boolean expansionDisabled) {
         mExpansionDisabled = expansionDisabled;
-        applyExpansionToLayout();
+        notifyHeightChanged();
     }
 
     /**
@@ -160,13 +160,8 @@
         }
     }
 
-    /**
-     * If {@link #isExpanded()} then this is the greatest possible height this view can
-     * get and otherwise it is {@link #mRowMinHeight}.
-     *
-     * @return the maximum allowed expansion height of this view.
-     */
-    public int getMaximumAllowedExpandHeight() {
+    @Override
+    public int getIntrinsicHeight() {
         if (isUserLocked()) {
             return getActualHeight();
         }
@@ -216,9 +211,10 @@
     /**
      * Sets the notification as dimmed, meaning that it will appear in a more gray variant.
      */
-    public void setDimmed(boolean dimmed) {
-        super.setDimmed(dimmed);
-        mActivator.setDimmed(dimmed);
+    @Override
+    public void setDimmed(boolean dimmed, boolean fade) {
+        super.setDimmed(dimmed, fade);
+        mActivator.setDimmed(dimmed, fade);
     }
 
     public int getMaxExpandHeight() {
@@ -233,7 +229,12 @@
      * @return the potential height this view could expand in addition.
      */
     public int getExpandPotential() {
-        return getMaximumAllowedExpandHeight() - getActualHeight();
+        return getIntrinsicHeight() - getActualHeight();
+    }
+
+    @Override
+    public boolean isContentExpandable() {
+        return mPrivateLayout.isContentExpandable();
     }
 
     @Override
@@ -249,6 +250,11 @@
     }
 
     @Override
+    public int getMinHeight() {
+        return mPrivateLayout.getMinHeight();
+    }
+
+    @Override
     public void setClipTopAmount(int clipTopAmount) {
         super.setClipTopAmount(clipTopAmount);
         mPrivateLayout.setClipTopAmount(clipTopAmount);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index 35913fa..33e9051 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -23,6 +23,7 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.InsetDrawable;
 import android.util.AttributeSet;
+import android.view.MotionEvent;
 import android.view.View;
 import android.widget.FrameLayout;
 
@@ -34,7 +35,6 @@
     private OnHeightChangedListener mOnHeightChangedListener;
     protected int mActualHeight;
     protected int mClipTopAmount;
-    protected Drawable mCustomBackground;
     private boolean mActualHeightInitialized;
 
     public ExpandableView(Context context, AttributeSet attrs) {
@@ -42,27 +42,6 @@
     }
 
     @Override
-    protected void onDraw(Canvas canvas) {
-        if (mCustomBackground != null) {
-            mCustomBackground.setBounds(0, mClipTopAmount, getWidth(), mActualHeight);
-            mCustomBackground.draw(canvas);
-        }
-    }
-
-    @Override
-    protected boolean verifyDrawable(Drawable who) {
-        return super.verifyDrawable(who) || who == mCustomBackground;
-    }
-
-    @Override
-    protected void drawableStateChanged() {
-        final Drawable d = mCustomBackground;
-        if (d != null && d.isStateful()) {
-            d.setState(getDrawableState());
-        }
-    }
-
-    @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         super.onLayout(changed, left, top, right, bottom);
         if (!mActualHeightInitialized && mActualHeight == 0) {
@@ -71,22 +50,32 @@
         mActualHeightInitialized = true;
     }
 
+    @Override
+    public boolean dispatchTouchEvent(MotionEvent ev) {
+        if (filterMotionEvent(ev)) {
+            return super.dispatchTouchEvent(ev);
+        }
+        return false;
+    }
+
+    private boolean filterMotionEvent(MotionEvent event) {
+        return event.getActionMasked() != MotionEvent.ACTION_DOWN
+                || event.getY() > mClipTopAmount && event.getY() < mActualHeight;
+    }
+
     /**
      * Sets the actual height of this notification. This is different than the laid out
      * {@link View#getHeight()}, as we want to avoid layouting during scrolling and expanding.
      */
     public void setActualHeight(int actualHeight) {
         mActualHeight = actualHeight;
-        invalidate();
-        if (mOnHeightChangedListener != null) {
-            mOnHeightChangedListener.onHeightChanged(this);
-        }
+        notifyHeightChanged();
     }
 
     /**
      * See {@link #setActualHeight}.
      *
-     * @return The actual height of this notification.
+     * @return The current actual height of this notification.
      */
     public int getActualHeight() {
         return mActualHeight;
@@ -95,7 +84,23 @@
     /**
      * @return The maximum height of this notification.
      */
-    public abstract int getMaxHeight();
+    public int getMaxHeight() {
+        return getHeight();
+    }
+
+    /**
+     * @return The minimum height of this notification.
+     */
+    public int getMinHeight() {
+        return getHeight();
+    }
+
+    /**
+     * @return The desired notification height.
+     */
+    public int getIntrinsicHeight() {
+        return mActualHeight;
+    }
 
     /**
      * Sets the amount this view should be clipped from the top. This is used when an expanded
@@ -105,7 +110,6 @@
      */
     public void setClipTopAmount(int clipTopAmount) {
         mClipTopAmount = clipTopAmount;
-        invalidate();
     }
 
     public void setOnHeightChangedListener(OnHeightChangedListener listener) {
@@ -113,22 +117,16 @@
     }
 
     /**
-     * Sets a custom background drawable. As we need to change our bounds independently of layout,
-     * we need the notition of a custom background.
+     * @return Whether we can expand this views content.
      */
-    public void setCustomBackground(Drawable customBackground) {
-        if (mCustomBackground != null) {
-            mCustomBackground.setCallback(null);
-            unscheduleDrawable(mCustomBackground);
-        }
-        mCustomBackground = customBackground;
-        mCustomBackground.setCallback(this);
-        setWillNotDraw(customBackground == null);
-        invalidate();
+    public boolean isContentExpandable() {
+        return false;
     }
 
-    public void setCustomBackgroundResource(int drawableResId) {
-        setCustomBackground(getResources().getDrawable(drawableResId));
+    public void notifyHeightChanged() {
+        if (mOnHeightChangedListener != null) {
+            mOnHeightChangedListener.onHeightChanged(this);
+        }
     }
 
     /**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationActivator.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationActivator.java
index 620e457..a03aeec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationActivator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationActivator.java
@@ -30,18 +30,44 @@
  */
 public class NotificationActivator {
 
-    private static final int ANIMATION_LENGTH_MS = 220;
+    public static final int ANIMATION_LENGTH_MS = 220;
     private static final float INVERSE_ALPHA = 0.9f;
     private static final float DIMMED_SCALE = 0.95f;
 
-    private final View mTargetView;
+    /**
+     * Normal state. Notification is fully interactable.
+     */
+    private static final int STATE_NORMAL = 0;
 
+    /**
+     * Dimmed state. Neutral state when on the lockscreen, with slight transparency and scaled down
+     * a bit.
+     */
+    private static final int STATE_DIMMED = 1;
+
+    /**
+     * Activated state. Used after tapping a notification on the lockscreen. Normal transparency and
+     * normal scale.
+     */
+    private static final int STATE_ACTIVATED = 2;
+
+    /**
+     * Inverse activated state. Used for the other notifications on the lockscreen when tapping on
+     * one.
+     */
+    private static final int STATE_ACTIVATED_INVERSE = 3;
+
+    private final View mTargetView;
+    private final View mHotspotView;
     private final Interpolator mFastOutSlowInInterpolator;
     private final Interpolator mLinearOutSlowInInterpolator;
     private final int mTranslationZ;
 
-    public NotificationActivator(View targetView) {
+    private int mState;
+
+    public NotificationActivator(View targetView, View hotspotView) {
         mTargetView = targetView;
+        mHotspotView = hotspotView;
         Context ctx = targetView.getContext();
         mFastOutSlowInInterpolator =
                 AnimationUtils.loadInterpolator(ctx, android.R.interpolator.fast_out_slow_in);
@@ -53,18 +79,37 @@
     }
 
     public void activateInverse() {
+        if (mState == STATE_ACTIVATED_INVERSE) {
+            return;
+        }
+        mTargetView.animate().cancel();
         mTargetView.animate().withLayer().alpha(INVERSE_ALPHA);
+        mState = STATE_ACTIVATED_INVERSE;
+    }
+
+    public void addHotspot() {
+        mHotspotView.getBackground().setHotspot(
+                0, mHotspotView.getWidth()/2, mHotspotView.getHeight()/2);
     }
 
     public void activate() {
+        if (mState == STATE_ACTIVATED) {
+            return;
+        }
+        mTargetView.animate().cancel();
         mTargetView.animate()
                 .setInterpolator(mLinearOutSlowInInterpolator)
                 .scaleX(1)
                 .scaleY(1)
                 .translationZBy(mTranslationZ);
+        mState = STATE_ACTIVATED;
     }
 
     public void reset() {
+        if (mState == STATE_DIMMED) {
+            return;
+        }
+        mTargetView.animate().cancel();
         mTargetView.animate()
                 .setInterpolator(mFastOutSlowInInterpolator)
                 .scaleX(DIMMED_SCALE)
@@ -73,15 +118,35 @@
         if (mTargetView.getAlpha() != 1.0f) {
             mTargetView.animate().withLayer().alpha(1);
         }
+        mState = STATE_DIMMED;
     }
 
-    public void setDimmed(boolean dimmed) {
+    public void setDimmed(boolean dimmed, boolean fade) {
         if (dimmed) {
-            mTargetView.setScaleX(DIMMED_SCALE);
-            mTargetView.setScaleY(DIMMED_SCALE);
+            mTargetView.animate().cancel();
+            if (fade) {
+                mTargetView.animate()
+                        .setInterpolator(mFastOutSlowInInterpolator)
+                        .scaleX(DIMMED_SCALE)
+                        .scaleY(DIMMED_SCALE);
+            } else {
+                mTargetView.setScaleX(DIMMED_SCALE);
+                mTargetView.setScaleY(DIMMED_SCALE);
+            }
+            mState = STATE_DIMMED;
         } else {
-            mTargetView.setScaleX(1);
-            mTargetView.setScaleY(1);
+            mTargetView.animate().cancel();
+            if (fade) {
+                mTargetView.animate()
+                        .setInterpolator(mFastOutSlowInInterpolator)
+                        .scaleX(1)
+                        .scaleY(1);
+            } else {
+                mTargetView.animate().cancel();
+                mTargetView.setScaleX(1);
+                mTargetView.setScaleY(1);
+            }
+            mState = STATE_NORMAL;
         }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index fd0cb08..1f15eaf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -84,6 +84,11 @@
     }
 
     @Override
+    public int getMinHeight() {
+        return mSmallHeight;
+    }
+
+    @Override
     public void setClipTopAmount(int clipTopAmount) {
         super.setClipTopAmount(clipTopAmount);
         updateClipping();
@@ -125,4 +130,9 @@
     public void notifyContentUpdated() {
         selectLayout();
     }
+
+    @Override
+    public boolean isContentExpandable() {
+        return mExpandedChild != null;
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java
index 8ebd50d..e6b5600 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowContainer.java
@@ -45,11 +45,6 @@
     }
 
     @Override
-    public int getMaxHeight() {
-        return getHeight();
-    }
-
-    @Override
     public void setClipTopAmount(int clipTopAmount) {
         // noop
     }
@@ -60,10 +55,14 @@
         mIconsView = (NotificationOverflowIconsView) findViewById(R.id.overflow_icons_view);
         mIconsView.setMoreText((TextView) findViewById(R.id.more_text));
 
-        mActivator = new NotificationActivator(this);
-        mActivator.setDimmed(true);
-        setLocked(true);
-        setDimmed(true);
+        mActivator = new NotificationActivator(this, this);
+        setDimmed(true, false);
+    }
+
+    @Override
+    public void setDimmed(boolean dimmed, boolean fade) {
+        super.setDimmed(dimmed, fade);
+        mActivator.setDimmed(dimmed, fade);
     }
 
     public NotificationOverflowIconsView getIconsView() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarState.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarState.java
new file mode 100644
index 0000000..9d75228
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarState.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.statusbar;
+
+/**
+ * Class to encapsulate all possible status bar states regarding Keyguard.
+ */
+public class StatusBarState {
+
+    /**
+     * The status bar is in the "normal" shade mode.
+     */
+    public static final int SHADE = 0;
+
+    /**
+     * Status bar is currently the Keyguard.
+     */
+    public static final int KEYGUARD = 1;
+
+    /**
+     * Status bar is in the special mode, where it is fully interactive but still locked. So
+     * dismissing the shade will still show the bouncer.
+     */
+    public static final int SHADE_LOCKED = 2;
+
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 3fae3f0..089757a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -39,6 +39,7 @@
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityManager;
 import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
@@ -142,6 +143,14 @@
         }
     };
 
+    private final OnClickListener mImeSwitcherClickListener = new OnClickListener() {
+        @Override
+        public void onClick(View view) {
+            ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
+                    .showInputMethodPicker();
+        }
+    };
+
     private class H extends Handler {
         public void handleMessage(Message m) {
             switch (m.what) {
@@ -233,6 +242,10 @@
         return mCurrentView.findViewById(R.id.home);
     }
 
+    public View getImeSwitchButton() {
+        return mCurrentView.findViewById(R.id.ime_switcher);
+    }
+
     // for when home is disabled, but search isn't
     public View getSearchLight() {
         return mCurrentView.findViewById(R.id.search_light);
@@ -283,6 +296,12 @@
 
         ((ImageView)getRecentsButton()).setImageDrawable(mVertical ? mRecentLandIcon : mRecentIcon);
 
+        final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0);
+        getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE);
+        // Update menu button in case the IME state has changed.
+        setMenuVisibility(mShowMenu, true);
+
+
         setDisabledFlags(mDisabledFlags, true);
     }
 
@@ -363,7 +382,10 @@
 
         mShowMenu = show;
 
-        getMenuButton().setVisibility(mShowMenu ? View.VISIBLE : View.INVISIBLE);
+        // Only show Menu if IME switcher not shown.
+        final boolean shouldShow = mShowMenu &&
+                ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0);
+        getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE);
     }
 
     @Override
@@ -379,6 +401,8 @@
 
         mCurrentView = mRotatedViews[Surface.ROTATION_0];
 
+        getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
+
         watchForAccessibilityChanges();
     }
 
@@ -424,6 +448,8 @@
         mCurrentView = mRotatedViews[rot];
         mCurrentView.setVisibility(View.VISIBLE);
 
+        getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
+
         mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
 
         // force the low profile & disabled states into compliance
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 712eec8..627b80f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -25,6 +25,7 @@
 import com.android.systemui.R;
 import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.GestureRecorder;
+import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
 
 public class NotificationPanelView extends PanelView implements
@@ -38,6 +39,7 @@
     private NotificationStackScrollLayout mNotificationStackScroller;
     private boolean mTrackingSettings;
     private int mNotificationTopPadding;
+    private boolean mAnimateNextTopPaddingChange;
 
     public NotificationPanelView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -76,9 +78,16 @@
         super.onLayout(changed, left, top, right, bottom);
         int keyguardBottomMargin =
                 ((MarginLayoutParams) mKeyguardStatusView.getLayoutParams()).bottomMargin;
-        mNotificationStackScroller.setTopPadding(mStatusBar.isOnKeyguard()
+        mNotificationStackScroller.setTopPadding(mStatusBar.getBarState() == StatusBarState.KEYGUARD
                 ? mKeyguardStatusView.getBottom() + keyguardBottomMargin
-                : mHeader.getBottom() + mNotificationTopPadding);
+                : mHeader.getBottom() + mNotificationTopPadding,
+                mAnimateNextTopPaddingChange);
+        mAnimateNextTopPaddingChange = false;
+    }
+
+    public void animateNextTopPaddingChange() {
+        mAnimateNextTopPaddingChange = true;
+        requestLayout();
     }
 
     @Override
@@ -107,14 +116,18 @@
     public boolean onInterceptTouchEvent(MotionEvent event) {
         // intercept for quick settings
         if (event.getAction() == MotionEvent.ACTION_DOWN) {
-            final View target = mStatusBar.isOnKeyguard() ?  mKeyguardStatusView : mHeader;
+            final View target = mStatusBar.getBarState() == StatusBarState.KEYGUARD
+                    ? mKeyguardStatusView
+                    : mHeader;
             final boolean inTarget = PhoneStatusBar.inBounds(target, event, true);
             if (inTarget && !isInSettings()) {
                 mTrackingSettings = true;
+                requestDisallowInterceptTouchEvent(true);
                 return true;
             }
             if (!inTarget && isInSettings()) {
                 mTrackingSettings = true;
+                requestDisallowInterceptTouchEvent(true);
                 return true;
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 545352c..0db6914 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -18,6 +18,7 @@
 
 
 import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT;
+import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN;
 import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
 import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
 import static android.app.StatusBarManager.windowStateToString;
@@ -95,6 +96,8 @@
 import com.android.systemui.keyguard.KeyguardViewMediator;
 import com.android.systemui.statusbar.BaseStatusBar;
 import com.android.systemui.statusbar.CommandQueue;
+import com.android.systemui.statusbar.DragDownHelper;
+import com.android.systemui.statusbar.ExpandableNotificationRow;
 import com.android.systemui.statusbar.GestureRecorder;
 import com.android.systemui.statusbar.InterceptedNotifications;
 import com.android.systemui.statusbar.NotificationData;
@@ -102,6 +105,7 @@
 import com.android.systemui.statusbar.NotificationOverflowContainer;
 import com.android.systemui.statusbar.SignalClusterView;
 import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.policy.BatteryController;
 import com.android.systemui.statusbar.policy.BluetoothController;
 import com.android.systemui.statusbar.policy.DateView;
@@ -119,7 +123,8 @@
 import java.util.Collection;
 import java.util.Collections;
 
-public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
+public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
+        DragDownHelper.OnDragDownListener {
     static final String TAG = "PhoneStatusBar";
     public static final boolean DEBUG = BaseStatusBar.DEBUG;
     public static final boolean SPEW = false;
@@ -232,6 +237,7 @@
     View mNotificationPanelHeader;
     View mKeyguardStatusView;
     View mKeyguardBottomArea;
+    boolean mLeaveOpenOnKeyguardHide;
     KeyguardIndicationTextView mKeyguardIndicationTextView;
 
     // TODO: Fetch phrase from search/hotword provider.
@@ -379,7 +385,7 @@
     private boolean mSettingsStarted;
     private boolean mSettingsCancelled;
     private boolean mSettingsClosing;
-    private int mNotificationPadding;
+    private boolean mVisible;
 
     private final OnChildLocationsChangedListener mOnChildLocationsChangedListener =
             new OnChildLocationsChangedListener() {
@@ -469,6 +475,13 @@
         }
     };
 
+    private final View.OnClickListener mOverflowClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            goToLockedShade(null);
+        }
+    };
+
     @Override
     public void setZenMode(int mode) {
         super.setZenMode(mode);
@@ -618,6 +631,8 @@
                         R.layout.status_bar_notification_keyguard_overflow, mStackScroller, false);
         mKeyguardIconOverflowContainer.setOnActivatedListener(this);
         mKeyguardCarrierLabel = mStatusBarWindow.findViewById(R.id.keyguard_carrier_text);
+        // TODO: Comment in when transition is ready.
+        //mKeyguardIconOverflowContainer.setOnClickListener(mOverflowClickListener);
         mStackScroller.addView(mKeyguardIconOverflowContainer);
 
         mExpandedContents = mStackScroller;
@@ -719,8 +734,6 @@
         }
 
         // Quick Settings (where available, some restrictions apply)
-        mNotificationPadding = mContext.getResources()
-                .getDimensionPixelSize(R.dimen.notification_side_padding);
         if (mHasQuickSettings) {
             // Quick Settings needs a container to survive
             mSettingsContainer = (QuickSettingsContainerView)
@@ -785,7 +798,9 @@
         } else if (mSettingsTracker != null && (event.getAction() == MotionEvent.ACTION_UP
                 || event.getAction() == MotionEvent.ACTION_CANCEL)) {
             final float dy = event.getY() - mSettingsDownY;
-            final FlipperButton flipper = mOnKeyguard ? mKeyguardFlipper : mHeaderFlipper;
+            final FlipperButton flipper = mState == StatusBarState.KEYGUARD
+                    ? mKeyguardFlipper
+                    : mHeaderFlipper;
             final boolean inButton = flipper.inHolderBounds(event);
             final boolean qsTap = mSettingsClosing && Math.abs(dy) < slop;
             if (!qsTap && !inButton) {
@@ -1193,7 +1208,7 @@
             }
 
             if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0
-                    && !mNotificationPanel.isTracking() && !mOnKeyguard) {
+                    && !mNotificationPanel.isTracking() && mState != StatusBarState.KEYGUARD) {
                 animateCollapsePanels();
             }
         }
@@ -1347,7 +1362,7 @@
             && mStackScroller.getHeight() < (mNotificationPanel.getHeight()
                     - mCarrierLabelHeight - mNotificationHeaderHeight)
             && mStackScroller.getVisibility() == View.VISIBLE
-            && !mOnKeyguard;
+            && mState != StatusBarState.KEYGUARD;
 
         if (force || mCarrierLabelVisible != makeVisible) {
             mCarrierLabelVisible = makeVisible;
@@ -2098,7 +2113,7 @@
         if (mDemoMode) return;
         int sbMode = mStatusBarMode;
         if (panelsEnabled() && (mInteractingWindows & StatusBarManager.WINDOW_STATUS_BAR) != 0
-                && !mOnKeyguard) {
+                && mState != StatusBarState.KEYGUARD) {
             // if panels are expandable, force the status bar opaque on any interaction
             sbMode = MODE_OPAQUE;
         }
@@ -2211,12 +2226,20 @@
 
     @Override
     public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
-        boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS)
-            || ((vis & InputMethodService.IME_VISIBLE) != 0);
+        boolean imeShown = (vis & InputMethodService.IME_VISIBLE) != 0;
+        int flags = mNavigationIconHints;
+        if ((backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS) || imeShown) {
+            flags |= NAVIGATION_HINT_BACK_ALT;
+        } else {
+            flags &= ~NAVIGATION_HINT_BACK_ALT;
+        }
+        if (imeShown) {
+            flags |= NAVIGATION_HINT_IME_SHOWN;
+        } else {
+            flags &= ~NAVIGATION_HINT_IME_SHOWN;
+        }
 
-        setNavigationIconHints(
-                altBack ? (mNavigationIconHints | NAVIGATION_HINT_BACK_ALT)
-                        : (mNavigationIconHints & ~NAVIGATION_HINT_BACK_ALT));
+        setNavigationIconHints(flags);
         if (mQS != null) mQS.setImeWindowStatus(vis > 0);
     }
 
@@ -2551,12 +2574,14 @@
                 notifyNavigationBarScreenOn(false);
                 notifyHeadsUpScreenOn(false);
                 finishBarAnimations();
+                stopNotificationLogging();
             }
             else if (Intent.ACTION_SCREEN_ON.equals(action)) {
                 mScreenOn = true;
                 // work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
                 repositionNavigationBar();
                 notifyNavigationBarScreenOn(true);
+                startNotificationLoggingIfScreenOnAndVisible();
             }
             else if (ACTION_DEMO.equals(action)) {
                 Bundle bundle = intent.getExtras();
@@ -2730,22 +2755,40 @@
 
     @Override
     protected void visibilityChanged(boolean visible) {
+        mVisible = visible;
         if (visible) {
-            mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
+            startNotificationLoggingIfScreenOnAndVisible();
         } else {
-            // Report all notifications as invisible and turn down the
-            // reporter.
-            if (!mCurrentlyVisibleNotifications.isEmpty()) {
-                logNotificationVisibilityChanges(
-                        Collections.<String>emptyList(), mCurrentlyVisibleNotifications);
-                mCurrentlyVisibleNotifications.clear();
-            }
-            mHandler.removeCallbacks(mVisibilityReporter);
-            mStackScroller.setChildLocationsChangedListener(null);
+            stopNotificationLogging();
         }
         super.visibilityChanged(visible);
     }
 
+    private void stopNotificationLogging() {
+        // Report all notifications as invisible and turn down the
+        // reporter.
+        if (!mCurrentlyVisibleNotifications.isEmpty()) {
+            logNotificationVisibilityChanges(
+                    Collections.<String>emptyList(), mCurrentlyVisibleNotifications);
+            mCurrentlyVisibleNotifications.clear();
+        }
+        mHandler.removeCallbacks(mVisibilityReporter);
+        mStackScroller.setChildLocationsChangedListener(null);
+    }
+
+    private void startNotificationLoggingIfScreenOnAndVisible() {
+        if (mVisible && mScreenOn) {
+            mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
+            // Some transitions like mScreenOn=false -> mScreenOn=true don't
+            // cause the scroller to emit child location events. Hence generate
+            // one ourselves to guarantee that we're reporting visible
+            // notifications.
+            // (Note that in cases where the scroller does emit events, this
+            // additional event doesn't break anything.)
+            mNotificationLocationsChangedListener.onChildLocationsChanged(mStackScroller);
+        }
+    }
+
     private void logNotificationVisibilityChanges(
             Collection<String> newlyVisible, Collection<String> noLongerVisible) {
         if (newlyVisible.isEmpty() && noLongerVisible.isEmpty()) {
@@ -2930,28 +2973,38 @@
         }
     }
 
-    public boolean isOnKeyguard() {
-        return mOnKeyguard;
+    /**
+     * @return The {@link StatusBarState} the status bar is in.
+     */
+    public int getBarState() {
+        return mState;
     }
 
     public void showKeyguard() {
-        mOnKeyguard = true;
+        setBarState(StatusBarState.KEYGUARD);
         updateKeyguardState();
         instantExpandNotificationsPanel();
+        mLeaveOpenOnKeyguardHide = false;
     }
 
     public void hideKeyguard() {
-        mOnKeyguard = false;
+        setBarState(StatusBarState.SHADE);
+        if (mLeaveOpenOnKeyguardHide) {
+            mLeaveOpenOnKeyguardHide = false;
+            mNotificationPanel.animateNextTopPaddingChange();
+        } else {
+            instantCollapseNotificationPanel();
+        }
         updateKeyguardState();
-        instantCollapseNotificationPanel();
     }
 
     private void updatePublicMode() {
-        setLockscreenPublicMode(mOnKeyguard && mStatusBarKeyguardViewManager.isSecure());
+        setLockscreenPublicMode(mState == StatusBarState.KEYGUARD
+                && mStatusBarKeyguardViewManager.isSecure());
     }
 
     private void updateKeyguardState() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD) {
             if (isFlippedToSettings()) {
                 flipToNotifications(false /*animate*/);
             }
@@ -2983,17 +3036,17 @@
     }
 
     public void userActivity() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD) {
             mKeyguardViewMediatorCallback.userActivity();
         }
     }
 
     public boolean onMenuPressed() {
-        return mOnKeyguard && mStatusBarKeyguardViewManager.onMenuPressed();
+        return mState == StatusBarState.KEYGUARD && mStatusBarKeyguardViewManager.onMenuPressed();
     }
 
     public boolean onBackPressed() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
             return mStatusBarKeyguardViewManager.onBackPressed();
         } else {
             animateCollapsePanels();
@@ -3002,7 +3055,7 @@
     }
 
     private void showBouncer() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
             mStatusBarKeyguardViewManager.dismiss();
         }
     }
@@ -3038,6 +3091,14 @@
         super.onActivated(view);
     }
 
+    /**
+     * @param state The {@link StatusBarState} to set.
+     */
+    public void setBarState(int state) {
+        mState = state;
+        mStatusBarWindowManager.setStatusBarState(state);
+    }
+
     @Override
     public void onReset(View view) {
         super.onReset(view);
@@ -3045,13 +3106,13 @@
     }
 
     public void onTrackingStarted() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD) {
             mKeyguardIndicationTextView.switchIndication(R.string.keyguard_unlock);
         }
     }
 
     public void onTrackingStopped() {
-        if (mOnKeyguard) {
+        if (mState == StatusBarState.KEYGUARD) {
             mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase);
         }
     }
@@ -3065,6 +3126,67 @@
         return mNavigationBarView;
     }
 
+    // ---------------------- DragDownHelper.OnDragDownListener ------------------------------------
+
+    @Override
+    public void onDraggedDown(View startingChild) {
+        goToLockedShade(startingChild);
+    }
+
+    @Override
+    public void onReset() {
+        int n = mNotificationData.size();
+        for (int i = 0; i < n; i++) {
+            NotificationData.Entry entry = mNotificationData.get(i);
+            if (entry.row.getVisibility() != View.GONE) {
+                entry.row.setDimmed(true /* dimmed */, true /* fade */);
+            }
+        }
+        if (mKeyguardIconOverflowContainer.getVisibility() != View.GONE) {
+            mKeyguardIconOverflowContainer.setDimmed(true /* dimmed */, true /* fade */);
+        }
+    }
+
+    public void onThresholdReached() {
+        int n = mNotificationData.size();
+        for (int i = 0; i < n; i++) {
+            NotificationData.Entry entry = mNotificationData.get(i);
+            if (entry.row.getVisibility() != View.GONE) {
+                entry.row.setDimmed(false /* dimmed */, true /* fade */);
+            }
+        }
+        if (mKeyguardIconOverflowContainer.getVisibility() != View.GONE) {
+            mKeyguardIconOverflowContainer.setDimmed(false /* dimmed */, true /* fade */);
+        }
+    }
+
+    /**
+     * If secure with redaction: Show bouncer, go to unlocked shade.
+     *
+     * <p>If secure without redaction: Go to {@link StatusBarState#SHADE_LOCKED}.</p>
+     *
+     * <p>Otherwise go directly to unlocked shade.</p>
+     *
+     * @param expandView The view to expand after going to the shade.
+     */
+    public void goToLockedShade(View expandView) {
+        if (expandView instanceof ExpandableNotificationRow) {
+            ExpandableNotificationRow row = (ExpandableNotificationRow) expandView;
+            row.setUserExpanded(true);
+        }
+        if (isLockscreenPublicMode() && !userAllowsPrivateNotificationsInPublic(mCurrentUserId)) {
+            mLeaveOpenOnKeyguardHide = true;
+            showBouncer();
+        } else if (mStatusBarKeyguardViewManager.isSecure()) {
+            mNotificationPanel.animateNextTopPaddingChange();
+            setBarState(StatusBarState.SHADE_LOCKED);
+            updateKeyguardState();
+        } else {
+            mLeaveOpenOnKeyguardHide = true;
+            mStatusBarKeyguardViewManager.dismiss();
+        }
+    }
+
     /**
      * @return a ViewGroup that spans the entire panel which contains the quick settings
      */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 79c63f7..10c1625 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -19,7 +19,6 @@
 import android.app.ActivityManager;
 import android.content.Context;
 import android.content.res.Resources;
-import android.content.res.Resources.NotFoundException;
 import android.util.AttributeSet;
 import android.util.EventLog;
 import android.util.Log;
@@ -29,6 +28,7 @@
 
 import com.android.systemui.EventLogTags;
 import com.android.systemui.R;
+import com.android.systemui.statusbar.StatusBarState;
 
 public class PhoneStatusBarView extends PanelBar {
     private static final String TAG = "PhoneStatusBarView";
@@ -187,7 +187,10 @@
         if (panel == mFadingPanel && mScrimColor != 0 && ActivityManager.isHighEndGfx()
                 && mBar.mStatusBarWindow != null) {
             if (mShouldFade) {
-                int scrimColor = mBar.isOnKeyguard() ? mScrimColorKeyguard : mScrimColor;
+                int scrimColor = (mBar.getBarState() == StatusBarState.KEYGUARD
+                        || mBar.getBarState() == StatusBarState.SHADE_LOCKED)
+                        ? mScrimColorKeyguard
+                        : mScrimColor;
                 frac = mPanelExpandedFractionSum; // don't judge me
                 // let's start this 20% of the way down the screen
                 frac = frac * 1.2f - 0.2f;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index c2595cf..554892c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -18,22 +18,14 @@
 
 import android.content.Context;
 import android.os.Bundle;
-import android.os.IBinder;
 import android.os.RemoteException;
-import android.util.Log;
 import android.util.Slog;
-import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
 
 import com.android.internal.policy.IKeyguardShowCallback;
 import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardHostView;
-import com.android.keyguard.KeyguardSimpleHostView;
-import com.android.keyguard.R;
 import com.android.keyguard.ViewMediatorCallback;
-import com.android.systemui.keyguard.KeyguardViewMediator;
 
 /**
  * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back
@@ -82,7 +74,7 @@
         mShowing = true;
         mStatusBarWindowManager.setKeyguardShowing(true);
         showBouncerOrKeyguard();
-        updateBackButtonState();
+        updateStates();
     }
 
     /**
@@ -102,9 +94,9 @@
         }
     }
 
-    public void showBouncer() {
+    private void showBouncer() {
         mBouncer.show();
-        updateBackButtonState();
+        updateStates();
     }
 
     /**
@@ -112,7 +104,7 @@
      */
     public void reset() {
         showBouncerOrKeyguard();
-        updateBackButtonState();
+        updateStates();
     }
 
     public void onScreenTurnedOff() {
@@ -155,7 +147,7 @@
     public void setOccluded(boolean occluded) {
         mOccluded = occluded;
         mStatusBarWindowManager.setKeyguardOccluded(occluded);
-        updateBackButtonState();
+        updateStates();
     }
 
     /**
@@ -167,7 +159,7 @@
         mStatusBarWindowManager.setKeyguardShowing(false);
         mBouncer.hide();
         mViewMediatorCallback.keyguardGone();
-        updateBackButtonState();
+        updateStates();
     }
 
     /**
@@ -199,13 +191,13 @@
         if (mBouncer.isShowing()) {
             mBouncer.hide();
             mPhoneStatusBar.showKeyguard();
-            updateBackButtonState();
+            updateStates();
             return true;
         }
         return false;
     }
 
-    private void updateBackButtonState() {
+    private void updateStates() {
         int vis = mContainer.getSystemUiVisibility();
         boolean bouncerDismissable = mBouncer.isShowing() && !mBouncer.needsFullscreenBouncer();
         if (bouncerDismissable || !mShowing) {
@@ -218,6 +210,7 @@
         } else {
             mPhoneStatusBar.getNavigationBarView().setVisibility(View.GONE);
         }
+        mPhoneStatusBar.setBouncerShowing(mBouncer.isShowing());
     }
 
     public boolean onMenuPressed() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index d175d7a..a4c9df5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -16,7 +16,6 @@
 
 package com.android.systemui.statusbar.phone;
 
-import android.app.ActionBar;
 import android.content.Context;
 import android.content.pm.ActivityInfo;
 import android.content.res.Resources;
@@ -28,6 +27,8 @@
 import android.view.WindowManager;
 
 import com.android.keyguard.R;
+import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.statusbar.StatusBarState;
 
 /**
  * Encapsulates all logic for the status bar window state management.
@@ -137,7 +138,8 @@
     }
 
     private void applyUserActivityTimeout(State state) {
-        if (state.isKeyguardShowingAndNotOccluded()) {
+        if (state.isKeyguardShowingAndNotOccluded()
+                && state.statusBarState == StatusBarState.KEYGUARD) {
             mLp.userActivityTimeout = state.keyguardUserActivityTimeout;
         } else {
             mLp.userActivityTimeout = -1;
@@ -145,7 +147,8 @@
     }
 
     private void applyInputFeatures(State state) {
-        if (state.isKeyguardShowingAndNotOccluded()) {
+        if (state.isKeyguardShowingAndNotOccluded()
+                && state.statusBarState == StatusBarState.KEYGUARD) {
             mLp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
         } else {
             mLp.inputFeatures &= ~WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
@@ -194,6 +197,14 @@
         apply(mCurrentState);
     }
 
+    /**
+     * @param state The {@link StatusBarState} of the status bar.
+     */
+    public void setStatusBarState(int state) {
+        mCurrentState.statusBarState = state;
+        apply(mCurrentState);
+    }
+
     private static class State {
         boolean keyguardShowing;
         boolean keyguardOccluded;
@@ -202,6 +213,11 @@
         boolean statusBarFocusable;
         long keyguardUserActivityTimeout;
 
+        /**
+         * The {@link BaseStatusBar} state from the status bar.
+         */
+        int statusBarState;
+
         private boolean isKeyguardShowingAndNotOccluded() {
             return keyguardShowing && !keyguardOccluded;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 6b5ef5a..acc3a0b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -31,16 +31,17 @@
 import com.android.systemui.ExpandHelper;
 import com.android.systemui.R;
 import com.android.systemui.statusbar.BaseStatusBar;
-import com.android.systemui.statusbar.policy.ScrollAdapter;
+import com.android.systemui.statusbar.DragDownHelper;
+import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
 
 
-public class StatusBarWindowView extends FrameLayout
-{
+public class StatusBarWindowView extends FrameLayout {
     public static final String TAG = "StatusBarWindowView";
     public static final boolean DEBUG = BaseStatusBar.DEBUG;
 
     private ExpandHelper mExpandHelper;
+    private DragDownHelper mDragDownHelper;
     private NotificationStackScrollLayout mStackScrollLayout;
     private NotificationPanelView mNotificationPanel;
 
@@ -75,6 +76,7 @@
                 minHeight, maxHeight);
         mExpandHelper.setEventSource(this);
         mExpandHelper.setScrollAdapter(mStackScrollLayout);
+        mDragDownHelper = new DragDownHelper(getContext(), this, mStackScrollLayout, mService);
 
         // We really need to be able to animate while window animations are going on
         // so that activities may be started asynchronously from panel animations
@@ -106,8 +108,13 @@
         boolean intercept = false;
         if (mNotificationPanel.isFullyExpanded()
                 && mStackScrollLayout.getVisibility() == View.VISIBLE
-                && !mService.isOnKeyguard()) {
+                && mService.getBarState() != StatusBarState.KEYGUARD) {
             intercept = mExpandHelper.onInterceptTouchEvent(ev);
+        } else if (mNotificationPanel.isFullyExpanded()
+                && mStackScrollLayout.getVisibility() == View.VISIBLE
+                && mService.getBarState() == StatusBarState.KEYGUARD
+                && !mService.isBouncerShowing()) {
+            intercept = mDragDownHelper.onInterceptTouchEvent(ev);
         }
         if (!intercept) {
             super.onInterceptTouchEvent(ev);
@@ -124,8 +131,11 @@
     @Override
     public boolean onTouchEvent(MotionEvent ev) {
         boolean handled = false;
-        if (mNotificationPanel.isFullyExpanded()) {
+        if (mNotificationPanel.isFullyExpanded()
+                && mService.getBarState() != StatusBarState.KEYGUARD) {
             handled = mExpandHelper.onTouchEvent(ev);
+        } else if (mService.getBarState() == StatusBarState.KEYGUARD) {
+            handled = mDragDownHelper.onTouchEvent(ev);
         }
         if (!handled) {
             handled = super.onTouchEvent(ev);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
index b09b462..8748888 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java
@@ -222,7 +222,7 @@
                 mExits.remove(i);
             }
             for (Condition c : mConditions.values()) {
-                mExits.add(newExit(c.caption, "", "", c.id));
+                mExits.add(newExit(c.summary, c.line1, c.line2, c.id));
             }
             dispatchChanged();
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
index c94c65f..72e22e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
@@ -32,6 +32,7 @@
 import com.android.systemui.R;
 import com.android.systemui.SwipeHelper;
 import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.statusbar.ExpandableView;
 import com.android.systemui.statusbar.NotificationData;
 
 public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.Callback, ExpandHelper.Callback {
@@ -185,12 +186,12 @@
     // ExpandHelper.Callback methods
 
     @Override
-    public View getChildAtRawPosition(float x, float y) {
+    public ExpandableView getChildAtRawPosition(float x, float y) {
         return getChildAtPosition(x, y);
     }
 
     @Override
-    public View getChildAtPosition(float x, float y) {
+    public ExpandableView getChildAtPosition(float x, float y) {
         return mHeadsUp == null ? null : mHeadsUp.row;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 4c0962e..e4e5fb1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -97,24 +97,24 @@
     private StackScrollState mCurrentStackScrollState = new StackScrollState(this);
     private ArrayList<View> mChildrenToAddAnimated = new ArrayList<View>();
     private ArrayList<View> mChildrenToRemoveAnimated = new ArrayList<View>();
-    private ArrayList<ChildHierarchyChangeEvent> mAnimationEvents
-            = new ArrayList<ChildHierarchyChangeEvent>();
+    private ArrayList<AnimationEvent> mAnimationEvents
+            = new ArrayList<AnimationEvent>();
     private ArrayList<View> mSwipedOutViews = new ArrayList<View>();
     private final StackStateAnimator mStateAnimator = new StackStateAnimator(this);
 
     private OnChildLocationsChangedListener mListener;
     private ExpandableView.OnHeightChangedListener mOnHeightChangedListener;
-    private boolean mChildHierarchyDirty;
+    private boolean mNeedsAnimation;
+    private boolean mTopPaddingNeedsAnimation;
     private boolean mIsExpanded = true;
-    private boolean mChildrenNeedUpdate;
-    private ViewTreeObserver.OnPreDrawListener mPreDrawListener
+    private boolean mChildrenUpdateRequested;
+    private ViewTreeObserver.OnPreDrawListener mChildrenUpdater
             = new ViewTreeObserver.OnPreDrawListener() {
         @Override
         public boolean onPreDraw() {
-            if (mChildrenNeedUpdate) {
-                updateChildren();
-                mChildrenNeedUpdate = false;
-            }
+            updateChildren();
+            mChildrenUpdateRequested = false;
+            getViewTreeObserver().removeOnPreDrawListener(this);
             return true;
         }
     };
@@ -160,6 +160,7 @@
         mScroller = new OverScroller(getContext());
         setFocusable(true);
         setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
+        setClipChildren(false);
         final ViewConfiguration configuration = ViewConfiguration.get(context);
         mTouchSlop = configuration.getScaledTouchSlop();
         mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
@@ -181,7 +182,6 @@
         mPaddingBetweenElements = context.getResources()
                 .getDimensionPixelSize(R.dimen.notification_padding);
         mStackScrollAlgorithm = new StackScrollAlgorithm(context);
-        getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
     }
 
     @Override
@@ -267,7 +267,7 @@
     private void updateChildren() {
         mCurrentStackScrollState.setScrollY(mOwnScrollY);
         mStackScrollAlgorithm.getStackScrollState(mCurrentStackScrollState);
-        if (!isCurrentlyAnimating() && !mChildHierarchyDirty) {
+        if (!isCurrentlyAnimating() && !mNeedsAnimation) {
             applyCurrentState();
         } else {
             startAnimationToState();
@@ -275,8 +275,11 @@
     }
 
     private void requestChildrenUpdate() {
-        mChildrenNeedUpdate = true;
-        invalidate();
+        if (!mChildrenUpdateRequested) {
+            getViewTreeObserver().addOnPreDrawListener(mChildrenUpdater);
+            mChildrenUpdateRequested = true;
+            invalidate();
+        }
     }
 
     private boolean isCurrentlyAnimating() {
@@ -294,12 +297,19 @@
         return mTopPadding;
     }
 
-    public void setTopPadding(int topPadding) {
+    public void setTopPadding(int topPadding, boolean animate) {
         if (mTopPadding != topPadding) {
             mTopPadding = topPadding;
             updateAlgorithmHeightAndPadding();
             updateContentHeight();
+            if (animate) {
+                mTopPaddingNeedsAnimation = true;
+                mNeedsAnimation =  true;
+            }
             requestChildrenUpdate();
+            if (mOnHeightChangedListener != null) {
+                mOnHeightChangedListener.onHeightChanged(null);
+            }
         }
     }
 
@@ -382,13 +392,13 @@
         return getChildAtPosition(ev.getX(), ev.getY());
     }
 
-    public View getChildAtRawPosition(float touchX, float touchY) {
+    public ExpandableView getChildAtRawPosition(float touchX, float touchY) {
         int[] location = new int[2];
         getLocationOnScreen(location);
         return getChildAtPosition(touchX - location[0], touchY - location[1]);
     }
 
-    public View getChildAtPosition(float touchX, float touchY) {
+    public ExpandableView getChildAtPosition(float touchX, float touchY) {
         // find the view under the pointer, accounting for GONE views
         final int count = getChildCount();
         for (int childIdx = 0; childIdx < count; childIdx++) {
@@ -747,7 +757,7 @@
     private int getMaxExpandHeight(View view) {
         if (view instanceof ExpandableNotificationRow) {
             ExpandableNotificationRow row = (ExpandableNotificationRow) view;
-            return row.getMaximumAllowedExpandHeight();
+            return row.getIntrinsicHeight();
         }
         return view.getHeight();
     }
@@ -767,7 +777,7 @@
                 }
                 if (child instanceof ExpandableNotificationRow) {
                     ExpandableNotificationRow row = (ExpandableNotificationRow) child;
-                    height += row.getMaximumAllowedExpandHeight();
+                    height += row.getIntrinsicHeight();
                 } else if (child instanceof ExpandableView) {
                     ExpandableView expandableView = (ExpandableView) child;
                     height += expandableView.getActualHeight();
@@ -834,7 +844,7 @@
             if (!mChildrenToAddAnimated.contains(child)) {
                 // Generate Animations
                 mChildrenToRemoveAnimated.add(child);
-                mChildHierarchyDirty = true;
+                mNeedsAnimation = true;
             } else {
                 mChildrenToAddAnimated.remove(child);
             }
@@ -893,7 +903,7 @@
 
             // Generate Animations
             mChildrenToAddAnimated.add(child);
-            mChildHierarchyDirty = true;
+            mNeedsAnimation = true;
         }
     }
 
@@ -910,9 +920,9 @@
     }
 
     private void startAnimationToState() {
-        if (mChildHierarchyDirty) {
+        if (mNeedsAnimation) {
             generateChildHierarchyEvents();
-            mChildHierarchyDirty = false;
+            mNeedsAnimation = false;
         }
         if (!mAnimationEvents.isEmpty()) {
             mStateAnimator.startAnimationForEvents(mAnimationEvents, mCurrentStackScrollState);
@@ -924,16 +934,17 @@
     private void generateChildHierarchyEvents() {
         generateChildAdditionEvents();
         generateChildRemovalEvents();
-        mChildHierarchyDirty = false;
+        generateTopPaddingEvent();
+        mNeedsAnimation = false;
     }
 
     private void generateChildRemovalEvents() {
         for (View  child : mChildrenToRemoveAnimated) {
             boolean childWasSwipedOut = mSwipedOutViews.contains(child);
             int animationType = childWasSwipedOut
-                    ? ChildHierarchyChangeEvent.ANIMATION_TYPE_REMOVE_SWIPED_OUT
-                    : ChildHierarchyChangeEvent.ANIMATION_TYPE_REMOVE;
-            mAnimationEvents.add(new ChildHierarchyChangeEvent(child, animationType));
+                    ? AnimationEvent.ANIMATION_TYPE_REMOVE_SWIPED_OUT
+                    : AnimationEvent.ANIMATION_TYPE_REMOVE;
+            mAnimationEvents.add(new AnimationEvent(child, animationType));
         }
         mSwipedOutViews.clear();
         mChildrenToRemoveAnimated.clear();
@@ -941,12 +952,20 @@
 
     private void generateChildAdditionEvents() {
         for (View  child : mChildrenToAddAnimated) {
-            mAnimationEvents.add(new ChildHierarchyChangeEvent(child,
-                    ChildHierarchyChangeEvent.ANIMATION_TYPE_ADD));
+            mAnimationEvents.add(new AnimationEvent(child,
+                    AnimationEvent.ANIMATION_TYPE_ADD));
         }
         mChildrenToAddAnimated.clear();
     }
 
+    private void generateTopPaddingEvent() {
+        if (mTopPaddingNeedsAnimation) {
+            mAnimationEvents.add(
+                    new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_TOP_PADDING_CHANGED));
+        }
+        mTopPaddingNeedsAnimation = false;
+    }
+
     private boolean onInterceptTouchEventScroll(MotionEvent ev) {
         /*
          * This method JUST determines whether we want to intercept the motion.
@@ -1148,16 +1167,18 @@
         public void onChildLocationsChanged(NotificationStackScrollLayout stackScrollLayout);
     }
 
-    static class ChildHierarchyChangeEvent {
+    static class AnimationEvent {
 
         static int ANIMATION_TYPE_ADD = 1;
         static int ANIMATION_TYPE_REMOVE = 2;
         static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 3;
+        static int ANIMATION_TYPE_TOP_PADDING_CHANGED = 4;
+
         final long eventStartTime;
         final View changingView;
         final int animationType;
 
-        ChildHierarchyChangeEvent(View view, int type) {
+        AnimationEvent(View view, int type) {
             eventStartTime = AnimationUtils.currentAnimationTimeMillis();
             changingView = view;
             animationType = type;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index 42edbf3..09d8d50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -275,7 +275,7 @@
     private int getMaxAllowedChildHeight(View child) {
         if (child instanceof ExpandableNotificationRow) {
             ExpandableNotificationRow row = (ExpandableNotificationRow) child;
-            return row.getMaximumAllowedExpandHeight();
+            return row.getIntrinsicHeight();
         } else if (child instanceof ExpandableView) {
             ExpandableView expandableView = (ExpandableView) child;
             return expandableView.getActualHeight();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
index 8c75adc..26cef36 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
@@ -71,7 +71,7 @@
                 mStateMap.put(child, viewState);
             }
             // initialize with the default values of the view
-            viewState.height = child.getActualHeight();
+            viewState.height = child.getIntrinsicHeight();
             viewState.gone = child.getVisibility() == View.GONE;
             viewState.alpha = 1;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
index 24daa4f..4dce288 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
@@ -16,7 +16,6 @@
 
 package com.android.systemui.statusbar.stack;
 
-import android.animation.Animator;
 import android.animation.ValueAnimator;
 import android.view.View;
 import android.view.animation.AnimationUtils;
@@ -35,7 +34,7 @@
     private final Interpolator mFastOutSlowInInterpolator;
     public NotificationStackScrollLayout mHostLayout;
     private boolean mAnimationIsRunning;
-    private ArrayList<NotificationStackScrollLayout.ChildHierarchyChangeEvent> mHandledEvents =
+    private ArrayList<NotificationStackScrollLayout.AnimationEvent> mHandledEvents =
             new ArrayList<>();
 
     public StackStateAnimator(NotificationStackScrollLayout hostLayout) {
@@ -49,7 +48,7 @@
     }
 
     public void startAnimationForEvents(
-            ArrayList<NotificationStackScrollLayout.ChildHierarchyChangeEvent> mAnimationEvents,
+            ArrayList<NotificationStackScrollLayout.AnimationEvent> mAnimationEvents,
             StackScrollState finalState) {
         int numEvents = mAnimationEvents.size();
         if (numEvents == 0) {
@@ -96,7 +95,6 @@
     private void startPropertyAnimation(long newDuration, final boolean hasFinishAction,
             final ExpandableView child, StackScrollState.ViewState viewState, final float alpha) {
         child.animate().setInterpolator(mFastOutSlowInInterpolator)
-                .alpha(alpha)
                 .translationY(viewState.yTranslation)
                 .translationZ(viewState.zTranslation)
                 .setDuration(newDuration)
@@ -113,6 +111,9 @@
                         }
                     }
                 });
+        if (alpha != child.getAlpha()) {
+            child.animate().withLayer().alpha(alpha);
+        }
     }
 
     private void startHeightAnimation(long newDuration, final ExpandableView child,
@@ -136,11 +137,11 @@
      * @param finalState the final state to animate to
      */
     private void initializeAddedViewStates(
-            ArrayList<NotificationStackScrollLayout.ChildHierarchyChangeEvent> animationEvents,
+            ArrayList<NotificationStackScrollLayout.AnimationEvent> animationEvents,
             StackScrollState finalState) {
-        for (NotificationStackScrollLayout.ChildHierarchyChangeEvent event: animationEvents) {
+        for (NotificationStackScrollLayout.AnimationEvent event: animationEvents) {
             View changingView = event.changingView;
-            if (event.animationType == NotificationStackScrollLayout.ChildHierarchyChangeEvent
+            if (event.animationType == NotificationStackScrollLayout.AnimationEvent
                     .ANIMATION_TYPE_ADD && !mHandledEvents.contains(event)) {
 
                 // This item is added, initialize it's properties.
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 8bc669a..ae6aeee 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -667,7 +667,8 @@
     private void interceptPowerKeyDown(boolean handled) {
         mPowerKeyHandled = handled;
         if (!handled) {
-            mHandler.postDelayed(mPowerLongPress, ViewConfiguration.getGlobalActionKeyTimeout());
+            mHandler.postDelayed(mPowerLongPress,
+                    ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
         }
     }
 
@@ -706,9 +707,9 @@
         if (mKeyguardDelegate.isShowing()) {
             // Double the time it takes to take a screenshot from the keyguard
             return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER *
-                    ViewConfiguration.getGlobalActionKeyTimeout());
+                    ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout());
         }
-        return ViewConfiguration.getGlobalActionKeyTimeout();
+        return ViewConfiguration.get(mContext).getDeviceGlobalActionKeyTimeout();
     }
 
     private void cancelPendingScreenshotChordAction() {
@@ -990,9 +991,9 @@
 
         // Match current screen state.
         if (mPowerManager.isInteractive()) {
-            screenTurningOn(null);
+            wakingUp(null);
         } else {
-            screenTurnedOff(WindowManagerPolicy.OFF_BECAUSE_OF_USER);
+            goingToSleep(WindowManagerPolicy.OFF_BECAUSE_OF_USER);
         }
     }
 
@@ -4314,7 +4315,7 @@
     }
 
     @Override
-    public void screenTurnedOff(int why) {
+    public void goingToSleep(int why) {
         EventLog.writeEvent(70000, 0);
         synchronized (mLock) {
             mScreenOnEarly = false;
@@ -4330,7 +4331,7 @@
     }
 
     @Override
-    public void screenTurningOn(final ScreenOnListener screenOnListener) {
+    public void wakingUp(final ScreenOnListener screenOnListener) {
         EventLog.writeEvent(70000, 1);
         if (false) {
             RuntimeException here = new RuntimeException("here");
@@ -4776,7 +4777,11 @@
         mHandler.post(new Runnable() {
             @Override public void run() {
                 if (mBootMsgDialog == null) {
-                    mBootMsgDialog = new ProgressDialog(mContext) {
+                    int theme =  mContext.getPackageManager().hasSystemFeature(
+                            PackageManager.FEATURE_WATCH) ?
+                            com.android.internal.R.style.Theme_Micro_Dialog_Alert : 0;
+
+                    mBootMsgDialog = new ProgressDialog(mContext, theme) {
                         // This dialog will consume all events coming in to
                         // it, to avoid it trying to do things too early in boot.
                         @Override public boolean dispatchKeyEvent(KeyEvent event) {
diff --git a/services/core/java/com/android/server/NetworkScoreService.java b/services/core/java/com/android/server/NetworkScoreService.java
index 8a30e50..4f0c9b5 100644
--- a/services/core/java/com/android/server/NetworkScoreService.java
+++ b/services/core/java/com/android/server/NetworkScoreService.java
@@ -20,19 +20,24 @@
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
+import android.net.INetworkScoreCache;
 import android.net.INetworkScoreService;
-import android.net.NetworkKey;
 import android.net.NetworkScorerAppManager;
-import android.net.RssiCurve;
 import android.net.ScoredNetwork;
+import android.os.RemoteException;
 import android.text.TextUtils;
+import android.util.Log;
 
 import com.android.internal.R;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Backing service for {@link android.net.NetworkScoreManager}.
@@ -46,12 +51,11 @@
 
     private final Context mContext;
 
-    // TODO: Delete this temporary class once we have a real place for scores.
-    private final Map<NetworkKey, RssiCurve> mScoredNetworks;
+    private final Map<Integer, INetworkScoreCache> mScoreCaches;
 
     public NetworkScoreService(Context context) {
         mContext = context;
-        mScoredNetworks = new HashMap<>();
+        mScoreCaches = new HashMap<>();
     }
 
     /** Called when the system is ready to run third-party code but before it actually does so. */
@@ -76,10 +80,31 @@
                     " is not the active scorer.");
         }
 
-        // TODO: Propagate these scores down to the network subsystem layer instead of just holding
-        // them in memory.
+        // Separate networks by type.
+        Map<Integer, List<ScoredNetwork>> networksByType = new HashMap<>();
         for (ScoredNetwork network : networks) {
-            mScoredNetworks.put(network.networkKey, network.rssiCurve);
+            List<ScoredNetwork> networkList = networksByType.get(network.networkKey.type);
+            if (networkList == null) {
+                networkList = new ArrayList<>();
+                networksByType.put(network.networkKey.type, networkList);
+            }
+            networkList.add(network);
+        }
+
+        // Pass the scores of each type down to the appropriate network scorer.
+        for (Map.Entry<Integer, List<ScoredNetwork>> entry : networksByType.entrySet()) {
+            INetworkScoreCache scoreCache = mScoreCaches.get(entry.getKey());
+            if (scoreCache != null) {
+                try {
+                    scoreCache.updateScores(entry.getValue());
+                } catch (RemoteException e) {
+                    if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                        Log.v(TAG, "Unable to update scores of type " + entry.getKey(), e);
+                    }
+                }
+            } else if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                Log.v(TAG, "No scorer registered for type " + entry.getKey() + ", discarding");
+            }
         }
 
         return true;
@@ -112,8 +137,29 @@
 
     /** Clear scores. Callers are responsible for checking permissions as appropriate. */
     private void clearInternal() {
-        // TODO: Propagate the flush down to the network subsystem layer.
-        mScoredNetworks.clear();
+        Set<INetworkScoreCache> cachesToClear = getScoreCaches();
+
+        for (INetworkScoreCache scoreCache : cachesToClear) {
+            try {
+                scoreCache.clearScores();
+            } catch (RemoteException e) {
+                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                    Log.v(TAG, "Unable to clear scores", e);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache) {
+        mContext.enforceCallingOrSelfPermission(permission.BROADCAST_SCORE_NETWORKS, TAG);
+        synchronized (mScoreCaches) {
+            if (mScoreCaches.containsKey(networkType)) {
+                throw new IllegalArgumentException(
+                        "Score cache already registered for type " + networkType);
+            }
+            mScoreCaches.put(networkType, scoreCache);
+        }
     }
 
     @Override
@@ -125,12 +171,28 @@
             return;
         }
         writer.println("Current scorer: " + currentScorer);
-        if (mScoredNetworks.isEmpty()) {
-            writer.println("No networks scored.");
-        } else {
-            for (Map.Entry<NetworkKey, RssiCurve> entry : mScoredNetworks.entrySet()) {
-                writer.println(entry.getKey() + ": " + entry.getValue());
+
+        for (INetworkScoreCache scoreCache : getScoreCaches()) {
+            try {
+                scoreCache.asBinder().dump(fd, args);
+            } catch (RemoteException e) {
+                writer.println("Unable to dump score cache");
+                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                    Log.v(TAG, "Unable to dump score cache", e);
+                }
             }
         }
     }
+
+    /**
+     * Returns a set of all score caches that are currently active.
+     *
+     * <p>May be used to perform an action on all score caches without potentially strange behavior
+     * if a new scorer is registered during that action's execution.
+     */
+    private Set<INetworkScoreCache> getScoreCaches() {
+        synchronized (mScoreCaches) {
+            return new HashSet<>(mScoreCaches.values());
+        }
+    }
 }
diff --git a/services/core/java/com/android/server/am/UsageStatsService.java b/services/core/java/com/android/server/am/UsageStatsService.java
index 587f949..42cf900 100644
--- a/services/core/java/com/android/server/am/UsageStatsService.java
+++ b/services/core/java/com/android/server/am/UsageStatsService.java
@@ -73,42 +73,44 @@
     private static final boolean localLOGV = false;
     private static final boolean REPORT_UNEXPECTED = false;
     private static final String TAG = "UsageStats";
-    
+
     // Current on-disk Parcel version
     private static final int VERSION = 1008;
 
     private static final int CHECKIN_VERSION = 4;
-    
+
     private static final String FILE_PREFIX = "usage-";
 
     private static final String FILE_HISTORY = FILE_PREFIX + "history.xml";
 
-    private static final int FILE_WRITE_INTERVAL = 30*60*1000; //ms
-    
+    private static final int FILE_WRITE_INTERVAL = (localLOGV) ? 0 : 30*60*1000; // 30m in ms
+
     private static final int MAX_NUM_FILES = 5;
-    
+
     private static final int NUM_LAUNCH_TIME_BINS = 10;
     private static final int[] LAUNCH_TIME_BINS = {
         250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000
     };
-    
+
     static IUsageStats sService;
     private Context mContext;
     // structure used to maintain statistics since the last checkin.
-    final private ArrayMap<String, PkgUsageStatsExtended> mStats;
+    final private ArrayMap<String, PkgUsageStatsExtended> mStats
+            = new ArrayMap<String, PkgUsageStatsExtended>();
 
     // Maintains the last time any component was resumed, for all time.
-    final private ArrayMap<String, ArrayMap<String, Long>> mLastResumeTimes;
+    final private ArrayMap<String, ArrayMap<String, Long>> mLastResumeTimes
+            = new ArrayMap<String, ArrayMap<String, Long>>();
 
     // To remove last-resume time stats when a pacakge is removed.
     private PackageMonitor mPackageMonitor;
 
     // Lock to update package stats. Methods suffixed by SLOCK should invoked with
     // this lock held
-    final Object mStatsLock;
+    final Object mStatsLock = new Object();
     // Lock to write to file. Methods suffixed by FLOCK should invoked with
     // this lock held.
-    final Object mFileLock;
+    final Object mFileLock = new Object();
     // Order of locks is mFileLock followed by mStatsLock to avoid deadlocks
     private String mLastResumedPkg;
     private String mLastResumedComp;
@@ -118,52 +120,53 @@
     private String mFileLeaf;
     private File mDir;
 
-    private Calendar mCal; // guarded by itself
+    private final Calendar mCal // guarded by itself
+            = Calendar.getInstance(TimeZone.getTimeZone("GMT+0"));
 
     private final AtomicInteger mLastWriteDay = new AtomicInteger(-1);
     private final AtomicLong mLastWriteElapsedTime = new AtomicLong(0);
     private final AtomicBoolean mUnforcedDiskWriteRunning = new AtomicBoolean(false);
-    
+
     static class TimeStats {
-        int count;
-        int[] times = new int[NUM_LAUNCH_TIME_BINS];
-        
+        int mCount;
+        final int[] mTimes = new int[NUM_LAUNCH_TIME_BINS];
+
         TimeStats() {
         }
-        
+
         void incCount() {
-            count++;
+            mCount++;
         }
-        
+
         void add(int val) {
             final int[] bins = LAUNCH_TIME_BINS;
             for (int i=0; i<NUM_LAUNCH_TIME_BINS-1; i++) {
                 if (val < bins[i]) {
-                    times[i]++;
+                    mTimes[i]++;
                     return;
                 }
             }
-            times[NUM_LAUNCH_TIME_BINS-1]++;
+            mTimes[NUM_LAUNCH_TIME_BINS-1]++;
         }
-        
+
         TimeStats(Parcel in) {
-            count = in.readInt();
-            final int[] localTimes = times;
+            mCount = in.readInt();
+            final int[] localTimes = mTimes;
             for (int i=0; i<NUM_LAUNCH_TIME_BINS; i++) {
                 localTimes[i] = in.readInt();
             }
         }
-        
+
         void writeToParcel(Parcel out) {
-            out.writeInt(count);
-            final int[] localTimes = times;
+            out.writeInt(mCount);
+            final int[] localTimes = mTimes;
             for (int i=0; i<NUM_LAUNCH_TIME_BINS; i++) {
                 out.writeInt(localTimes[i]);
             }
         }
     }
-    
-    private class PkgUsageStatsExtended {
+
+    static class PkgUsageStatsExtended {
         final ArrayMap<String, TimeStats> mLaunchTimes
                 = new ArrayMap<String, TimeStats>();
         final ArrayMap<String, TimeStats> mFullyDrawnTimes
@@ -172,18 +175,18 @@
         long mUsageTime;
         long mPausedTime;
         long mResumedTime;
-        
+
         PkgUsageStatsExtended() {
             mLaunchCount = 0;
             mUsageTime = 0;
         }
-        
+
         PkgUsageStatsExtended(Parcel in) {
             mLaunchCount = in.readInt();
             mUsageTime = in.readLong();
             if (localLOGV) Slog.v(TAG, "Launch count: " + mLaunchCount
                     + ", Usage time:" + mUsageTime);
-            
+
             final int numLaunchTimeStats = in.readInt();
             if (localLOGV) Slog.v(TAG, "Reading launch times: " + numLaunchTimeStats);
             mLaunchTimes.ensureCapacity(numLaunchTimeStats);
@@ -207,16 +210,16 @@
 
         void updateResume(String comp, boolean launched) {
             if (launched) {
-                mLaunchCount ++;
+                mLaunchCount++;
             }
             mResumedTime = SystemClock.elapsedRealtime();
         }
-        
+
         void updatePause() {
             mPausedTime =  SystemClock.elapsedRealtime();
             mUsageTime += (mPausedTime - mResumedTime);
         }
-        
+
         void addLaunchCount(String comp) {
             TimeStats times = mLaunchTimes.get(comp);
             if (times == null) {
@@ -225,7 +228,7 @@
             }
             times.incCount();
         }
-        
+
         void addLaunchTime(String comp, int millis) {
             TimeStats times = mLaunchTimes.get(comp);
             if (times == null) {
@@ -260,7 +263,7 @@
                 mFullyDrawnTimes.valueAt(i).writeToParcel(out);
             }
         }
-        
+
         void clear() {
             mLaunchTimes.clear();
             mFullyDrawnTimes.clear();
@@ -268,32 +271,25 @@
             mUsageTime = 0;
         }
     }
-    
+
     UsageStatsService(String dir) {
-        mStats = new ArrayMap<String, PkgUsageStatsExtended>();
-        mLastResumeTimes = new ArrayMap<String, ArrayMap<String, Long>>();
-        mStatsLock = new Object();
-        mFileLock = new Object();
+        if (localLOGV) Slog.v(TAG, "UsageStatsService: " + dir);
         mDir = new File(dir);
-        mCal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0"));
-        
         mDir.mkdir();
-        
-        // Remove any old usage files from previous versions.
+
+        // Remove any old /data/system/usagestats.* files from previous versions.
         File parentDir = mDir.getParentFile();
-        String fList[] = parentDir.list();
-        if (fList != null) {
+        String files[] = parentDir.list();
+        if (files != null) {
             String prefix = mDir.getName() + ".";
-            int i = fList.length;
-            while (i > 0) {
-                i--;
-                if (fList[i].startsWith(prefix)) {
-                    Slog.i(TAG, "Deleting old usage file: " + fList[i]);
-                    (new File(parentDir, fList[i])).delete();
+            for (String file : files) {
+                if (file.startsWith(prefix)) {
+                    Slog.i(TAG, "Deleting old usage file: " + file);
+                    (new File(parentDir, file)).delete();
                 }
             }
         }
-        
+
         // Update current stats which are binned by date
         mFileLeaf = getCurrentDateStr(FILE_PREFIX);
         mFile = new File(mDir, mFileLeaf);
@@ -310,11 +306,11 @@
      */
     private String getCurrentDateStr(String prefix) {
         StringBuilder sb = new StringBuilder();
+        if (prefix != null) {
+            sb.append(prefix);
+        }
         synchronized (mCal) {
             mCal.setTimeInMillis(System.currentTimeMillis());
-            if (prefix != null) {
-                sb.append(prefix);
-            }
             sb.append(mCal.get(Calendar.YEAR));
             int mm = mCal.get(Calendar.MONTH) - Calendar.JANUARY +1;
             if (mm < 10) {
@@ -329,17 +325,20 @@
         }
         return sb.toString();
     }
-    
+
     private Parcel getParcelForFile(File file) throws IOException {
         FileInputStream stream = new FileInputStream(file);
-        byte[] raw = readFully(stream);
-        Parcel in = Parcel.obtain();
-        in.unmarshall(raw, 0, raw.length);
-        in.setDataPosition(0);
-        stream.close();
-        return in;
+        try {
+            byte[] raw = readFully(stream);
+            Parcel in = Parcel.obtain();
+            in.unmarshall(raw, 0, raw.length);
+            in.setDataPosition(0);
+            return in;
+        } finally {
+            stream.close();
+        }
     }
-    
+
     private void readStatsFromFile() {
         File newFile = mFile;
         synchronized (mFileLock) {
@@ -356,12 +355,13 @@
             }
         }
     }
-    
+
     private void readStatsFLOCK(File file) throws IOException {
         Parcel in = getParcelForFile(file);
         int vers = in.readInt();
-        if (vers != VERSION) {
-            Slog.w(TAG, "Usage stats version changed; dropping");
+        if (vers != VERSION) {  // vers will be 0 if the parcel file was empty
+            Slog.w(TAG, "Usage stats version of " + file + " changed from " + vers + " to "
+                   + VERSION + "; dropping");
             return;
         }
         int N = in.readInt();
@@ -382,12 +382,12 @@
     private void readHistoryStatsFromFile() {
         synchronized (mFileLock) {
             if (mHistoryFile.getBaseFile().exists()) {
-                readHistoryStatsFLOCK(mHistoryFile);
+                readHistoryStatsFLOCK();
             }
         }
     }
 
-    private void readHistoryStatsFLOCK(AtomicFile file) {
+    private void readHistoryStatsFLOCK() {
         FileInputStream fis = null;
         try {
             fis = mHistoryFile.openRead();
@@ -470,12 +470,12 @@
         }
         return fileList;
     }
-    
+
     private void checkFileLimitFLOCK() {
         // Get all usage stats output files
         ArrayList<String> fileList = getUsageStatsFileListFLOCK();
         if (fileList == null) {
-            // Strange but we dont have to delete any thing
+            // Empty /data/system/usagestats/ so we don't have anything to delete
             return;
         }
         int count = fileList.size();
@@ -575,8 +575,8 @@
                 }
 
                 if (dayChanged || forceWriteHistoryStats) {
-                    // Write history stats daily, or when forced (due to shutdown).
-                    writeHistoryStatsFLOCK(mHistoryFile);
+                    // Write history stats daily or when forced (due to shutdown) or when debugging.
+                    writeHistoryStatsFLOCK();
                 }
 
                 // Delete the backup file
@@ -638,10 +638,10 @@
         }
     }
 
-    private void writeHistoryStatsFLOCK(AtomicFile historyFile) {
+    private void writeHistoryStatsFLOCK() {
         FileOutputStream fos = null;
         try {
-            fos = historyFile.startWrite();
+            fos = mHistoryFile.startWrite();
             XmlSerializer out = new FastXmlSerializer();
             out.setOutput(fos, "utf-8");
             out.startDocument(null, true);
@@ -664,11 +664,11 @@
             out.endTag(null, "usage-history");
             out.endDocument();
 
-            historyFile.finishWrite(fos);
+            mHistoryFile.finishWrite(fos);
         } catch (IOException e) {
             Slog.w(TAG,"Error writing history stats" + e);
             if (fos != null) {
-                historyFile.failWrite(fos);
+                mHistoryFile.failWrite(fos);
             }
         }
     }
@@ -711,7 +711,8 @@
         sService = asInterface(b);
         return sService;
     }
-    
+
+    @Override
     public void noteResumeComponent(ComponentName componentName) {
         enforceCallingPermission();
         String pkgName;
@@ -720,7 +721,7 @@
                     ((pkgName = componentName.getPackageName()) == null)) {
                 return;
             }
-            
+
             final boolean samePackage = pkgName.equals(mLastResumedPkg);
             if (mIsResumed) {
                 if (mLastResumedPkg != null) {
@@ -734,14 +735,14 @@
                     }
                 }
             }
-            
+
             final boolean sameComp = samePackage
                     && componentName.getClassName().equals(mLastResumedComp);
-            
+
             mIsResumed = true;
             mLastResumedPkg = pkgName;
             mLastResumedComp = componentName.getClassName();
-            
+
             if (localLOGV) Slog.i(TAG, "started component:" + pkgName);
             PkgUsageStatsExtended pus = mStats.get(pkgName);
             if (pus == null) {
@@ -762,9 +763,10 @@
         }
     }
 
+    @Override
     public void notePauseComponent(ComponentName componentName) {
         enforceCallingPermission();
-        
+
         synchronized (mStatsLock) {
             String pkgName;
             if ((componentName == null) ||
@@ -777,9 +779,9 @@
                 return;
             }
             mIsResumed = false;
-            
+
             if (localLOGV) Slog.i(TAG, "paused component:"+pkgName);
-        
+
             PkgUsageStatsExtended pus = mStats.get(pkgName);
             if (pus == null) {
                 // Weird some error here
@@ -788,11 +790,12 @@
             }
             pus.updatePause();
         }
-        
+
         // Persist current data to file if needed.
         writeStatsToFile(false, false);
     }
-    
+
+    @Override
     public void noteLaunchTime(ComponentName componentName, int millis) {
         enforceCallingPermission();
         String pkgName;
@@ -800,10 +803,10 @@
                 ((pkgName = componentName.getPackageName()) == null)) {
             return;
         }
-        
+
         // Persist current data to file if needed.
         writeStatsToFile(false, false);
-        
+
         synchronized (mStatsLock) {
             PkgUsageStatsExtended pus = mStats.get(pkgName);
             if (pus != null) {
@@ -811,7 +814,7 @@
             }
         }
     }
-    
+
     public void noteFullyDrawnTime(ComponentName componentName, int millis) {
         enforceCallingPermission();
         String pkgName;
@@ -838,7 +841,8 @@
         mContext.enforcePermission(android.Manifest.permission.UPDATE_DEVICE_STATS,
                 Binder.getCallingPid(), Binder.getCallingUid(), null);
     }
-    
+
+    @Override
     public PkgUsageStats getPkgUsageStats(ComponentName componentName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.PACKAGE_USAGE_STATS, null);
@@ -858,7 +862,8 @@
             return new PkgUsageStats(pkgName, launchCount, usageTime, lastResumeTimes);
         }
     }
-    
+
+    @Override
     public PkgUsageStats[] getAllPkgUsageStats() {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.PACKAGE_USAGE_STATS, null);
@@ -884,8 +889,8 @@
             return retArr;
         }
     }
-    
-    static byte[] readFully(FileInputStream stream) throws java.io.IOException {
+
+    static byte[] readFully(FileInputStream stream) throws IOException {
         int pos = 0;
         int avail = stream.available();
         byte[] data = new byte[avail];
@@ -903,7 +908,7 @@
             }
         }
     }
-    
+
     private void collectDumpInfoFLOCK(PrintWriter pw, boolean isCompactOutput,
             boolean deleteAfterPrint, HashSet<String> packages) {
         List<String> fileList = getUsageStatsFileListFLOCK();
@@ -932,15 +937,12 @@
                     // Delete old file after collecting info only for checkin requests
                     dFile.delete();
                 }
-            } catch (FileNotFoundException e) {
-                Slog.w(TAG, "Failed with "+e+" when collecting dump info from file : " + file);
-                return;
             } catch (IOException e) {
                 Slog.w(TAG, "Failed with "+e+" when collecting dump info from file : "+file);
-            }      
+            }
         }
     }
-    
+
     private void collectDumpInfoFromParcelFLOCK(Parcel in, PrintWriter pw,
             String date, boolean isCompactOutput, HashSet<String> packages) {
         StringBuilder sb = new StringBuilder(512);
@@ -951,19 +953,19 @@
         } else {
             sb.append("Date: ");
         }
-        
+
         sb.append(date);
-        
+
         int vers = in.readInt();
         if (vers != VERSION) {
             sb.append(" (old data version)");
             pw.println(sb.toString());
             return;
         }
-        
+
         pw.println(sb.toString());
         int N = in.readInt();
-        
+
         while (N > 0) {
             N--;
             String pkgName = in.readString();
@@ -990,10 +992,10 @@
                     sb.append(activity);
                     TimeStats times = pus.mLaunchTimes.valueAt(i);
                     sb.append(',');
-                    sb.append(times.count);
+                    sb.append(times.mCount);
                     for (int j=0; j<NUM_LAUNCH_TIME_BINS; j++) {
                         sb.append(",");
-                        sb.append(times.times[j]);
+                        sb.append(times.mTimes[j]);
                     }
                     sb.append('\n');
                 }
@@ -1005,7 +1007,7 @@
                     TimeStats times = pus.mFullyDrawnTimes.valueAt(i);
                     for (int j=0; j<NUM_LAUNCH_TIME_BINS; j++) {
                         sb.append(",");
-                        sb.append(times.times[j]);
+                        sb.append(times.mTimes[j]);
                     }
                     sb.append('\n');
                 }
@@ -1025,26 +1027,26 @@
                     sb.append(pus.mLaunchTimes.keyAt(i));
                     TimeStats times = pus.mLaunchTimes.valueAt(i);
                     sb.append(": ");
-                    sb.append(times.count);
+                    sb.append(times.mCount);
                     sb.append(" starts");
                     int lastBin = 0;
                     for (int j=0; j<NUM_LAUNCH_TIME_BINS-1; j++) {
-                        if (times.times[j] != 0) {
+                        if (times.mTimes[j] != 0) {
                             sb.append(", ");
                             sb.append(lastBin);
                             sb.append('-');
                             sb.append(LAUNCH_TIME_BINS[j]);
                             sb.append("ms=");
-                            sb.append(times.times[j]);
+                            sb.append(times.mTimes[j]);
                         }
                         lastBin = LAUNCH_TIME_BINS[j];
                     }
-                    if (times.times[NUM_LAUNCH_TIME_BINS-1] != 0) {
+                    if (times.mTimes[NUM_LAUNCH_TIME_BINS-1] != 0) {
                         sb.append(", ");
                         sb.append(">=");
                         sb.append(lastBin);
                         sb.append("ms=");
-                        sb.append(times.times[NUM_LAUNCH_TIME_BINS-1]);
+                        sb.append(times.mTimes[NUM_LAUNCH_TIME_BINS-1]);
                     }
                     sb.append('\n');
                 }
@@ -1057,7 +1059,7 @@
                     boolean needComma = false;
                     int lastBin = 0;
                     for (int j=0; j<NUM_LAUNCH_TIME_BINS-1; j++) {
-                        if (times.times[j] != 0) {
+                        if (times.mTimes[j] != 0) {
                             if (needComma) {
                                 sb.append(", ");
                             } else {
@@ -1067,27 +1069,27 @@
                             sb.append('-');
                             sb.append(LAUNCH_TIME_BINS[j]);
                             sb.append("ms=");
-                            sb.append(times.times[j]);
+                            sb.append(times.mTimes[j]);
                         }
                         lastBin = LAUNCH_TIME_BINS[j];
                     }
-                    if (times.times[NUM_LAUNCH_TIME_BINS-1] != 0) {
+                    if (times.mTimes[NUM_LAUNCH_TIME_BINS-1] != 0) {
                         if (needComma) {
                             sb.append(", ");
                         }
                         sb.append(">=");
                         sb.append(lastBin);
                         sb.append("ms=");
-                        sb.append(times.times[NUM_LAUNCH_TIME_BINS-1]);
+                        sb.append(times.mTimes[NUM_LAUNCH_TIME_BINS-1]);
                     }
                     sb.append('\n');
                 }
             }
-            
+
             pw.write(sb.toString());
         }
     }
-    
+
     /**
      * Searches array of arguments for the specified string
      * @param args array of argument strings
@@ -1104,7 +1106,7 @@
         }
         return false;
     }
-    
+
     /**
      * Searches array of arguments for the specified string's data
      * @param args array of argument strings
@@ -1123,11 +1125,11 @@
         }
         return null;
     }
-    
-    @Override
+
     /*
-     * The data persisted to file is parsed and the stats are computed. 
+     * The data persisted to file is parsed and the stats are computed.
      */
+    @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingPermission(android.Manifest.permission.DUMP)
                 != PackageManager.PERMISSION_GRANTED) {
@@ -1141,23 +1143,23 @@
         final boolean isCompactOutput = isCheckinRequest || scanArgs(args, "-c");
         final boolean deleteAfterPrint = isCheckinRequest || scanArgs(args, "-d");
         final String rawPackages = scanArgsData(args, "--packages");
-        
+
         // Make sure the current stats are written to the file.  This
         // doesn't need to be done if we are deleting files after printing,
-        // since it that case we won't print the current stats.
+        // since in that case we won't print the current stats.
         if (!deleteAfterPrint) {
             writeStatsToFile(true, false);
         }
-        
+
         HashSet<String> packages = null;
         if (rawPackages != null) {
             if (!"*".equals(rawPackages)) {
                 // A * is a wildcard to show all packages.
                 String[] names = rawPackages.split(",");
+                if (names.length != 0) {
+                    packages = new HashSet<String>();
+                }
                 for (String n : names) {
-                    if (packages == null) {
-                        packages = new HashSet<String>();
-                    }
                     packages.add(n);
                 }
             }
@@ -1167,7 +1169,7 @@
             Slog.w(TAG, "Checkin without packages");
             return;
         }
-        
+
         synchronized (mFileLock) {
             collectDumpInfoFLOCK(pw, isCompactOutput, deleteAfterPrint, packages);
         }
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 5f07108..c87fc99 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -16,9 +16,20 @@
 
 package com.android.server.hdmi;
 
+import android.hardware.hdmi.HdmiCec;
+import android.hardware.hdmi.HdmiCecDeviceInfo;
+import android.hardware.hdmi.HdmiCecMessage;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
+import android.util.Slog;
+import android.util.SparseArray;
+
+import libcore.util.EmptyArray;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * Manages HDMI-CEC command and behaviors. It converts user's command into CEC command
@@ -32,17 +43,48 @@
 class HdmiCecController {
     private static final String TAG = "HdmiCecController";
 
+    private static final byte[] EMPTY_BODY = EmptyArray.BYTE;
+
+    // A message to pass cec send command to IO looper.
+    private static final int MSG_SEND_CEC_COMMAND = 1;
+    // A message to delegate logical allocation to IO looper.
+    private static final int MSG_ALLOCATE_LOGICAL_ADDRESS = 2;
+
+    // Message types to handle incoming message in main service looper.
+    private final static int MSG_RECEIVE_CEC_COMMAND = 1;
+    // A message to report allocated logical address to main control looper.
+    private final static int MSG_REPORT_LOGICAL_ADDRESS = 2;
+
+    // TODO: move these values to HdmiCec.java once make it internal constant class.
+    // CEC's ABORT reason values.
+    private static final int ABORT_UNRECOGNIZED_MODE = 0;
+    private static final int ABORT_NOT_IN_CORRECT_MODE = 1;
+    private static final int ABORT_CANNOT_PROVIDE_SOURCE = 2;
+    private static final int ABORT_INVALID_OPERAND = 3;
+    private static final int ABORT_REFUSED = 4;
+    private static final int ABORT_UNABLE_TO_DETERMINE = 5;
+
+    private static final int NUM_LOGICAL_ADDRESS = 16;
+
+    // TODO: define other constants for errors.
+    private static final int ERROR_SUCCESS = 0;
+
     // Handler instance to process synchronous I/O (mainly send) message.
     private Handler mIoHandler;
 
     // Handler instance to process various messages coming from other CEC
     // device or issued by internal state change.
-    private Handler mMessageHandler;
+    private Handler mControlHandler;
 
     // Stores the pointer to the native implementation of the service that
     // interacts with HAL.
     private long mNativePtr;
 
+    // Map-like container of all cec devices. A logical address of device is
+    // used as key of container.
+    private final SparseArray<HdmiCecDeviceInfo> mDeviceInfos =
+            new SparseArray<HdmiCecDeviceInfo>();
+
     // Private constructor.  Use HdmiCecController.create().
     private HdmiCecController() {
     }
@@ -52,14 +94,12 @@
      * inner device or has no device it will return {@code null}.
      *
      * <p>Declared as package-private, accessed by {@link HdmiControlService} only.
-     *
-     * @param ioLooper a Looper instance to handle IO (mainly send message) operation.
-     * @param messageHandler a message handler that processes a message coming from other
-     *                       CEC compatible device or callback of internal state change.
+     * @param service {@link HdmiControlService} instance used to create internal handler
+     *                and to pass callback for incoming message or event.
      * @return {@link HdmiCecController} if device is initialized successfully. Otherwise,
      *         returns {@code null}.
      */
-    static HdmiCecController create(Looper ioLooper, Handler messageHandler) {
+    static HdmiCecController create(HdmiControlService service) {
         HdmiCecController handler = new HdmiCecController();
         long nativePtr = nativeInit(handler);
         if (nativePtr == 0L) {
@@ -67,28 +107,263 @@
             return null;
         }
 
-        handler.init(ioLooper, messageHandler, nativePtr);
+        handler.init(service, nativePtr);
         return handler;
     }
 
-    private void init(Looper ioLooper, Handler messageHandler, long nativePtr) {
-        mIoHandler = new Handler(ioLooper) {
-                @Override
-            public void handleMessage(Message msg) {
-                // TODO: Call native sendMessage.
-            }
-        };
-
-        mMessageHandler = messageHandler;
-        mNativePtr = nativePtr;
+    /**
+     * Interface to report allocated logical address.
+     */
+    interface AllocateLogicalAddressCallback {
+        /**
+         * Called when a new logical address is allocated.
+         *
+         * @param deviceType requested device type to allocate logical address
+         * @param logicalAddress allocated logical address. If it is
+         *                       {@link HdmiCec#ADDR_UNREGISTERED}, it means that
+         *                       it failed to allocate logical address for the given device type
+         */
+        void onAllocated(int deviceType, int logicalAddress);
     }
 
     /**
-     * Called by native when an HDMI-CEC message arrived.
+     * Allocate a new logical address of the given device type. Allocated
+     * address will be reported through {@link AllocateLogicalAddressCallback}.
+     *
+     * <p> Declared as package-private, accessed by {@link HdmiControlService} only.
+     *
+     * @param deviceType type of device to used to determine logical address
+     * @param preferredAddress a logical address preferred to be allocated.
+     *                         If sets {@link HdmiCec#ADDR_UNREGISTERED}, scans
+     *                         the smallest logical address matched with the given device type.
+     *                         Otherwise, scan address will start from {@code preferredAddress}
+     * @param callback callback interface to report allocated logical address to caller
      */
-    private void handleMessage(int srcAddress, int dstAddres, int opcode, byte[] params) {
-        // TODO: Translate message and delegate it to main message handler.
+    void allocateLogicalAddress(int deviceType, int preferredAddress,
+            AllocateLogicalAddressCallback callback) {
+        Message msg = mIoHandler.obtainMessage(MSG_ALLOCATE_LOGICAL_ADDRESS);
+        msg.arg1 = deviceType;
+        msg.arg2 = preferredAddress;
+        msg.obj = callback;
+        mIoHandler.sendMessage(msg);
+    }
+
+    private static byte[] buildBody(int opcode, byte[] params) {
+        byte[] body = new byte[params.length + 1];
+        body[0] = (byte) opcode;
+        System.arraycopy(params, 0, body, 1, params.length);
+        return body;
+    }
+
+    private final class IoHandler extends Handler {
+        private IoHandler(Looper looper) {
+            super(looper);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_SEND_CEC_COMMAND:
+                    HdmiCecMessage cecMessage = (HdmiCecMessage) msg.obj;
+                    byte[] body = buildBody(cecMessage.getOpcode(), cecMessage.getParams());
+                    nativeSendCecCommand(mNativePtr, cecMessage.getSource(),
+                            cecMessage.getDestination(), body);
+                    break;
+                case MSG_ALLOCATE_LOGICAL_ADDRESS:
+                    int deviceType = msg.arg1;
+                    int preferredAddress = msg.arg2;
+                    AllocateLogicalAddressCallback callback =
+                            (AllocateLogicalAddressCallback) msg.obj;
+                    handleAllocateLogicalAddress(deviceType, preferredAddress, callback);
+                    break;
+                default:
+                    Slog.w(TAG, "Unsupported CEC Io request:" + msg.what);
+                    break;
+            }
+        }
+
+        private void handleAllocateLogicalAddress(int deviceType, int preferredAddress,
+                AllocateLogicalAddressCallback callback) {
+            int startAddress = preferredAddress;
+            // If preferred address is "unregistered", start_index will be the smallest
+            // address matched with the given device type.
+            if (preferredAddress == HdmiCec.ADDR_UNREGISTERED) {
+                for (int i = 0; i < NUM_LOGICAL_ADDRESS; ++i) {
+                    if (deviceType == HdmiCec.getTypeFromAddress(i)) {
+                        startAddress = i;
+                        break;
+                    }
+                }
+            }
+
+            int logcialAddress = HdmiCec.ADDR_UNREGISTERED;
+            // Iterates all possible addresses which has the same device type.
+            for (int i = 0; i < NUM_LOGICAL_ADDRESS; ++i) {
+                int curAddress = (startAddress + i) % NUM_LOGICAL_ADDRESS;
+                if (curAddress != HdmiCec.ADDR_UNREGISTERED
+                        && deviceType == HdmiCec.getTypeFromAddress(i)) {
+                    // <Polling Message> is a message which has empty body and
+                    // uses same address for both source and destination address.
+                    // If sending <Polling Message> failed (NAK), it becomes
+                    // new logical address for the device because no device uses
+                    // it as logical address of the device.
+                    int error = nativeSendCecCommand(mNativePtr, curAddress, curAddress,
+                            EMPTY_BODY);
+                    if (error != ERROR_SUCCESS) {
+                        logcialAddress = curAddress;
+                        break;
+                    }
+                }
+            }
+
+            Message msg = mControlHandler.obtainMessage(MSG_REPORT_LOGICAL_ADDRESS);
+            msg.arg1 = deviceType;
+            msg.arg2 = logcialAddress;
+            msg.obj = callback;
+            mControlHandler.sendMessage(msg);
+        }
+    }
+
+    private final class ControlHandler extends Handler {
+        private ControlHandler(Looper looper) {
+            super(looper);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_RECEIVE_CEC_COMMAND:
+                    // TODO: delegate it to HdmiControl service.
+                    onReceiveCommand((HdmiCecMessage) msg.obj);
+                    break;
+                case MSG_REPORT_LOGICAL_ADDRESS:
+                    int deviceType = msg.arg1;
+                    int logicalAddress = msg.arg2;
+                    AllocateLogicalAddressCallback callback =
+                            (AllocateLogicalAddressCallback) msg.obj;
+                    callback.onAllocated(deviceType, logicalAddress);
+                    break;
+                default:
+                    Slog.i(TAG, "Unsupported message type:" + msg.what);
+                    break;
+            }
+        }
+    }
+
+    /**
+     * Add a new {@link HdmiCecDeviceInfo}. It returns old device info which has the same
+     * logical address as new device info's.
+     *
+     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
+     *
+     * @param deviceInfo a new {@link HdmiCecDeviceInfo} to be added.
+     * @return {@code null} if it is new device. Otherwise, returns old {@HdmiCecDeviceInfo}
+     *         that has the same logical address as new one has.
+     */
+    HdmiCecDeviceInfo addDeviceInfo(HdmiCecDeviceInfo deviceInfo) {
+        HdmiCecDeviceInfo oldDeviceInfo = getDeviceInfo(deviceInfo.getLogicalAddress());
+        if (oldDeviceInfo != null) {
+            removeDeviceInfo(deviceInfo.getLogicalAddress());
+        }
+        mDeviceInfos.append(deviceInfo.getLogicalAddress(), deviceInfo);
+        return oldDeviceInfo;
+    }
+
+    /**
+     * Remove a device info corresponding to the given {@code logicalAddress}.
+     * It returns removed {@link HdmiCecDeviceInfo} if exists.
+     *
+     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
+     *
+     * @param logicalAddress logical address of device to be removed
+     * @return removed {@link HdmiCecDeviceInfo} it exists. Otherwise, returns {@code null}
+     */
+    HdmiCecDeviceInfo removeDeviceInfo(int logicalAddress) {
+        HdmiCecDeviceInfo deviceInfo = mDeviceInfos.get(logicalAddress);
+        if (deviceInfo != null) {
+            mDeviceInfos.remove(logicalAddress);
+        }
+        return deviceInfo;
+    }
+
+    /**
+     * Return a list of all {@HdmiCecDeviceInfo}.
+     *
+     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
+     */
+    List<HdmiCecDeviceInfo> getDeviceInfoList() {
+        List<HdmiCecDeviceInfo> deviceInfoList = new ArrayList<HdmiCecDeviceInfo>(
+                mDeviceInfos.size());
+        for (int i = 0; i < mDeviceInfos.size(); ++i) {
+            deviceInfoList.add(mDeviceInfos.valueAt(i));
+        }
+        return deviceInfoList;
+    }
+
+    /**
+     * Return a {@link HdmiCecDeviceInfo} corresponding to the given {@code logicalAddress}.
+     *
+     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
+     *
+     * @param logicalAddress logical address to be retrieved
+     * @return {@link HdmiCecDeviceInfo} matched with the given {@code logicalAddress}.
+     *         Returns null if no logical address matched
+     */
+    HdmiCecDeviceInfo getDeviceInfo(int logicalAddress) {
+        return mDeviceInfos.get(logicalAddress);
+    }
+
+    private void init(HdmiControlService service, long nativePtr) {
+        mIoHandler = new IoHandler(service.getServiceLooper());
+        mControlHandler = new ControlHandler(service.getServiceLooper());
+        mNativePtr = nativePtr;
+    }
+
+    private void onReceiveCommand(HdmiCecMessage message) {
+        // TODO: Handle message according to opcode type.
+
+        // TODO: Use device's source address for broadcast message.
+        int sourceAddress = message.getDestination() != HdmiCec.ADDR_BROADCAST ?
+                message.getDestination() : 0;
+        // Reply <Feature Abort> to initiator (source) for all requests.
+        sendFeatureAbort(sourceAddress, message.getSource(), message.getOpcode(),
+                ABORT_REFUSED);
+    }
+
+    private void sendFeatureAbort(int srcAddress, int destAddress, int originalOpcode,
+            int reason) {
+        byte[] params = new byte[2];
+        params[0] = (byte) originalOpcode;
+        params[1] = (byte) reason;
+
+        HdmiCecMessage cecMessage = new HdmiCecMessage(srcAddress, destAddress,
+                HdmiCec.MESSAGE_FEATURE_ABORT, params);
+        Message message = mIoHandler.obtainMessage(MSG_SEND_CEC_COMMAND, cecMessage);
+        mIoHandler.sendMessage(message);
+    }
+
+    /**
+     * Called by native when incoming CEC message arrived.
+     */
+    private void handleIncomingCecCommand(int srcAddress, int dstAddress, byte[] body) {
+        byte opcode = body[0];
+        byte params[] = Arrays.copyOfRange(body, 1, body.length);
+        HdmiCecMessage cecMessage = new HdmiCecMessage(srcAddress, dstAddress, opcode, params);
+
+        // Delegate message to main handler so that it handles in main thread.
+        Message message = mControlHandler.obtainMessage(
+                MSG_RECEIVE_CEC_COMMAND, cecMessage);
+        mControlHandler.sendMessage(message);
+    }
+
+    /**
+     * Called by native when a hotplug event issues.
+     */
+    private void handleHotplug(boolean connected) {
+        // TODO: Delegate event to main message handler.
     }
 
     private static native long nativeInit(HdmiCecController handler);
+    private static native int nativeSendCecCommand(long contollerPtr, int srcAddress,
+            int dstAddress, byte[] body);
 }
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 56c5b49..7c1995e 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -18,9 +18,8 @@
 
 import android.annotation.Nullable;
 import android.content.Context;
-import android.os.Handler;
 import android.os.HandlerThread;
-import android.os.Message;
+import android.os.Looper;
 import android.util.Slog;
 
 import com.android.server.SystemService;
@@ -37,14 +36,6 @@
     // and sparse call it shares a thread to handle IO operations.
     private final HandlerThread mIoThread = new HandlerThread("Hdmi Control Io Thread");
 
-    // Main handler class to handle incoming message from each controller.
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            // TODO: Add handler for each message type.
-        }
-    };
-
     @Nullable
     private HdmiCecController mCecController;
 
@@ -57,14 +48,33 @@
 
     @Override
     public void onStart() {
-        mCecController = HdmiCecController.create(mIoThread.getLooper(), mHandler);
+        mCecController = HdmiCecController.create(this);
         if (mCecController == null) {
             Slog.i(TAG, "Device does not support HDMI-CEC.");
         }
 
-        mMhlController = HdmiMhlController.create(mIoThread.getLooper(), mHandler);
+        mMhlController = HdmiMhlController.create(this);
         if (mMhlController == null) {
             Slog.i(TAG, "Device does not support MHL-control.");
         }
     }
+
+    /**
+     * Returns {@link Looper} for IO operation.
+     *
+     * <p>Declared as package-private.
+     */
+    Looper getIoLooper() {
+        return mIoThread.getLooper();
+    }
+
+    /**
+     * Returns {@link Looper} of main thread. Use this {@link Looper} instance
+     * for tasks that are running on main service thread.
+     *
+     * <p>Declared as package-private.
+     */
+    Looper getServiceLooper() {
+        return Looper.myLooper();
+    }
 }
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index ab63c9c..48e9737 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -38,6 +38,7 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.util.Log;
 import android.util.Slog;
 
 import com.android.internal.content.PackageMonitor;
@@ -50,7 +51,7 @@
  * managed profiles. 
  */
 public class LauncherAppsService extends ILauncherApps.Stub {
-
+    private static final boolean DEBUG = false;
     private static final String TAG = "LauncherAppsService";
     private final Context mContext;
     private final PackageManager mPm;
@@ -73,11 +74,17 @@
     @Override
     public void addOnAppsChangedListener(IOnAppsChangedListener listener) throws RemoteException {
         synchronized (mListeners) {
+            if (DEBUG) {
+                Log.d(TAG, "Adding listener from " + Binder.getCallingUserHandle());
+            }
             if (mListeners.getRegisteredCallbackCount() == 0) {
+                if (DEBUG) {
+                    Log.d(TAG, "Starting package monitoring");
+                }
                 startWatchingPackageBroadcasts();
             }
             mListeners.unregister(listener);
-            mListeners.register(listener);
+            mListeners.register(listener, Binder.getCallingUserHandle());
         }
     }
 
@@ -89,6 +96,9 @@
     public void removeOnAppsChangedListener(IOnAppsChangedListener listener)
             throws RemoteException {
         synchronized (mListeners) {
+            if (DEBUG) {
+                Log.d(TAG, "Removing listener from " + Binder.getCallingUserHandle());
+            }
             mListeners.unregister(listener);
             if (mListeners.getRegisteredCallbackCount() == 0) {
                 stopWatchingPackageBroadcasts();
@@ -107,11 +117,17 @@
      * Unregister package broadcast receiver
      */
     private void stopWatchingPackageBroadcasts() {
+        if (DEBUG) {
+            Log.d(TAG, "Stopped watching for packages");
+        }
         mPackageMonitor.unregister();
     }
 
     void checkCallbackCount() {
-        synchronized (LauncherAppsService.this) {
+        synchronized (mListeners) {
+            if (DEBUG) {
+                Log.d(TAG, "Callback count = " + mListeners.getRegisteredCallbackCount());
+            }
             if (mListeners.getRegisteredCallbackCount() == 0) {
                 stopWatchingPackageBroadcasts();
             }
@@ -223,13 +239,44 @@
 
     private class MyPackageMonitor extends PackageMonitor {
 
+        /** Checks if user is a profile of or same as listeningUser. */
+        private boolean isProfileOf(UserHandle user, UserHandle listeningUser, String debugMsg) {
+            if (user.getIdentifier() == listeningUser.getIdentifier()) {
+                if (DEBUG) Log.d(TAG, "Delivering msg to same user " + debugMsg);
+                return true;
+            }
+            long ident = Binder.clearCallingIdentity();
+            try {
+                UserInfo userInfo = mUm.getUserInfo(user.getIdentifier());
+                UserInfo listeningUserInfo = mUm.getUserInfo(listeningUser.getIdentifier());
+                if (userInfo == null || listeningUserInfo == null
+                        || userInfo.profileGroupId == UserInfo.NO_PROFILE_GROUP_ID
+                        || userInfo.profileGroupId != listeningUserInfo.profileGroupId) {
+                    if (DEBUG) {
+                        Log.d(TAG, "Not delivering msg from " + user + " to " + listeningUser + ":"
+                                + debugMsg);
+                    }
+                    return false;
+                } else {
+                    if (DEBUG) {
+                        Log.d(TAG, "Delivering msg from " + user + " to " + listeningUser + ":"
+                                + debugMsg);
+                    }
+                    return true;
+                }
+            } finally {
+                Binder.restoreCallingIdentity(ident);
+            }
+        }
+
         @Override
         public void onPackageAdded(String packageName, int uid) {
             UserHandle user = new UserHandle(getChangingUserId());
-            // TODO: if (!isProfile(user)) return;
             final int n = mListeners.beginBroadcast();
             for (int i = 0; i < n; i++) {
                 IOnAppsChangedListener listener = mListeners.getBroadcastItem(i);
+                UserHandle listeningUser = (UserHandle) mListeners.getBroadcastCookie(i);
+                if (!isProfileOf(user, listeningUser, "onPackageAdded")) continue;
                 try {
                     listener.onPackageAdded(user, packageName);
                 } catch (RemoteException re) {
@@ -244,10 +291,11 @@
         @Override
         public void onPackageRemoved(String packageName, int uid) {
             UserHandle user = new UserHandle(getChangingUserId());
-            // TODO: if (!isCurrentProfile(user)) return;
             final int n = mListeners.beginBroadcast();
             for (int i = 0; i < n; i++) {
                 IOnAppsChangedListener listener = mListeners.getBroadcastItem(i);
+                UserHandle listeningUser = (UserHandle) mListeners.getBroadcastCookie(i);
+                if (!isProfileOf(user, listeningUser, "onPackageRemoved")) continue;
                 try {
                     listener.onPackageRemoved(user, packageName);
                 } catch (RemoteException re) {
@@ -262,10 +310,11 @@
         @Override
         public void onPackageModified(String packageName) {
             UserHandle user = new UserHandle(getChangingUserId());
-            // TODO: if (!isProfile(user)) return;
             final int n = mListeners.beginBroadcast();
             for (int i = 0; i < n; i++) {
                 IOnAppsChangedListener listener = mListeners.getBroadcastItem(i);
+                UserHandle listeningUser = (UserHandle) mListeners.getBroadcastCookie(i);
+                if (!isProfileOf(user, listeningUser, "onPackageModified")) continue;
                 try {
                     listener.onPackageChanged(user, packageName);
                 } catch (RemoteException re) {
@@ -280,10 +329,11 @@
         @Override
         public void onPackagesAvailable(String[] packages) {
             UserHandle user = new UserHandle(getChangingUserId());
-            // TODO: if (!isProfile(user)) return;
             final int n = mListeners.beginBroadcast();
             for (int i = 0; i < n; i++) {
                 IOnAppsChangedListener listener = mListeners.getBroadcastItem(i);
+                UserHandle listeningUser = (UserHandle) mListeners.getBroadcastCookie(i);
+                if (!isProfileOf(user, listeningUser, "onPackagesAvailable")) continue;
                 try {
                     listener.onPackagesAvailable(user, packages, isReplacing());
                 } catch (RemoteException re) {
@@ -298,10 +348,11 @@
         @Override
         public void onPackagesUnavailable(String[] packages) {
             UserHandle user = new UserHandle(getChangingUserId());
-            // TODO: if (!isProfile(user)) return;
             final int n = mListeners.beginBroadcast();
             for (int i = 0; i < n; i++) {
                 IOnAppsChangedListener listener = mListeners.getBroadcastItem(i);
+                UserHandle listeningUser = (UserHandle) mListeners.getBroadcastCookie(i);
+                if (!isProfileOf(user, listeningUser, "onPackagesUnavailable")) continue;
                 try {
                     listener.onPackagesUnavailable(user, packages, isReplacing());
                 } catch (RemoteException re) {
@@ -316,7 +367,6 @@
     }
 
     class PackageCallbackList<T extends IInterface> extends RemoteCallbackList<T> {
-
         @Override
         public void onCallbackDied(T callback, Object cookie) {
             checkCallbackCount();
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index d84e8e1..d9e95c7 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -409,7 +409,7 @@
 
         EventLog.writeEvent(EventLogTags.POWER_SCREEN_STATE, 1, 0, 0, 0);
 
-        mPolicy.screenTurningOn(mScreenOnListener);
+        mPolicy.wakingUp(mScreenOnListener);
         mActivityManagerInternal.wakingUp();
 
         if (ActivityManagerNative.isSystemReady()) {
@@ -460,7 +460,7 @@
 
         EventLog.writeEvent(EventLogTags.POWER_SCREEN_STATE, 0, why, 0, 0);
 
-        mPolicy.screenTurnedOff(why);
+        mPolicy.goingToSleep(why);
         mActivityManagerInternal.goingToSleep();
 
         if (ActivityManagerNative.isSystemReady()) {
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
index f3e8f3c..527216d 100644
--- a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
+++ b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
@@ -19,57 +19,173 @@
 #define LOG_NDEBUG 1
 
 #include "JNIHelp.h"
+#include "ScopedPrimitiveArray.h"
+
+#include <string>
 
 #include <android_runtime/AndroidRuntime.h>
 #include <android_runtime/Log.h>
 #include <hardware/hdmi_cec.h>
+#include <sys/param.h>
 
 namespace android {
 
 static struct {
-    jmethodID handleMessage;
+    jmethodID handleIncomingCecCommand;
+    jmethodID handleHotplug;
 } gHdmiCecControllerClassInfo;
 
-
 class HdmiCecController {
 public:
-    HdmiCecController(jobject callbacksObj);
+    HdmiCecController(hdmi_cec_device_t* device, jobject callbacksObj);
+
+    void init();
+
+    // Send message to other device. Note that it runs in IO thread.
+    int sendMessage(const cec_message_t& message);
 
 private:
-    static void onReceived(const hdmi_event_t* event, void* arg);
+    // Propagate the message up to Java layer.
+    void propagateCecCommand(const cec_message_t& message);
+    void propagateHotplugEvent(const hotplug_event_t& event);
 
+    static void onReceived(const hdmi_event_t* event, void* arg);
+    static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName);
+
+    hdmi_cec_device_t* mDevice;
     jobject mCallbacksObj;
 };
 
-HdmiCecController::HdmiCecController(jobject callbacksObj) :
+HdmiCecController::HdmiCecController(hdmi_cec_device_t* device, jobject callbacksObj) :
+    mDevice(device),
     mCallbacksObj(callbacksObj) {
 }
 
+void HdmiCecController::init() {
+    mDevice->register_event_callback(mDevice, HdmiCecController::onReceived, this);
+}
+
+void HdmiCecController::propagateCecCommand(const cec_message_t& message) {
+    jint srcAddr = message.initiator;
+    jint dstAddr = message.destination;
+    JNIEnv* env = AndroidRuntime::getJNIEnv();
+    jbyteArray body = env->NewByteArray(message.length);
+    const jbyte* bodyPtr = reinterpret_cast<const jbyte *>(message.body);
+    env->SetByteArrayRegion(body, 0, message.length, bodyPtr);
+
+    env->CallVoidMethod(mCallbacksObj,
+            gHdmiCecControllerClassInfo.handleIncomingCecCommand,
+            srcAddr, dstAddr, body);
+    env->DeleteLocalRef(body);
+
+    checkAndClearExceptionFromCallback(env, __FUNCTION__);
+}
+
+void HdmiCecController::propagateHotplugEvent(const hotplug_event_t& event) {
+    JNIEnv* env = AndroidRuntime::getJNIEnv();
+    env->CallVoidMethod(mCallbacksObj,
+            gHdmiCecControllerClassInfo.handleHotplug, event.connected);
+
+    checkAndClearExceptionFromCallback(env, __FUNCTION__);
+}
+
+int HdmiCecController::sendMessage(const cec_message_t& message) {
+    // TODO: propagate send_message's return value.
+    return mDevice->send_message(mDevice, &message);
+}
+
+// static
+void HdmiCecController::checkAndClearExceptionFromCallback(JNIEnv* env,
+        const char* methodName) {
+    if (env->ExceptionCheck()) {
+        ALOGE("An exception was thrown by callback '%s'.", methodName);
+        LOGE_EX(env);
+        env->ExceptionClear();
+    }
+}
+
 // static
 void HdmiCecController::onReceived(const hdmi_event_t* event, void* arg) {
-    HdmiCecController* handler = static_cast<HdmiCecController*>(arg);
-    if (handler == NULL) {
+    HdmiCecController* controller = static_cast<HdmiCecController*>(arg);
+    if (controller == NULL) {
         return;
     }
 
-    // TODO: propagate message to Java layer.
+    switch (event->type) {
+    case HDMI_EVENT_CEC_MESSAGE:
+        controller->propagateCecCommand(event->cec);
+        break;
+    case HDMI_EVENT_HOT_PLUG:
+        controller->propagateHotplugEvent(event->hotplug);
+        break;
+    default:
+        ALOGE("Unsupported event type: %d", event->type);
+        break;
+    }
 }
 
-
 //------------------------------------------------------------------------------
+#define GET_METHOD_ID(var, clazz, methodName, methodDescriptor) \
+        var = env->GetMethodID(clazz, methodName, methodDescriptor); \
+        LOG_FATAL_IF(! var, "Unable to find method " methodName);
+
 static jlong nativeInit(JNIEnv* env, jclass clazz, jobject callbacksObj) {
-    // TODO: initialize hal and pass it to controller if ready.
+    int err;
+    // If use same hardware module id between HdmiCecService and
+    // HdmiControlSservice it may conflict and cause abnormal state of HAL.
+    // TODO: use HDMI_CEC_HARDWARE_MODULE_ID of hdmi_cec.h for module id
+    //       once migration to HdmiControlService is done.
+    hw_module_t* module;
+    err = hw_get_module("hdmi_cec_module",
+            const_cast<const hw_module_t **>(&module));
+    if (err != 0) {
+        ALOGE("Error acquiring hardware module: %d", err);
+        return 0;
+    }
+    hw_device_t* device;
+    // TODO: use HDMI_CEC_HARDWARE_INTERFACE of hdmi_cec.h for interface name
+    //       once migration to HdmiControlService is done.
+    err = module->methods->open(module, "hdmi_cec_module_hw_if", &device);
+    if (err != 0) {
+        ALOGE("Error opening hardware module: %d", err);
+        return 0;
+    }
 
     HdmiCecController* controller = new HdmiCecController(
+            reinterpret_cast<hdmi_cec_device*>(device),
             env->NewGlobalRef(callbacksObj));
+    controller->init();
+
+    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleIncomingCecCommand, clazz,
+            "handleIncomingCecCommand", "(II[B)V");
+    GET_METHOD_ID(gHdmiCecControllerClassInfo.handleHotplug, clazz,
+            "handleHotplug", "(Z)V");
 
     return reinterpret_cast<jlong>(controller);
 }
 
+static jint nativeSendCecCommand(JNIEnv* env, jclass clazz, jlong controllerPtr,
+        jint srcAddr, jint dstAddr, jbyteArray body) {
+    cec_message_t message;
+    message.initiator = static_cast<cec_logical_address_t>(srcAddr);
+    message.destination = static_cast<cec_logical_address_t>(dstAddr);
+
+    jsize len = env->GetArrayLength(body);
+    message.length = MIN(len, CEC_MESSAGE_BODY_MAX_LENGTH);
+    ScopedByteArrayRO bodyPtr(env, body);
+    std::memcpy(message.body, bodyPtr.get(), len);
+
+    HdmiCecController* controller =
+            reinterpret_cast<HdmiCecController*>(controllerPtr);
+    return controller->sendMessage(message);
+}
+
 static JNINativeMethod sMethods[] = {
     /* name, signature, funcPtr */
     { "nativeInit", "(Lcom/android/server/hdmi/HdmiCecController;)J",
             (void *) nativeInit },
+    { "nativeSendCecCommand", "(JII[B)I",
+            (void *) nativeSendCecCommand },
 };
 
 #define CLASS_PATH "com/android/server/hdmi/HdmiCecController"
diff --git a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
index 4bef424..cdb839a 100644
--- a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
@@ -16,6 +16,12 @@
 
 package com.android.internal.view.menu;
 
+import com.android.layoutlib.bridge.android.BridgeContext;
+
+import android.content.Context;
+import android.view.ContextThemeWrapper;
+import android.view.View;
+
 /**
  * An extension of the {@link MenuItemImpl} to store the view cookie also.
  */
@@ -27,6 +33,7 @@
      * at the time of rendering.
      */
     private Object viewCookie;
+    private BridgeContext mContext;
 
     /**
      * Instantiates this menu item.
@@ -34,14 +41,28 @@
     BridgeMenuItemImpl(MenuBuilder menu, int group, int id, int categoryOrder, int ordering,
             CharSequence title, int showAsAction) {
         super(menu, group, id, categoryOrder, ordering, title, showAsAction);
+        Context context = menu.getContext();
+        if (context instanceof ContextThemeWrapper) {
+            context = ((ContextThemeWrapper) context).getBaseContext();
+        }
+        if (context instanceof BridgeContext) {
+            mContext = ((BridgeContext) context);
+        }
     }
 
-
     public Object getViewCookie() {
         return viewCookie;
     }
 
     public void setViewCookie(Object viewCookie) {
+        // If the menu item has an associated action provider view,
+        // directly set the cookie in the view to cookie map stored in BridgeContext.
+        View actionView = getActionView();
+        if (actionView != null && mContext != null) {
+            mContext.addViewKey(actionView, viewCookie);
+            // We don't need to add the view cookie to the this item now. But there's no harm in
+            // storing it, in case we need it in the future.
+        }
         this.viewCookie = viewCookie;
     }
 }
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
index 08512e7..936ab4f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
@@ -50,6 +50,7 @@
 import android.view.MenuInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.ActionMenuView;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 import android.widget.ListAdapter;
@@ -179,8 +180,9 @@
             Predicate<View> overflowMenuButtonTest = new Predicate<View>() {
                 @Override
                 public boolean apply(View view) {
-                    return view.getClass().getName()
-                            .equals("android.widget.ActionMenuPresenter$OverflowMenuButton");
+                    ViewGroup.LayoutParams lp = view.getLayoutParams();
+                    return lp instanceof ActionMenuView.LayoutParams &&
+                            ((ActionMenuView.LayoutParams) lp).isOverflowButton;
                 }
             };
             View overflowMenu = null;