Merge "Surface: move the SurfaceTexture ctor"
diff --git a/api/current.txt b/api/current.txt
index c8cebce..e379f8b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -184,21 +184,21 @@
   public static final class R.attr {
     ctor public R.attr();
     field public static final int absListViewStyle = 16842858; // 0x101006a
-    field public static final int accessibilityEventTypes = 16843643; // 0x101037b
-    field public static final int accessibilityFeedbackType = 16843645; // 0x101037d
-    field public static final int accessibilityFlags = 16843647; // 0x101037f
+    field public static final int accessibilityEventTypes = 16843648; // 0x1010380
+    field public static final int accessibilityFeedbackType = 16843650; // 0x1010382
+    field public static final int accessibilityFlags = 16843652; // 0x1010384
     field public static final int accountPreferences = 16843423; // 0x101029f
     field public static final int accountType = 16843407; // 0x101028f
     field public static final int action = 16842797; // 0x101002d
-    field public static final int actionBarDivider = 16843684; // 0x10103a4
-    field public static final int actionBarItemBackground = 16843685; // 0x10103a5
+    field public static final int actionBarDivider = 16843689; // 0x10103a9
+    field public static final int actionBarItemBackground = 16843690; // 0x10103aa
     field public static final int actionBarSize = 16843499; // 0x10102eb
-    field public static final int actionBarSplitStyle = 16843665; // 0x1010391
+    field public static final int actionBarSplitStyle = 16843670; // 0x1010396
     field public static final int actionBarStyle = 16843470; // 0x10102ce
     field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4
     field public static final int actionBarTabStyle = 16843507; // 0x10102f3
     field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5
-    field public static final int actionBarWidgetTheme = 16843680; // 0x10103a0
+    field public static final int actionBarWidgetTheme = 16843685; // 0x10103a5
     field public static final int actionButtonStyle = 16843480; // 0x10102d8
     field public static final int actionDropDownStyle = 16843479; // 0x10102d7
     field public static final int actionLayout = 16843515; // 0x10102fb
@@ -210,11 +210,11 @@
     field public static final int actionModeCopyDrawable = 16843538; // 0x1010312
     field public static final int actionModeCutDrawable = 16843537; // 0x1010311
     field public static final int actionModePasteDrawable = 16843539; // 0x1010313
-    field public static final int actionModeSelectAllDrawable = 16843641; // 0x1010379
-    field public static final int actionModeSplitBackground = 16843686; // 0x10103a6
-    field public static final int actionModeStyle = 16843677; // 0x101039d
+    field public static final int actionModeSelectAllDrawable = 16843646; // 0x101037e
+    field public static final int actionModeSplitBackground = 16843691; // 0x10103ab
+    field public static final int actionModeStyle = 16843682; // 0x10103a2
     field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
-    field public static final int actionProviderClass = 16843666; // 0x1010392
+    field public static final int actionProviderClass = 16843671; // 0x1010397
     field public static final int actionViewClass = 16843516; // 0x10102fc
     field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
     field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
@@ -226,7 +226,7 @@
     field public static final int alertDialogIcon = 16843605; // 0x1010355
     field public static final int alertDialogStyle = 16842845; // 0x101005d
     field public static final int alertDialogTheme = 16843529; // 0x1010309
-    field public static final int alignmentMode = 16843637; // 0x1010375
+    field public static final int alignmentMode = 16843642; // 0x101037a
     field public static final int allContactsName = 16843468; // 0x10102cc
     field public static final int allowBackup = 16843392; // 0x1010280
     field public static final int allowClearUserData = 16842757; // 0x1010005
@@ -260,8 +260,8 @@
     field public static final int background = 16842964; // 0x10100d4
     field public static final int backgroundDimAmount = 16842802; // 0x1010032
     field public static final int backgroundDimEnabled = 16843295; // 0x101021f
-    field public static final int backgroundSplit = 16843668; // 0x1010394
-    field public static final int backgroundStacked = 16843667; // 0x1010393
+    field public static final int backgroundSplit = 16843673; // 0x1010399
+    field public static final int backgroundStacked = 16843672; // 0x1010398
     field public static final int backupAgent = 16843391; // 0x101027f
     field public static final int baseline = 16843548; // 0x101031c
     field public static final int baselineAlignBottom = 16843042; // 0x1010122
@@ -270,7 +270,7 @@
     field public static final int borderlessButtonStyle = 16843563; // 0x101032b
     field public static final int bottom = 16843184; // 0x10101b0
     field public static final int bottomBright = 16842957; // 0x10100cd
-    field public static final int bottomChevronDrawable = 16843654; // 0x1010386
+    field public static final int bottomChevronDrawable = 16843659; // 0x101038b
     field public static final int bottomDark = 16842953; // 0x10100c9
     field public static final int bottomLeftRadius = 16843179; // 0x10101ab
     field public static final int bottomMedium = 16842958; // 0x10100ce
@@ -289,7 +289,7 @@
     field public static final int cacheColorHint = 16843009; // 0x1010101
     field public static final int calendarViewShown = 16843596; // 0x101034c
     field public static final int calendarViewStyle = 16843613; // 0x101035d
-    field public static final int canRetrieveWindowContent = 16843648; // 0x1010380
+    field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
     field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
     field public static final deprecated int capitalize = 16843113; // 0x1010169
     field public static final int centerBright = 16842956; // 0x10100cc
@@ -318,18 +318,18 @@
     field public static final int codes = 16843330; // 0x1010242
     field public static final int collapseColumns = 16843083; // 0x101014b
     field public static final int color = 16843173; // 0x10101a5
-    field public static final int colorActivatedHighlight = 16843673; // 0x1010399
+    field public static final int colorActivatedHighlight = 16843678; // 0x101039e
     field public static final int colorBackground = 16842801; // 0x1010031
     field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
-    field public static final int colorFocusedHighlight = 16843672; // 0x1010398
+    field public static final int colorFocusedHighlight = 16843677; // 0x101039d
     field public static final int colorForeground = 16842800; // 0x1010030
     field public static final int colorForegroundInverse = 16843270; // 0x1010206
-    field public static final int colorLongPressedHighlight = 16843671; // 0x1010397
-    field public static final int colorMultiSelectHighlight = 16843674; // 0x101039a
-    field public static final int colorPressedHighlight = 16843670; // 0x1010396
-    field public static final int columnCount = 16843634; // 0x1010372
+    field public static final int colorLongPressedHighlight = 16843676; // 0x101039c
+    field public static final int colorMultiSelectHighlight = 16843679; // 0x101039f
+    field public static final int colorPressedHighlight = 16843675; // 0x101039b
+    field public static final int columnCount = 16843639; // 0x1010377
     field public static final int columnDelay = 16843215; // 0x10101cf
-    field public static final int columnOrderPreserved = 16843635; // 0x1010373
+    field public static final int columnOrderPreserved = 16843640; // 0x1010378
     field public static final int columnWidth = 16843031; // 0x1010117
     field public static final int compatibleWidthLimitDp = 16843621; // 0x1010365
     field public static final int completionHint = 16843122; // 0x1010172
@@ -383,11 +383,11 @@
     field public static final int drawSelectorOnTop = 16843004; // 0x10100fc
     field public static final int drawable = 16843161; // 0x1010199
     field public static final int drawableBottom = 16843118; // 0x101016e
-    field public static final int drawableEnd = 16843676; // 0x101039c
+    field public static final int drawableEnd = 16843681; // 0x10103a1
     field public static final int drawableLeft = 16843119; // 0x101016f
     field public static final int drawablePadding = 16843121; // 0x1010171
     field public static final int drawableRight = 16843120; // 0x1010170
-    field public static final int drawableStart = 16843675; // 0x101039b
+    field public static final int drawableStart = 16843680; // 0x10103a0
     field public static final int drawableTop = 16843117; // 0x101016d
     field public static final int drawingCacheQuality = 16842984; // 0x10100e8
     field public static final int dropDownAnchor = 16843363; // 0x1010263
@@ -444,7 +444,7 @@
     field public static final int fastScrollTextColor = 16843609; // 0x1010359
     field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336
     field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339
-    field public static final int feedbackCount = 16843660; // 0x101038c
+    field public static final int feedbackCount = 16843665; // 0x1010391
     field public static final int fillAfter = 16843197; // 0x10101bd
     field public static final int fillBefore = 16843196; // 0x10101bc
     field public static final int fillEnabled = 16843343; // 0x101024f
@@ -497,7 +497,7 @@
     field public static final int hand_hour = 16843011; // 0x1010103
     field public static final int hand_minute = 16843012; // 0x1010104
     field public static final int handle = 16843354; // 0x101025a
-    field public static final int handleDrawable = 16843650; // 0x1010382
+    field public static final int handleDrawable = 16843655; // 0x1010387
     field public static final int handleProfiling = 16842786; // 0x1010022
     field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
     field public static final int hardwareAccelerated = 16843475; // 0x10102d3
@@ -506,12 +506,12 @@
     field public static final int headerDividersEnabled = 16843310; // 0x101022e
     field public static final int height = 16843093; // 0x1010155
     field public static final int hint = 16843088; // 0x1010150
-    field public static final int hitRadius = 16843657; // 0x1010389
+    field public static final int hitRadius = 16843662; // 0x101038e
     field public static final int homeAsUpIndicator = 16843531; // 0x101030b
     field public static final int homeLayout = 16843549; // 0x101031d
     field public static final int horizontalDivider = 16843053; // 0x101012d
     field public static final int horizontalGap = 16843327; // 0x101023f
-    field public static final int horizontalOffset = 16843662; // 0x101038e
+    field public static final int horizontalOffset = 16843667; // 0x1010393
     field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353
     field public static final int horizontalSpacing = 16843028; // 0x1010114
     field public static final int host = 16842792; // 0x1010028
@@ -557,7 +557,7 @@
     field public static final int installLocation = 16843447; // 0x10102b7
     field public static final int interpolator = 16843073; // 0x1010141
     field public static final int isAlwaysSyncable = 16843571; // 0x1010333
-    field public static final int isAuxiliary = 16843642; // 0x101037a
+    field public static final int isAuxiliary = 16843647; // 0x101037f
     field public static final int isDefault = 16843297; // 0x1010221
     field public static final int isIndicator = 16843079; // 0x1010147
     field public static final int isModifier = 16843334; // 0x1010246
@@ -610,7 +610,7 @@
     field public static final int layout_centerInParent = 16843151; // 0x101018f
     field public static final int layout_centerVertical = 16843153; // 0x1010191
     field public static final int layout_column = 16843084; // 0x101014c
-    field public static final int layout_columnSpan = 16843640; // 0x1010378
+    field public static final int layout_columnSpan = 16843645; // 0x101037d
     field public static final int layout_gravity = 16842931; // 0x10100b3
     field public static final int layout_height = 16842997; // 0x10100f5
     field public static final int layout_margin = 16842998; // 0x10100f6
@@ -618,8 +618,8 @@
     field public static final int layout_marginLeft = 16842999; // 0x10100f7
     field public static final int layout_marginRight = 16843001; // 0x10100f9
     field public static final int layout_marginTop = 16843000; // 0x10100f8
-    field public static final int layout_row = 16843638; // 0x1010376
-    field public static final int layout_rowSpan = 16843639; // 0x1010377
+    field public static final int layout_row = 16843643; // 0x101037b
+    field public static final int layout_rowSpan = 16843644; // 0x101037c
     field public static final int layout_scale = 16843155; // 0x1010193
     field public static final int layout_span = 16843085; // 0x101014d
     field public static final int layout_toLeftOf = 16843138; // 0x1010182
@@ -629,7 +629,7 @@
     field public static final int layout_x = 16843135; // 0x101017f
     field public static final int layout_y = 16843136; // 0x1010180
     field public static final int left = 16843181; // 0x10101ad
-    field public static final int leftChevronDrawable = 16843651; // 0x1010383
+    field public static final int leftChevronDrawable = 16843656; // 0x1010388
     field public static final int lineSpacingExtra = 16843287; // 0x1010217
     field public static final int lineSpacingMultiplier = 16843288; // 0x1010218
     field public static final int lines = 16843092; // 0x1010154
@@ -641,8 +641,8 @@
     field public static final int listDividerAlertDialog = 16843525; // 0x1010305
     field public static final int listPopupWindowStyle = 16843519; // 0x10102ff
     field public static final int listPreferredItemHeight = 16842829; // 0x101004d
-    field public static final int listPreferredItemHeightLarge = 16843663; // 0x101038f
-    field public static final int listPreferredItemHeightSmall = 16843664; // 0x1010390
+    field public static final int listPreferredItemHeightLarge = 16843668; // 0x1010394
+    field public static final int listPreferredItemHeightSmall = 16843669; // 0x1010395
     field public static final int listSelector = 16843003; // 0x10100fb
     field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208
     field public static final int listViewStyle = 16842868; // 0x1010074
@@ -673,8 +673,8 @@
     field public static final int minHeight = 16843072; // 0x1010140
     field public static final int minLevel = 16843185; // 0x10101b1
     field public static final int minLines = 16843094; // 0x1010156
-    field public static final int minResizeHeight = 16843679; // 0x101039f
-    field public static final int minResizeWidth = 16843678; // 0x101039e
+    field public static final int minResizeHeight = 16843684; // 0x10103a4
+    field public static final int minResizeWidth = 16843683; // 0x10103a3
     field public static final int minSdkVersion = 16843276; // 0x101020c
     field public static final int minWidth = 16843071; // 0x101013f
     field public static final int mode = 16843134; // 0x101017e
@@ -690,7 +690,7 @@
     field public static final int nextFocusUp = 16842979; // 0x10100e3
     field public static final int noHistory = 16843309; // 0x101022d
     field public static final int normalScreens = 16843397; // 0x1010285
-    field public static final int notificationTimeout = 16843646; // 0x101037e
+    field public static final int notificationTimeout = 16843651; // 0x1010383
     field public static final int numColumns = 16843032; // 0x1010118
     field public static final int numStars = 16843076; // 0x1010144
     field public static final deprecated int numeric = 16843109; // 0x1010165
@@ -704,11 +704,11 @@
     field public static final int orderingFromXml = 16843239; // 0x10101e7
     field public static final int orientation = 16842948; // 0x10100c4
     field public static final int outAnimation = 16843128; // 0x1010178
-    field public static final int outerRadius = 16843656; // 0x1010388
+    field public static final int outerRadius = 16843661; // 0x101038d
     field public static final int overScrollFooter = 16843459; // 0x10102c3
     field public static final int overScrollHeader = 16843458; // 0x10102c2
     field public static final int overScrollMode = 16843457; // 0x10102c1
-    field public static final int packageNames = 16843644; // 0x101037c
+    field public static final int packageNames = 16843649; // 0x1010381
     field public static final int padding = 16842965; // 0x10100d5
     field public static final int paddingBottom = 16842969; // 0x10100d9
     field public static final int paddingLeft = 16842966; // 0x10100d6
@@ -793,17 +793,17 @@
     field public static final int restoreAnyVersion = 16843450; // 0x10102ba
     field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
     field public static final int right = 16843183; // 0x10101af
-    field public static final int rightChevronDrawable = 16843652; // 0x1010384
+    field public static final int rightChevronDrawable = 16843657; // 0x1010389
     field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093
     field public static final int ringtoneType = 16843257; // 0x10101f9
     field public static final int rotation = 16843558; // 0x1010326
     field public static final int rotationX = 16843559; // 0x1010327
     field public static final int rotationY = 16843560; // 0x1010328
-    field public static final int rowCount = 16843632; // 0x1010370
+    field public static final int rowCount = 16843637; // 0x1010375
     field public static final int rowDelay = 16843216; // 0x10101d0
     field public static final int rowEdgeFlags = 16843329; // 0x1010241
     field public static final int rowHeight = 16843058; // 0x1010132
-    field public static final int rowOrderPreserved = 16843633; // 0x1010371
+    field public static final int rowOrderPreserved = 16843638; // 0x1010376
     field public static final int saveEnabled = 16842983; // 0x10100e7
     field public static final int scaleGravity = 16843262; // 0x10101fe
     field public static final int scaleHeight = 16843261; // 0x10101fd
@@ -869,7 +869,7 @@
     field public static final int smallIcon = 16843422; // 0x101029e
     field public static final int smallScreens = 16843396; // 0x1010284
     field public static final int smoothScrollbar = 16843313; // 0x1010231
-    field public static final int snapMargin = 16843659; // 0x101038b
+    field public static final int snapMargin = 16843664; // 0x1010390
     field public static final int soundEffectsEnabled = 16843285; // 0x1010215
     field public static final int spacing = 16843027; // 0x1010113
     field public static final int spinnerDropDownItemStyle = 16842887; // 0x1010087
@@ -915,8 +915,8 @@
     field public static final int stretchMode = 16843030; // 0x1010116
     field public static final int subtitle = 16843473; // 0x10102d1
     field public static final int subtitleTextStyle = 16843513; // 0x10102f9
-    field public static final int subtypeExtraValue = 16843683; // 0x10103a3
-    field public static final int subtypeLocale = 16843682; // 0x10103a2
+    field public static final int subtypeExtraValue = 16843688; // 0x10103a8
+    field public static final int subtypeLocale = 16843687; // 0x10103a7
     field public static final int suggestActionMsg = 16843228; // 0x10101dc
     field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd
     field public static final int summary = 16843241; // 0x10101e9
@@ -924,7 +924,10 @@
     field public static final int summaryOff = 16843248; // 0x10101f0
     field public static final int summaryOn = 16843247; // 0x10101ef
     field public static final int supportsUploading = 16843419; // 0x101029b
+    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 switchTextAppearance = 16843630; // 0x101036e
     field public static final int switchTextOff = 16843628; // 0x101036c
     field public static final int switchTextOn = 16843627; // 0x101036b
     field public static final int syncable = 16842777; // 0x1010019
@@ -935,7 +938,7 @@
     field public static final int tag = 16842961; // 0x10100d1
     field public static final int targetActivity = 16843266; // 0x1010202
     field public static final int targetClass = 16842799; // 0x101002f
-    field public static final int targetDrawables = 16843649; // 0x1010381
+    field public static final int targetDrawables = 16843654; // 0x1010386
     field public static final int targetPackage = 16842785; // 0x1010021
     field public static final int targetSdkVersion = 16843376; // 0x1010270
     field public static final int taskAffinity = 16842770; // 0x1010012
@@ -950,15 +953,15 @@
     field public static final int tension = 16843370; // 0x101026a
     field public static final int testOnly = 16843378; // 0x1010272
     field public static final int text = 16843087; // 0x101014f
-    field public static final int textAllCaps = 16843669; // 0x1010395
+    field public static final int textAllCaps = 16843674; // 0x101039a
     field public static final int textAppearance = 16842804; // 0x1010034
     field public static final int textAppearanceButton = 16843271; // 0x1010207
     field public static final int textAppearanceInverse = 16842805; // 0x1010035
     field public static final int textAppearanceLarge = 16842816; // 0x1010040
     field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043
     field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301
-    field public static final int textAppearanceListItem = 16843687; // 0x10103a7
-    field public static final int textAppearanceListItemSmall = 16843688; // 0x10103a8
+    field public static final int textAppearanceListItem = 16843692; // 0x10103ac
+    field public static final int textAppearanceListItemSmall = 16843693; // 0x10103ad
     field public static final int textAppearanceMedium = 16842817; // 0x1010041
     field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044
     field public static final int textAppearanceSearchResultSubtitle = 16843424; // 0x10102a0
@@ -993,7 +996,7 @@
     field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
     field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
     field public static final int textEditSidePasteWindowLayout = 16843614; // 0x101035e
-    field public static final int textEditSuggestionItemLayout = 16843631; // 0x101036f
+    field public static final int textEditSuggestionItemLayout = 16843636; // 0x1010374
     field public static final int textFilterEnabled = 16843007; // 0x10100ff
     field public static final int textIsSelectable = 16843542; // 0x1010316
     field public static final int textOff = 16843045; // 0x1010125
@@ -1005,13 +1008,14 @@
     field public static final int textSelectHandleWindowStyle = 16843464; // 0x10102c8
     field public static final int textSize = 16842901; // 0x1010095
     field public static final int textStyle = 16842903; // 0x1010097
-    field public static final int textSuggestionsWindowStyle = 16843630; // 0x101036e
+    field public static final int textSuggestionsWindowStyle = 16843635; // 0x1010373
     field public static final int textViewStyle = 16842884; // 0x1010084
     field public static final int theme = 16842752; // 0x1010000
     field public static final int thickness = 16843360; // 0x1010260
     field public static final int thicknessRatio = 16843164; // 0x101019c
     field public static final int thumb = 16843074; // 0x1010142
     field public static final int thumbOffset = 16843075; // 0x1010143
+    field public static final int thumbTextPadding = 16843634; // 0x1010372
     field public static final int thumbnail = 16843429; // 0x10102a5
     field public static final int tileMode = 16843265; // 0x1010201
     field public static final int tint = 16843041; // 0x1010121
@@ -1026,11 +1030,12 @@
     field public static final int toYScale = 16843205; // 0x10101c5
     field public static final int top = 16843182; // 0x10101ae
     field public static final int topBright = 16842955; // 0x10100cb
-    field public static final int topChevronDrawable = 16843653; // 0x1010385
+    field public static final int topChevronDrawable = 16843658; // 0x101038a
     field public static final int topDark = 16842951; // 0x10100c7
     field public static final int topLeftRadius = 16843177; // 0x10101a9
     field public static final int topOffset = 16843352; // 0x1010258
     field public static final int topRightRadius = 16843178; // 0x10101aa
+    field public static final int track = 16843631; // 0x101036f
     field public static final int transcriptMode = 16843008; // 0x1010100
     field public static final int transformPivotX = 16843552; // 0x1010320
     field public static final int transformPivotY = 16843553; // 0x1010321
@@ -1038,12 +1043,12 @@
     field public static final int translationY = 16843555; // 0x1010323
     field public static final int type = 16843169; // 0x10101a1
     field public static final int typeface = 16842902; // 0x1010096
-    field public static final int uiOptions = 16843681; // 0x10103a1
+    field public static final int uiOptions = 16843686; // 0x10103a6
     field public static final int uncertainGestureColor = 16843382; // 0x1010276
     field public static final int unfocusedMonthDateColor = 16843588; // 0x1010344
     field public static final int unselectedAlpha = 16843278; // 0x101020e
     field public static final int updatePeriodMillis = 16843344; // 0x1010250
-    field public static final int useDefaultMargins = 16843636; // 0x1010374
+    field public static final int useDefaultMargins = 16843641; // 0x1010379
     field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310
     field public static final int useLevel = 16843167; // 0x101019f
     field public static final int userVisible = 16843409; // 0x1010291
@@ -1057,10 +1062,10 @@
     field public static final int verticalCorrection = 16843322; // 0x101023a
     field public static final int verticalDivider = 16843054; // 0x101012e
     field public static final int verticalGap = 16843328; // 0x1010240
-    field public static final int verticalOffset = 16843661; // 0x101038d
+    field public static final int verticalOffset = 16843666; // 0x1010392
     field public static final int verticalScrollbarPosition = 16843572; // 0x1010334
     field public static final int verticalSpacing = 16843029; // 0x1010115
-    field public static final int vibrationDuration = 16843658; // 0x101038a
+    field public static final int vibrationDuration = 16843663; // 0x101038f
     field public static final int visibility = 16842972; // 0x10100dc
     field public static final int visible = 16843156; // 0x1010194
     field public static final int vmSafeMode = 16843448; // 0x10102b8
@@ -1077,7 +1082,7 @@
     field public static final int wallpaperIntraOpenExitAnimation = 16843416; // 0x1010298
     field public static final int wallpaperOpenEnterAnimation = 16843411; // 0x1010293
     field public static final int wallpaperOpenExitAnimation = 16843412; // 0x1010294
-    field public static final int waveDrawable = 16843655; // 0x1010387
+    field public static final int waveDrawable = 16843660; // 0x101038c
     field public static final int webTextViewStyle = 16843449; // 0x10102b9
     field public static final int webViewStyle = 16842885; // 0x1010085
     field public static final int weekDayTextAppearance = 16843592; // 0x1010348
@@ -1605,6 +1610,7 @@
     field public static final int TextAppearance_StatusBar_EventContent_Title = 16973928; // 0x1030068
     field public static final int TextAppearance_StatusBar_Icon = 16973926; // 0x1030066
     field public static final int TextAppearance_StatusBar_Title = 16973925; // 0x1030065
+    field public static final int TextAppearance_SuggestionHighlight = 16974104; // 0x1030118
     field public static final int TextAppearance_Theme = 16973888; // 0x1030040
     field public static final int TextAppearance_Theme_Dialog = 16973896; // 0x1030048
     field public static final int TextAppearance_Widget = 16973897; // 0x1030049
@@ -26904,6 +26910,20 @@
     ctor public StackView(android.content.Context, android.util.AttributeSet, int);
   }
 
+  public class Switch extends android.widget.CompoundButton {
+    ctor public Switch(android.content.Context);
+    ctor public Switch(android.content.Context, android.util.AttributeSet);
+    ctor public Switch(android.content.Context, android.util.AttributeSet, int);
+    method public java.lang.CharSequence getTextOff();
+    method public java.lang.CharSequence getTextOn();
+    method public void onMeasure(int, int);
+    method public void setSwitchTextAppearance(android.content.Context, int);
+    method public void setSwitchTypeface(android.graphics.Typeface, int);
+    method public void setSwitchTypeface(android.graphics.Typeface);
+    method public void setTextOff(java.lang.CharSequence);
+    method public void setTextOn(java.lang.CharSequence);
+  }
+
   public class TabHost extends android.widget.FrameLayout implements android.view.ViewTreeObserver.OnTouchModeChangeListener {
     ctor public TabHost(android.content.Context);
     ctor public TabHost(android.content.Context, android.util.AttributeSet);
diff --git a/core/java/android/preference/DialogPreference.java b/core/java/android/preference/DialogPreference.java
index 73427d2..c59ed18 100644
--- a/core/java/android/preference/DialogPreference.java
+++ b/core/java/android/preference/DialogPreference.java
@@ -321,8 +321,7 @@
      */
     private void requestInputMethod(Dialog dialog) {
         Window window = dialog.getWindow();
-        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE |
-                WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
+        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
     }
 
     /**
diff --git a/core/java/android/text/Html.java b/core/java/android/text/Html.java
index 07e71f9..85a3bbb 100644
--- a/core/java/android/text/Html.java
+++ b/core/java/android/text/Html.java
@@ -449,11 +449,11 @@
             handleP(mSpannableStringBuilder);
         } else if (tag.equalsIgnoreCase("div")) {
             handleP(mSpannableStringBuilder);
-        } else if (tag.equalsIgnoreCase("em")) {
+        } else if (tag.equalsIgnoreCase("strong")) {
             start(mSpannableStringBuilder, new Bold());
         } else if (tag.equalsIgnoreCase("b")) {
             start(mSpannableStringBuilder, new Bold());
-        } else if (tag.equalsIgnoreCase("strong")) {
+        } else if (tag.equalsIgnoreCase("em")) {
             start(mSpannableStringBuilder, new Italic());
         } else if (tag.equalsIgnoreCase("cite")) {
             start(mSpannableStringBuilder, new Italic());
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index 83ef6ce..b8b54f4 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -31,9 +31,11 @@
 import android.text.style.RelativeSizeSpan;
 import android.text.style.ReplacementSpan;
 import android.text.style.ScaleXSpan;
+import android.text.style.SpellCheckSpan;
 import android.text.style.StrikethroughSpan;
 import android.text.style.StyleSpan;
 import android.text.style.SubscriptSpan;
+import android.text.style.SuggestionRangeSpan;
 import android.text.style.SuggestionSpan;
 import android.text.style.SuperscriptSpan;
 import android.text.style.TextAppearanceSpan;
@@ -579,6 +581,10 @@
     public static final int ANNOTATION = 18;
     /** @hide */
     public static final int SUGGESTION_SPAN = 19;
+    /** @hide */
+    public static final int SPELL_CHECK_SPAN = 20;
+    /** @hide */
+    public static final int SUGGESTION_RANGE_SPAN = 21;
 
     /**
      * Flatten a CharSequence and whatever styles can be copied across processes
@@ -734,6 +740,14 @@
                     readSpan(p, sp, new SuggestionSpan(p));
                     break;
 
+                case SPELL_CHECK_SPAN:
+                    readSpan(p, sp, new SpellCheckSpan(p));
+                    break;
+
+                case SUGGESTION_RANGE_SPAN:
+                    readSpan(p, sp, new SuggestionRangeSpan());
+                    break;
+                    
                 default:
                     throw new RuntimeException("bogus span encoding " + kind);
                 }
diff --git a/core/java/android/text/style/SpellCheckSpan.java b/core/java/android/text/style/SpellCheckSpan.java
index 9b23177..caaae99 100644
--- a/core/java/android/text/style/SpellCheckSpan.java
+++ b/core/java/android/text/style/SpellCheckSpan.java
@@ -16,6 +16,10 @@
 
 package android.text.style;
 
+import android.os.Parcel;
+import android.text.ParcelableSpan;
+import android.text.TextUtils;
+
 /**
  * A SpellCheckSpan is an internal data structure created by the TextView's SpellChecker to
  * annotate portions of the text that are about to or currently being spell checked. They are
@@ -23,7 +27,7 @@
  *
  * @hide
  */
-public class SpellCheckSpan {
+public class SpellCheckSpan implements ParcelableSpan {
 
     private boolean mSpellCheckInProgress;
 
@@ -31,6 +35,10 @@
         mSpellCheckInProgress = false;
     }
 
+    public SpellCheckSpan(Parcel src) {
+        mSpellCheckInProgress = (src.readInt() != 0);
+    }
+
     public void setSpellCheckInProgress() {
         mSpellCheckInProgress = true;
     }
@@ -38,4 +46,19 @@
     public boolean isSpellCheckInProgress() {
         return mSpellCheckInProgress;
     }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(mSpellCheckInProgress ? 1 : 0);
+    }
+
+    @Override
+    public int getSpanTypeId() {
+        return TextUtils.SPELL_CHECK_SPAN;
+    }
 }
diff --git a/core/java/android/text/style/SuggestionRangeSpan.java b/core/java/android/text/style/SuggestionRangeSpan.java
new file mode 100644
index 0000000..fc91697
--- /dev/null
+++ b/core/java/android/text/style/SuggestionRangeSpan.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2011 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.text.style;
+
+import android.graphics.Color;
+import android.os.Parcel;
+import android.text.ParcelableSpan;
+import android.text.TextPaint;
+import android.text.TextUtils;
+
+/**
+ * A SuggestionRangeSpan is used to show which part of an EditText is affected by a suggestion
+ * popup window.
+ *
+ * @hide
+ */
+public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpan {
+    @Override
+    public void updateDrawState(TextPaint tp) {
+        tp.setColor(Color.GREEN);            
+    }
+
+    public SuggestionRangeSpan() { /* Nothing to do*/ }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) { /* Nothing to do*/ }
+
+    @Override
+    public int getSpanTypeId() {
+        return TextUtils.SUGGESTION_RANGE_SPAN;
+    }
+}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6238b72..2aa481c 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4004,9 +4004,12 @@
         // state.
         // If mNativeClass is 0, we should not reach here, so we do not
         // need to check it again.
-        nativeRecordButtons(hasFocus() && hasWindowFocus(),
-                            mTouchMode == TOUCH_SHORTPRESS_START_MODE
-                            || mTrackballDown || mGotCenterDown, false);
+        if (mDrawCursorRing && drawRings) {
+            // Only update if we are actually going to use the result
+            nativeRecordButtons(hasFocus() && hasWindowFocus(),
+                    mTouchMode == TOUCH_SHORTPRESS_START_MODE
+                    || mTrackballDown || mGotCenterDown, false);
+        }
         drawCoreAndCursorRing(canvas, mBackgroundColor,
                 mDrawCursorRing && drawRings);
     }
@@ -4075,7 +4078,8 @@
         boolean drawJavaRings = !mTouchHighlightRegion.isEmpty()
                 && (mTouchMode == TOUCH_INIT_MODE
                 || mTouchMode == TOUCH_SHORTPRESS_START_MODE
-                || mTouchMode == TOUCH_SHORTPRESS_MODE);
+                || mTouchMode == TOUCH_SHORTPRESS_MODE
+                || mTouchMode == TOUCH_DONE_MODE);
         boolean drawNativeRings = !drawJavaRings;
         if (USE_WEBKIT_RINGS) {
             drawNativeRings = !drawJavaRings && !isInTouchMode();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 86f061a..80cbbfb 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1574,8 +1574,17 @@
 
         ss.inActionMode = mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode != null;
 
-        ss.checkState = mCheckStates;
-        ss.checkIdState = mCheckedIdStates;
+        if (mCheckStates != null) {
+            ss.checkState = mCheckStates.clone();
+        }
+        if (mCheckedIdStates != null) {
+            final LongSparseArray<Boolean> idState = new LongSparseArray<Boolean>();
+            final int count = mCheckedIdStates.size();
+            for (int i = 0; i < count; i++) {
+                idState.put(mCheckedIdStates.keyAt(i), mCheckedIdStates.valueAt(i));
+            }
+            ss.checkIdState = idState;
+        }
         ss.checkedItemCount = mCheckedItemCount;
 
         return ss;
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 4143383..4fcb358 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -41,9 +41,15 @@
 /**
  * A Switch is a two-state toggle switch widget that can select between two
  * options. The user may drag the "thumb" back and forth to choose the selected option,
- * or simply tap to toggle as if it were a checkbox.
+ * or simply tap to toggle as if it were a checkbox. The {@link #setText(CharSequence) text}
+ * property controls the text displayed in the label for the switch, whereas the
+ * {@link #setTextOff(CharSequence) off} and {@link #setTextOn(CharSequence) on} text
+ * controls the text on the thumb. Similarly, the
+ * {@link #setTextAppearance(android.content.Context, int) textAppearance} and the related
+ * setTypeface() methods control the typeface and style of label text, whereas the
+ * {@link #setSwitchTextAppearance(android.content.Context, int) switchTextAppearance} and
+ * the related seSwitchTypeface() methods control that of the thumb.
  *
- * @hide
  */
 public class Switch extends CompoundButton {
     private static final int TOUCH_MODE_IDLE = 0;
@@ -132,8 +138,8 @@
         TypedArray a = context.obtainStyledAttributes(attrs,
                 com.android.internal.R.styleable.Switch, defStyle, 0);
 
-        mThumbDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_switchThumb);
-        mTrackDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_switchTrack);
+        mThumbDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_thumb);
+        mTrackDrawable = a.getDrawable(com.android.internal.R.styleable.Switch_track);
         mTextOn = a.getText(com.android.internal.R.styleable.Switch_textOn);
         mTextOff = a.getText(com.android.internal.R.styleable.Switch_textOff);
         mThumbTextPadding = a.getDimensionPixelSize(
@@ -146,7 +152,7 @@
         int appearance = a.getResourceId(
                 com.android.internal.R.styleable.Switch_switchTextAppearance, 0);
         if (appearance != 0) {
-            setSwitchTextAppearance(appearance);
+            setSwitchTextAppearance(context, appearance);
         }
         a.recycle();
 
@@ -162,9 +168,9 @@
      * Sets the switch text color, size, style, hint color, and highlight color
      * from the specified TextAppearance resource.
      */
-    public void setSwitchTextAppearance(int resid) {
+    public void setSwitchTextAppearance(Context context, int resid) {
         TypedArray appearance =
-                getContext().obtainStyledAttributes(resid,
+                context.obtainStyledAttributes(resid,
                         com.android.internal.R.styleable.TextAppearance);
 
         ColorStateList colors;
@@ -174,6 +180,9 @@
                 TextAppearance_textColor);
         if (colors != null) {
             mTextColors = colors;
+        } else {
+            // If no color set in TextAppearance, default to the view's textColor
+            mTextColors = getTextColors();
         }
 
         ts = appearance.getDimensionPixelSize(com.android.internal.R.styleable.
@@ -244,7 +253,7 @@
     }
 
     /**
-     * Sets the typeface and style in which the text should be displayed on the switch.
+     * Sets the typeface in which the text should be displayed on the switch.
      * Note that not all Typeface families actually have bold and italic
      * variants, so you may need to use
      * {@link #setSwitchTypeface(Typeface, int)} to get the appearance
@@ -263,18 +272,14 @@
     }
 
     /**
-     * Returns the text for when the button is in the checked state.
-     *
-     * @return The text.
+     * Returns the text displayed when the button is in the checked state.
      */
     public CharSequence getTextOn() {
         return mTextOn;
     }
 
     /**
-     * Sets the text for when the button is in the checked state.
-     *
-     * @param textOn The text.
+     * Sets the text displayed when the button is in the checked state.
      */
     public void setTextOn(CharSequence textOn) {
         mTextOn = textOn;
@@ -282,18 +287,14 @@
     }
 
     /**
-     * Returns the text for when the button is not in the checked state.
-     *
-     * @return The text.
+     * Returns the text displayed when the button is not in the checked state.
      */
     public CharSequence getTextOff() {
         return mTextOff;
     }
 
     /**
-     * Sets the text for when the button is not in the checked state.
-     *
-     * @param textOff The text.
+     * Sets the text displayed when the button is not in the checked state.
      */
     public void setTextOff(CharSequence textOff) {
         mTextOff = textOff;
@@ -582,8 +583,11 @@
         mThumbDrawable.setBounds(thumbLeft, switchTop, thumbRight, switchBottom);
         mThumbDrawable.draw(canvas);
 
-        mTextPaint.setColor(mTextColors.getColorForState(getDrawableState(),
-                mTextColors.getDefaultColor()));
+        // mTextColors should not be null, but just in case
+        if (mTextColors != null) {
+            mTextPaint.setColor(mTextColors.getColorForState(getDrawableState(),
+                    mTextColors.getDefaultColor()));
+        }
         mTextPaint.drawableState = getDrawableState();
 
         Layout switchText = getTargetCheckedState() ? mOnLayout : mOffLayout;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c021c48..e9662ae 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -84,10 +84,10 @@
 import android.text.style.ClickableSpan;
 import android.text.style.ParagraphStyle;
 import android.text.style.SpellCheckSpan;
+import android.text.style.SuggestionRangeSpan;
 import android.text.style.SuggestionSpan;
 import android.text.style.TextAppearanceSpan;
 import android.text.style.URLSpan;
-import android.text.style.UnderlineSpan;
 import android.text.style.UpdateAppearance;
 import android.text.util.Linkify;
 import android.util.AttributeSet;
@@ -2894,7 +2894,6 @@
                     sp.removeSpan(cw);
                 }
 
-                // hideControllers would do it, but it gets called after this method on rotation
                 sp.removeSpan(mSuggestionRangeSpan);
 
                 ss.text = sp;
@@ -5099,10 +5098,9 @@
     @Override
     public boolean onKeyPreIme(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_BACK) {
-            boolean areSuggestionsShown = areSuggestionsShown();
             boolean isInSelectionMode = mSelectionActionMode != null;
 
-            if (areSuggestionsShown || isInSelectionMode) {
+            if (isInSelectionMode) {
                 if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
                     KeyEvent.DispatcherState state = getKeyDispatcherState();
                     if (state != null) {
@@ -5115,10 +5113,6 @@
                         state.handleUpEvent(event);
                     }
                     if (event.isTracking() && !event.isCanceled()) {
-                        if (areSuggestionsShown) {
-                            hideSuggestions();
-                            return true;
-                        }
                         if (isInSelectionMode) {
                             stopSelectionActionMode();
                             return true;
@@ -5282,10 +5276,6 @@
 
                 // Has to be done on key down (and not on key up) to correctly be intercepted.
             case KeyEvent.KEYCODE_BACK:
-                if (areSuggestionsShown()) {
-                    hideSuggestions();
-                    return -1;
-                }
                 if (mSelectionActionMode != null) {
                     stopSelectionActionMode();
                     return -1;
@@ -7950,9 +7940,6 @@
             }
 
             hideControllers();
-
-            removeSpans(0, mText.length(), SuggestionSpan.class);
-            removeSpans(0, mText.length(), SpellCheckSpan.class);
         }
 
         startStopMarquee(hasWindowFocus);
@@ -9196,11 +9183,6 @@
         }
     }
 
-    private static class SuggestionRangeSpan extends UnderlineSpan {
-        // TODO themable, would be nice to make it a child class of TextAppearanceSpan, but
-        // there is no way to have underline and TextAppearanceSpan.
-    }
-
     private class SuggestionsPopupWindow extends PinnedPopupWindow implements OnClickListener {
         private static final int MAX_NUMBER_SUGGESTIONS = SuggestionSpan.SUGGESTIONS_MAX_SIZE;
         private static final int NO_SUGGESTIONS = -1;
@@ -9208,13 +9190,42 @@
         private WordIterator mSuggestionWordIterator;
         private TextAppearanceSpan[] mHighlightSpans = new TextAppearanceSpan
                 [(int) (AVERAGE_HIGHLIGHTS_PER_SUGGESTION * MAX_NUMBER_SUGGESTIONS)];
+        private boolean mCursorWasVisibleBeforeSuggestions;
+
+        private class CustomPopupWindow extends PopupWindow {
+            public CustomPopupWindow(Context context, int defStyle) {
+                super(context, null, defStyle);
+            }
+
+            @Override
+            public void dismiss() {
+                super.dismiss();
+
+                if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
+                    ((Editable) mText).removeSpan(mSuggestionRangeSpan);
+                }
+
+                setCursorVisible(mCursorWasVisibleBeforeSuggestions);
+                if (hasInsertionController()) {
+                    getInsertionController().show(); 
+                }
+            }
+        }
+
+        public SuggestionsPopupWindow() {
+            for (int i = 0; i < mHighlightSpans.length; i++) {
+                mHighlightSpans[i] = new TextAppearanceSpan(mContext,
+                        android.R.style.TextAppearance_SuggestionHighlight);
+            }
+            mCursorWasVisibleBeforeSuggestions = mCursorVisible;
+        }
 
         @Override
         protected void createPopupWindow() {
-            mPopupWindow = new PopupWindow(TextView.this.mContext, null,
+            mPopupWindow = new CustomPopupWindow(TextView.this.mContext,
                 com.android.internal.R.attr.textSuggestionsWindowStyle);
             mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
-            mPopupWindow.setOutsideTouchable(true);
+            mPopupWindow.setFocusable(true);
             mPopupWindow.setClippingEnabled(false);
         }
 
@@ -9288,6 +9299,8 @@
             if (!(mText instanceof Editable)) return;
 
             if (updateSuggestions()) {
+                mCursorWasVisibleBeforeSuggestions = mCursorVisible;
+                setCursorVisible(false);
                 super.show();
             }
         }
@@ -9312,9 +9325,6 @@
         @Override
         public void hide() {
             super.hide();
-            if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
-                ((Editable) mText).removeSpan(mSuggestionRangeSpan);
-            }
         }
 
         private boolean updateSuggestions() {
@@ -9553,7 +9563,7 @@
                 final int spanEnd = suggestionInfo.spanEnd;
                 if (spanStart != NO_SUGGESTIONS) {
                     // SuggestionSpans are removed by replace: save them before
-                    Editable editable = ((Editable) mText);
+                    Editable editable = (Editable) mText;
                     SuggestionSpan[] suggestionSpans = editable.getSpans(spanStart, spanEnd,
                             SuggestionSpan.class);
                     final int length = suggestionSpans.length;
@@ -9572,7 +9582,7 @@
                     final String suggestion = textView.getText().subSequence(
                             suggestionStart, suggestionEnd).toString();
                     final String originalText = mText.subSequence(spanStart, spanEnd).toString();
-                    ((Editable) mText).replace(spanStart, spanEnd, suggestion);
+                    editable.replace(spanStart, spanEnd, suggestion);
 
                     // A replacement on a misspelled text removes the misspelled flag.
                     // TODO restore the flag if the misspelled word is selected back?
@@ -9624,12 +9634,6 @@
         mSuggestionsPopupWindow.show();
     }
 
-    void hideSuggestions() {
-        if (mSuggestionsPopupWindow != null) {
-            mSuggestionsPopupWindow.hide();
-        }
-    }
-
     boolean areSuggestionsShown() {
         return mSuggestionsPopupWindow != null && mSuggestionsPopupWindow.isShowing();
     }
@@ -10579,7 +10583,6 @@
             mEndHandle.setActionPopupWindow(mStartHandle.getActionPopupWindow());
 
             hideInsertionPointCursorController();
-            hideSuggestions();
         }
 
         public void hide() {
@@ -10691,7 +10694,6 @@
     private void hideControllers() {
         hideInsertionPointCursorController();
         stopSelectionActionMode();
-        hideSuggestions();
     }
 
     /**
diff --git a/core/java/com/android/internal/widget/AbsActionBarView.java b/core/java/com/android/internal/widget/AbsActionBarView.java
index ccbce3e..df2f717 100644
--- a/core/java/com/android/internal/widget/AbsActionBarView.java
+++ b/core/java/com/android/internal/widget/AbsActionBarView.java
@@ -56,6 +56,16 @@
         mSplitView = splitView;
     }
 
+    /**
+     * @return Current visibility or if animating, the visibility being animated to.
+     */
+    public int getAnimatedVisibility() {
+        if (mVisibilityAnim != null) {
+            return mVisAnimListener.mFinalVisibility;
+        }
+        return getVisibility();
+    }
+
     public void animateToVisibility(int visibility) {
         if (mVisibilityAnim != null) {
             mVisibilityAnim.cancel();
@@ -179,7 +189,7 @@
 
     protected class VisibilityAnimListener implements Animator.AnimatorListener {
         private boolean mCanceled = false;
-        private int mFinalVisibility;
+        int mFinalVisibility;
 
         public VisibilityAnimListener withFinalVisibility(int visibility) {
             mFinalVisibility = visibility;
@@ -199,6 +209,9 @@
 
             mVisibilityAnim = null;
             setVisibility(mFinalVisibility);
+            if (mSplitView != null && mMenuView != null) {
+                mMenuView.setVisibility(mFinalVisibility);
+            }
         }
 
         @Override
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 45d38ae..4fccc32 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -33,6 +33,7 @@
 import android.view.ActionMode;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.animation.DecelerateInterpolator;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -270,14 +271,14 @@
     }
 
     @Override
-    protected LayoutParams generateDefaultLayoutParams() {
+    protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
         // Used by custom views if they don't supply layout params. Everything else
         // added to an ActionBarContextView should have them already.
         return new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
     }
 
     @Override
-    public LayoutParams generateLayoutParams(AttributeSet attrs) {
+    public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
         return new MarginLayoutParams(getContext(), attrs);
     }
 
@@ -321,7 +322,7 @@
         }
 
         if (mCustomView != null) {
-            LayoutParams lp = mCustomView.getLayoutParams();
+            ViewGroup.LayoutParams lp = mCustomView.getLayoutParams();
             final int customWidthMode = lp.width != LayoutParams.WRAP_CONTENT ?
                     MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
             final int customWidth = lp.width >= 0 ?
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index a0f6259..ff26d50 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -401,6 +401,7 @@
                 if (oldParent != null && oldParent != mSplitView) {
                     oldParent.removeView(menuView);
                 }
+                menuView.setVisibility(getAnimatedVisibility());
                 mSplitView.addView(menuView, layoutParams);
             } else {
                 // We'll add this later if we missed it this time.
@@ -683,7 +684,7 @@
     }
 
     @Override
-    protected LayoutParams generateDefaultLayoutParams() {
+    protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
         // Used by custom nav views if they don't supply layout params. Everything else
         // added to an ActionBarView should have them already.
         return new ActionBar.LayoutParams(DEFAULT_CUSTOM_GRAVITY);
@@ -810,7 +811,7 @@
         HomeView homeLayout = mExpandedActionView != null ? mExpandedHomeLayout : mHomeLayout;
 
         if (homeLayout.getVisibility() != GONE) {
-            final LayoutParams lp = homeLayout.getLayoutParams();
+            final ViewGroup.LayoutParams lp = homeLayout.getLayoutParams();
             int homeWidthSpec;
             if (lp.width < 0) {
                 homeWidthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST);
@@ -881,7 +882,7 @@
         }
 
         if (customView != null) {
-            final LayoutParams lp = generateLayoutParams(customView.getLayoutParams());
+            final ViewGroup.LayoutParams lp = generateLayoutParams(customView.getLayoutParams());
             final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
                     (ActionBar.LayoutParams) lp : null;
 
@@ -1017,7 +1018,7 @@
             customView = mCustomNavView;
         }
         if (customView != null) {
-            LayoutParams lp = customView.getLayoutParams();
+            ViewGroup.LayoutParams lp = customView.getLayoutParams();
             final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
                     (ActionBar.LayoutParams) lp : null;
 
@@ -1095,12 +1096,12 @@
     }
 
     @Override
-    public LayoutParams generateLayoutParams(AttributeSet attrs) {
+    public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
         return new ActionBar.LayoutParams(getContext(), attrs);
     }
 
     @Override
-    public LayoutParams generateLayoutParams(LayoutParams lp) {
+    public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
         if (lp == null) {
             lp = generateDefaultLayoutParams();
         }
diff --git a/core/res/res/anim-sw600dp/activity_close_enter.xml b/core/res/res/anim-sw600dp/activity_close_enter.xml
deleted file mode 100644
index c17786f..0000000
--- a/core/res/res/anim-sw600dp/activity_close_enter.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
-            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/activity_close_exit.xml b/core/res/res/anim-sw600dp/activity_close_exit.xml
deleted file mode 100644
index ba33640..0000000
--- a/core/res/res/anim-sw600dp/activity_close_exit.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shareInterpolator="false"
-        android:zAdjustment="top">
-    <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-    <scale android:fromXScale="1.0" android:toXScale="1.1"
-            android:fromYScale="1.0" android:toYScale="1.1"
-            android:pivotX="50%p" android:pivotY="50%p"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/activity_open_enter.xml b/core/res/res/anim-sw600dp/activity_open_enter.xml
deleted file mode 100644
index c4b5ed7..0000000
--- a/core/res/res/anim-sw600dp/activity_open_enter.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shareInterpolator="false"
-        android:zAdjustment="top">
-    <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true"
-            android:fillBefore="false" android:fillAfter="false"
-            android:duration="@android:integer/config_shortAnimTime"/>
-    <scale android:fromXScale="1.1" android:toXScale="1.0"
-            android:fromYScale="1.1" android:toYScale="1.0"
-            android:pivotX="50%p" android:pivotY="50%p"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true"
-            android:fillBefore="false" android:fillAfter="false"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/activity_open_exit.xml b/core/res/res/anim-sw600dp/activity_open_exit.xml
deleted file mode 100644
index b386b8bc..0000000
--- a/core/res/res/anim-sw600dp/activity_open_exit.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
-            android:fillEnabled="true" android:fillBefore="false" android:fillAfter="false"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/wallpaper_close_enter.xml b/core/res/res/anim-sw600dp/wallpaper_close_enter.xml
deleted file mode 100644
index b65ecf4..0000000
--- a/core/res/res/anim-sw600dp/wallpaper_close_enter.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="true" android:shareInterpolator="false"
-        android:zAdjustment="top">
-
-        <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
-                android:interpolator="@interpolator/decelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:duration="@android:integer/config_shortAnimTime"/>
-
-        <scale android:fromXScale="2.0" android:toXScale="1.0"
-                android:fromYScale="0.1" android:toYScale="1.0"
-                android:pivotX="50%p" android:pivotY="50%p"
-                android:interpolator="@interpolator/decelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:duration="@android:integer/config_shortAnimTime"/>
-
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/wallpaper_close_exit.xml b/core/res/res/anim-sw600dp/wallpaper_close_exit.xml
deleted file mode 100644
index fabfacc..0000000
--- a/core/res/res/anim-sw600dp/wallpaper_close_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="false" android:shareInterpolator="false"
-        android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
-            android:interpolator="@interpolator/decelerate_cubic"
-            android:fillEnabled="true"
-            android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/wallpaper_open_enter.xml b/core/res/res/anim-sw600dp/wallpaper_open_enter.xml
deleted file mode 100644
index 96bdf42..0000000
--- a/core/res/res/anim-sw600dp/wallpaper_open_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="false" android:shareInterpolator="false"
-        android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
-            android:interpolator="@interpolator/accelerate_cubic"
-            android:fillEnabled="true"
-            android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim-sw600dp/wallpaper_open_exit.xml b/core/res/res/anim-sw600dp/wallpaper_open_exit.xml
deleted file mode 100644
index d7bcc5c..0000000
--- a/core/res/res/anim-sw600dp/wallpaper_open_exit.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="true" android:shareInterpolator="false"
-        android:zAdjustment="top">
-
-
-        <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
-                android:interpolator="@interpolator/accelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="@android:integer/config_shortAnimTime"/>
-
-
-        <scale android:fromXScale="1.0" android:toXScale="2.0"
-                android:fromYScale="1.0" android:toYScale="0.1"
-                android:pivotX="50%p" android:pivotY="50%p"
-                android:interpolator="@interpolator/accelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="@android:integer/config_shortAnimTime" />
-
-</set>
\ No newline at end of file
diff --git a/core/res/res/anim/activity_close_enter.xml b/core/res/res/anim/activity_close_enter.xml
index c17786f..c759a83 100644
--- a/core/res/res/anim/activity_close_enter.xml
+++ b/core/res/res/anim/activity_close_enter.xml
@@ -21,4 +21,11 @@
     <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
             android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
             android:duration="@android:integer/config_shortAnimTime"/>
+    <scale android:fromXScale=".95" android:toXScale="1.0"
+            android:fromYScale=".95" android:toYScale="1.0"
+            android:pivotX="50%p" android:pivotY="50%p"
+            android:interpolator="@interpolator/accelerate_quint"
+            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+            android:duration="@android:integer/config_shortAnimTime"/>
+
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/activity_close_exit.xml b/core/res/res/anim/activity_close_exit.xml
index e560a41..384810f2 100644
--- a/core/res/res/anim/activity_close_exit.xml
+++ b/core/res/res/anim/activity_close_exit.xml
@@ -18,16 +18,15 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shareInterpolator="false"
-        android:zAdjustment="top">
+        android:shareInterpolator="false" android:zAdjustment="top">
     <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
-            android:interpolator="@interpolator/accelerate_decelerate"
+            android:interpolator="@interpolator/decelerate_cubic"
             android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
             android:duration="@android:integer/config_shortAnimTime"/>
-    <scale android:fromXScale="1.0" android:toXScale="1.15"
-            android:fromYScale="1.0" android:toYScale="1.15"
+    <scale android:fromXScale="1.0" android:toXScale="1.1"
+            android:fromYScale="1.0" android:toYScale="1.1"
             android:pivotX="50%p" android:pivotY="50%p"
-            android:interpolator="@interpolator/accelerate_decelerate"
+            android:interpolator="@interpolator/decelerate_quint"
             android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
             android:duration="@android:integer/config_shortAnimTime"/>
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/activity_open_enter.xml b/core/res/res/anim/activity_open_enter.xml
index 55fcc0d..744153d 100644
--- a/core/res/res/anim/activity_open_enter.xml
+++ b/core/res/res/anim/activity_open_enter.xml
@@ -21,14 +21,14 @@
         android:shareInterpolator="false"
         android:zAdjustment="top">
     <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
-            android:interpolator="@interpolator/accelerate_decelerate"
+            android:interpolator="@interpolator/decelerate_cubic"
             android:fillEnabled="true"
             android:fillBefore="false" android:fillAfter="false"
             android:duration="@android:integer/config_shortAnimTime"/>
-    <scale android:fromXScale="1.15" android:toXScale="1.0"
-            android:fromYScale="1.15" android:toYScale="1.0"
+    <scale android:fromXScale="1.1" android:toXScale="1.0"
+            android:fromYScale="1.1" android:toYScale="1.0"
             android:pivotX="50%p" android:pivotY="50%p"
-            android:interpolator="@interpolator/accelerate_decelerate"
+            android:interpolator="@interpolator/decelerate_quint"
             android:fillEnabled="true"
             android:fillBefore="false" android:fillAfter="false"
             android:duration="@android:integer/config_shortAnimTime"/>
diff --git a/core/res/res/anim/activity_open_exit.xml b/core/res/res/anim/activity_open_exit.xml
index b386b8bc..58e8816 100644
--- a/core/res/res/anim/activity_open_exit.xml
+++ b/core/res/res/anim/activity_open_exit.xml
@@ -21,4 +21,12 @@
     <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
             android:fillEnabled="true" android:fillBefore="false" android:fillAfter="false"
             android:duration="@android:integer/config_shortAnimTime"/>
+    <scale android:fromXScale="1.0" android:toXScale=".95"
+            android:fromYScale="1.0" android:toYScale=".95"
+            android:pivotX="50%p" android:pivotY="50%p"
+            android:interpolator="@interpolator/decelerate_quint"
+            android:fillEnabled="true"
+            android:fillBefore="false" android:fillAfter="false"
+            android:duration="@android:integer/config_shortAnimTime"/>
+
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/lock_screen_behind_enter.xml b/core/res/res/anim/lock_screen_behind_enter.xml
index 232096c..4f58be4 100644
--- a/core/res/res/anim/lock_screen_behind_enter.xml
+++ b/core/res/res/anim/lock_screen_behind_enter.xml
@@ -19,10 +19,18 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:detachWallpaper="true" android:shareInterpolator="false">
+    <scale
+        android:fromXScale="0.95" android:toXScale="1.0"
+        android:fromYScale="0.95" android:toYScale="1.0"
+        android:pivotX="50%p" android:pivotY="50%p"
+        android:fillEnabled="true" android:fillBefore="true"
+        android:interpolator="@interpolator/decelerate_cubic"
+        android:startOffset="@android:integer/config_shortAnimTime"
+        android:duration="@android:integer/config_shortAnimTime" />
     <alpha
-        android:fromAlpha="0" android:toAlpha="1.0"
+        android:fromAlpha="0.0" android:toAlpha="1.0"
         android:fillEnabled="true" android:fillBefore="true"
         android:interpolator="@interpolator/decelerate_quad"
         android:startOffset="@android:integer/config_shortAnimTime"
-        android:duration="300"/>
+        android:duration="@android:integer/config_shortAnimTime"/>
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/lock_screen_exit.xml b/core/res/res/anim/lock_screen_exit.xml
index c4b6fcb..a186126 100644
--- a/core/res/res/anim/lock_screen_exit.xml
+++ b/core/res/res/anim/lock_screen_exit.xml
@@ -19,16 +19,18 @@
 
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:shareInterpolator="false"
-        android:zAdjustment="top">
-    <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
-    <scale android:fromXScale="1.0" android:toXScale="1.15"
-            android:fromYScale="1.0" android:toYScale="1.15"
-            android:pivotX="50%p" android:pivotY="50%p"
-            android:interpolator="@interpolator/accelerate_decelerate"
-            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
-            android:duration="@android:integer/config_shortAnimTime"/>
+    android:zAdjustment="top"
+    android:shareInterpolator="false">
+    <scale
+        android:fromXScale="1.0" android:toXScale="1.15"
+        android:fromYScale="1.0" android:toYScale="1.15"
+        android:pivotX="50%p" android:pivotY="50%p"
+        android:fillEnabled="true" android:fillAfter="true"
+        android:interpolator="@interpolator/accelerate_quint"
+        android:duration="@android:integer/config_shortAnimTime" />
+    <alpha
+        android:fromAlpha="1.0" android:toAlpha="0"
+        android:fillEnabled="true" android:fillAfter="true"
+        android:interpolator="@interpolator/accelerate_quad"
+        android:duration="@android:integer/config_shortAnimTime"/>
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/wallpaper_close_enter.xml b/core/res/res/anim/wallpaper_close_enter.xml
index 1cbe3ec..1ca5c0c 100644
--- a/core/res/res/anim/wallpaper_close_enter.xml
+++ b/core/res/res/anim/wallpaper_close_enter.xml
@@ -18,35 +18,17 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="true" android:shareInterpolator="false"
-        android:zAdjustment="top">
-
-        <alpha android:fromAlpha="0.0" android:toAlpha="0.5"
-                android:interpolator="@interpolator/accelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="140"/>
-        <alpha android:fromAlpha="0.5" android:toAlpha="1.0"
-                android:interpolator="@interpolator/decelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:startOffset="140"
-                android:duration="140"/>
-
-        <scale android:fromXScale="2.0" android:toXScale="1.5"
-                android:fromYScale="0.01" android:toYScale="0.495"
-                android:pivotX="50%p" android:pivotY="50%p"
-                android:interpolator="@interpolator/accelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="140"/>
-        <scale android:fromXScale="1.5" android:toXScale="1.0"
-                android:fromYScale="0.495" android:toYScale="1.0"
-                android:pivotX="50%p" android:pivotY="50%p"
-                android:interpolator="@interpolator/decelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:startOffset="140"
-                android:duration="140"/>
-
+        android:shareInterpolator="false" android:zAdjustment="top">
+    <scale android:fromXScale="1.2" android:toXScale="1.0"
+            android:fromYScale=".8" android:toYScale="1.0"
+            android:pivotX="50%p" android:pivotY="50%p"
+            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+            android:interpolator="@interpolator/decelerate_quint"
+            android:startOffset="300"
+            android:duration="240" />
+    <alpha android:fromAlpha="0" android:toAlpha="1.0"
+            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+            android:interpolator="@interpolator/decelerate_quad"
+            android:startOffset="300"
+            android:duration="300"/>
 </set>
\ No newline at end of file
diff --git a/core/res/res/anim/wallpaper_close_exit.xml b/core/res/res/anim/wallpaper_close_exit.xml
index ebeae6e..7e0e05f 100644
--- a/core/res/res/anim/wallpaper_close_exit.xml
+++ b/core/res/res/anim/wallpaper_close_exit.xml
@@ -18,11 +18,15 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="false" android:shareInterpolator="false"
-        android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
+        android:detachWallpaper="true" android:shareInterpolator="false" android:zAdjustment="normal">
+    <alpha android:fromAlpha="1.0" android:toAlpha="0"
+            android:fillEnabled="true" android:fillAfter="true"
             android:interpolator="@interpolator/decelerate_cubic"
-            android:fillEnabled="true"
-            android:fillBefore="true" android:fillAfter="true"
-            android:duration="280"/>
-</set>
+            android:duration="200"/>
+    <scale android:fromXScale="1.0" android:toXScale="0.95"
+            android:fromYScale="1.0" android:toYScale="0.95"
+            android:pivotX="50%p" android:pivotY="50%p"
+            android:fillEnabled="true" android:fillAfter="true"
+            android:interpolator="@interpolator/decelerate_quint"
+            android:duration="300" />
+</set>
\ No newline at end of file
diff --git a/core/res/res/anim/wallpaper_open_enter.xml b/core/res/res/anim/wallpaper_open_enter.xml
index 411ecd6..6fdbd40 100644
--- a/core/res/res/anim/wallpaper_open_enter.xml
+++ b/core/res/res/anim/wallpaper_open_enter.xml
@@ -18,11 +18,17 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="false" android:shareInterpolator="false"
-        android:zAdjustment="normal">
-    <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
-            android:interpolator="@interpolator/accelerate_cubic"
-            android:fillEnabled="true"
-            android:fillBefore="true" android:fillAfter="true"
-            android:duration="280"/>
-</set>
+        android:detachWallpaper="true" android:shareInterpolator="false" android:zAdjustment="normal">
+    <scale android:fromXScale="0.95" android:toXScale="1.0"
+            android:fromYScale="0.95" android:toYScale="1.0"
+            android:pivotX="50%p" android:pivotY="50%p"
+            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+            android:interpolator="@interpolator/decelerate_quint"
+            android:startOffset="200"
+            android:duration="300" />
+    <alpha android:fromAlpha="0" android:toAlpha="1.0"
+            android:interpolator="@interpolator/decelerate_cubic"
+            android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+            android:startOffset="200"
+            android:duration="300"/>
+</set>
\ No newline at end of file
diff --git a/core/res/res/anim/wallpaper_open_exit.xml b/core/res/res/anim/wallpaper_open_exit.xml
index f9e0996..075831b 100644
--- a/core/res/res/anim/wallpaper_open_exit.xml
+++ b/core/res/res/anim/wallpaper_open_exit.xml
@@ -18,35 +18,16 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
-        android:detachWallpaper="true" android:shareInterpolator="false"
-        android:zAdjustment="top">
-
-
-        <alpha android:fromAlpha="1.0" android:toAlpha="0.5"
+        android:shareInterpolator="false" android:zAdjustment="top">
+        <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
                 android:interpolator="@interpolator/accelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="140"/>
-        <alpha android:fromAlpha="0.5" android:toAlpha="0.0"
-                android:interpolator="@interpolator/decelerate_cubic"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:startOffset="140" android:duration="140"/>
-
-
-        <scale android:fromXScale="1.0" android:toXScale="1.5"
-                android:fromYScale="1.0" android:toYScale="0.495"
+                android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+                android:duration="200" />
+        <scale android:fromXScale="1.0" android:toXScale="1.2"
+                android:fromYScale="1.0" android:toYScale="0.8"
                 android:pivotX="50%p" android:pivotY="50%p"
                 android:interpolator="@interpolator/accelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="true" android:fillAfter="false"
-                android:duration="140" />
-        <scale android:fromXScale="1.5" android:toXScale="2.0"
-                android:fromYScale="0.495" android:toYScale="0.0"
-                android:pivotX="50%p" android:pivotY="50%p"
-                android:interpolator="@interpolator/decelerate_quint"
-                android:fillEnabled="true"
-                android:fillBefore="false" android:fillAfter="true"
-                android:startOffset="140" android:duration="140" />
+                android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
+                android:duration="200" />
 
 </set>
\ No newline at end of file
diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..53871a05
--- /dev/null
+++ b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..e3a0313
--- /dev/null
+++ b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/text_select_handle_left.png b/core/res/res/drawable-hdpi/text_select_handle_left.png
index 82cb640..e980857 100644
--- a/core/res/res/drawable-hdpi/text_select_handle_left.png
+++ b/core/res/res/drawable-hdpi/text_select_handle_left.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/text_select_handle_middle.png b/core/res/res/drawable-hdpi/text_select_handle_middle.png
index a2a909a..603f497 100644
--- a/core/res/res/drawable-hdpi/text_select_handle_middle.png
+++ b/core/res/res/drawable-hdpi/text_select_handle_middle.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/text_select_handle_right.png b/core/res/res/drawable-hdpi/text_select_handle_right.png
index 31f1c03..a5efe30 100644
--- a/core/res/res/drawable-hdpi/text_select_handle_right.png
+++ b/core/res/res/drawable-hdpi/text_select_handle_right.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..9d80b77
--- /dev/null
+++ b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..efa4325
--- /dev/null
+++ b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/text_select_handle_left.png b/core/res/res/drawable-mdpi/text_select_handle_left.png
index d2cb710..0c3a0cc 100644
--- a/core/res/res/drawable-mdpi/text_select_handle_left.png
+++ b/core/res/res/drawable-mdpi/text_select_handle_left.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/text_select_handle_middle.png b/core/res/res/drawable-mdpi/text_select_handle_middle.png
index db70e5a..f488bdd 100644
--- a/core/res/res/drawable-mdpi/text_select_handle_middle.png
+++ b/core/res/res/drawable-mdpi/text_select_handle_middle.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/text_select_handle_right.png b/core/res/res/drawable-mdpi/text_select_handle_right.png
index be3d6ea..d3880c6 100644
--- a/core/res/res/drawable-mdpi/text_select_handle_right.png
+++ b/core/res/res/drawable-mdpi/text_select_handle_right.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..521e2d9
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..92e117d
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/text_select_handle_left.png b/core/res/res/drawable-xhdpi/text_select_handle_left.png
index 6a10560..5fcbc52 100644
--- a/core/res/res/drawable-xhdpi/text_select_handle_left.png
+++ b/core/res/res/drawable-xhdpi/text_select_handle_left.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/text_select_handle_middle.png b/core/res/res/drawable-xhdpi/text_select_handle_middle.png
index 71aaa85..05c2ca7 100644
--- a/core/res/res/drawable-xhdpi/text_select_handle_middle.png
+++ b/core/res/res/drawable-xhdpi/text_select_handle_middle.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/text_select_handle_right.png b/core/res/res/drawable-xhdpi/text_select_handle_right.png
index 5339adc..ebf97c4 100644
--- a/core/res/res/drawable-xhdpi/text_select_handle_right.png
+++ b/core/res/res/drawable-xhdpi/text_select_handle_right.png
Binary files differ
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 04e510b..57e9bbf 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -163,6 +163,8 @@
        <item>@drawable/list_selector_holo_light</item>
        <item>@drawable/menu_background</item>
        <item>@drawable/menu_background_fill_parent_width</item>
+       <item>@drawable/menu_hardkey_panel_holo_dark</item>
+       <item>@drawable/menu_hardkey_panel_holo_light</item>
        <item>@drawable/menu_submenu_background</item>
        <item>@drawable/menu_selector</item>
        <item>@drawable/overscroll_edge</item>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 93cbde5..dae9f70 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5318,9 +5318,9 @@
 
     <declare-styleable name="Switch">
         <!-- Drawable to use as the "thumb" that switches back and forth. -->
-        <attr name="switchThumb" format="reference" />
+        <attr name="thumb" />
         <!-- Drawable to use as the "track" that the switch thumb slides within. -->
-        <attr name="switchTrack" format="reference" />
+        <attr name="track" format="reference" />
         <!-- Text to use when the switch is in the checked/"on" state. -->
         <attr name="textOn" />
         <!-- Text to use when the switch is in the unchecked/"off" state. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index b9d05fd..fcd3bba 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1713,6 +1713,11 @@
   <public type="attr" name="switchTextOn" />
   <public type="attr" name="switchTextOff" />
   <public type="attr" name="switchPreferenceStyle" />
+  <public type="attr" name="switchTextAppearance" />
+  <public type="attr" name="track" />
+  <public type="attr" name="switchMinWidth" />
+  <public type="attr" name="switchPadding" />
+  <public type="attr" name="thumbTextPadding" />
 
   <public type="attr" name="textSuggestionsWindowStyle" />
   <public type="attr" name="textEditSuggestionItemLayout" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index a3e460e..8e0f300 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1789,7 +1789,7 @@
 
     <!-- When the lock screen is showing and the phone plugged in, and the battery
          is not fully charged, show the current charge %.  -->
-    <string name="lockscreen_plugged_in">Charging (<xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>)</string>
+    <string name="lockscreen_plugged_in">Charging, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
     <!-- When the lock screen is showing, the phone is plugged in and the battery is fully
          charged, say that it is charged. -->
     <string name="lockscreen_charged">Charged.</string>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 5a76ed4..052a040 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -725,6 +725,11 @@
         <item name="android:quickContactWindowSize">modeLarge</item>
     </style>
 
+    <style name="Widget.CompoundButton.Switch">
+        <item name="android:textOn">@android:string/capital_on</item>
+        <item name="android:textOff">@android:string/capital_off</item>
+    </style>
+
     <!-- Text Appearances -->
     <eat-comment />
 
@@ -885,11 +890,9 @@
         <item name="android:textSize">30sp</item>
     </style>
 
-     <!-- @hide -->
      <style name="TextAppearance.SuggestionHighlight">
          <item name="android:textSize">18sp</item>
          <item name="android:textColor">@android:color/suggestion_highlight_text</item>
-         <item name="android:textStyle">bold</item>
      </style>
 
     <!-- Preference Styles -->
@@ -1919,8 +1922,8 @@
     </style>
 
     <style name="Widget.Holo.CompoundButton.Switch">
-        <item name="android:switchTrack">@android:drawable/switch_track_holo_dark</item>
-        <item name="android:switchThumb">@android:drawable/switch_inner_holo_dark</item>
+        <item name="android:track">@android:drawable/switch_track_holo_dark</item>
+        <item name="android:thumb">@android:drawable/switch_inner_holo_dark</item>
         <item name="android:switchTextAppearance">@android:style/TextAppearance.Holo.Widget.Switch</item>
         <item name="android:textOn">@android:string/capital_on</item>
         <item name="android:textOff">@android:string/capital_off</item>
@@ -2293,6 +2296,17 @@
         <item name="android:itemPadding">8dip</item>
     </style>
 
+    <style name="Widget.Holo.Light.CompoundButton.Switch" parent="Widget.CompoundButton.Switch">
+        <item name="android:track">@android:drawable/switch_track_holo_light</item>
+        <item name="android:thumb">@android:drawable/switch_inner_holo_light</item>
+        <item name="android:switchTextAppearance">@android:style/TextAppearance.Holo.Widget.Switch</item>
+        <item name="android:textOn">@android:string/capital_on</item>
+        <item name="android:textOff">@android:string/capital_off</item>
+        <item name="android:thumbTextPadding">12dip</item>
+        <item name="android:switchMinWidth">96dip</item>
+        <item name="android:switchPadding">16dip</item>
+    </style>
+
     <!-- Animation Styles -->
 
     <style name="Animation.Holo" parent="Animation">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 903fc04..f434ce8 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -980,7 +980,7 @@
         <item name="toastFrameBackground">@android:drawable/toast_frame_holo</item>
         
         <!-- Panel attributes -->
-        <item name="panelBackground">@android:drawable/menu_dropdown_panel_holo_dark</item>
+        <item name="panelBackground">@android:drawable/menu_hardkey_panel_holo_dark</item>
         <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
         <!-- These three attributes do not seems to be used by the framework. Declared public though -->
         <item name="panelColorBackground">#000</item>
@@ -1215,6 +1215,7 @@
         <item name="buttonStyleInset">@android:style/Widget.Holo.Light.Button.Inset</item>
 
         <item name="buttonStyleToggle">@android:style/Widget.Holo.Light.Button.Toggle</item>
+        <item name="switchStyle">@android:style/Widget.Holo.Light.CompoundButton.Switch</item>
 
         <item name="selectableItemBackground">@android:drawable/item_background_holo_light</item>
         <item name="borderlessButtonStyle">@android:style/Widget.Holo.Light.Button.Borderless</item>
@@ -1283,7 +1284,7 @@
         <item name="toastFrameBackground">@android:drawable/toast_frame_holo</item>
         
         <!-- Panel attributes -->
-        <item name="panelBackground">@android:drawable/menu_dropdown_panel_holo_light</item>
+        <item name="panelBackground">@android:drawable/menu_hardkey_panel_holo_light</item>
         <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
         <!-- These three attributes do not seems to be used by the framework. Declared public though -->
         <item name="panelColorBackground">#000</item>
diff --git a/docs/html/resources/tutorials/hello-world.jd b/docs/html/resources/tutorials/hello-world.jd
index b11770f..9afab6a 100644
--- a/docs/html/resources/tutorials/hello-world.jd
+++ b/docs/html/resources/tutorials/hello-world.jd
@@ -18,16 +18,14 @@
   </div>
 </div>
 
-<p>As a developer, you know that the first impression
-of a development framework is how easy it is to write "Hello,
-World." Well, on Android, it's pretty easy. 
-It's particularly easy if you're using Eclipse as your IDE, because we've provided a
-great plugin that handles your project creation and management to greatly speed-up your
-development cycles.</p>
+<p>As a developer, you know that the first impression of a development framework is how easy it is
+to write "Hello, World." Well, on Android, it's pretty easy. It's particularly easy if you're using
+Eclipse as your IDE, because we've provided a great plugin that handles your project creation and
+management to greatly speed up your development cycles.</p>
 
-<p>This tutorial assumes that you're using Eclipse. If you're not, see 
-<a href="{@docRoot}guide/developing/other-ide.html">Developing in Other IDEs</a>.
-You can then return to this tutorial and ignore anything about Eclipse.</p>
+<p>This tutorial assumes that you're using Eclipse. If you're using the command line, see
+<a href="{@docRoot}/guide/developing/building/building-cmdline.html">Building and Running from the
+Command Line</a>. You can then return to this tutorial and ignore anything about Eclipse.</p>
 
 <p>Before you start, you should already have the SDK installed, and if you're
 using Eclipse, you should have installed the ADT plugin as well. If you have not
@@ -43,12 +41,12 @@
 <p>To install a platform in Eclipse:</p>
 
 <ol>
-  
+
   <li>In the Android SDK and AVD Manager, choose <strong>Available
-Packages</strong> in the left panel.</li> 
- 
-<li>Click the repository site checkbox to display the components
-available for installation.</li>
+Packages</strong> in the left panel.</li>
+
+<li>In the right panel, expand the Android Repository list to display
+the components available for installation.</li>
 
   <li>Select at least one platform to install, and click <strong>Install
 Selected</strong>. If you aren't sure which platform to install, use the latest
@@ -59,15 +57,14 @@
 
 <div class="sidebox-wrapper">
   <div class="sidebox">
-    <p>To learn more about how to use AVDs and the options 
-       available to you, refer to the 
-       <a href="{@docRoot}guide/developing/tools/avd.html">Android 
-       Virtual Devices</a> document.</p>
+    <p>To learn more about how to use AVDs and the options
+       available to you, see <a href="{@docRoot}guide/developing/devices/index.html">Managing
+       Virtual Devices</a>.</p>
   </div>
 </div>
 
 <p>In this tutorial, you will run your application in the Android Emulator.
-Before you can launch the emulator, you must create an 
+Before you can launch the emulator, you must create an
 Android Virtual Device (AVD). An AVD defines the system image and
 device settings used by the emulator.</p>
 
@@ -75,32 +72,31 @@
 
 <p>To create an AVD:</p>
 <ol>
-  <li>In Eclipse, choose <strong>Window &gt; Android SDK and AVD Manager</strong>. 
+  <li>In Eclipse, select <strong>Window &gt; Android SDK and AVD Manager</strong>.</li>
   <li>Select <strong>Virtual Devices</strong> in the left panel.</li>
 
-  <li>Click <strong>New</strong>. </li>
- 
-
-<p>The <strong>Create New AVD</strong> dialog appears.</p>
-
+  <li>Click <strong>New...</strong>.
+    <p>The <strong>Create New AVD</strong> dialog appears.</p>
+  </li>
   <li>Type the name of the AVD, such as "my_avd".</li>
-  <li>Choose a target. The target is the platform (that is, the version of the Android
-    SDK, such as 2.1) you want to run on the emulator. </li>
-  
-  <p>You can ignore the rest of the fields for now. </p>
+  <li>Choose a target.
+    <p>The target is the platform (that is, the version of the Android SDK, such as 2.3.3) you want
+    to run on the emulator. For this tutorial, choose the latest platform that you have installed
+    and ignore the rest of the fields.</p>
+  </li>
   <li>Click <strong>Create AVD</strong>.</li>
 </ol>
 <h2 id="create">Create a New Android Project</h2>
 
-<p>After you've created an AVD, the next step is to start a new
-Android project in Eclipse.</p>
+<p>After you've created an AVD you can move to the next step and start a new Android project in
+Eclipse.</p>
 
 <ol>
-    <li>From Eclipse, select <strong>File &gt; New &gt; Project</strong>. 
+    <li>In Eclipse, select <strong>File &gt; New &gt; Project...</strong>.
       <p>If the ADT
       Plugin for Eclipse has been successfully installed, the resulting dialog
       should have a folder labeled "Android" which should contain
-      "Android Project". (After you create one or more Android projects, an entry for 
+      "Android Project". (After you create one or more Android projects, an entry for
       "Android XML File" will also be available.)</p>
     </li>
 
@@ -111,6 +107,8 @@
     <li>Fill in the project details with the following values:
         <ul>
           <li><em>Project name:</em> HelloAndroid</li>
+          <li><em>Build Target:</em> Select a platform version that is equal to or lower than the
+          target you chose for your AVD.</li>
           <li><em>Application name:</em> Hello, Android</li>
           <li><em>Package name:</em> com.example.helloandroid (or your own private namespace)</li>
           <li><em>Create Activity:</em> HelloAndroid</li>
@@ -120,55 +118,60 @@
         <a href="images/hello_world_1.png"><img src="images/hello_world_1.png" style="height:400px" alt="" /></a>
 
         <p>Here is a description of each field:</p>
-      
+
         <dl>
             <dt><em>Project Name</em></dt>
-                <dd>This is the Eclipse Project name &mdash; the name of the directory
-                that will contain the project files.</dd>
+                <dd>This is the Eclipse project name &mdash; the name of the directory
+                that contains the project files.</dd>
+            <dt><em>Build Target</em></dt>
+                <dd>This is the version of the Android SDK that you're using to build your
+                application. For example, if you choose Android 2.1, your application will be
+                compiled against the Android 2.1 platform library. The target you choose here
+                does not have to match the target you chose for your AVD; however, the target must
+                be equal to or lower than the target you chose for your AVD. Android
+                applications are forward-compatible, which means an application will run on the
+                platform against which it is built as well as all platforms that are released in the
+                future. For example, an application that is built against the 2.1 platform library
+                will run normally on an AVD or device that is running the 2.3.3. The reverse is not
+                true.</dd>
             <dt><em>Application Name</em></dt>
                 <dd>This is the human-readable title for your application &mdash; the name that
-                will appear on the Android device.</dd>
+                appears on the Android device.</dd>
             <dt><em>Package Name</em></dt>
                 <dd>This is the package namespace (following the same rules as for
                   packages in the Java programming language) that you want all your source code to
                   reside under. This also sets the package name under which the stub
-                  Activity will be generated.
+                  Activity is generated.
                   <p>Your package name must be unique across
-                  all packages installed on the Android system; for this reason, it's 
+                  all packages installed on the Android system; for this reason, it's
                   important to use a standard domain-style package for your
                   applications.  The example above uses the "com.example" namespace, which is
                   a namespace reserved for example documentation &mdash;
                   when you develop your own applications, you should use a namespace that's
                   appropriate to your organization or entity.</p></dd>
             <dt><em>Create Activity</em></dt>
-                <dd>This is the name for the class stub that will be generated by the plugin.
-                This will be a subclass of Android's {@link android.app.Activity} class.  An 
-                Activity is simply a class that can run and do work. It can create a UI if it 
+                <dd>This is the name for the class stub that is generated by the plugin.
+                This is a subclass of Android's {@link android.app.Activity} class.  An
+                Activity is simply a class that can run and do work. It can create a UI if it
                 chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an
                 Activity is almost always used as the basis for an application.</dd>
             <dt><em>Min SDK Version</em></dt>
-                <dd>This value specifies the minimum API Level required by your application. For
-                more information, see <a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.
+                <dd>This value specifies the minimum API Level on which your application will run.
+                The <em>Min SDK Version</em> should be the same as the <em>Build Target</em> you
+                chose. For example, if the <em>Build Target</em> is Android 2.1, then the <em>Min
+                SDK Version</em> should be 7 or lower (it can never be higher than 7). For more
+                information, see
+                <a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a>.
                </dd>
         </dl>
-      
-        <p><em>Other fields</em>: The checkbox for "Use default location" allows you to change 
-        the location on disk where the project's files will be generated and stored. "Build Target"
-        is the platform target that your application will be compiled against 
-        (this should be selected automatically, based on your Min SDK Version).</p>
 
-        <p class="note">Notice that the "Build Target" you've selected uses the Android 1.1
-        platform. This means that your application will be compiled against the Android 1.1 
-        platform library. If you recall, the AVD created above runs on the Android 1.5 platform.
-        These don't have to match; Android applications are forward-compatible, so an application
-        built against the 1.1 platform library will run normally on the 1.5 platform. The reverse
-        is not true.</p>
+        <p><em>Other fields</em>: The checkbox for "Use default location" allows you to change
+        the location on disk where the project's files are generated and stored.</p>
     </li>
 </ol>
 
-<p>Your Android project is now ready. It should be visible in the Package
-Explorer on the left.
-Open the <code>HelloAndroid.java</code> file, located inside <em>HelloAndroid > src > 
+<p>Your Android project is now ready. It should be visible in the Package Explorer on the left. Open
+the <code>HelloAndroid.java</code> file, located inside <em>HelloAndroid > src >
 com.example.helloandroid</em>). It should look like this:</p>
 
 <pre>
@@ -186,13 +189,13 @@
     }
 }</pre>
 
-<p>Notice that the class is based on the {@link android.app.Activity} class. An Activity is a 
-single application entity that is used to perform actions. An application may have many separate 
-activities, but the user interacts with them one at a time. The 
-{@link android.app.Activity#onCreate(Bundle) onCreate()} method  
-will be called by the Android system when your Activity starts &mdash;
+<p>Notice that the class is based on the {@link android.app.Activity} class. An Activity is a
+single application entity that is used to perform actions. An application may have many separate
+activities, but the user interacts with them one at a time. The
+{@link android.app.Activity#onCreate(Bundle) onCreate()} method
+is called by the Android system when your Activity starts &mdash;
 it is where you should perform all initialization and UI setup. An activity is not required to
-have a user interface, but usually will.</p>
+have a user interface, but usually does.</p>
 
 <p>Now let's modify some code! </p>
 
@@ -221,11 +224,12 @@
 }</pre>
 
 <p class="note"><strong>Tip:</strong> An easy way to add import packages to your project is
-to press <strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac). This is an Eclipse 
-shortcut that identifies missing packages based on your code and adds them for you.</p>
+to press <strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac). This is an Eclipse
+shortcut that identifies missing packages based on your code and adds them for you. You may have
+to expand the <code>import</code> statements in your code for this to work.</p>
 
 <p>An Android user interface is composed of hierarchies of objects called
-Views. A {@link android.view.View} is a drawable object used as an element in your UI layout, 
+Views. A {@link android.view.View} is a drawable object used as an element in your UI layout,
 such as a button, image, or (in this case) a text label. Each of these objects is a subclass
 of the View class and the subclass that handles text is {@link android.widget.TextView}.</p>
 
@@ -237,7 +241,7 @@
 HelloAndroid class is a subclass of Activity, it is also a Context. So, you can
 pass <code>this</code> as your Context reference to the TextView.</p>
 
-<p>Next, you define the text content with 
+<p>Next, you define the text content with
 {@link android.widget.TextView#setText(CharSequence) setText()}.</p>
 
 <p>Finally, you pass the TextView to
@@ -277,7 +281,7 @@
 
 <p>The "Hello, Android" you see in the grey bar is actually the application title. The Eclipse plugin
 creates this automatically (the string is defined in the <code>res/values/strings.xml</code> file and referenced
-by your <code>AndroidManifest.xml</code> file). The text below the title is the actual text that you have 
+by your <code>AndroidManifest.xml</code> file). The text below the title is the actual text that you have
 created in the TextView object.</p>
 
 <p>That concludes the basic "Hello World" tutorial, but you should continue reading for some more
@@ -307,7 +311,7 @@
   android:text=&quot;@string/hello&quot;/&gt;</pre>
 
 <p>The general structure of an Android XML layout file is simple: it's a tree
-of XML elements, wherein each node is the name of a View class 
+of XML elements, wherein each node is the name of a View class
 (this example, however, is just one View element). You can use the
 name of any class that extends {@link android.view.View} as an element in your XML layouts,
 including custom View classes you define in your own code. This
@@ -316,7 +320,7 @@
 by the web development model, wherein you can separate the presentation of your
 application (its UI) from the application logic used to fetch and fill in data.</p>
 
-<p>In the above XML example, there's just one View element: the <code>TextView</code>, 
+<p>In the above XML example, there's just one View element: the <code>TextView</code>,
 which has five XML attributes.  Here's a summary of what they mean:</p>
 
 <table>
@@ -343,7 +347,7 @@
             </td>
             <td>
                 This attribute assigns a unique identifier to the <code>TextView</code> element.
-                You can use the assigned ID to reference this View from your source code or from other 
+                You can use the assigned ID to reference this View from your source code or from other
                 XML resource declarations.
             </td>
         </tr>
@@ -352,7 +356,7 @@
                 <code>android:layout_width</code>
             </td>
             <td>
-                This attribute defines how much of the available width on the screen this View should consume. 
+                This attribute defines how much of the available width on the screen this View should consume.
                 In this case, it's the only View so you want it to take up the entire screen, which is what a value of "fill_parent" means.<br>
             </td>
         </tr>
@@ -369,7 +373,7 @@
                 <code>android:text</code>
             </td>
             <td>
-                This sets the text that the TextView should display. In this example, you use a string 
+                This sets the text that the TextView should display. In this example, you use a string
                 resource instead of a hard-coded string value.
                 The <em>hello</em> string is defined in the <em>res/values/strings.xml</em> file. This is the
                 recommended practice for inserting strings to your application, because it makes the localization
@@ -396,17 +400,17 @@
 </div>
 </div>
 
-<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml. 
-In the "Hello World" application you just completed, this file was ignored and you created a 
+<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml.
+In the "Hello World" application you just completed, this file was ignored and you created a
 layout programmatically. This was meant to teach you more
-about the Android framework, but you should almost always define your layout 
+about the Android framework, but you should almost always define your layout
 in an XML file instead of in your code.
-The following procedures will instruct you how to change your 
+The following procedures will instruct you how to change your
 existing application to use an XML layout.</p>
 
 <ol>
   <li>In the Eclipse Package Explorer, expand the
-<code>/res/layout/</code> folder and open <code>main.xml</code> (once opened, you might need to click 
+<code>/res/layout/</code> folder and open <code>main.xml</code> (once opened, you might need to click
 the "main.xml" tab at the bottom of the window to see the XML source). Replace the contents with
 the following XML:
 
@@ -421,7 +425,7 @@
 
 <li>Inside the <code>res/values/</code> folder, open <code>strings.xml</code>.
 This is where you should save all default text strings for your user interface. If you're using Eclipse, then
-ADT will have started you with two strings, <em>hello</em> and <em>app_name</em>. 
+ADT will have started you with two strings, <em>hello</em> and <em>app_name</em>.
 Revise <em>hello</em> to something else. Perhaps "Hello, Android! I am a string resource!"
 The entire file should now look like this:
 <pre>
@@ -450,11 +454,11 @@
     }
 }</pre>
 
-<p>When you make this change, type it by hand to try the 
+<p>When you make this change, type it by hand to try the
 code-completion feature. As you begin typing "R.layout.main" the plugin will offer you
 suggestions. You'll find that it helps in a lot of situations.</p>
 
-<p>Instead of passing <code>setContentView()</code> a View object, you give it a reference 
+<p>Instead of passing <code>setContentView()</code> a View object, you give it a reference
 to the layout resource.
 The resource is identified as <code>R.layout.main</code>, which is actually a compiled object representation of
 the layout defined in <code>/res/layout/main.xml</code>. The Eclipse plugin automatically creates this reference for
@@ -464,25 +468,27 @@
 </ol>
 
 <p>Now re-run your application &mdash; because you've created a launch configuration, all
-you need to do is click the green arrow icon to run, or select 
+you need to do is click the green arrow icon to run, or select
 <strong>Run &gt; Run History &gt; Android Activity</strong>. Other than the change to the TextView
 string, the application looks the same. After all, the point was to show that the two different
 layout approaches produce identical results.</p>
 
-<p class="note"><strong>Tip:</strong> Use the shortcut <strong>Ctrl-F11</strong> 
-(<strong>Cmd-Shift-F11</strong>, on Mac) to run your currently visible application.</p>
+<p class="note"><strong>Note:</strong> You may have to unlock the screen on the emulator to see
+your application &mdash; just as you would unlock the screen on a device. If you have problems
+running the emulator, see <a href="{@docRoot}guide/developing/devices/emulator.html">Using the
+Android Emulator</a>.</p>
 
 <p>Continue reading for an introduction
 to debugging and a little more information on using other IDEs. When you're ready to learn more,
 read <a href="{@docRoot}guide/topics/fundamentals.html">Application
-Fundamentals</a> for an introduction to all the elements that make Android applications work. 
+Fundamentals</a> for an introduction to all the elements that make Android applications work.
 Also refer to the <a href="{@docRoot}guide/index.html">Developer's Guide</a>
 introduction page for an overview of the <em>Dev Guide</em> documentation.</p>
 
 
 <div class="special">
 <h3>R class</h3>
-<p>In Eclipse, open the file named <code>R.java</code> (in the <code>gen/</code> [Generated Java Files] folder). 
+<p>In Eclipse, open the file named <code>R.java</code> (in the <code>gen/</code> [Generated Java Files] folder).
 It should look something like this:</p>
 
 <pre>
@@ -510,16 +516,17 @@
 <p>A project's <code>R.java</code> file is an index into all the resources defined in the
 file. You use this class in your source code as a sort of short-hand
 way to refer to resources you've included in your project. This is
-particularly powerful with the code-completion features of IDEs like Eclipse 
+particularly powerful with the code-completion features of IDEs like Eclipse
 because it lets you quickly and interactively locate the specific reference
 you're looking for.</p>
 
-<p>It's possible yours looks slighly different than this (perhaps the hexadecimal values are different). 
+<p>It's possible yours looks slightly different than this (perhaps the hexadecimal values are
+different).
 For now, notice the inner class named "layout", and its
 member field "main". The Eclipse plugin noticed the XML
 layout file named main.xml and generated a class for it here.  As you add other
 resources to your project (such as strings in the <code>res/values/string.xml</code> file or drawables inside
-the <code>res/drawable/</code> direcory) you'll see <code>R.java</code> change to keep up.</p>
+the <code>res/drawable/</code> directory) you'll see <code>R.java</code> change to keep up.</p>
 <p>When not using Eclipse, this class file will be generated for you at build time (with the Ant tool).</p>
 <p><em>You should never edit this file by hand.</em></p>
 </div>
@@ -554,9 +561,9 @@
 
 <p>Press "Force Quit" to terminate the application and close the emulator window.</p>
 
-<p>To find out more about the error, set a breakpoint in your source code 
-on the line <code>Object o = null;</code> (double-click on the marker bar next to the source code line). Then select <strong>Run &gt; Debug History &gt; Hello, 
-Android</strong> from the menu to enter debug mode. Your app will restart in the 
+<p>To find out more about the error, set a breakpoint in your source code
+on the line <code>Object o = null;</code> (double-click on the marker bar next to the source code line). Then select <strong>Run &gt; Debug History &gt; Hello,
+Android</strong> from the menu to enter debug mode. Your app will restart in the
 emulator, but this time it will suspend when it reaches the breakpoint you
 set. You can then step through the code in Eclipse's Debug Perspective,
 just as you would for any other application.</p>
@@ -565,36 +572,36 @@
 
 
 <h2 id="noeclipse">Creating the Project without Eclipse</h2>
-  
+
   <p>If you don't use Eclipse (such as if you prefer another IDE, or simply use text
   editors and command line tools) then the Eclipse plugin can't help you.
   Don't worry though &mdash; you don't lose any functionality just because you don't
   use Eclipse.</p>
-  
+
   <p>The Android Plugin for Eclipse is really just a wrapper around a set of tools
   included with the Android SDK. (These tools, like the emulator, aapt, adb,
-  ddms, and others are <a href="{@docRoot}guide/developing/tools/index.html">documented elsewhere.</a>) 
+  ddms, and others are <a href="{@docRoot}guide/developing/tools/index.html">documented elsewhere.</a>)
   Thus, it's possible to
   wrap those tools with another tool, such as an 'ant' build file.</p>
-  
+
   <p>The Android SDK includes a tool named "android" that can be
   used to create all the source code and directory stubs for your project, as well
   as an ant-compatible <code>build.xml</code> file. This allows you to build your project
   from the command line, or integrate it with the IDE of your choice.</p>
-  
+
   <p>For example, to create a HelloAndroid project similar to the one created
   in Eclipse, use this command:</p>
-  
+
   <pre>
 android create project \
     --package com.example.helloandroid \
-    --activity HelloAndroid \ 
+    --activity HelloAndroid \
     --target 2 \
-    --path <em>&lt;path-to-your-project></em>/HelloAndroid 
+    --path <em>&lt;path-to-your-project></em>/HelloAndroid
 </pre>
 
-  <p>This creates the required folders and files for the project at the location 
+  <p>This creates the required folders and files for the project at the location
   defined by the <em>path</em>.</p>
-  
-  <p>For more information on how to use the SDK tools to create and build projects, please read 
+
+  <p>For more information on how to use the SDK tools to create and build projects, please read
 <a href="{@docRoot}guide/developing/other-ide.html">Developing in Other IDEs</a>.</p>
\ No newline at end of file
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index a5c9053..dbe4115 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -3084,7 +3084,7 @@
                 mRcDisplay.setCurrentClientId(
                         newClientGeneration, newClientEventReceiver, clearing);
             } catch (RemoteException e) {
-                Log.e(TAG, "Dead display in onRcDisplayUpdate() "+e);
+                Log.e(TAG, "Dead display in setNewRcClientOnDisplays_syncRcsCurrc() "+e);
                 // if we had a display before, stop monitoring its death
                 rcDisplay_stopDeathMonitor_syncRcStack();
                 mRcDisplay = null;
@@ -3103,7 +3103,7 @@
                 try {
                     se.mRcClient.setCurrentClientGenerationId(newClientGeneration);
                 } catch (RemoteException e) {
-                    Log.w(TAG, "Dead client in onRcDisplayUpdate()"+e);
+                    Log.w(TAG, "Dead client in setNewRcClientGenerationOnClients_syncRcsCurrc()"+e);
                     stackIterator.remove();
                     se.unlinkToRcClientDeath();
                 }
@@ -3160,7 +3160,7 @@
                             rcse.mReceiverComponent /*event receiver*/,
                             false /*clearing*/);
 
-                    // ask the current client that it needs to send info
+                    // tell the current client that it needs to send info
                     try {
                         mCurrentRcClient.onInformationRequested(mCurrentRcClientGen,
                                 flags, mArtworkExpectedWidth, mArtworkExpectedHeight);
@@ -3457,6 +3457,21 @@
                     }
                 }
             }
+
+            // we have a new display, tell the current client that it needs to send info
+            // (following lock order: mRCStack then mCurrentRcLock)
+            synchronized(mCurrentRcLock) {
+                if (mCurrentRcClient != null) {
+                    // tell the current client that it needs to send info
+                    try {
+                        mCurrentRcClient.onInformationRequested(mCurrentRcClientGen,
+                                RC_INFO_ALL, mArtworkExpectedWidth, mArtworkExpectedHeight);
+                    } catch (RemoteException e) {
+                        Log.e(TAG, "Current valid remote client is dead: "+e);
+                        mCurrentRcClient = null;
+                    }
+                }
+            }
         }
     }
 
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 2bdd3c9..d59bc2b 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -703,7 +703,7 @@
 
     private void onUnplugDisplay(IRemoteControlDisplay rcd) {
         synchronized(mCacheLock) {
-            if ((mRcDisplay != null) && (mRcDisplay.equals(rcd))) {
+            if ((mRcDisplay != null) && (mRcDisplay.asBinder().equals(rcd.asBinder()))) {
                 mRcDisplay = null;
                 mArtworkExpectedWidth = ARTWORK_DEFAULT_SIZE;
                 mArtworkExpectedHeight = ARTWORK_DEFAULT_SIZE;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 7fb141a..1f08a91 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -316,9 +316,11 @@
                                 &cropLeft, &cropTop, &cropRight, &cropBottom));
 
                     LOGV("Video output format changed to %d x %d "
-                         "(crop: %d, %d, %d, %d)",
+                         "(crop: %d x %d @ (%d, %d))",
                          width, height,
-                         cropLeft, cropTop, cropRight, cropBottom);
+                         (cropRight - cropLeft + 1),
+                         (cropBottom - cropTop + 1),
+                         cropLeft, cropTop);
 
                     notifyListener(
                             MEDIA_SET_VIDEO_SIZE,
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 35ed43f..8f213da 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -395,29 +395,40 @@
         postDrainVideoQueue();
     }
 
-    if (mSyncQueues && !mAudioQueue.empty() && !mVideoQueue.empty()) {
-        int64_t firstAudioTimeUs;
-        int64_t firstVideoTimeUs;
-        CHECK((*mAudioQueue.begin()).mBuffer->meta()
-                ->findInt64("timeUs", &firstAudioTimeUs));
-        CHECK((*mVideoQueue.begin()).mBuffer->meta()
-                ->findInt64("timeUs", &firstVideoTimeUs));
-
-        int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
-
-        LOGV("queueDiff = %.2f secs", diff / 1E6);
-
-        if (diff > 100000ll) {
-            // Audio data starts More than 0.1 secs before video.
-            // Drop some audio.
-
-            (*mAudioQueue.begin()).mNotifyConsumed->post();
-            mAudioQueue.erase(mAudioQueue.begin());
-            return;
-        }
-
-        syncQueuesDone();
+    if (!mSyncQueues || mAudioQueue.empty() || mVideoQueue.empty()) {
+        return;
     }
+
+    sp<ABuffer> firstAudioBuffer = (*mAudioQueue.begin()).mBuffer;
+    sp<ABuffer> firstVideoBuffer = (*mVideoQueue.begin()).mBuffer;
+
+    if (firstAudioBuffer == NULL || firstVideoBuffer == NULL) {
+        // EOS signalled on either queue.
+        syncQueuesDone();
+        return;
+    }
+
+    int64_t firstAudioTimeUs;
+    int64_t firstVideoTimeUs;
+    CHECK(firstAudioBuffer->meta()
+            ->findInt64("timeUs", &firstAudioTimeUs));
+    CHECK(firstVideoBuffer->meta()
+            ->findInt64("timeUs", &firstVideoTimeUs));
+
+    int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
+
+    LOGV("queueDiff = %.2f secs", diff / 1E6);
+
+    if (diff > 100000ll) {
+        // Audio data starts More than 0.1 secs before video.
+        // Drop some audio.
+
+        (*mAudioQueue.begin()).mNotifyConsumed->post();
+        mAudioQueue.erase(mAudioQueue.begin());
+        return;
+    }
+
+    syncQueuesDone();
 }
 
 void NuPlayer::Renderer::syncQueuesDone() {
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 5d91f6a..e9dc61c 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1738,7 +1738,17 @@
 void ACodec::LoadedToIdleState::stateEntered() {
     LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
 
-    CHECK_EQ(allocateBuffers(), (status_t)OK);
+    status_t err;
+    if ((err = allocateBuffers()) != OK) {
+        LOGE("Failed to allocate buffers after transitioning to IDLE state "
+             "(error 0x%08x)",
+             err);
+
+        sp<AMessage> notify = mCodec->mNotify->dup();
+        notify->setInt32("what", ACodec::kWhatError);
+        notify->setInt32("omx-error", OMX_ErrorUndefined);
+        notify->post();
+    }
 }
 
 status_t ACodec::LoadedToIdleState::allocateBuffers() {
@@ -2046,8 +2056,18 @@
                             mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput),
                          (status_t)OK);
 
-                CHECK_EQ(mCodec->allocateBuffersOnPort(kPortIndexOutput),
-                         (status_t)OK);
+                status_t err;
+                if ((err = mCodec->allocateBuffersOnPort(
+                                kPortIndexOutput)) != OK) {
+                    LOGE("Failed to allocate output port buffers after "
+                         "port reconfiguration (error 0x%08x)",
+                         err);
+
+                    sp<AMessage> notify = mCodec->mNotify->dup();
+                    notify->setInt32("what", ACodec::kWhatError);
+                    notify->setInt32("omx-error", OMX_ErrorUndefined);
+                    notify->post();
+                }
 
                 return true;
             } else if (data1 == (OMX_U32)OMX_CommandPortEnable) {
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index c2e6707..91b81c2 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -179,9 +179,11 @@
     // TODO: Currently just uses mDefaultWidth/Height. In the future
     // we might declare mHeight and mWidth and check against those here.
     if ((w != 0) || (h != 0)) {
-        LOGE("dequeuebuffer: invalid buffer size! Req: %dx%d, Found: %dx%d",
-                mDefaultWidth, mDefaultHeight, w, h);
-        return BAD_VALUE;
+        if ((w != mDefaultWidth) || (h != mDefaultHeight)) {
+            LOGE("dequeuebuffer: invalid buffer size! Req: %dx%d, Found: %dx%d",
+                    mDefaultWidth, mDefaultHeight, w, h);
+            return BAD_VALUE;
+        }
     }
 
     status_t returnFlags(OK);
diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
index ee0a6e9..ce3bc74 100644
--- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
@@ -165,7 +165,7 @@
         View switchImeButton = findViewById(R.id.switch_ime_button);
         final InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
                 Context.INPUT_METHOD_SERVICE);
-        if (switchImeButton != null && hasMultipleEnabledIMEsOrSubtypes(imm, false)) {
+        if (mIsAlpha && switchImeButton != null && hasMultipleEnabledIMEsOrSubtypes(imm, false)) {
             switchImeButton.setVisibility(View.VISIBLE);
             switchImeButton.setOnClickListener(new OnClickListener() {
                 public void onClick(View v) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e2d6c5f..b69a7c2 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -888,7 +888,8 @@
             // Mark as handled
             st.isHandled = true;
 
-            if ((flags & Menu.FLAG_PERFORM_NO_CLOSE) == 0) {
+            // Only close down the menu if we don't have an action bar keeping it open.
+            if ((flags & Menu.FLAG_PERFORM_NO_CLOSE) == 0 && mActionBar == null) {
                 closePanel(st, true);
             }
         }
@@ -909,7 +910,10 @@
 
         boolean res = st.menu.performIdentifierAction(id, flags);
 
-        closePanel(st, true);
+        // Only close down the menu if we don't have an action bar keeping it open.
+        if (mActionBar == null) {
+            closePanel(st, true);
+        }
 
         return res;
     }
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 4ad2916..496210c 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -21,11 +21,8 @@
 
 import android.content.Context;
 import android.os.Handler;
-import android.os.SystemClock;
 import android.util.Slog;
 import android.view.MotionEvent;
-import android.view.MotionEvent.PointerCoords;
-import android.view.MotionEvent.PointerProperties;
 import android.view.ViewConfiguration;
 import android.view.WindowManagerPolicy;
 import android.view.accessibility.AccessibilityEvent;
@@ -75,11 +72,6 @@
     // Invalid pointer ID.
     private static final int INVALID_POINTER_ID = -1;
 
-    // The coefficient by which to multiply
-    // ViewConfiguration.#getScaledTouchExplorationTapSlop()
-    // to compute #mDraggingDistance.
-    private static final int COEFFICIENT_DRAGGING_DISTANCE = 2;
-
     // The time slop in milliseconds for activating an item after it has
     // been touch explored. Tapping on an item within this slop will perform
     // a click and tapping and holding down a long press.
@@ -95,23 +87,14 @@
     private static final float MIN_ANGLE_COS = 0.866025404f; // cos(pi/6)
 
     // The delay for sending a hover enter event.
-    private static final long DELAY_SEND_HOVER_MOVE = 200;
+    private static final long DELAY_SEND_HOVER_ENTER = 200;
+
+    // Constant referring to the ids bits of all pointers.
+    private static final int ALL_POINTER_ID_BITS = 0xFFFFFFFF;
 
     // Temporary array for storing pointer IDs.
     private final int[] mTempPointerIds = new int[MAX_POINTER_COUNT];
 
-    // Temporary array for storing PointerProperties
-    private final PointerProperties[] mTempPointerProperties =
-            PointerProperties.createArray(MAX_POINTER_COUNT);
-
-    // Temporary array for storing PointerCoords
-    private final PointerCoords[] mTempPointerCoords =
-            PointerCoords.createArray(MAX_POINTER_COUNT);
-
-    // The maximal distance between two pointers so they are
-    // considered to be performing a drag operation.
-    private final float mDraggingDistance;
-
     // The distance from the last touch explored location tapping within
     // which would perform a click and tapping and holding a long press.
     private final int mTouchExplorationTapSlop;
@@ -159,7 +142,6 @@
         mInputFilter = inputFilter;
         mTouchExplorationTapSlop =
             ViewConfiguration.get(context).getScaledTouchExplorationTapSlop();
-        mDraggingDistance = mTouchExplorationTapSlop * COEFFICIENT_DRAGGING_DISTANCE;
         mPointerTracker = new PointerTracker(context);
         mHandler = new Handler(context.getMainLooper());
         mSendHoverDelayed = new SendHoverDelayed();
@@ -220,18 +202,21 @@
                                 + "touch exploring state!");
                     }
                     case 1: {
-                        // Send hover if pending.
-                        mSendHoverDelayed.forceSendAndRemove();
+                        mSendHoverDelayed.remove();
                         // Send a hover for every finger down so the user gets feedback.
                         final int pointerId = pointerTracker.getPrimaryActivePointerId();
                         final int pointerIdBits = (1 << pointerId);
                         final int lastAction = pointerTracker.getLastInjectedHoverAction();
-                        // If a hover enter for another pointer is delivered we send move.
-                        final int action = (lastAction == MotionEvent.ACTION_HOVER_ENTER)
-                                ? MotionEvent.ACTION_HOVER_MOVE
-                                : MotionEvent.ACTION_HOVER_ENTER;
-                        mSendHoverDelayed.post(event, action, pointerIdBits, policyFlags,
-                                DELAY_SEND_HOVER_MOVE);
+
+                        // Deliver hover enter with a delay to have a change to detect
+                        // whether the user actually starts a scrolling gesture.
+                        if (lastAction == MotionEvent.ACTION_HOVER_EXIT) {
+                            mSendHoverDelayed.post(event, MotionEvent.ACTION_HOVER_ENTER,
+                                    pointerIdBits, policyFlags, DELAY_SEND_HOVER_ENTER);
+                        } else {
+                            sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits,
+                                    policyFlags);
+                        }
 
                         if (mLastTouchExploreEvent == null) {
                             break;
@@ -318,12 +303,11 @@
                         }
                     } break;
                     case 2: {
-                        mSendHoverDelayed.forceSendAndRemove();
+                        mSendHoverDelayed.remove();
                         mPerformLongPressDelayed.remove();
                         // We want to no longer hover over the location so subsequent
                         // touch at the same spot will generate a hover enter.
-                        sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits,
-                                policyFlags);
+                        ensureHoverExitSent(event, pointerIdBits, policyFlags);
 
                         if (isDraggingGesture(event)) {
                             // Two pointers moving in the same direction within
@@ -340,6 +324,7 @@
                         } else {
                             // Two pointers moving arbitrary are delegated to the view hierarchy.
                             mCurrentState = STATE_DELEGATING;
+                            mSendHoverDelayed.remove();
                             if (mTouchExploreGestureInProgress) {
                                 sendAccessibilityEvent(TYPE_TOUCH_EXPLORATION_GESTURE_END);
                                 mTouchExploreGestureInProgress = false;
@@ -349,12 +334,11 @@
                         }
                     } break;
                     default: {
-                        mSendHoverDelayed.forceSendAndRemove();
+                        mSendHoverDelayed.remove();
                         mPerformLongPressDelayed.remove();
                         // We want to no longer hover over the location so subsequent
                         // touch at the same spot will generate a hover enter.
-                        sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits,
-                                policyFlags);
+                        ensureHoverExitSent(event, pointerIdBits, policyFlags);
 
                         // More than two pointers are delegated to the view hierarchy.
                         mCurrentState = STATE_DELEGATING;
@@ -379,8 +363,9 @@
                             break;
                         }
 
-                        mSendHoverDelayed.forceSendAndRemove();
                         mPerformLongPressDelayed.remove();
+                        mSendHoverDelayed.forceSendAndRemove();
+                        ensureHoverExitSent(event, pointerIdBits, policyFlags);
 
                         // If touch exploring announce the end of the gesture.
                         // Also do not click on the last explored location.
@@ -388,11 +373,6 @@
                             mTouchExploreGestureInProgress = false;
                             mLastTouchExploreEvent = MotionEvent.obtain(event);
                             sendAccessibilityEvent(TYPE_TOUCH_EXPLORATION_GESTURE_END);
-                            final int lastAction = mPointerTracker.getLastInjectedHoverAction();
-                            if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
-                                sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT,
-                                        pointerIdBits, policyFlags);
-                            }
                             break;
                         }
 
@@ -404,11 +384,6 @@
                             final long exploreTime = mLastTouchExploreEvent.getEventTime();
                             final long deltaTime = eventTime - exploreTime;
                             if (deltaTime > ACTIVATION_TIME_SLOP) {
-                                final int lastAction = mPointerTracker.getLastInjectedHoverAction();
-                                if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
-                                    sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT,
-                                            pointerIdBits, policyFlags);
-                                }
                                 mLastTouchExploreEvent = MotionEvent.obtain(event);
                                 break;
                             }
@@ -421,11 +396,6 @@
                                     - event.getY(pointerIndex);
                             final float deltaMove = (float) Math.hypot(deltaX, deltaY);
                             if (deltaMove > mTouchExplorationTapSlop) {
-                                final int lastAction = mPointerTracker.getLastInjectedHoverAction();
-                                if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
-                                    sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT,
-                                            pointerIdBits, policyFlags);
-                                }
                                 mLastTouchExploreEvent = MotionEvent.obtain(event);
                                 break;
                             }
@@ -434,12 +404,6 @@
                             sendActionDownAndUp(mLastTouchExploreEvent, policyFlags);
                             mLastTouchExploreEvent = null;
                         } else {
-                            mSendHoverDelayed.forceSendAndRemove();
-                            final int lastAction = mPointerTracker.getLastInjectedHoverAction();
-                            if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
-                                sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT,
-                                        pointerIdBits, policyFlags);
-                            }
                             mLastTouchExploreEvent = MotionEvent.obtain(event);
                         }
                     } break;
@@ -448,13 +412,9 @@
             case MotionEvent.ACTION_CANCEL: {
                 mSendHoverDelayed.remove();
                 mPerformLongPressDelayed.remove();
-                final int lastAction = pointerTracker.getLastInjectedHoverAction();
-                if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
-                    final int pointerId = pointerTracker.getPrimaryActivePointerId();
-                    final int pointerIdBits = (1 << pointerId);
-                    sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits,
-                            policyFlags);
-                }
+                final int pointerId = pointerTracker.getPrimaryActivePointerId();
+                final int pointerIdBits = (1 << pointerId);                
+                ensureHoverExitSent(event, pointerIdBits, policyFlags);
                 clear();
             } break;
         }
@@ -540,7 +500,8 @@
                 // a given distance and if such exist send them to the view hierarchy
                 final int notInjectedCount = mPointerTracker.getNotInjectedActivePointerCount();
                 if (notInjectedCount > 0) {
-                    sendDownForAllActiveNotInjectedPointers(event, policyFlags);
+                    MotionEvent prototype = MotionEvent.obtain(event);
+                    sendDownForAllActiveNotInjectedPointers(prototype, policyFlags);
                 }
             } break;
             case MotionEvent.ACTION_POINTER_UP: {
@@ -565,42 +526,47 @@
      * @param policyFlags The policy flags associated with the event.
      */
     private void sendDownForAllActiveNotInjectedPointers(MotionEvent prototype, int policyFlags) {
-        final PointerProperties[] pointerProperties = mTempPointerProperties;
-        final PointerCoords[] pointerCoords = mTempPointerCoords;
         final PointerTracker pointerTracker = mPointerTracker;
-        int pointerDataIndex = 0;
+        int pointerIdBits = 0;
+        final int pointerCount = prototype.getPointerCount();
 
-        final int pinterCount = prototype.getPointerCount();
-        for (int i = 0; i < pinterCount; i++) {
+        // Find which pointers are already injected.
+        for (int i = 0; i < pointerCount; i++) {
             final int pointerId = prototype.getPointerId(i);
+            if (pointerTracker.isInjectedPointerDown(pointerId)) {
+                pointerIdBits |= (1 << pointerId);
+            }
+        }
 
+        // Inject the active and not injected pointers.
+        for (int i = 0; i < pointerCount; i++) {
+            final int pointerId = prototype.getPointerId(i);
             // Skip inactive pointers.
             if (!pointerTracker.isActivePointer(pointerId)) {
                 continue;
             }
-            // Skip already delivered pointers.
+            // Do not send event for already delivered pointers.
             if (pointerTracker.isInjectedPointerDown(pointerId)) {
                 continue;
             }
+            pointerIdBits |= (1 << pointerId);
+            final int action = computeInjectionAction(MotionEvent.ACTION_DOWN, i);
+            sendMotionEvent(prototype, action, pointerIdBits, policyFlags);
+        }
+    }
 
-            // Populate and inject an event for the current pointer.
-            prototype.getPointerProperties(i, pointerProperties[pointerDataIndex]);
-            prototype.getPointerCoords(i, pointerCoords[pointerDataIndex]);
-
-            final long downTime = pointerTracker.getLastInjectedDownEventTime();
-            final int action = computeInjectionAction(MotionEvent.ACTION_DOWN, pointerDataIndex);
-            final int pointerCount = pointerDataIndex + 1;
-            final long eventTime = SystemClock.uptimeMillis();
-
-            MotionEvent event = MotionEvent.obtain(downTime, eventTime,
-                    action, pointerCount, pointerProperties, pointerCoords,
-                    prototype.getMetaState(), prototype.getButtonState(),
-                    prototype.getXPrecision(), prototype.getYPrecision(), prototype.getDeviceId(),
-                    prototype.getEdgeFlags(), prototype.getSource(), prototype.getFlags());
-            sendMotionEvent(event, policyFlags);
-            event.recycle();
-
-            pointerDataIndex++;
+    /**
+     * Ensures that hover exit has been sent.
+     *
+     * @param prototype The prototype from which to create the injected events.
+     * @param pointerIdBits The bits of the pointers to send.
+     * @param policyFlags The policy flags associated with the event.
+     */
+    private void ensureHoverExitSent(MotionEvent prototype, int pointerIdBits, int policyFlags) {
+        final int lastAction = mPointerTracker.getLastInjectedHoverAction();
+        if (lastAction != MotionEvent.ACTION_HOVER_EXIT) {
+            sendMotionEvent(prototype, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits,
+                    policyFlags);
         }
     }
 
@@ -613,38 +579,17 @@
      */
     private void sendUpForInjectedDownPointers(MotionEvent prototype, int policyFlags) {
         final PointerTracker pointerTracker = mPointerTracker;
-        final PointerProperties[] pointerProperties = mTempPointerProperties;
-        final PointerCoords[] pointerCoords = mTempPointerCoords;
-        int pointerDataIndex = 0;
-
-        final int pointerCount = prototype.getPointerCount(); 
+        int pointerIdBits = 0;
+        final int pointerCount = prototype.getPointerCount();
         for (int i = 0; i < pointerCount; i++) {
             final int pointerId = prototype.getPointerId(i);
-
             // Skip non injected down pointers.
             if (!pointerTracker.isInjectedPointerDown(pointerId)) {
                 continue;
             }
-
-            // Populate and inject event.
-            prototype.getPointerProperties(i, pointerProperties[pointerDataIndex]);
-            prototype.getPointerCoords(i, pointerCoords[pointerDataIndex]);
-
-            final long downTime = pointerTracker.getLastInjectedDownEventTime();
-            final int action = computeInjectionAction(MotionEvent.ACTION_UP, pointerDataIndex);
-            final int newPointerCount = pointerDataIndex + 1;
-            final long eventTime = SystemClock.uptimeMillis();
-
-            MotionEvent event = MotionEvent.obtain(downTime, eventTime, action,
-                    newPointerCount, pointerProperties, pointerCoords,
-                    prototype.getMetaState(), prototype.getButtonState(),
-                    prototype.getXPrecision(), prototype.getYPrecision(), prototype.getDeviceId(),
-                    prototype.getEdgeFlags(), prototype.getSource(), prototype.getFlags());
-
-            sendMotionEvent(event, policyFlags);
-            event.recycle();
-
-            pointerDataIndex++;
+            pointerIdBits |= (1 << pointerId);
+            final int action = computeInjectionAction(MotionEvent.ACTION_UP, i);
+            sendMotionEvent(prototype, action, pointerIdBits, policyFlags);
         }
     }
 
@@ -659,7 +604,7 @@
 
         // All pointers active therefore we just inject the event as is.
         if (prototype.getPointerCount() == pointerTracker.getActivePointerCount()) {
-            sendMotionEvent(prototype, policyFlags);
+            sendMotionEvent(prototype, prototype.getAction(), ALL_POINTER_ID_BITS, policyFlags);
             return;
         }
 
@@ -670,20 +615,27 @@
             return;
         }
 
+        // If the action pointer going up/down is not active we have nothing to do.
+        // However, for moves we keep going to report moves of active pointers.
+        final int actionMasked = prototype.getActionMasked();
+        final int actionPointerId = prototype.getPointerId(prototype.getActionIndex());
+        if (actionMasked != MotionEvent.ACTION_MOVE) {
+            if (!pointerTracker.isActiveOrWasLastActiveUpPointer(actionPointerId)) {
+                return;
+            }
+        }
+
+        // If the pointer is active or the pointer that just went up
+        // was active we keep the pointer data in the event.
         int pointerIdBits = 0;
         final int pointerCount = prototype.getPointerCount();
         for (int pointerIndex = 0; pointerIndex < pointerCount; pointerIndex++) {
             final int pointerId = prototype.getPointerId(pointerIndex);
-            // If the pointer is inactive or the pointer that just went up
-            // was inactive we strip the pointer data from the event.
             if (pointerTracker.isActiveOrWasLastActiveUpPointer(pointerId)) {
                 pointerIdBits |= (1 << pointerId);
             }
         }
-
-        MotionEvent event = prototype.split(pointerIdBits);
-        sendMotionEvent(event, policyFlags);
-        event.recycle();
+        sendMotionEvent(prototype, prototype.getAction(), pointerIdBits, policyFlags);
     }
 
     /**
@@ -693,26 +645,11 @@
      * @param policyFlags The policy flags associated with the event.
      */
     private void sendActionDownAndUp(MotionEvent prototype, int policyFlags) {
-        final PointerProperties[] pointerProperties = mTempPointerProperties;
-        final PointerCoords[] pointerCoords = mTempPointerCoords;
-        final int pointerIndex = prototype.getActionIndex();
-
-        // Send down.
-        prototype.getPointerProperties(pointerIndex, pointerProperties[0]);
-        prototype.getPointerCoords(pointerIndex, pointerCoords[0]);
-
-        final long downTime = SystemClock.uptimeMillis();
-        MotionEvent event = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN,
-                1, pointerProperties, pointerCoords,
-                prototype.getMetaState(), prototype.getButtonState(),
-                prototype.getXPrecision(), prototype.getYPrecision(), prototype.getDeviceId(),
-                prototype.getEdgeFlags(), prototype.getSource(), prototype.getFlags());
-        sendMotionEvent(event, policyFlags);
-
-        // Send up.
-        event.setAction(MotionEvent.ACTION_UP);
-        sendMotionEvent(event, policyFlags);
-        event.recycle();
+        // Tap with the pointer that last went up - we may have inactive pointers.
+        final int pointerId = mPointerTracker.getLastReceivedUpPointerId();
+        final int pointerIdBits = (1 << pointerId);
+        sendMotionEvent(prototype, MotionEvent.ACTION_DOWN, pointerIdBits, policyFlags);
+        sendMotionEvent(prototype, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
     }
 
     /**
@@ -725,11 +662,33 @@
      */
     private void sendMotionEvent(MotionEvent prototype, int action, int pointerIdBits,
             int policyFlags) {
-        MotionEvent event = prototype.split(pointerIdBits);
-        event.setDownTime(mPointerTracker.getLastInjectedDownEventTime());
-        event.setAction(action);
-        sendMotionEvent(event, policyFlags);
-        event.recycle();
+        prototype.setAction(action);
+
+        MotionEvent event = null;
+        if (pointerIdBits == ALL_POINTER_ID_BITS) {
+            event = prototype;
+        } else {
+            event = prototype.split(pointerIdBits);
+        }
+        if (action == MotionEvent.ACTION_DOWN) {
+            event.setDownTime(event.getEventTime());
+        } else {
+            event.setDownTime(mPointerTracker.getLastInjectedDownEventTime());
+        }
+
+        if (DEBUG) {
+            Slog.d(LOG_TAG_INJECTED, "Injecting event: " + event + ", policyFlags=0x"
+                    + Integer.toHexString(policyFlags));
+        }
+
+        // Make sure that the user will see the event.
+        policyFlags |= WindowManagerPolicy.FLAG_PASS_TO_USER;
+        mPointerTracker.onInjectedMotionEvent(event);
+        mInputFilter.sendInputEvent(event, policyFlags);
+
+        if (event != prototype) {
+            event.recycle();
+        }
     }
 
     /**
@@ -787,19 +746,16 @@
         final float secondPtrX = event.getX(secondPtrIndex);
         final float secondPtrY = event.getY(secondPtrIndex);
 
-        // Check if the pointers are close enough.
-        final float deltaX = firstPtrX - secondPtrX;
-        final float deltaY = firstPtrY - secondPtrY;
-        final float deltaMove = (float) Math.hypot(deltaX, deltaY);
-        if (deltaMove > mDraggingDistance) {
-            return false;
-        }
-
         // Check if the pointers are moving in the same direction.
         final float firstDeltaX =
             firstPtrX - pointerTracker.getReceivedPointerDownX(firstPtrIndex);
         final float firstDeltaY =
             firstPtrY - pointerTracker.getReceivedPointerDownY(firstPtrIndex);
+
+        if (firstDeltaX == 0 && firstDeltaY == 0) {
+            return true;
+        }
+
         final float firstMagnitude =
             (float) Math.sqrt(firstDeltaX * firstDeltaX + firstDeltaY * firstDeltaY);
         final float firstXNormalized =
@@ -811,6 +767,11 @@
             secondPtrX - pointerTracker.getReceivedPointerDownX(secondPtrIndex);
         final float secondDeltaY =
             secondPtrY - pointerTracker.getReceivedPointerDownY(secondPtrIndex);
+
+        if (secondDeltaX == 0 && secondDeltaY == 0) {
+            return true;
+        }
+
         final float secondMagnitude =
             (float) Math.sqrt(secondDeltaX * secondDeltaX + secondDeltaY * secondDeltaY);
         final float secondXNormalized =
@@ -839,23 +800,6 @@
     }
 
     /**
-     * Sends a motion event to the input filter for injection.
-     *
-     * @param event The event to send.
-     * @param policyFlags The policy flags associated with the event.
-     */
-    private void sendMotionEvent(MotionEvent event, int policyFlags) {
-        if (DEBUG) {
-            Slog.d(LOG_TAG_INJECTED, "Injecting event: " + event + ", policyFlags=0x"
-                    + Integer.toHexString(policyFlags));
-        }
-        // Make sure that the user will see the event.
-        policyFlags |= WindowManagerPolicy.FLAG_PASS_TO_USER;
-        mPointerTracker.onInjectedMotionEvent(event);
-        mInputFilter.sendInputEvent(event, policyFlags);
-    }
-
-    /**
      * Clears the internal state of this explorer.
      */
     public void clear() {
@@ -1013,6 +957,7 @@
             switch (action) {
                 case MotionEvent.ACTION_DOWN: {
                     handleInjectedPointerDown(event.getActionIndex(), event);
+                    mLastInjectedDownEventTime = event.getDownTime();
                 } break;
                 case MotionEvent.ACTION_POINTER_DOWN: {
                     handleInjectedPointerDown(event.getActionIndex(), event);
@@ -1270,7 +1215,6 @@
             final int pointerId = event.getPointerId(pointerIndex);
             final int pointerFlag = (1 << pointerId);
             mInjectedPointersDown |= pointerFlag;
-            mLastInjectedDownEventTime = event.getEventTime();
         }
 
         /**
@@ -1406,7 +1350,11 @@
         public void run() {
             mCurrentState = STATE_DELEGATING;
             // Make sure the scheduled hover exit is delivered.
-            mSendHoverDelayed.forceSendAndRemove();
+            mSendHoverDelayed.remove();
+            final int pointerId = mPointerTracker.getPrimaryActivePointerId();
+            final int pointerIdBits = (1 << pointerId);
+            ensureHoverExitSent(mEvent, pointerIdBits, mPolicyFlags);
+
             sendDownForAllActiveNotInjectedPointers(mEvent, mPolicyFlags);
             mTouchExploreGestureInProgress = false;
             mLastTouchExploreEvent = null;
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index e258b1a..192d32b 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -5291,24 +5291,24 @@
                     case Surface.ROTATION_0:
                         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_90:
-                        return Gravity.RIGHT | Gravity.CENTER_VERTICAL;
+                        return Gravity.RIGHT | Gravity.BOTTOM;
                     case Surface.ROTATION_180:
-                        return Gravity.CENTER_HORIZONTAL | Gravity.TOP;
+                        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_270:
-                        return Gravity.LEFT | Gravity.CENTER_VERTICAL;
+                        return Gravity.LEFT | Gravity.BOTTOM;
                 }
             } else {
                 // On devices with a natural orientation of landscape
                 switch (rotation) {
                     default:
                     case Surface.ROTATION_0:
-                        return Gravity.RIGHT | Gravity.CENTER_VERTICAL;
+                        return Gravity.RIGHT | Gravity.BOTTOM;
                     case Surface.ROTATION_90:
                         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_180:
-                        return Gravity.LEFT | Gravity.CENTER_VERTICAL;
+                        return Gravity.LEFT | Gravity.BOTTOM;
                     case Surface.ROTATION_270:
-                        return Gravity.CENTER_HORIZONTAL | Gravity.TOP;
+                        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                 }
             }
         }