Merge "Bug 4599730 Get audio channel count on MediaPlayer"
diff --git a/Android.mk b/Android.mk
index 737202d..5cb4d30 100644
--- a/Android.mk
+++ b/Android.mk
@@ -469,7 +469,7 @@
 
 ## SDK version identifiers used in the published docs
   # major[.minor] version for current SDK. (full releases only)
-framework_docs_SDK_VERSION:=3.1
+framework_docs_SDK_VERSION:=3.2
   # release version (ie "Release x")  (full releases only)
 framework_docs_SDK_REL_ID:=1
 
diff --git a/api/current.txt b/api/current.txt
index fef65175..815fec8 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -185,14 +185,14 @@
   public static final class R.attr {
     ctor public R.attr();
     field public static final int absListViewStyle = 16842858; // 0x101006a
-    field public static final int accessibilityEventTypes = 16843647; // 0x101037f
-    field public static final int accessibilityFeedbackType = 16843649; // 0x1010381
-    field public static final int accessibilityFlags = 16843651; // 0x1010383
+    field public static final int accessibilityEventTypes = 16843646; // 0x101037e
+    field public static final int accessibilityFeedbackType = 16843648; // 0x1010380
+    field public static final int accessibilityFlags = 16843650; // 0x1010382
     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 actionBarSize = 16843499; // 0x10102eb
-    field public static final int actionBarSplitStyle = 16843669; // 0x1010395
+    field public static final int actionBarSplitStyle = 16843668; // 0x1010394
     field public static final int actionBarStyle = 16843470; // 0x10102ce
     field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4
     field public static final int actionBarTabStyle = 16843507; // 0x10102f3
@@ -208,10 +208,10 @@
     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 = 16843645; // 0x101037d
-    field public static final int actionModeStyle = 16843681; // 0x10103a1
+    field public static final int actionModeSelectAllDrawable = 16843644; // 0x101037c
+    field public static final int actionModeStyle = 16843680; // 0x10103a0
     field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
-    field public static final int actionProviderClass = 16843670; // 0x1010396
+    field public static final int actionProviderClass = 16843669; // 0x1010395
     field public static final int actionViewClass = 16843516; // 0x10102fc
     field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
     field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
@@ -223,7 +223,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 = 16843639; // 0x1010377
+    field public static final int alignmentMode = 16843638; // 0x1010376
     field public static final int allContactsName = 16843468; // 0x10102cc
     field public static final int allowBackup = 16843392; // 0x1010280
     field public static final int allowClearUserData = 16842757; // 0x1010005
@@ -257,8 +257,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 = 16843672; // 0x1010398
-    field public static final int backgroundStacked = 16843671; // 0x1010397
+    field public static final int backgroundSplit = 16843671; // 0x1010397
+    field public static final int backgroundStacked = 16843670; // 0x1010396
     field public static final int backupAgent = 16843391; // 0x101027f
     field public static final int baseline = 16843548; // 0x101031c
     field public static final int baselineAlignBottom = 16843042; // 0x1010122
@@ -267,7 +267,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 = 16843658; // 0x101038a
+    field public static final int bottomChevronDrawable = 16843657; // 0x1010389
     field public static final int bottomDark = 16842953; // 0x10100c9
     field public static final int bottomLeftRadius = 16843179; // 0x10101ab
     field public static final int bottomMedium = 16842958; // 0x10100ce
@@ -286,7 +286,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 = 16843652; // 0x1010384
+    field public static final int canRetrieveWindowContent = 16843651; // 0x1010383
     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
@@ -315,18 +315,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 = 16843677; // 0x101039d
+    field public static final int colorActivatedHighlight = 16843676; // 0x101039c
     field public static final int colorBackground = 16842801; // 0x1010031
     field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
-    field public static final int colorFocusedHighlight = 16843676; // 0x101039c
+    field public static final int colorFocusedHighlight = 16843675; // 0x101039b
     field public static final int colorForeground = 16842800; // 0x1010030
     field public static final int colorForegroundInverse = 16843270; // 0x1010206
-    field public static final int colorLongPressedHighlight = 16843675; // 0x101039b
-    field public static final int colorMultiSelectHighlight = 16843678; // 0x101039e
-    field public static final int colorPressedHighlight = 16843674; // 0x101039a
-    field public static final int columnCount = 16843636; // 0x1010374
+    field public static final int colorLongPressedHighlight = 16843674; // 0x101039a
+    field public static final int colorMultiSelectHighlight = 16843677; // 0x101039d
+    field public static final int colorPressedHighlight = 16843673; // 0x1010399
+    field public static final int columnCount = 16843635; // 0x1010373
     field public static final int columnDelay = 16843215; // 0x10101cf
-    field public static final int columnOrderPreserved = 16843637; // 0x1010375
+    field public static final int columnOrderPreserved = 16843636; // 0x1010374
     field public static final int columnWidth = 16843031; // 0x1010117
     field public static final int compatibleWidthLimitDp = 16843621; // 0x1010365
     field public static final int completionHint = 16843122; // 0x1010172
@@ -380,11 +380,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 = 16843680; // 0x10103a0
+    field public static final int drawableEnd = 16843679; // 0x101039f
     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 = 16843679; // 0x101039f
+    field public static final int drawableStart = 16843678; // 0x101039e
     field public static final int drawableTop = 16843117; // 0x101016d
     field public static final int drawingCacheQuality = 16842984; // 0x10100e8
     field public static final int dropDownAnchor = 16843363; // 0x1010263
@@ -441,7 +441,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 = 16843664; // 0x1010390
+    field public static final int feedbackCount = 16843663; // 0x101038f
     field public static final int fillAfter = 16843197; // 0x10101bd
     field public static final int fillBefore = 16843196; // 0x10101bc
     field public static final int fillEnabled = 16843343; // 0x101024f
@@ -494,7 +494,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 = 16843654; // 0x1010386
+    field public static final int handleDrawable = 16843653; // 0x1010385
     field public static final int handleProfiling = 16842786; // 0x1010022
     field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
     field public static final int hardwareAccelerated = 16843475; // 0x10102d3
@@ -503,12 +503,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 = 16843661; // 0x101038d
+    field public static final int hitRadius = 16843660; // 0x101038c
     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 = 16843666; // 0x1010392
+    field public static final int horizontalOffset = 16843665; // 0x1010391
     field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353
     field public static final int horizontalSpacing = 16843028; // 0x1010114
     field public static final int host = 16842792; // 0x1010028
@@ -554,7 +554,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 = 16843646; // 0x101037e
+    field public static final int isAuxiliary = 16843645; // 0x101037d
     field public static final int isDefault = 16843297; // 0x1010221
     field public static final int isIndicator = 16843079; // 0x1010147
     field public static final int isModifier = 16843334; // 0x1010246
@@ -607,8 +607,8 @@
     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 deprecated int layout_columnFlexibility = 16843644; // 0x101037c
-    field public static final int layout_columnSpan = 16843643; // 0x101037b
+    field public static final deprecated int layout_columnFlexibility = 16843643; // 0x101037b
+    field public static final int layout_columnSpan = 16843642; // 0x101037a
     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
@@ -616,9 +616,9 @@
     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 = 16843640; // 0x1010378
-    field public static final deprecated int layout_rowFlexibility = 16843642; // 0x101037a
-    field public static final int layout_rowSpan = 16843641; // 0x1010379
+    field public static final int layout_row = 16843639; // 0x1010377
+    field public static final deprecated int layout_rowFlexibility = 16843641; // 0x1010379
+    field public static final int layout_rowSpan = 16843640; // 0x1010378
     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
@@ -628,7 +628,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 = 16843655; // 0x1010387
+    field public static final int leftChevronDrawable = 16843654; // 0x1010386
     field public static final int lineSpacingExtra = 16843287; // 0x1010217
     field public static final int lineSpacingMultiplier = 16843288; // 0x1010218
     field public static final int lines = 16843092; // 0x1010154
@@ -640,8 +640,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 = 16843667; // 0x1010393
-    field public static final int listPreferredItemHeightSmall = 16843668; // 0x1010394
+    field public static final int listPreferredItemHeightLarge = 16843666; // 0x1010392
+    field public static final int listPreferredItemHeightSmall = 16843667; // 0x1010393
     field public static final int listSelector = 16843003; // 0x10100fb
     field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208
     field public static final int listViewStyle = 16842868; // 0x1010074
@@ -672,8 +672,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 = 16843683; // 0x10103a3
-    field public static final int minResizeWidth = 16843682; // 0x10103a2
+    field public static final int minResizeHeight = 16843682; // 0x10103a2
+    field public static final int minResizeWidth = 16843681; // 0x10103a1
     field public static final int minSdkVersion = 16843276; // 0x101020c
     field public static final int minWidth = 16843071; // 0x101013f
     field public static final int mode = 16843134; // 0x101017e
@@ -689,7 +689,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 = 16843650; // 0x1010382
+    field public static final int notificationTimeout = 16843649; // 0x1010381
     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
@@ -703,11 +703,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 = 16843660; // 0x101038c
+    field public static final int outerRadius = 16843659; // 0x101038b
     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 = 16843648; // 0x1010380
+    field public static final int packageNames = 16843647; // 0x101037f
     field public static final int padding = 16842965; // 0x10100d5
     field public static final int paddingBottom = 16842969; // 0x10100d9
     field public static final int paddingLeft = 16842966; // 0x10100d6
@@ -792,17 +792,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 = 16843656; // 0x1010388
+    field public static final int rightChevronDrawable = 16843655; // 0x1010387
     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 = 16843634; // 0x1010372
+    field public static final int rowCount = 16843633; // 0x1010371
     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 = 16843635; // 0x1010373
+    field public static final int rowOrderPreserved = 16843634; // 0x1010372
     field public static final int saveEnabled = 16842983; // 0x10100e7
     field public static final int scaleGravity = 16843262; // 0x10101fe
     field public static final int scaleHeight = 16843261; // 0x10101fd
@@ -868,7 +868,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 = 16843663; // 0x101038f
+    field public static final int snapMargin = 16843662; // 0x101038e
     field public static final int soundEffectsEnabled = 16843285; // 0x1010215
     field public static final int spacing = 16843027; // 0x1010113
     field public static final int spinnerDropDownItemStyle = 16842887; // 0x1010087
@@ -916,7 +916,7 @@
     field public static final int subtitleTextStyle = 16843513; // 0x10102f9
     field public static final int suggestActionMsg = 16843228; // 0x10101dc
     field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd
-    field public static final int suggestionsEnabled = 16843633; // 0x1010371
+    field public static final int suggestionsEnabled = 16843632; // 0x1010370
     field public static final int summary = 16843241; // 0x10101e9
     field public static final int summaryColumn = 16843426; // 0x10102a2
     field public static final int summaryOff = 16843248; // 0x10101f0
@@ -933,7 +933,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 = 16843653; // 0x1010385
+    field public static final int targetDrawables = 16843652; // 0x1010384
     field public static final int targetPackage = 16842785; // 0x1010021
     field public static final int targetSdkVersion = 16843376; // 0x1010270
     field public static final int taskAffinity = 16842770; // 0x1010012
@@ -948,7 +948,7 @@
     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 = 16843673; // 0x1010399
+    field public static final int textAllCaps = 16843672; // 0x1010398
     field public static final int textAppearance = 16842804; // 0x1010034
     field public static final int textAppearanceButton = 16843271; // 0x1010207
     field public static final int textAppearanceInverse = 16842805; // 0x1010035
@@ -989,8 +989,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 = 16843632; // 0x1010370
-    field public static final int textEditSuggestionsWindowLayout = 16843631; // 0x101036f
+    field public static final int textEditSuggestionItemLayout = 16843631; // 0x101036f
     field public static final int textFilterEnabled = 16843007; // 0x10100ff
     field public static final int textIsSelectable = 16843542; // 0x1010316
     field public static final int textOff = 16843045; // 0x1010125
@@ -1023,7 +1022,7 @@
     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 = 16843657; // 0x1010389
+    field public static final int topChevronDrawable = 16843656; // 0x1010388
     field public static final int topDark = 16842951; // 0x10100c7
     field public static final int topLeftRadius = 16843177; // 0x10101a9
     field public static final int topOffset = 16843352; // 0x1010258
@@ -1039,7 +1038,7 @@
     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 = 16843638; // 0x1010376
+    field public static final int useDefaultMargins = 16843637; // 0x1010375
     field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310
     field public static final int useLevel = 16843167; // 0x101019f
     field public static final int userVisible = 16843409; // 0x1010291
@@ -1053,10 +1052,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 = 16843665; // 0x1010391
+    field public static final int verticalOffset = 16843664; // 0x1010390
     field public static final int verticalScrollbarPosition = 16843572; // 0x1010334
     field public static final int verticalSpacing = 16843029; // 0x1010115
-    field public static final int vibrationDuration = 16843662; // 0x101038e
+    field public static final int vibrationDuration = 16843661; // 0x101038d
     field public static final int visibility = 16842972; // 0x10100dc
     field public static final int visible = 16843156; // 0x1010194
     field public static final int vmSafeMode = 16843448; // 0x10102b8
@@ -1073,7 +1072,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 = 16843659; // 0x101038b
+    field public static final int waveDrawable = 16843658; // 0x101038a
     field public static final int webTextViewStyle = 16843449; // 0x10102b9
     field public static final int webViewStyle = 16842885; // 0x1010085
     field public static final int weekDayTextAppearance = 16843592; // 0x1010348
@@ -17047,6 +17046,7 @@
 
   public class BaseObj {
     method public synchronized void destroy();
+    method public java.lang.String getName();
     method public void setName(java.lang.String);
   }
 
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index 36940c2..a217867 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -29,10 +29,16 @@
 import android.widget.SpinnerAdapter;
 
 /**
- * This is the public interface to the contextual ActionBar.
- * The ActionBar acts as a replacement for the title bar in Activities.
- * It provides facilities for creating toolbar actions as well as
- * methods of navigating around an application. 
+ * Acts as a replacement for the title bar in Activities.
+ * The action bar provides facilities for creating toolbar actions as well as
+ * methods of navigating the application.
+ * <p>By default, the action bar appears at the top of every activity, with the application icon on
+ * the left, followed by the activity title. Items from the activity's options menu are also
+ * accessible from the action bar.</p>
+ * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link
+ * android.app.Activity#getActionBar getActionBar()}.</p>
+ * <p>For more information, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action
+ * Bar</a> developer guide.</p>
  */
 public abstract class ActionBar {
     /**
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index cb97c46..2035c73 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -162,6 +162,9 @@
  * constructor to instantiate it.  If the empty constructor is not available,
  * a runtime exception will occur in some cases during state restore.
  *
+ * <p>For more documentation, also see the <a
+ * href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> developer guide.</p>
+ *
  * <p>Topics covered here:
  * <ol>
  * <li><a href="#OlderPlatforms">Older Platforms</a>
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index cdda910..2a02446 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -129,7 +129,7 @@
     /**
      * Flag for {@link #bindService}: don't allow this binding to raise
      * the target service's process to the foreground scheduling priority.
-     * It will still be raised to the at least the same memory priority
+     * It will still be raised to at least the same memory priority
      * as the client (so that its process will not be killable in any
      * situation where the client is not killable), but for CPU scheduling
      * purposes it may be left in the background.  This only has an impact
@@ -138,6 +138,16 @@
      */
     public static final int BIND_NOT_FOREGROUND = 0x0004;
 
+    /**
+     * Flag for {@link #bindService}: allow the process hosting the bound
+     * service to go through its normal memory management.  It will be
+     * treated more like a running service, allowing the system to
+     * (temporarily) expunge the process if low on memory or for some other
+     * whim it may have.
+     * @hide
+     */
+    public static final int BIND_ALLOW_OOM_MANAGEMENT = 0x0008;
+
     /** Return an AssetManager instance for your application's package. */
     public abstract AssetManager getAssets();
 
diff --git a/core/java/android/content/Loader.java b/core/java/android/content/Loader.java
index 4e70b74..368c33e 100644
--- a/core/java/android/content/Loader.java
+++ b/core/java/android/content/Loader.java
@@ -40,6 +40,8 @@
  *
  * <p>Most implementations should not derive directly from this class, but
  * instead inherit from {@link AsyncTaskLoader}.</p>
+ * <p>For more information, see the <a
+ * href="{@docRoot}guide/topics/fundamentals/loaders.html">Loaders</a> developer guide.</p>
  *
  * @param <D> The result returned when the load is complete
  */
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 2cb8a86..5be6ec1 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -1691,12 +1691,28 @@
                         continue;
                     }
 
-                    // skip the sync if it isn't manual and auto sync or
-                    // background data usage is disabled
+                    final RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterInfo;
+                    syncAdapterInfo = mSyncAdapters.getServiceInfo(
+                            SyncAdapterType.newKey(op.authority, op.account.type));
+
+                    // only proceed if network is connected for requesting UID
+                    final boolean uidNetworkConnected;
+                    if (syncAdapterInfo != null) {
+                        final NetworkInfo networkInfo = getConnectivityManager()
+                                .getActiveNetworkInfoForUid(syncAdapterInfo.uid);
+                        uidNetworkConnected = networkInfo != null && networkInfo.isConnected();
+                    } else {
+                        uidNetworkConnected = false;
+                    }
+
+                    // skip the sync if it isn't manual, and auto sync or
+                    // background data usage is disabled or network is
+                    // disconnected for the target UID.
                     if (!op.extras.getBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS, false)
                             && (syncableState > 0)
                             && (!masterSyncAutomatically
                                 || !backgroundDataUsageAllowed
+                                || !uidNetworkConnected
                                 || !mSyncStorageEngine.getSyncAutomatically(
                                        op.account, op.authority))) {
                         operationIterator.remove();
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 0067e940..9a53d76 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -20,12 +20,15 @@
 import android.os.WorkSource;
 
 /** @hide */
+
 interface IPowerManager
 {
+    // WARNING: changes in acquireWakeLock() signature must be reflected in IPowerManager.cpp/h
     void acquireWakeLock(int flags, IBinder lock, String tag, in WorkSource ws);
     void updateWakeLockWorkSource(IBinder lock, in WorkSource ws);
     void goToSleep(long time);
     void goToSleepWithReason(long time, int reason);
+    // WARNING: changes in releaseWakeLock() signature must be reflected in IPowerManager.cpp/h
     void releaseWakeLock(IBinder lock, int flags);
     void userActivity(long when, boolean noChangeLights);
     void userActivityWithForce(long when, boolean noChangeLights, boolean force);
diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java
index 1926c92..b4e8ab4 100644
--- a/core/java/android/speech/tts/TextToSpeechService.java
+++ b/core/java/android/speech/tts/TextToSpeechService.java
@@ -227,7 +227,7 @@
         private boolean mFirstIdle = true;
 
         public SynthThread() {
-            super(SYNTH_THREAD_NAME, android.os.Process.THREAD_PRIORITY_AUDIO);
+            super(SYNTH_THREAD_NAME, android.os.Process.THREAD_PRIORITY_DEFAULT);
         }
 
         @Override
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index d22fa6e..d561484 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -51,7 +51,7 @@
 
     // The native renderer will be destroyed when this object dies.
     // DO NOT overwrite this reference once it is set.
-    @SuppressWarnings("unused")
+    @SuppressWarnings({"unused", "FieldCanBeLocal"})
     private CanvasFinalizer mFinalizer;
 
     private int mWidth;
diff --git a/core/java/android/view/GLES20RenderLayer.java b/core/java/android/view/GLES20RenderLayer.java
index 7adac1c..41f16e2 100644
--- a/core/java/android/view/GLES20RenderLayer.java
+++ b/core/java/android/view/GLES20RenderLayer.java
@@ -24,7 +24,6 @@
  * {@link Canvas} that can be used to render into an FBO using OpenGL.
  */
 class GLES20RenderLayer extends GLES20Layer {
-
     private int mLayerWidth;
     private int mLayerHeight;
 
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 14a77b4..d2476af 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -283,7 +283,7 @@
      *              see {@link android.content.ComponentCallbacks}
      */
     static void trimMemory(int level) {
-        Gl20Renderer.flushCaches(level);
+        Gl20Renderer.trimMemory(level);
     }
 
     /**
@@ -677,22 +677,13 @@
         }
 
         EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) {
-            int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
+            int[] attribs = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE };
 
             return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT,
-                    mGlVersion != 0 ? attrib_list : null);            
+                    mGlVersion != 0 ? attribs : null);            
         }
 
         @Override
-        void initializeIfNeeded(int width, int height, View.AttachInfo attachInfo,
-                SurfaceHolder holder) throws Surface.OutOfResourcesException {
-            if (isRequested()) {
-                checkEglErrors();
-                super.initializeIfNeeded(width, height, attachInfo, holder);
-            }
-        }
-        
-        @Override
         void destroy(boolean full) {
             if (full && mCanvas != null) {
                 mCanvas = null;
@@ -726,6 +717,7 @@
 
         @Override
         void setup(int width, int height) {
+            checkCurrent();
             mCanvas.setViewport(width, height);
         }
 
@@ -819,7 +811,7 @@
          *         {@link #SURFACE_STATE_UPDATED} if the EGL context was changed or
          *         {@link #SURFACE_STATE_SUCCESS} if the EGL context was the correct one
          */
-        private int checkCurrent() {
+        int checkCurrent() {
             if (mEglThread != Thread.currentThread()) {
                 throw new IllegalStateException("Hardware acceleration can only be used with a " +
                         "single UI thread.\nOriginal thread: " + mEglThread + "\n" +
@@ -847,6 +839,9 @@
     static class Gl20Renderer extends GlRenderer {
         private GLES20Canvas mGlCanvas;
 
+        private static EGLSurface sPbuffer;
+        private static final Object[] sPbufferLock = new Object[0];
+
         Gl20Renderer(boolean translucent) {
             super(2, translucent);
         }
@@ -926,14 +921,26 @@
             return ((GLES20TextureLayer) layer).getSurfaceTexture();
         }
 
-        static HardwareRenderer create(boolean translucent) {
-            if (GLES20Canvas.isAvailable()) {
-                return new Gl20Renderer(translucent);
+        static void trimMemory(int level) {
+            if (sEgl == null || sEglConfig == null) return;
+
+            EGLContext eglContext = sEglContextStorage.get();
+            // We do not have OpenGL objects
+            if (eglContext == null) {
+                return;
+            } else {
+                synchronized (sPbufferLock) {
+                    // Create a temporary 1x1 pbuffer so we have a context
+                    // to clear our OpenGL objects
+                    if (sPbuffer == null) {
+                        sPbuffer = sEgl.eglCreatePbufferSurface(sEglDisplay, sEglConfig, new int[] {
+                                EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE
+                        });
+                    }
+                }
+                sEgl.eglMakeCurrent(sEglDisplay, sPbuffer, sPbuffer, eglContext);
             }
-            return null;
-        }
-        
-        static void flushCaches(int level) {
+
             switch (level) {
                 case ComponentCallbacks.TRIM_MEMORY_MODERATE:
                     GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_MODERATE);
@@ -943,5 +950,12 @@
                     break;
             }
         }
+
+        static HardwareRenderer create(boolean translucent) {
+            if (GLES20Canvas.isAvailable()) {
+                return new Gl20Renderer(translucent);
+            }
+            return null;
+        }
     }
 }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2213188..8c41b9f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -672,19 +672,23 @@
     private static final int FITS_SYSTEM_WINDOWS = 0x00000002;
 
     /**
-     * This view is visible.  Use with {@link #setVisibility(int)}.
+     * This view is visible.
+     * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
+     * android:visibility}.
      */
     public static final int VISIBLE = 0x00000000;
 
     /**
      * This view is invisible, but it still takes up space for layout purposes.
-     * Use with {@link #setVisibility(int)}.
+     * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
+     * android:visibility}.
      */
     public static final int INVISIBLE = 0x00000004;
 
     /**
      * This view is invisible, and it doesn't take any space for layout
-     * purposes. Use with {@link #setVisibility(int)}.
+     * purposes. Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
+     * android:visibility}.
      */
     public static final int GONE = 0x00000008;
 
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 8cf03a6..697636e 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -788,7 +788,7 @@
         final View[] children = mChildren;
         for (int i = 0; i < childrenCount; i++) {
             View child = children[i];
-            if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
+            if ((child.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
                 child.findViewsWithText(outViews, text);
             }
         }
@@ -2162,6 +2162,9 @@
     @Override
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfo(info);
+        if ((mPrivateFlags & IS_ROOT_NAMESPACE) != 0) {
+            return;
+        }
         for (int i = 0, count = mChildrenCount; i < count; i++) {
             View child = mChildren[i];
             if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 470493d..35a40fc 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -235,6 +235,7 @@
     final Configuration mLastConfiguration = new Configuration();
     final Configuration mPendingConfiguration = new Configuration();
 
+    
     class ResizedInfo {
         Rect coveredInsets;
         Rect visibleInsets;
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index b7c1687..c4458df 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2817,9 +2817,11 @@
                     mPositionScroller.stop();
                 }
                 mTouchMode = TOUCH_MODE_OVERSCROLL;
+                mMotionX = (int) ev.getX();
                 mMotionY = mLastY = (int) ev.getY();
                 mMotionCorrection = 0;
                 mActivePointerId = ev.getPointerId(0);
+                mDirection = 0;
                 break;
             }
 
@@ -2994,9 +2996,38 @@
                         mDirection = newDirection;
                     }
 
-                    if (mDirection != newDirection) {
+                    int overScrollDistance = -incrementalDeltaY;
+                    if ((newScroll < 0 && oldScroll >= 0) || (newScroll > 0 && oldScroll <= 0)) {
+                        overScrollDistance = -oldScroll;
+                        incrementalDeltaY += overScrollDistance;
+                    } else {
+                        incrementalDeltaY = 0;
+                    }
+
+                    if (overScrollDistance != 0) {
+                        overScrollBy(0, overScrollDistance, 0, mScrollY, 0, 0,
+                                0, mOverscrollDistance, true);
+                        final int overscrollMode = getOverScrollMode();
+                        if (overscrollMode == OVER_SCROLL_ALWAYS ||
+                                (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
+                                        !contentFits())) {
+                            if (rawDeltaY > 0) {
+                                mEdgeGlowTop.onPull((float) overScrollDistance / getHeight());
+                                if (!mEdgeGlowBottom.isFinished()) {
+                                    mEdgeGlowBottom.onRelease();
+                                }
+                            } else if (rawDeltaY < 0) {
+                                mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight());
+                                if (!mEdgeGlowTop.isFinished()) {
+                                    mEdgeGlowTop.onRelease();
+                                }
+                            }
+                            invalidate();
+                        }
+                    }
+
+                    if (incrementalDeltaY != 0) {
                         // Coming back to 'real' list scrolling
-                        incrementalDeltaY = -newScroll;
                         mScrollY = 0;
                         invalidateParentIfNeeded();
 
@@ -3005,45 +3036,17 @@
                             trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
                         }
 
-                        // Check to see if we are back in
-                        View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
-                        if (motionView != null) {
-                            mTouchMode = TOUCH_MODE_SCROLL;
+                        mTouchMode = TOUCH_MODE_SCROLL;
 
-                            // We did not scroll the full amount. Treat this essentially like the
-                            // start of a new touch scroll
-                            final int motionPosition = findClosestMotionRow(y);
+                        // We did not scroll the full amount. Treat this essentially like the
+                        // start of a new touch scroll
+                        final int motionPosition = findClosestMotionRow(y);
 
-                            mMotionCorrection = 0;
-                            motionView = getChildAt(motionPosition - mFirstPosition);
-                            mMotionViewOriginalTop = motionView.getTop();
-                            mMotionY = y;
-                            mMotionPosition = motionPosition;
-                        }
-                    } else {
-                        overScrollBy(0, -incrementalDeltaY, 0, mScrollY, 0, 0,
-                                0, mOverscrollDistance, true);
-                        final int overscrollMode = getOverScrollMode();
-                        if (overscrollMode == OVER_SCROLL_ALWAYS ||
-                                (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS &&
-                                        !contentFits())) {
-                            if (rawDeltaY > 0) {
-                                mEdgeGlowTop.onPull((float) -incrementalDeltaY / getHeight());
-                                if (!mEdgeGlowBottom.isFinished()) {
-                                    mEdgeGlowBottom.onRelease();
-                                }
-                            } else if (rawDeltaY < 0) {
-                                mEdgeGlowBottom.onPull((float) -incrementalDeltaY / getHeight());
-                                if (!mEdgeGlowTop.isFinished()) {
-                                    mEdgeGlowTop.onRelease();
-                                }
-                            }
-                            invalidate();
-                        }
-                        if (Math.abs(mOverscrollDistance) == Math.abs(mScrollY)) {
-                            // Don't allow overfling if we're at the edge.
-                            mVelocityTracker.clear();
-                        }
+                        mMotionCorrection = 0;
+                        View motionView = getChildAt(motionPosition - mFirstPosition);
+                        mMotionViewOriginalTop = motionView != null ? motionView.getTop() : 0;
+                        mMotionY = y;
+                        mMotionPosition = motionPosition;
                     }
                     mLastY = y;
                     mDirection = newDirection;
@@ -3320,12 +3323,6 @@
             mScrollY = scrollY;
             invalidateParentIfNeeded();
 
-            if (clampedY) {
-                // Velocity is broken by hitting the limit; don't start a fling off of this.
-                if (mVelocityTracker != null) {
-                    mVelocityTracker.clear();
-                }
-            }
             awakenScrollBars();
         }
     }
@@ -3616,9 +3613,8 @@
         }
 
         void startOverfling(int initialVelocity) {
-            final int min = mScrollY > 0 ? Integer.MIN_VALUE : 0;
-            final int max = mScrollY > 0 ? 0 : Integer.MAX_VALUE;
-            mScroller.fling(0, mScrollY, 0, initialVelocity, 0, 0, min, max, 0, getHeight());
+            mScroller.fling(0, mScrollY, 0, initialVelocity, 0, 0,
+                    Integer.MIN_VALUE, Integer.MAX_VALUE, 0, getHeight());
             mTouchMode = TOUCH_MODE_OVERFLING;
             invalidate();
             post(this);
@@ -3768,10 +3764,22 @@
                 final OverScroller scroller = mScroller;
                 if (scroller.computeScrollOffset()) {
                     final int scrollY = mScrollY;
-                    final int deltaY = scroller.getCurrY() - scrollY;
+                    final int currY = scroller.getCurrY();
+                    final int deltaY = currY - scrollY;
                     if (overScrollBy(0, deltaY, 0, scrollY, 0, 0,
                             0, mOverflingDistance, false)) {
-                        startSpringback();
+                        final boolean crossDown = scrollY <= 0 && currY > 0;
+                        final boolean crossUp = scrollY >= 0 && currY < 0;
+                        if (crossDown || crossUp) {
+                            int velocity = (int) scroller.getCurrVelocity();
+                            if (crossUp) velocity = -velocity;
+
+                            // Don't flywheel from this; we're just continuing things.
+                            scroller.abortAnimation();
+                            start(velocity);
+                        } else {
+                            startSpringback();
+                        }
                     } else {
                         invalidate();
                         post(this);
diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java
index d85f8a4..45d73af 100644
--- a/core/java/android/widget/ActivityChooserView.java
+++ b/core/java/android/widget/ActivityChooserView.java
@@ -29,16 +29,7 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.ActivityChooserModel;
 import android.widget.ActivityChooserModel.ActivityChooserModelClient;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.ListPopupWindow;
-import android.widget.PopupWindow;
-import android.widget.TextView;
 
 import com.android.internal.R;
 
@@ -85,12 +76,22 @@
     /**
      * The expand activities action button;
      */
-    private final ImageButton mExpandActivityOverflowButton;
+    private final FrameLayout mExpandActivityOverflowButton;
+
+    /**
+     * The image for the expand activities action button;
+     */
+    private final ImageView mExpandActivityOverflowButtonImage;
 
     /**
      * The default activities action button;
      */
-    private final ImageButton mDefaultActionButton;
+    private final FrameLayout mDefaultActivityButton;
+
+    /**
+     * The image for the default activities action button;
+     */
+    private final ImageView mDefaultActivityButtonImage;
 
     /**
      * The maximal width of the list popup.
@@ -185,13 +186,16 @@
 
         mActivityChooserContent = (LinearLayout) findViewById(R.id.activity_chooser_view_content);
 
-        mDefaultActionButton = (ImageButton) findViewById(R.id.default_activity_button);
-        mDefaultActionButton.setOnClickListener(mCallbacks);
-        mDefaultActionButton.setOnLongClickListener(mCallbacks);
+        mDefaultActivityButton = (FrameLayout) findViewById(R.id.default_activity_button);
+        mDefaultActivityButton.setOnClickListener(mCallbacks);
+        mDefaultActivityButton.setOnLongClickListener(mCallbacks);
+        mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.image);
 
-        mExpandActivityOverflowButton = (ImageButton) findViewById(R.id.expand_activities_button);
+        mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.expand_activities_button);
         mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
-        mExpandActivityOverflowButton.setImageDrawable(expandActivityOverflowButtonDrawable);
+        mExpandActivityOverflowButtonImage =
+            (ImageView) mExpandActivityOverflowButton.findViewById(R.id.image);
+        mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);
 
         mAdapter = new ActivityChooserViewAdapter();
         mAdapter.registerDataSetObserver(new DataSetObserver() {
@@ -230,7 +234,7 @@
      * @param drawable The drawable.
      */
     public void setExpandActivityOverflowButtonDrawable(Drawable drawable) {
-        mExpandActivityOverflowButton.setImageDrawable(drawable);
+        mExpandActivityOverflowButtonImage.setImageDrawable(drawable);
     }
 
     /**
@@ -391,7 +395,7 @@
     private void updateButtons() {
         final int activityCount = mAdapter.getActivityCount();
         if (activityCount > 0) {
-            mDefaultActionButton.setVisibility(VISIBLE);
+            mDefaultActivityButton.setVisibility(VISIBLE);
             if (mAdapter.getCount() > 0) {
                 mExpandActivityOverflowButton.setEnabled(true);
             } else {
@@ -399,9 +403,9 @@
             }
             ResolveInfo activity = mAdapter.getDefaultActivity();
             PackageManager packageManager = mContext.getPackageManager();
-            mDefaultActionButton.setImageDrawable(activity.loadIcon(packageManager));
+            mDefaultActivityButtonImage.setImageDrawable(activity.loadIcon(packageManager));
         } else {
-            mDefaultActionButton.setVisibility(View.INVISIBLE);
+            mDefaultActivityButton.setVisibility(View.INVISIBLE);
             mExpandActivityOverflowButton.setEnabled(false);
         }
     }
@@ -440,7 +444,7 @@
 
         // View.OnClickListener
         public void onClick(View view) {
-            if (view == mDefaultActionButton) {
+            if (view == mDefaultActivityButton) {
                 dismissPopup();
                 ResolveInfo defaultActivity = mAdapter.getDefaultActivity();
                 final int index = mAdapter.getDataModel().getActivityIndex(defaultActivity);
@@ -457,7 +461,7 @@
         // OnLongClickListener#onLongClick
         @Override
         public boolean onLongClick(View view) {
-            if (view == mDefaultActionButton) {
+            if (view == mDefaultActivityButton) {
                 if (mAdapter.getCount() > 0) {
                     mIsSelectingDefaultActivity = true;
                     showPopupUnchecked(mInitialActivityCount);
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 5eba1a0..0b0b812 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -34,12 +34,17 @@
 
 /**
  * FrameLayout is designed to block out an area on the screen to display
- * a single item. You can add multiple children to a FrameLayout and control their
- * position within the FrameLayout using {@link android.widget.FrameLayout.LayoutParams#gravity}.
- * Children are drawn in a stack, with the most recently added child on top.
- * The size of the frame layout is the size of its largest child (plus padding), visible
- * or not (if the FrameLayout's parent permits). Views that are GONE are used for sizing
- * only if {@link #setMeasureAllChildren(boolean) setMeasureAllChildren()}
+ * a single item. Generally, FrameLayout should be used to hold a single child view, because it can
+ * be difficult to organize child views in a way that's scalable to different screen sizes without
+ * the children overlapping each other. You can, however, add multiple children to a FrameLayout
+ * and control their position within the FrameLayout by assigning gravity to each child, using the
+ * <a href="FrameLayout.LayoutParams.html#attr_android:layout_gravity">{@code
+ * android:layout_gravity}</a> attribute.
+ * <p>Child views are drawn in a stack, with the most recently added child on top.
+ * The size of the FrameLayout is the size of its largest child (plus padding), visible
+ * or not (if the FrameLayout's parent permits). Views that are {@link android.view.View#GONE} are
+ * used for sizing
+ * only if {@link #setMeasureAllChildren(boolean) setConsiderGoneChildrenWhenMeasuring()}
  * is set to true.
  *
  * @attr ref android.R.styleable#FrameLayout_foreground
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 55b73df..91b19ed 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -221,6 +221,7 @@
         mCloseButton.setOnClickListener(mOnClickListener);
         mSubmitButton.setOnClickListener(mOnClickListener);
         mVoiceButton.setOnClickListener(mOnClickListener);
+        mQueryTextView.setOnClickListener(mOnClickListener);
 
         mQueryTextView.addTextChangedListener(mTextWatcher);
         mQueryTextView.setOnEditorActionListener(mOnEditorActionListener);
@@ -319,7 +320,9 @@
         // If it is not iconified, then give the focus to the text field
         if (!isIconified()) {
             boolean result = mQueryTextView.requestFocus(direction, previouslyFocusedRect);
-            if (result) updateViewsVisibility(false);
+            if (result) {
+                updateViewsVisibility(false);
+            }
             return result;
         } else {
             return super.requestFocus(direction, previouslyFocusedRect);
@@ -330,9 +333,9 @@
     @Override
     public void clearFocus() {
         mClearingFocus = true;
+        setImeVisibility(false);
         super.clearFocus();
         mQueryTextView.clearFocus();
-        setImeVisibility(false);
         mClearingFocus = false;
     }
 
@@ -681,6 +684,8 @@
                 onSubmitQuery();
             } else if (v == mVoiceButton) {
                 onVoiceClicked();
+            } else if (v == mQueryTextView) {
+                forceSuggestionQuery();
             }
         }
     };
@@ -1029,6 +1034,9 @@
     void onTextFocusChanged() {
         updateViewsVisibility(isIconified());
         updateFocusedState(mQueryTextView.hasFocus());
+        if (mQueryTextView.hasFocus()) {
+            forceSuggestionQuery();
+        }
     }
 
     @Override
@@ -1041,8 +1049,9 @@
      */
     @Override
     public void onActionViewCollapsed() {
+        clearFocus();
+        updateViewsVisibility(true);
         mQueryTextView.setText("");
-        setIconified(true);
         mExpandedInActionView = false;
     }
 
@@ -1376,6 +1385,11 @@
         }
     }
 
+    private void forceSuggestionQuery() {
+        mQueryTextView.doBeforeTextChanged();
+        mQueryTextView.doAfterTextChanged();
+    }
+
     static boolean isLandscapeMode(Context context) {
         return context.getResources().getConfiguration().orientation
                 == Configuration.ORIENTATION_LANDSCAPE;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a7324b0..127b6a3 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -329,7 +329,6 @@
     private int mTextEditPasteWindowLayout, mTextEditSidePasteWindowLayout;
     private int mTextEditNoPasteWindowLayout, mTextEditSideNoPasteWindowLayout;
 
-    private int mTextEditSuggestionsWindowLayout;
     private int mTextEditSuggestionItemLayout;
     private SuggestionsPopupWindow mSuggestionsPopupWindow;
     private SuggestionRangeSpan mSuggestionRangeSpan;
@@ -830,10 +829,6 @@
                 mTextEditSideNoPasteWindowLayout = a.getResourceId(attr, 0);
                 break;
 
-            case com.android.internal.R.styleable.TextView_textEditSuggestionsWindowLayout:
-                mTextEditSuggestionsWindowLayout = a.getResourceId(attr, 0);
-                break;
-
             case com.android.internal.R.styleable.TextView_textEditSuggestionItemLayout:
                 mTextEditSuggestionItemLayout = a.getResourceId(attr, 0);
                 break;
@@ -8780,20 +8775,48 @@
     private class SuggestionsPopupWindow implements OnClickListener {
         private static final int MAX_NUMBER_SUGGESTIONS = 5;
         private static final int NO_SUGGESTIONS = -1;
-        private final PopupWindow mContainer;
-        private ViewGroup mSuggestionViewGroup;
+        private final PopupWindow mPopupWindow;
+        private LinearLayout mSuggestionsContainer;
         private WordIterator mSuggestionWordIterator;
         private TextAppearanceSpan[] mHighlightSpans = new TextAppearanceSpan[0];
 
         public SuggestionsPopupWindow() {
-            mContainer = new PopupWindow(TextView.this.mContext, null,
+            mPopupWindow = new PopupWindow(TextView.this.mContext, null,
                     com.android.internal.R.attr.textSuggestionsWindowStyle);
-            mContainer.setSplitTouchEnabled(true);
-            mContainer.setClippingEnabled(false);
-            mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
+            mPopupWindow.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
+            mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
+            mPopupWindow.setOutsideTouchable(true);
 
-            mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
-            mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+            mPopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
+            mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+
+            mSuggestionsContainer = new LinearLayout(TextView.this.mContext);
+            mSuggestionsContainer.setOrientation(LinearLayout.VERTICAL);
+
+            LayoutInflater inflater = (LayoutInflater) TextView.this.mContext.
+                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+            if (inflater == null) {
+                throw new IllegalArgumentException(
+                        "Unable to create inflater for TextEdit suggestions");
+            }
+
+            // Inflate the suggestion items once and for all.
+            for (int i = 0; i < MAX_NUMBER_SUGGESTIONS; i++) {
+                View childView = inflater.inflate(mTextEditSuggestionItemLayout,
+                        mSuggestionsContainer, false);
+
+                if (! (childView instanceof TextView)) {
+                    throw new IllegalArgumentException(
+                            "Inflated TextEdit suggestion item is not a TextView: " + childView);
+                }
+
+                childView.setTag(new SuggestionInfo());
+                mSuggestionsContainer.addView(childView);
+                childView.setOnClickListener(this);
+            }
+
+            mPopupWindow.setContentView(mSuggestionsContainer);
         }
 
         private class SuggestionInfo {
@@ -8803,44 +8826,6 @@
             int suggestionIndex; // the index of the suggestion inside suggestionSpan
         }
 
-        private void initSuggestionViewGroup() {
-            if (mSuggestionViewGroup == null) {
-                LayoutInflater inflater = (LayoutInflater) TextView.this.mContext.
-                        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-                if (inflater == null) {
-                    throw new IllegalArgumentException(
-                            "Unable to create TextEdit suggestion window inflater");
-                }
-
-                View view = inflater.inflate(mTextEditSuggestionsWindowLayout, null);
-
-                if (! (view instanceof ViewGroup)) {
-                    throw new IllegalArgumentException(
-                            "Inflated TextEdit suggestion window is not a ViewGroup: " + view);
-                }
-
-                mSuggestionViewGroup = (ViewGroup) view;
-
-                // Inflate the suggestion items once and for all.
-                for (int i = 0; i < MAX_NUMBER_SUGGESTIONS; i++) {
-                    View childView = inflater.inflate(mTextEditSuggestionItemLayout,
-                            mSuggestionViewGroup, false);
-
-                    if (! (childView instanceof TextView)) {
-                        throw new IllegalArgumentException(
-                               "Inflated TextEdit suggestion item is not a TextView: " + childView);
-                    }
-
-                    childView.setTag(new SuggestionInfo());
-                    mSuggestionViewGroup.addView(childView);
-                    childView.setOnClickListener(this);
-                }
-
-                mContainer.setContentView(mSuggestionViewGroup);
-            }
-        }
-
         public void show() {
             if (!(mText instanceof Editable)) return;
 
@@ -8849,8 +8834,6 @@
             SuggestionSpan[] suggestionSpans = spannable.getSpans(pos, pos, SuggestionSpan.class);
             final int nbSpans = suggestionSpans.length;
 
-            initSuggestionViewGroup();
-
             int totalNbSuggestions = 0;
             int spanUnionStart = mText.length();
             int spanUnionEnd = 0;
@@ -8865,7 +8848,7 @@
                 String[] suggestions = suggestionSpan.getSuggestions();
                 int nbSuggestions = suggestions.length;
                 for (int suggestionIndex = 0; suggestionIndex < nbSuggestions; suggestionIndex++) {
-                    TextView textView = (TextView) mSuggestionViewGroup.getChildAt(
+                    TextView textView = (TextView) mSuggestionsContainer.getChildAt(
                             totalNbSuggestions);
                     textView.setText(suggestions[suggestionIndex]);
                     SuggestionInfo suggestionInfo = (SuggestionInfo) textView.getTag();
@@ -8885,7 +8868,7 @@
 
             if (totalNbSuggestions == 0) {
                 // TODO Replace by final text, use a dedicated layout, add a fade out timer...
-                TextView textView = (TextView) mSuggestionViewGroup.getChildAt(0);
+                TextView textView = (TextView) mSuggestionsContainer.getChildAt(0);
                 textView.setText("No suggestions available");
                 SuggestionInfo suggestionInfo = (SuggestionInfo) textView.getTag();
                 suggestionInfo.spanStart = NO_SUGGESTIONS;
@@ -8896,22 +8879,22 @@
                         Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
 
                 for (int i = 0; i < totalNbSuggestions; i++) {
-                    final TextView textView = (TextView) mSuggestionViewGroup.getChildAt(i);
+                    final TextView textView = (TextView) mSuggestionsContainer.getChildAt(i);
                     highlightTextDifferences(textView, spanUnionStart, spanUnionEnd);
                 }
             }
 
             for (int i = 0; i < totalNbSuggestions; i++) {
-                mSuggestionViewGroup.getChildAt(i).setVisibility(VISIBLE);
+                mSuggestionsContainer.getChildAt(i).setVisibility(VISIBLE);
             }
             for (int i = totalNbSuggestions; i < MAX_NUMBER_SUGGESTIONS; i++) {
-                mSuggestionViewGroup.getChildAt(i).setVisibility(GONE);
+                mSuggestionsContainer.getChildAt(i).setVisibility(GONE);
             }
 
             final DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();
             final int screenWidth = displayMetrics.widthPixels;
             final int screenHeight = displayMetrics.heightPixels;
-            mSuggestionViewGroup.measure(
+            mSuggestionsContainer.measure(
                     View.MeasureSpec.makeMeasureSpec(screenWidth, View.MeasureSpec.AT_MOST),
                     View.MeasureSpec.makeMeasureSpec(screenHeight, View.MeasureSpec.AT_MOST));
 
@@ -9071,11 +9054,11 @@
             if ((mText instanceof Editable) && mSuggestionRangeSpan != null) {
                 ((Editable) mText).removeSpan(mSuggestionRangeSpan);
             }
-            mContainer.dismiss();
+            mPopupWindow.dismiss();
         }
 
         public boolean isShowing() {
-            return mContainer.isShowing();
+            return mPopupWindow.isShowing();
         }
 
         @Override
@@ -9139,7 +9122,7 @@
         }
 
         void positionAtCursor() {
-            View contentView = mContainer.getContentView();
+            View contentView = mPopupWindow.getContentView();
             int width = contentView.getMeasuredWidth();
             int height = contentView.getMeasuredHeight();
             final int offset = TextView.this.getSelectionStart();
@@ -9173,7 +9156,7 @@
             coords[0] = Math.min(displayMetrics.widthPixels - width, coords[0]);
             coords[0] = Math.max(0, coords[0]);
 
-            mContainer.showAtLocation(TextView.this, Gravity.NO_GRAVITY, coords[0], coords[1]);
+            mPopupWindow.showAtLocation(TextView.this, Gravity.NO_GRAVITY, coords[0], coords[1]);
         }
     }
 
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index b0a002d..8b53bb8 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -563,7 +563,7 @@
     public MenuItem setActionView(int resId) {
         final Context context = mMenu.getContext();
         final LayoutInflater inflater = LayoutInflater.from(context);
-        setActionView(inflater.inflate(resId, new LinearLayout(context)));
+        setActionView(inflater.inflate(resId, new LinearLayout(context), false));
         return this;
     }
 
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 09262e0..468f28e 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -1323,11 +1323,18 @@
             if (mExpandedActionView instanceof CollapsibleActionView) {
                 ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
             }
+
             return true;
         }
 
         @Override
         public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
+            // Do this before detaching the actionview from the hierarchy, in case
+            // it needs to dismiss the soft keyboard, etc.
+            if (mExpandedActionView instanceof CollapsibleActionView) {
+                ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
+            }
+
             removeView(mExpandedActionView);
             removeView(mExpandedHomeLayout);
             if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
@@ -1349,16 +1356,12 @@
             if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
                 mCustomNavView.setVisibility(VISIBLE);
             }
-            View collapsedView = mExpandedActionView;
             mExpandedActionView = null;
             mExpandedHomeLayout.setIcon(null);
             mCurrentExpandedItem = null;
             requestLayout();
             item.setActionViewExpanded(false);
 
-            if (collapsedView instanceof CollapsibleActionView) {
-                ((CollapsibleActionView) collapsedView).onActionViewCollapsed();
-            }
             return true;
         }
 
diff --git a/core/res/res/layout/activity_chooser_view.xml b/core/res/res/layout/activity_chooser_view.xml
index 50b1878..5d82a97 100644
--- a/core/res/res/layout/activity_chooser_view.xml
+++ b/core/res/res/layout/activity_chooser_view.xml
@@ -20,12 +20,52 @@
     android:id="@+id/activity_chooser_view_content"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
+    android:layout_gravity="center"
+    android:gravity="center"
     style="?android:attr/actionButtonStyle">
 
-    <ImageButton android:id="@+id/default_activity_button"
-        style="@style/Widget.ActivityChooserViewButton" />
+    <FrameLayout
+        android:id="@+id/default_activity_button"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:focusable="true"
+        android:addStatesFromChildren="true"
+        android:background="?android:attr/selectableItemBackground">
 
-    <ImageButton android:id="@+id/expand_activities_button"
-        style="@style/Widget.ActivityChooserViewButton" />
+        <ImageView android:id="@+id/image"
+            android:layout_width="32dip"
+            android:layout_height="32dip"
+            android:layout_gravity="center"
+            android:layout_marginTop="4dip"
+            android:layout_marginBottom="4dip"
+            android:layout_marginLeft="8dip"
+            android:layout_marginRight="8dip"
+            android:scaleType="fitCenter"
+            android:adjustViewBounds="true" />
+
+    </FrameLayout>
+
+    <FrameLayout
+        android:id="@+id/expand_activities_button"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:focusable="true"
+        android:addStatesFromChildren="true"
+        android:background="?android:attr/selectableItemBackground">
+
+        <ImageView android:id="@+id/image"
+            android:layout_width="32dip"
+            android:layout_height="32dip"
+            android:layout_gravity="center"
+            android:layout_marginTop="4dip"
+            android:layout_marginBottom="4dip"
+            android:layout_marginLeft="8dip"
+            android:layout_marginRight="8dip"
+            android:scaleType="fitCenter"
+            android:adjustViewBounds="true" />
+
+    </FrameLayout>
 
 </LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 88ab983..f6bf76b 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -711,9 +711,6 @@
         <!-- Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty. -->
         <attr name="textEditSideNoPasteWindowLayout" format="reference" />
 
-        <!-- Layout of a the view that is used to create the text suggestions popup window in an
-             EditText. This window will be displayed below the text line. -->
-        <attr name="textEditSuggestionsWindowLayout" format="reference" />
         <!-- Layout of the TextView item that will populate the suggestion popup window. -->
         <attr name="textEditSuggestionItemLayout" format="reference" />
 
@@ -3079,9 +3076,6 @@
         <!-- Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty. -->
         <attr name="textEditSideNoPasteWindowLayout" />
 
-        <!-- Layout of a the view that is used to create the text suggestions popup window in an
-             EditText. This window will be displayed below the text line. -->
-        <attr name="textEditSuggestionsWindowLayout" />
         <!-- Layout of the TextView item that will populate the suggestion popup window. -->
         <attr name="textEditSuggestionItemLayout" />
 
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 0ed8076..b3e50ea 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -35,7 +35,7 @@
     <!-- Height of the system bar -->
     <dimen name="system_bar_height">48dip</dimen>
     <!-- Height of notification icons in the status bar -->
-    <dimen name="status_bar_icon_size">25dip</dimen>
+    <dimen name="status_bar_icon_size">24dip</dimen>
     <!-- Size of the giant number (unread count) in the notifications -->
     <dimen name="status_bar_content_number_size">48sp</dimen>
     <!-- Height of notification icons in the system bar -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index b2b7025..49c9447 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1715,7 +1715,6 @@
   <public type="attr" name="switchPreferenceStyle" />
 
   <public type="attr" name="textSuggestionsWindowStyle" />
-  <public type="attr" name="textEditSuggestionsWindowLayout" />
   <public type="attr" name="textEditSuggestionItemLayout" />
 
   <public type="attr" name="suggestionsEnabled" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 9b6c442..fc10c081 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -423,7 +423,6 @@
         <item name="android:textEditNoPasteWindowLayout">?android:attr/textEditNoPasteWindowLayout</item>
         <item name="android:textEditSidePasteWindowLayout">?android:attr/textEditSidePasteWindowLayout</item>
         <item name="android:textEditSideNoPasteWindowLayout">?android:attr/textEditSideNoPasteWindowLayout</item>
-        <item name="android:textEditSuggestionsWindowLayout">?android:attr/textEditSuggestionsWindowLayout</item>
         <item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item>
         <item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item>
     </style>
@@ -712,16 +711,6 @@
         <item name="android:quickContactWindowSize">modeLarge</item>
     </style>
 
-    <style name="Widget.ActivityChooserViewButton">
-        <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_height">wrap_content</item>
-        <item name="android:layout_gravity">center</item>
-        <item name="android:background">?android:attr/selectableItemBackground</item>
-        <item name="android:adjustViewBounds">true</item>
-        <item name="android:scaleType">fitCenter</item>
-        <item name="android:padding">@android:dimen/action_bar_icon_vertical_padding</item>
-    </style>
-
     <!-- Text Appearances -->
     <eat-comment />
 
@@ -1075,14 +1064,10 @@
     </style>
 
     <!-- Style for the popup window that contains text suggestions. -->
-    <style name="Widget.TextSuggestions">
-        <item name="android:popupAnimationStyle">@android:style/Animation.TextSuggestions</item>
-    </style>
-
-    <!-- Animation effects when showing/hiding the text suggestions popup window. -->
-    <style name="Animation.TextSuggestions">
-        <item name="windowEnterAnimation">@android:anim/fade_in</item>
-        <item name="windowExitAnimation">@android:anim/fade_out</item>
+    <style name="Widget.TextSuggestionsPopupWindow">
+        <item name="android:dropDownSelector">@android:drawable/list_selector_background</item>
+        <item name="android:popupBackground">@android:drawable/text_edit_suggestions_window</item>
+        <item name="android:dropDownWidth">wrap_content</item>
     </style>
 
     <style name="Widget.ActionBar">
@@ -1552,7 +1537,7 @@
     <style name="Widget.Holo.TextSelectHandle" parent="Widget.TextSelectHandle">
     </style>
 
-    <style name="Widget.Holo.TextSuggestions" parent="Widget.TextSuggestions">
+    <style name="Widget.Holo.TextSuggestionsPopupWindow" parent="Widget.TextSuggestionsPopupWindow">
     </style>
 
     <style name="Widget.Holo.AbsListView" parent="Widget.AbsListView">
@@ -1983,6 +1968,9 @@
     <style name="Widget.Holo.Light.TextSelectHandle" parent="Widget.TextSelectHandle">
     </style>
 
+   <style name="Widget.Holo.Light.TextSuggestionsPopupWindow" parent="Widget.TextSuggestionsPopupWindow">
+    </style>
+
     <style name="Widget.Holo.Light.AbsListView" parent="Widget.AbsListView">
     </style>
 
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 93ccfe3..8d66b93 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -189,8 +189,7 @@
         <item name="textEditNoPasteWindowLayout">@android:layout/text_edit_no_paste_window</item>
         <item name="textEditSidePasteWindowLayout">@android:layout/text_edit_side_paste_window</item>
         <item name="textEditSideNoPasteWindowLayout">@android:layout/text_edit_side_no_paste_window</item>
-        <item name="textSuggestionsWindowStyle">@android:style/Widget.TextSuggestions</item>
-        <item name="textEditSuggestionsWindowLayout">@android:layout/text_edit_suggestions_window</item>
+        <item name="textSuggestionsWindowStyle">@android:style/Widget.TextSuggestionsPopupWindow</item>
         <item name="textEditSuggestionItemLayout">@android:layout/text_edit_suggestion_item</item>
         <item name="textCursorDrawable">@null</item>
 
@@ -954,7 +953,7 @@
         <item name="textSelectHandleRight">@android:drawable/text_select_handle_right</item>
         <item name="textSelectHandle">@android:drawable/text_select_handle_middle</item>
         <item name="textSelectHandleWindowStyle">@android:style/Widget.Holo.TextSelectHandle</item>
-        <item name="textSuggestionsWindowStyle">@android:style/Widget.Holo.TextSuggestions</item>
+        <item name="textSuggestionsWindowStyle">@android:style/Widget.Holo.TextSuggestionsPopupWindow</item>
         <item name="textCursorDrawable">@android:drawable/text_cursor_holo_dark</item>
 
         <!-- Widget styles -->
@@ -1250,7 +1249,7 @@
         <item name="textSelectHandleRight">@android:drawable/text_select_handle_right</item>
         <item name="textSelectHandle">@android:drawable/text_select_handle_middle</item>
         <item name="textSelectHandleWindowStyle">@android:style/Widget.Holo.TextSelectHandle</item>
-        <item name="textSuggestionsWindowStyle">@android:style/Widget.Holo.TextSuggestions</item>
+        <item name="textSuggestionsWindowStyle">@android:style/Widget.Holo.Light.TextSuggestionsPopupWindow</item>
         <item name="textCursorDrawable">@android:drawable/text_cursor_holo_light</item>
 
         <!-- Widget styles -->
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 0b8d40f..05bd626 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -159,6 +159,7 @@
     <assign-permission name="android.permission.MODIFY_AUDIO_SETTINGS" uid="media" />
     <assign-permission name="android.permission.ACCESS_DRM" uid="media" />
     <assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="media" />
+    <assign-permission name="android.permission.WAKE_LOCK" uid="media" />
 
     <assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="graphics" />
 
diff --git a/docs/html/guide/appendix/market-filters.jd b/docs/html/guide/appendix/market-filters.jd
index ef1deba..dc79d95 100644
--- a/docs/html/guide/appendix/market-filters.jd
+++ b/docs/html/guide/appendix/market-filters.jd
@@ -13,10 +13,15 @@
 
 <h2>In this document</h2>
 
-<ol> <li><a href="#how-filters-work">How Filters Work in Android Market</a></li>
-<li><a href="#manifest-filters">Filtering based on Manifest File Elements</a></li>
-<li><a href="#other-filters">Other Filters</a></li> 
-<li><a href="#advanced-filters">Advanced Manifest Filters</a></li>
+<ol>
+  <li><a href="#how-filters-work">How Filters Work in Android Market</a></li>
+  <li><a href="#manifest-filters">Filtering based on Manifest Elements</a>
+    <ol>
+      <li><a href="#advanced-filters">Advanced manifest filters</a></li>
+    </ol>
+  </li>
+  <li><a href="#other-filters">Other Filters</a></li>
+  <li><a href="#MultiApks">Publishing Multiple APKs with Different Filters</a></li>
 </ol>
 
 <h2>See also</h2>
@@ -39,75 +44,72 @@
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</code></a></li>
 </ol>
 
-<div id="qv-extra"> <img id="rule" src="{@docRoot}assets/images/grad-rule-qv.png">
-<div id="qv-sub-rule"> <img src="{@docRoot}assets/images/icon_market.jpg"
-style="float:left;margin:0;padding:0;"> <p style="color:#669999;">Interested in
-publishing your app on Android Market?</p> <a id="publish-link"
-href="http://market.android.com/publish">Go to Android Market &raquo;</a> </div>
+<div id="qv-extra">
+  <img id="rule" src="{@docRoot}assets/images/grad-rule-qv.png">
+  <div id="qv-sub-rule">
+    <img src="{@docRoot}assets/images/icon_market.jpg" style="float:left;margin:0;padding:0 5px;">
+    <h2 style="color:#669999;">Interested in publishing your app on Android Market?</h2> 
+    <p><a id="publish-link"
+href="http://market.android.com/publish">Go to Android Market</a> to create a publisher
+account and upload your app.</p></div>
 </div>
 
 </div>
 </div>
 
 
-<p>When a user searches or browses in Android Market, the results are filtered based on which
-applications are compatible with the user's device. For example, if an application requires a
-trackball (as specified in the manifest file), then Android Market will not show
-the app on any device that does not have a trackball.</p>
+<p>When a user searches or browses in Android Market on an Android device, the results are filtered
+based on which applications are compatible with that device. For example, if an application
+requires a camera (as specified in the application manifest file), then Android Market will not show
+the app on any device that does not have a camera.</p>
 
-<p>The manifest file and the device's hardware and features are only part of how applications are
-filtered&mdash;filtering might also depend on the country and carrier, the presence or absence of a
-SIM card, and other factors. </p>
+<p>Declarations in the manifest file that are compared to the device's configuration is not the
+only part of how applications are filtered. Filtering might also occur due to the user's country and
+carrier, the presence or absence of a SIM card, and other factors. </p>
 
-<p>Changes to the Android Market filters are independent of changes 
-to the Android platform itself. This document will be updated periodically to reflect 
-any changes that affect the way Android Market filters applications.</p>
+<p>Changes to the Android Market filters are independent of changes to the Android platform itself.
+This document is updated periodically to reflect any changes that affect the way Android Market
+filters applications.</p>
 
 
 <h2 id="how-filters-work">How Filters Work in Android Market</h2>
 
 <p>Android Market uses the filter restrictions described below to determine
 whether to show your application to a user who is browsing or searching for
-applications on an Android-powered device. When determining whether to display your app,
-Market checks the device's hardware and software capabilities, as well as it's
+applications from the Android Market app. When determining whether to display your app,
+Market checks the device's hardware and software configuration, as well as it's
 carrier, location, and other characteristics. It then compares those against the
-restrictions and dependencies expressed by the application itself, in its
+restrictions and dependencies expressed by the application's
 manifest file and publishing details. If the application is
 compatible with the device according to the filter rules, Market displays the
 application to the user. Otherwise, Market hides your application from search
-results and category browsing. </p>
+results and category browsing, even if a user specifically requests 
+the app by clicking a deep link that points directly to the app's ID within Market..</p>
 
-<p>You can use the filters described below to control whether Market shows or
-hides your application to users. You can use any combination of the
-available filters for your app&mdash;for example, you can set a
-<code>minSdkVersion</code> requirement of <code>"4"</code> and set
-<code>smallScreens="false"</code> in the app, then when uploading the app to
-Market you could target European countries (carriers) only. Android Market's
-filters would prevent the application from being visible on any device that did
-not match all three of these requirements. </p>
+<p class="note"><strong>Note:</strong> When users browse the <a
+href="http://market.android.com">Android Market web site</a>, they can see all published
+applications. The Android Market web site compares the application requirements to each of the
+user's registered devices for compatibility, though, and only allows them to install the application
+if it's compatible with their device.</p>
 
- <p>A filtered app is not visible within Market, even if a user specifically requests 
-the app by clicking a deep link that points directly to the app's ID within Market. 
-All filtering restrictions are associated with an application's version and can
-change between versions. For example:</p> 
+<p>You can use any combination of the available filters for your app. For example, you can set a
+<code>minSdkVersion</code> requirement of <code>"4"</code> and set <code>smallScreens="false"</code>
+in the app, then when uploading the app to Market you could target European countries (carriers)
+only. Android Market's filters will thus prevent the application from being available on any device
+that does not match all three of these requirements. </p>
 
-<ul> 
-<li>If you publish a new version of your app with stricter restrictions, the app
-will not be visible to users for whom it is filtered, even if those users were
-able see the previous version.</li>
-<li>If a user has installed your application and you publish an upgrade that
-makes the app invisible to the user, the user will not see that an upgrade is
-available. </li>
-</ul>
-
+<p>All filtering restrictions are associated with an application's version and can
+change between versions. For example, if a user has installed your application and you publish an
+update that makes the app invisible to the user, the user will not see that an update is
+available.</p>
 
 
 <h2 id="manifest-filters">Filtering based on Manifest Elements</h2>
 
 <p>Most Market filters are triggered by elements within an application's
 manifest file, <a
-href="{@docRoot}guide/topics/manifest/manifest-intro.html">AndroidManifest.xml</a>,
-although not everything in the manifest file can trigger filtering.
+href="{@docRoot}guide/topics/manifest/manifest-intro.html">AndroidManifest.xml</a> 
+(although not everything in the manifest file can trigger filtering).
 Table 1 lists the manifest elements that you should use to trigger Android
 Market filtering, and explains how the filtering for each element works.</p>
 
@@ -143,29 +145,22 @@
 attributes, which vary by API Level. Specifically: </p>
 
 <ul>
-<li><p>In API level 3, the <code>&lt;supports-screens&gt;</code> element itself
+<li><p>For applications that set either the <code><a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">android:
+minSdkVersion</a></code> or <code><a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">android:
+targetSdkVersion</a></code> to 3 or lower, the <code>&lt;supports-screens&gt;</code> element itself
 is undefined and no attributes are available. In this case, Market assumes that
 the application is designed for normal-size screens and shows the application to
-devices that have normal or large screens. </p>
+devices that have normal or larger screens. </p>
 
-<p>This behavior is especially significant for applications that set their
-<code><a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">android:
-minSdkVersion</a></code> to 3 or lower, since Market will filter them from
-small-screen devices by default. Such applications can enable support for
-small-screen devices by adding a <code>android:targetSdkVersion="4"</code>
-attribute to the <code>&lt;uses-sdk&gt;</code> element in their manifest
-files. For more information, see <a
-href="{@docRoot}guide/practices/screens_support.html#strategies">Strategies for
-Legacy Applications</a>.</p></li>
-
-<li>In API Level 4, the defaults for all of the attributes is
-<code>"true"</code>. If an application does not declare a
-<code>&lt;supports-screens&gt;</code> element, Market assumes that the
-application is designed for all screen sizes and does not filter it from any
-devices. If the application does not declare one of the attributes, Market uses
-the default value of <code>"true"</code> and does not filter the app for devices
-of corresponding screen size.</li>
+<li>When the either the <code><a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">android:
+minSdkVersion</a></code> or <code><a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">android:
+targetSdkVersion</a></code> is set to 4 or higher, the default for all attributes is
+<code>"true"</code>. In this way, the application is considered to support all screen sizes by
+default.</li>
 </ul>
 
     <p><strong>Example 1</strong><br />
@@ -192,6 +187,7 @@
     Screens</a>.</p>
 </td>
   </tr>
+
   <tr>
     <td valign="top" style="white-space:nowrap;"><code><a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></code>
       <!-- ##api level 3## --></td>
@@ -207,6 +203,7 @@
 <p>For more details, see  <a
 href="{@docRoot}guide/topics/manifest/uses-configuration-element.html"><code>&lt;uses-configuration&gt;</code></a>.</p></td>
   </tr>
+
   <tr>
     <td rowspan="2" valign="top" style="white-space:nowrap;"><code><a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a>
@@ -237,6 +234,7 @@
 below.</p>
 </td>
   </tr>
+
   <tr>
     <td valign="top">OpenGL-ES
     Version<br />
@@ -263,6 +261,7 @@
 <p>For more details, see <a
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html"><code>&lt;uses-feature&gt;</code></a>.</p></td>
   </tr>
+
   <tr>
     <td valign="top" style="white-space:nowrap;"><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code></td>
     <td valign="top">Software Libraries</td>
@@ -299,6 +298,7 @@
 element.</p>
 </td>
   </tr>
+
   <tr>
     <td rowspan="2" valign="top" style="white-space:nowrap;"><code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></code></td>
     <td valign="top">Minimum Framework Version (<code>minSdkVersion</code>)</td>
@@ -324,11 +324,55 @@
 </table>
 
 
+
+<h3 id="advanced-filters">Advanced manifest filters</h3>
+
+<p>In addition to the manifest elements in <a href="#table1">table 1</a>, Android Market can also
+filter applications based on the advanced manifest elements in table 2.</p>
+
+<p>These manifest elements and the filtering they trigger are for exceptional use-cases
+only. These are designed for certain types of high-performance games and similar applications that
+require strict controls on application distribution. <strong>Most applications should never use
+these filters</strong>.</p>
+
+<p id="table2" class="table-caption"><strong>Table 2.</strong> Advanced manifest elements for
+Android Market filtering.</p>
+<table>
+  <tr><th>Manifest Element</th><th>Summary</th></tr>
+  <tr>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens&gt;}</a></nobr></td>
+    <td>
+      <p>Android Market filters the application if the device screen size and density does not match
+any of the screen configurations (declared by a {@code &lt;screen&gt;} element) in the {@code
+&lt;compatible-screens&gt;} element.</p>
+      <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use
+this manifest element</strong>. Using this element can dramatically
+reduce the potential user base for your application, by excluding all combinations of screen size
+and density that you have not listed. You should instead use the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> manifest element (described above in <a href="#table1">table
+1</a>) to enable screen compatibility mode for screen configurations you have not accounted for
+with alternative resources.</p>
+    </td>
+  </tr>
+  <tr>
+    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
+&lt;supports-gl-texture&gt;}</a></nobr></td>
+    <td>
+      <p>Android Market filters the application unless one or more of the GL texture compression
+formats supported by the application are also supported by the device. </p>
+    </td>
+  </tr>
+</table>
+
+
+
 <h2 id="other-filters">Other Filters</h2>
 
 <p>Android Market uses other application characteristics to determine whether to show or hide an application for a particular user on a given device, as described in the table below. </p>
 
-<p id="table2" class="table-caption"><strong>Table 2.</strong> Application and publishing
+<p id="table3" class="table-caption"><strong>Table 3.</strong> Application and publishing
 characteristics that affect filtering on Market.</p>
 <table> <tr>
     <th>Filter Name</th> <th>How It Works</th> </tr>
@@ -365,44 +409,46 @@
 
 
 
+<h2 id="MultiApks">Publishing Multiple APKs with Different Filters</h2>
 
-<h2 id="advanced-filters">Advanced Manifest Filters</h2>
+<p>Some specific Android Market filters allow you to publish multiple APKs for the same
+application in order to provide a different APK to different device configurations. For example, if
+you're creating a video game that uses high-fidelity graphic assets, you might want to create
+two APKs that each support different texture compression formats. This way, you can reduce the
+size of the APK file by including only the textures that are required for each device
+configuration. Depending on each device's support for your texture compression formats, Android
+Market will deliver it the APK that you've declared to support that device.</p>
 
-<p>In addition to the manifest elements in <a href="#table1">table 1</a>, Android Market can also
-filter applications based on the advanced manifest elements in table 3.</p>
+<p>Currently, Android Market allows you to publish multiple APKs for the same application only
+when each APK provides different filters based on the following configurations:</p>
+<ul>
+  <li>OpenGL texture compression formats
+    <p>By using the <a
+href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
+&lt;supports-gl-texture&gt;}</a> element.</p>
+  </li>
+  <li>Screen size (and, optionally, screen density)
+    <p>By using the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> or <a
+href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens&gt;}</a> element.</p>   
+  </li>
+  <li>API level
+    <p>By using the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code
+&lt;uses-sdk&gt;}</a> element.</p>
+  </li>
+</ul>
 
-<p>These manifest elements and the filtering they trigger are for exceptional use-cases
-only. They are designed for some types of high-performance games and similar applications that
-require strict controls on application distribution. <strong>Most applications should never use
-these filters</strong>.</p>
+<p>All other filters still work the same as usual, but these three are the only filters that can
+distinguish one APK from another within the same application listing on Android Market. For example,
+you <em>cannot</em> publish multiple APKs for the same application if the APKs differ only based on
+whether the device has a camera.</p>
 
-<p id="table3" class="table-caption"><strong>Table 3.</strong> Advanced manifest elements for
-Android Market filtering.</p>
-<table>
-  <tr><th>Manifest Element</th><th>Summary</th></tr>
-  <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
-&lt;compatible-screens&gt;}</a></nobr></td>
-    <td>
-      <p>Android Market filters the application if the device screen size and density does not match
-any of the screen configurations (declared by a {@code &lt;screen&gt;} element) in the {@code
-&lt;compatible-screens&gt;} element.</p>
-      <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use
-this manifest element</strong>. Using this element can dramatically
-reduce the potential user base for your application, by excluding all combinations of screen size
-and density that you have not listed. You should instead use the <a
-href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens&gt;}</a> manifest element (described above in <a href="#table1">table
-1</a>) to enable screen compatibility mode for screen configurations you have not accounted for
-with alternative resources.</p>
-    </td>
-  </tr>
-  <tr>
-    <td><nobr><a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
-&lt;supports-gl-texture&gt;}</a></nobr></td>
-    <td>
-      <p>Android Market filters the application unless one or more of the GL texture compression formats supported by the application are also supported by the device. </p>
-    </td>
-  </tr>
-</table>
+<p class="caution"><strong>Caution:</strong> Publishing multiple APKs for the same application is
+considered an advanced feature and <strong>most application should publish only one
+APK that supports a wide range of device configurations</strong>. Publishing multiple APKs
+requires that you follow specific rules within your filters and that you pay extra attention to the
+version codes for each APK to ensure proper update paths for each configuration.</p>
 
+<p>If you need more information about how to publish multiple APKs on Android Market, read <a
+href="{@docRoot}guide/market/publishing/multiple-apks.html">Multiple APK Support</a>.</p>
diff --git a/docs/html/guide/developing/debugging/index.jd b/docs/html/guide/developing/debugging/index.jd
index 1f1a4ca..0ad1a08 100644
--- a/docs/html/guide/developing/debugging/index.jd
+++ b/docs/html/guide/developing/debugging/index.jd
@@ -1,4 +1,4 @@
-page.title=Debugging 
+page.title=Debugging
 @jd:body
 
 
@@ -10,7 +10,7 @@
         <li><a href="#stack">Debugging Environment</a></li>
 
         <li><a href="#addltools">Additional Debugging Tools</a></li>
-        
+
         <li><a href="#tips">Debugging Tips</a></li>
       </ol>
     </div>
@@ -50,7 +50,7 @@
 
     <dd>The Dalvik VM (Virtual Machine) supports the JDWP protocol to allow debuggers to attach to
     a VM. Each application runs in a VM and exposes a unique port that you can attach a debugger to
-    via DDMS. If you want to debug multiple applications, attaching to each port might become 
+    via DDMS. If you want to debug multiple applications, attaching to each port might become
     tedious, so DDMS provides a port forwarding feature that can forward a specific VM's debugging
     port to port 8700. You can switch freely from application to application by highlighting it in the
     Devices tab of DDMS. DDMS forwards the appropriate port to port 8700. Most modern Java IDEs include a JDWP debugger,
@@ -109,11 +109,11 @@
     that provide useful information such as CPU usage and frame rate. You can also transfer the
     application to a hardware device.</dd>
   </dl>
-  
-  
-  <h2 id="tips">Debugging Tips</h2>  
-  
-<p>While debugging, keep these helpful tips in mind to help you figure out common problems with your 
+
+
+  <h2 id="tips">Debugging Tips</h2>
+
+<p>While debugging, keep these helpful tips in mind to help you figure out common problems with your
 applications:</p>
 
 <dl>
@@ -131,14 +131,14 @@
 </dd>
 
 <dt><strong>Get application and system state information from the emulator</strong></dt>
-<dd>You can access dumpstate information from the <code>adb shell</code> commands. See 
+<dd>You can access dumpstate information from the <code>adb shell</code> commands. See
 <a href="{@docRoot}guide/developing/tools/adb.html#dumpsys">dumpsys and
 dumpstate</a> on the adb topic page.</dd>
 
 
 
 <dt><strong>Get wireless connectivity information</strong></dt>
-<dd>You can get information about wireless connectivity using DDMS. 
+<dd>You can get information about wireless connectivity using DDMS.
 From the <strong>Device</strong> menu, select <strong>Dump
 radio state</strong>.</dd>
 
@@ -165,6 +165,16 @@
 <dt><strong>Use debugging helper classes</strong></dt>
 <dd>Android provides debug helper classes such as {@link android.util.Log
     util.Log} and {@link android.os.Debug} for your convenience. </dd>
+
+<dt><strong>Garbage collection</strong></dt>
+<dd>
+The debugger and garbage collector are currently loosely integrated. The VM guarantees that any
+object the debugger is aware of is not garbage collected until after the debugger disconnects.
+This can result in a buildup of objects over time while the debugger is connected. For example,
+if the debugger sees a running thread, the associated {@link java.lang.Thread} object is not
+garbage collected even after the thread terminates.
+</dd>
+
 </dl>
 
 <p>See the <a href="{@docRoot}resources/faq/troubleshooting.html">Troubleshooting</a> document
@@ -176,10 +186,3 @@
 
 
 
-
-
-
-
-
-
-
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index cb5a0b6..bde170e 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -142,6 +142,9 @@
     <td>Huawei</td>
     <td><code>12d1</code></td></tr>
   <tr>
+    <td>K-Touch</td>
+    <td><code>24e3</code></td></tr>
+  <tr>
     <td>Kyocera</td>
     <td><code>0482</code></td></tr>
   <tr>
diff --git a/docs/html/guide/developing/index.jd b/docs/html/guide/developing/index.jd
index 3d7e353..722c75a 100644
--- a/docs/html/guide/developing/index.jd
+++ b/docs/html/guide/developing/index.jd
@@ -98,20 +98,22 @@
 
     <dt>Jarsigner (or similar signing tool)</dt>
 
-    <dd>To sign your .apk file with a private key generated by keytool. Jarsigner is part of the
+    <dd>To sign your .apk file with a private key generated by Keytool. Jarsigner is part of the
     JDK.</dd>
   </dl>
   
-  <p>If you are using Eclipse and ADT, tools such as <code>adb</code> and the <code>android</code>
-  are called by Eclipse and ADT under the hood or similar functionality is provided within Eclipse.
-  You need to be familiar with <code>adb</code>, however, because certain functions are not accessible from
-  Eclipse, such as the <code>adb</code> shell commands. You might also need to call Keytool and Jarsigner to
+  <p>If you are using Eclipse and ADT, tools such as <code>adb</code> and <code>android</code>
+  are automatically called by Eclipse and ADT so you don't have to manually invoke these tools.
+  You need to be familiar with <code>adb</code>, however, because certain functions are not
+accessible from
+  Eclipse, such as the <code>adb</code> shell commands. You might also need to call Keytool and
+Jarsigner to
   sign your applications, but you can set up Eclipse to do this automatically as well.</p>
   
 <p>For more information on the tools provided with the Android SDK, see the
   <a href="{@docRoot}guide/developing/tools/index.html">Tools</a> section of the documentation.</p>
   
-<h2 id="ThirdParty">Third-Party Development Tools</h2>
+<h2 id="ThirdParty">Other Third-Party Development Tools</h2>
 <p>
 	The tools described in this section are not developed by the Android SDK team. The Android Dev Guide
 	    does not provide documentation for these tools. Please refer to the linked documents in each
diff --git a/docs/html/guide/developing/tools/etc1tool.jd b/docs/html/guide/developing/tools/etc1tool.jd
new file mode 100644
index 0000000..a7f76f5
--- /dev/null
+++ b/docs/html/guide/developing/tools/etc1tool.jd
@@ -0,0 +1,68 @@
+page.title=etc1tool
+parent.title=Tools
+parent.link=index.html
+@jd:body
+
+
+ <p><code>etc1tool</code> is a command line utility that lets you encode PNG
+ images to the ETC1 compression standard and decode ETC1 compressed images back to PNG.</p>
+
+  <p>The usage for <code>etc1tool</code> is:</p>
+<pre>etc1tool infile [--help | --encode | --encodeNoHeader | --decode] [--showDifference
+diff-file] [-o outfile]</pre>
+
+  <table>
+    <tr>
+      <th>Option</th>
+
+      <th>Description</th>
+    </tr>
+
+    <tr>
+      <td><code>infile</code></td>
+
+      <td>The input file to compress</td>
+    </tr>
+
+    <tr>
+      <td><code>--help</code></td>
+
+      <td>Print usage information</td>
+    </tr>
+
+    <tr>
+      <td><code>--encode</code></td>
+
+      <td>Create an ETC1 file from a PNG file.
+      This is the default mode for the tool if nothing is specified.</td>
+    </tr>
+
+    <tr>
+      <td><code>--encodeNoHeader</code></td>
+
+      <td>Create a raw ETC1 data file (without a header) from a PNG file.</td>
+    </tr>
+
+    <tr>
+      <td><code>--decode</code></td>
+
+      <td>Create a PNG file from an ETC1 file</td>
+    </tr>
+
+    <tr>
+      <td><code>--showDifference <em>diff-file</em></code></td>
+
+      <td>Write the difference between the original and encoded image to
+      <code><em>diff-file</em></code> (only valid when encoding).</td>
+    </tr>
+
+    <tr>
+      <td><code>-o <em>outfile</em></code></td>
+
+      <td>Specify the name of the output file.
+      If <code><em>outfile</em></code> is not specified, the output file is constructed
+      from the input filename with the appropriate suffix (<code>.pkm</code> or <code>.png</code>).
+      </td>
+    </tr>
+
+  </table>
\ No newline at end of file
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index f7dbe30..a647cd3 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -148,7 +148,7 @@
               </a></li>
         </ul>
       </li><!-- end of User Interface -->
-      
+
       <li class="toggle-list">
         <div><a href="<?cs var:toroot ?>guide/topics/resources/index.html">
                <span class="en">Application Resources</span>
@@ -221,7 +221,7 @@
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></li>
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></li>
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/service-element.html">&lt;service&gt;</a></li>
-          <li><a href="<?cs var:toroot ?>guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture&gt;</a></li> 
+          <li><a href="<?cs var:toroot ?>guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture&gt;</a></li>
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a>
               <span class="new">updated</span></li>  <!-- ##api level 4## -->
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></li>
@@ -231,8 +231,8 @@
           <li><a href="<?cs var:toroot ?>guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></li>
         </ul>
       </li><!-- end of the manifest file -->
-    </ul>  
-      
+    </ul>
+
     <ul>
       <li class="toggle-list">
         <div><a href="<?cs var:toroot ?>guide/topics/graphics/index.html">
@@ -265,7 +265,7 @@
 	          <li><a href="<?cs var:toroot ?>guide/topics/renderscript/compute.html">
 	                <span class="en">Compute</span>
 	              </a>
-	          </li>         
+	          </li>
 	        </ul>
   	  </li>
 
@@ -383,9 +383,6 @@
             <span class="en">In-app Billing</span></a>
         </div>
         <ul>
-          <li><a href="<?cs var:toroot?>guide/market/billing/billing_about.html">
-              <span class="en">About this Release</span></a>
-          </li>
           <li><a href="<?cs var:toroot?>guide/market/billing/billing_overview.html">
               <span class="en">In-app Billing Overview</span></a>
           </li>
@@ -409,6 +406,10 @@
       <li><a href="<?cs var:toroot ?>guide/appendix/market-filters.html">
           <span class="en">Market Filters</span></a>
       </li>
+      <li><a href="<?cs var:toroot ?>guide/market/publishing/multiple-apks.html">
+          <span class="en">Multiple APK Support</span></a>
+          <span class="new">new!</span>
+      </li>
     </ul>
   </li>
 
@@ -571,8 +572,10 @@
           <li><a href="<?cs var:toroot ?>guide/developing/tools/android.html">android</a></li>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/bmgr.html">bmgr</a>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/dmtracedump.html">dmtracedump</a></li>
-          <li><a href="<?cs var:toroot ?>guide/developing/tools/draw9patch.html" >Draw 9-Patch</a></li>
+          <li><a href="<?cs var:toroot?>guide/developing/tools/draw9patch.html">Draw
+          9-Patch</a></li>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/emulator.html">Emulator</a></li>
+          <li><a href="<?cs var:toroot ?>guide/developing/tools/etc1tool.html">etc1tool</a></li>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a></li>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/hprof-conv.html">hprof-conv</a></li>
           <li><a href="<?cs var:toroot ?>guide/developing/tools/layoutopt.html">layoutopt</a></li>
@@ -668,11 +671,14 @@
       <li class="toggle-list">
         <div><a href="<?cs var:toroot ?>guide/practices/screens_support.html">
           <span class="en">Supporting Multiple Screens</span>
-        </a></div>
+        </a> <span class="new">updated</span></div>
         <ul>
           <li><a href="<?cs var:toroot ?>guide/practices/screens-distribution.html">
             <span class="en">Distributing to Specific Screens</span>
           </a></li>
+          <li><a href="<?cs var:toroot ?>guide/practices/screen-compat-mode.html">
+            <span class="en">Screen Compatibility Mode</span>
+          </a> <span class="new">new!</span></li>
           <li><a href="<?cs var:toroot ?>guide/practices/screens-support-1.5.html">
             <span class="en">Strategies for Android 1.5</span>
           </a></li>
@@ -727,9 +733,16 @@
       <li><a href="<?cs var:toroot ?>guide/practices/design/accessibility.html">
             <span class="en">Designing for Accessibility</span>
           </a></li>
-      <li><a href="<?cs var:toroot ?>guide/practices/design/performance.html">
+      <li class="toggle-list">
+        <div><a href="<?cs var:toroot ?>guide/practices/design/performance.html">
             <span class="en">Designing for Performance</span>
-          </a></li>
+          </a> <span class="new-child">new!</span></div>
+        <ul>
+          <li><a href="<?cs var:toroot ?>guide/practices/design/jni.html">
+                <span class="en">JNI Tips</span>
+              </a> <span class="new">new!</span></li>
+        </ul>
+      </li>
       <li><a href="<?cs var:toroot ?>guide/practices/design/responsiveness.html">
             <span class="en">Designing for Responsiveness</span>
           </a></li>
diff --git a/docs/html/guide/market/billing/billing_about.html b/docs/html/guide/market/billing/billing_about.html
new file mode 100644
index 0000000..d8395df
--- /dev/null
+++ b/docs/html/guide/market/billing/billing_about.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<meta http-equiv="refresh"
+content="0;url=http://developer.android.com/guide/market/billing/index.html">
+<title>Redirecting...</title>
+</head>
+<body>
+<p>You should be redirected. Please <a
+href="http://developer.android.com/guide/market/billing/index.html">click
+here</a>.</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/docs/html/guide/market/billing/billing_about.jd b/docs/html/guide/market/billing/billing_about.jd
deleted file mode 100755
index 5924170..0000000
--- a/docs/html/guide/market/billing/billing_about.jd
+++ /dev/null
@@ -1,30 +0,0 @@
-page.title=About this Release
-parent.title=In-app Billing
-parent.link=index.html
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-  <h2>In this document</h2>
-  <ol>
-    <li><a href="#billing-about">About this Release</a></li>
-  </ol>
-  <h2>Downloads</h2>
-  <ol>
-    <li><a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">Sample Application</a></li>
-  </ol>
-  <h2>See also</h2>
-  <ol>
-    <li><a href="{@docRoot}guide/market/billing/billing_overview.html">Overview of In-app Billing</a></li>
-    <li><a href="{@docRoot}guide/market/billing/billing_integrate.html">Implementing In-app Billing</a></li>
-    <li><a href="{@docRoot}guide/market/billing/billing_best_practices.html">Security and Design</a></li>
-    <li><a href="{@docRoot}guide/market/billing/billing_testing.html">Testing In-app Billing</a></li>
-    <li><a href="{@docRoot}guide/market/billing/billing_admin.html">Administering In-app Billing</a></li>
-    <li><a href="{@docRoot}guide/market/billing/billing_reference.html">In-app Billing Reference</a></li>
-  </ol>
-</div>
-</div>
-
-<p>Android Market In-app Billing has reached the final launch milestone and is now available to developers and users. You can now publish applications that use Android Market's in-app billing service, and users can make in-app purchases. To find out how to implement in-app billing in your applications, see the  <a href="{@docRoot}guide/market/billing/index.html">documentation</a> and the <a href="{@docRoot}guide/market/billing/billing_integrate.html#billing-download">sample application</a>.</p>
-
-
diff --git a/docs/html/guide/market/billing/billing_admin.jd b/docs/html/guide/market/billing/billing_admin.jd
index 939bbaa..cbb4b29 100755
--- a/docs/html/guide/market/billing/billing_admin.jd
+++ b/docs/html/guide/market/billing/billing_admin.jd
@@ -202,6 +202,11 @@
 href="http://www.google.com/support/androidmarket/bin/answer.py?answer=1153485">In-app Billing
 Pricing</a>.</p>
 
+<p class="caution"><strong>Important:</strong> You cannot use the Google Checkout API to issue
+refunds or cancel in-app billing transactions. You must do this manually through your Google
+Checkout merchant account. However, you can use the Google Checkout API to retrieve order
+information.</p>
+
 <h2 id="billing-testing-setup">Setting Up Test Accounts</h2>
 
 <p>The Android Market publisher site lets you set up one or more test accounts. A test account is a
diff --git a/docs/html/guide/market/billing/billing_integrate.jd b/docs/html/guide/market/billing/billing_integrate.jd
index 1a1f02a..3eebd59 100755
--- a/docs/html/guide/market/billing/billing_integrate.jd
+++ b/docs/html/guide/market/billing/billing_integrate.jd
@@ -783,11 +783,17 @@
 <code>RESPONSE_CODE</code> broadcast intent. This broadcast intent provides status and error
 information about the request.</p>
 
-<p class="note"><strong>Note:</strong> As a best practice, you should not send a
-<code>CONFIRM_NOTIFICATIONS</code> request for a purchased item until you have delivered the item to
-the user. This way, if your application crashes or something else prevents your application from
-delivering the product, your application will still receive an <code>IN_APP_NOTIFY</code> broadcast
-intent from Android Market indicating that you need to deliver the product.</p>
+<p>You must send a confirmation when you receive transaction information from Android Market. If you
+don't send a confirmation message, Android Market will continue sending
+<code>IN_APP_NOTIFY</code> messages for the transactions you have not confirmed. Also,
+your application must be able to handle <code>IN_APP_NOTIFY</code> messages that contain multiple
+orders.</p>
+
+<p>In addition, as a best practice, you should not send a <code>CONFIRM_NOTIFICATIONS</code> request
+for a purchased item until you have delivered the item to the user. This way, if your application
+crashes or something else prevents your application from delivering the product, your application
+will still receive an <code>IN_APP_NOTIFY</code> broadcast intent from Android Market indicating
+that you need to deliver the product.</p>
 
 <h4>Restoring transaction information (RESTORE_TRANSACTIONS)</h4>
 
@@ -828,6 +834,10 @@
 signed JSON string (unencrypted). The message includes the signature so you can verify the integrity
 of the signed string.</p>
 
+<p class="note"><strong>Note:</strong> You should use the <code>RESTORE_TRANSACTIONS</code>
+request type only when your application is installed for the first time on a device or when your
+application has been removed from a device and reinstalled.</p>
+
 <h3>Other service tasks</h3>
 
 <p>You may also want your {@link android.app.Service} to receive intent messages from your {@link
@@ -1061,7 +1071,12 @@
 Design</a>.</p>
 
 <p class="note"><strong>Note</strong>: If you store any purchase information on a device, be sure to
-encrypt the data and use a device-specific encryption key.</p>
+encrypt the data and use a device-specific encryption key. Also, if the purchase type for any of
+your items is "unmanaged," we recommend that you back up the purchase information for these items to
+a remote server or use Android's <a href="{@docRoot}guide/topics/data/backup.html">data
+backup</a> framework to back up the purchase information. Backing up purchase information for
+unmanaged items is important because unmanaged items cannot be restored by using the
+<code>RESTORE_TRANSACTIONS</code> request type.</p>
 
 <h3>Creating a user interface for selecting items</h3>
 
diff --git a/docs/html/guide/market/billing/billing_overview.jd b/docs/html/guide/market/billing/billing_overview.jd
index a42b772..8f9fd4c 100755
--- a/docs/html/guide/market/billing/billing_overview.jd
+++ b/docs/html/guide/market/billing/billing_overview.jd
@@ -257,7 +257,10 @@
   <code>RESPONSE_CODE</code>, <code>PURCHASE_INTENT</code>, and <code>REQUEST_ID</code>. The
   <code>PURCHASE_INTENT</code> key provides a {@link android.app.PendingIntent}, which your
   application uses to start the checkout UI for the given product ID.</li>
-  <li>Your application launches the pending intent, which launches the checkout UI.</li>
+  <li>Your application launches the pending intent, which launches the checkout UI.
+    <p class="note"><strong>Note:</strong> You must launch the pending intent from an activity
+    context and not an application context.</p>
+  </li>
   <li>When the checkout flow finishes (that is, the user successfully purchases the item or cancels
   the purchase), Android Market sends your application a notification message (an
   <code>IN_APP_NOTIFY</code> broadcast intent). The notification message includes a notification ID,
@@ -276,14 +279,21 @@
   <code>RESPONSE_CODE</code> key and a <code>REQUEST_ID</code> key.</li>
 </ol>
 
-<p class="note"><strong>Note:</strong> You must launch the pending intent from an activity context
-and not an application context.</p>
-
 <img src="{@docRoot}images/billing_request_purchase.png" height="231" id="figure2" />
 <p class="img-caption">
   <strong>Figure 2.</strong> Message sequence for a purchase request.
 </p>
 
+<p>Keep in mind, you must send a confirmation when you receive transaction information from Android
+Market (step 8 in figure 2). If you don't send a confirmation message, Android Market will
+continue sending <code>IN_APP_NOTIFY</code> messages for the transactions you have not
+confirmed. As a best practice, you should not send a <code>CONFIRM_NOTIFICATIONS</code> request for
+a purchased item until you have delivered the item to the user. This way, if your application
+crashes or something else prevents your application from delivering the product, your application
+will still receive an <code>IN_APP_NOTIFY</code> broadcast intent from Android Market indicating
+that you need to deliver the product. Also, as a best practice, your application must be able to
+handle <code>IN_APP_NOTIFY</code> messages that contain multiple orders.</p>
+
 <p>The messaging sequence for a restore transaction request is shown in figure 3. Request types for
 each <code>sendBillingRequest()</code> method are shown in <strong>bold</strong>, broadcast intents
 are shown in <em>italic</em>. For clarity, figure 3 does not show the <code>RESPONSE_CODE</code>
@@ -308,6 +318,10 @@
 information that is sent during a purchase request, although you do not need to respond to this
 intent with a <code>CONFIRM_NOTIFICATIONS</code> message.</p>
 
+<p class="note"><strong>Note:</strong> You should use the <code>RESTORE_TRANSACTIONS</code> request
+type only when your application is installed for the first time on a device or when your
+application has been removed from a device and reinstalled.</p>
+
 <p>The messaging sequence for checking whether in-app billing is supported is shown in figure 4. The
 request type for the <code>sendBillingRequest()</code> method is shown in <strong>bold</strong>.</p>
 
@@ -335,21 +349,32 @@
 <code>GET_PURCHASE_INFORMATION</code> request. Android Market responds with a
 <code>PURCHASE_STATE_CHANGED</code> broadcast intent, which contains the details of the purchase
 state change. Your application then sends a <code>CONFIRM_NOTIFICATIONS</code> message, informing
-Android Market that you've received the purchase state change information.</p>
+Android Market that you have received the purchase state change information.</p>
 
-<p>When Android Market receives a <code>CONFIRM_NOTIFICATIONS</code> message for a given message, it
-usually stops sending <code>IN_APP_NOTIFY</code> intents for that message. However, there are some
-cases where Android Market may send repeated <code>IN_APP_NOTIFY</code> intents for a message even
-though your application has sent a <code>CONFIRM_NOTIFICATIONS</code> message. This can occur if a
-device loses network connectivity while you are sending the <code>CONFIRM_NOTIFICATIONS</code>
-message. In this case, Android Market might not receive your <code>CONFIRM_NOTIFICATIONS</code>
-message and it could send multiple <code>IN_APP_NOTIFY</code> messages until it receives
-acknowledgement that you received the message. Therefore, your application must be able to recognize
-that the subsequent <code>IN_APP_NOTIFY</code> messages are for a previously processed transaction.
-You can do this by checking the <code>orderID</code> that's contained in the JSON string because
-every transaction has a unique <code>orderId</code>.</p>
+<p>In some special cases, you may receive multiple <code>IN_APP_NOTIFY</code> messages even though
+you have confirmed receipt of the purchase information, or you may receive
+<code>IN_APP_NOTIFY</code> messages for a purchase change even though you never initiated the
+purchase. Your application must handle both of these special cases.</p>
 
-<p>There are two cases where your application may also receive <code>IN_APP_NOTIFY</code> broadcast
+<h4>Handling multiple IN_APP_NOTIFY messages</h4>
+
+<p>When Android Market receives a <code>CONFIRM_NOTIFICATIONS</code> message for a given
+<code>PURCHASE_STATE_CHANGED</code> message, it usually stops sending <code>IN_APP_NOTIFY</code>
+intents for that <code>PURCHASE_STATE_CHANGED</code> message. Sometimes, however, Android
+Market may send repeated <code>IN_APP_NOTIFY</code> intents for a
+<code>PURCHASE_STATE_CHANGED</code> message even though your application has sent a
+<code>CONFIRM_NOTIFICATIONS</code> message. This can occur if a device loses network connectivity
+while you are sending the <code>CONFIRM_NOTIFICATIONS</code> message. In this case, Android Market
+might not receive your <code>CONFIRM_NOTIFICATIONS</code> message and it could send multiple
+<code>IN_APP_NOTIFY</code> messages until it receives acknowledgement that you received the
+transaction message. Therefore, your application must be able to recognize that the subsequent
+<code>IN_APP_NOTIFY</code> messages are for a previously processed transaction. You can do this by
+checking the <code>orderID</code> that's contained in the JSON string because every transaction has
+a unique <code>orderId</code>.</p>
+
+<h4>Handling refunds and other unsolicited IN_APP_NOTIFY messages</h4>
+
+<p>There are two cases where your application may receive <code>IN_APP_NOTIFY</code> broadcast
 intents even though your application has not sent a <code>REQUEST_PURCHASE</code> message. Figure 5
 shows the messaging sequence for both of these cases. Request types for each
 <code>sendBillingRequest()</code> method are shown in <strong>bold</strong>, broadcast intents are
@@ -359,11 +384,11 @@
 <div class="figure" style="width:481px">
 <img src="{@docRoot}images/billing_refund.png" alt="" height="189" />
 <p class="img-caption">
-  <strong>Figure 5.</strong> Message sequence for refunds and other unsolicited IN_APP_NOTIFY messages.
-</p>
+  <strong>Figure 5.</strong> Message sequence for refunds and other unsolicited
+IN_APP_NOTIFY messages.</p>
 </div>
 
-<p>In the first case, your application can receive an <code>IN_APP_NOTIFY</code> broadcast intent
+<p>In the first case, your application may receive an <code>IN_APP_NOTIFY</code> broadcast intent
 when a user has your application installed on two (or more) devices and the user makes an in-app
 purchase from one of the devices. In this case, Android Market sends an <code>IN_APP_NOTIFY</code>
 message to the second device, informing the application that there is a purchase state change. Your
@@ -384,6 +409,11 @@
 <code>PURCHASE_STATE_CHANGED</code> broadcast intent. Also, the <code>purchaseState</code> field in
 the JSON string is set to 2.</p>
 
+<p class="caution"><strong>Important:</strong> You cannot use the Google Checkout API to
+issue refunds or cancel in-app billing transactions. You must do this manually through your
+Google Checkout merchant account. However, you can use the Google Checkout API to retrieve order
+information.</p>
+
 <h2 id="billing-security">Security Controls</h2>
 
 <p>To help ensure the integrity of the transaction information that is sent to your application,
diff --git a/docs/html/guide/market/billing/billing_testing.jd b/docs/html/guide/market/billing/billing_testing.jd
index 84d25b2..5453047 100755
--- a/docs/html/guide/market/billing/billing_testing.jd
+++ b/docs/html/guide/market/billing/billing_testing.jd
@@ -211,7 +211,8 @@
 users will experience in your application.</p>
 
 <p class="note"><strong>Note</strong>: You do not need to publish your application to do end-to-end
-testing. You only need to upload your draft application to perform end-to-end testing.</p>
+testing. You only need to upload your application as a draft application to perform end-to-end
+testing.</p>
 
 <p>To test your in-app billing implementation with actual in-app purchases, you will need to
 register at least one test account on the Android Market publisher site. You cannot use your
@@ -233,8 +234,11 @@
 <ol>
   <li><strong>Upload your application as a draft application to the publisher site.</strong>
     <p>You do not need to publish your application to perform end-to-end testing with real product
-    IDs. To learn how to upload an application to Android Market, see <a
-    href="http://market.android.com/support/bin/answer.py?answer=113469">Uploading
+    IDs; you only need to upload your application as a draft application. However, you must sign
+    your application with your release key before you upload it as a draft application. Also, the
+    version number of the uploaded application must match the version number of the application you
+    load to your device for testing. To learn how to upload an application to Android Market, see
+    <a href="http://market.android.com/support/bin/answer.py?answer=113469">Uploading
     applications</a>.</p>
   </li>
   <li><strong>Add items to the application's product list.</strong>
diff --git a/docs/html/guide/market/publishing/multiple-apks.jd b/docs/html/guide/market/publishing/multiple-apks.jd
new file mode 100644
index 0000000..ff70e85
--- /dev/null
+++ b/docs/html/guide/market/publishing/multiple-apks.jd
@@ -0,0 +1,643 @@
+page.title=Multiple APK Support
+
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+  <h2>Quickview</h2>
+  <ul>
+    <li>Simultaneously publish different APKs for different
+device configurations</li>
+    <li>Different APKs are distributed to different devices based on filters declared in the
+manifest file</li>
+    <li>You should publish multiple APKs only when it's not possible or reasonable to
+support all desired devices with a single APK</li>
+  </ul>
+
+  <h2>In this document</h2>
+<ol>
+  <li><a href="#Concepts">Publishing Concepts</a>
+    <ol>
+      <li><a href="#Active">Active APKs</a></li>
+      <li><a href="#SimpleAndAdvanced">Simple mode and advanced mode</a></li>
+    </ol>
+  </li>
+  <li><a href="#HowItWorks">How Multiple APKs Work</a>
+    <ol>
+      <li><a href="#SupportedFilters">Supported filters</a></li>
+      <li><a href="#Rules">Rules for multiple APKs</a></li>
+    </ol>
+  </li>
+  <li><a href="#CreatingApks">Creating Multiple APKs</a>
+    <ol>
+      <li><a href="#VersionCodes">Assigning version codes</a></li>
+    </ol>
+  </li>
+  <li><a href="#SingleAPK">Using a Single APK Instead</a>
+    <ol>
+      <li><a href="#TextureOptions">Supporting multiple GL textures</a></li>
+      <li><a href="#ScreenOptions">Supporting multiple screens</a></li>
+      <li><a href="#ApiLevelOptions">Supporting multiple API levels</a></li>
+    </ol>
+  </li>
+</ol>
+
+  <h2>See also</h2>
+<ol>
+  <li><a href="{@docRoot}guide/appendix/market-filters.html">Market Filters</a></li>
+  <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
+  <li><a href="{@docRoot}sdk/compatibility-library.html">Compatibility
+Package</a></li>
+  <li><a href="{@docRoot}guide/appendix/api-levels.html">Android API Levels</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>Multiple APK support is a feature in Android Market that allows you to publish different APKs
+for your application that are each targeted to different device configurations. Each APK is a
+complete and independent version of your application, but they share the same application listing on
+Android Market and must share the same package name and be signed with the same release key. This
+feature is useful for cases in which your application cannot reach all desired devices with a single
+APK.</p>
+
+<p>Android-powered devices may differ in several ways and it's important
+to the success of your application that you make it available to as many devices as possible.
+Android applications usually run on most compatible devices with a single APK, by supplying
+alternative resources for different configurations (for example, different layouts for different
+screen sizes) and the Android system selects the appropriate resources for the device at runtime. In
+a few cases, however, a single APK is unable to support all device configurations, because
+alternative resources make the APK file too big (greater than 50MB) or other technical challenges
+prevent a single APK from working on all devices.</p>
+
+<p>Although <strong>we encourage you to develop and publish a single APK</strong> that supports as
+many device configurations as possible, doing so is sometimes not possible. To help
+you publish your application for as many devices as possible, Android Market allows you to
+publish multiple APKs under the same application listing. Android Market then supplies each APK to
+the appropriate devices based on configuration support you've declared in the manifest file of each
+APK.</p>
+
+<p>By publishing your application with multiple APKs, you can:</p>
+
+<ul>
+  <li>Support different OpenGL texture compression formats with each APK.</li>
+  <li>Support different screen configurations with each APK.</li>
+  <li>Support different platform versions with each APK.</li>
+</ul>
+
+<p>Currently, these are the only device characteristics that Android Market supports for publishing
+multiple APKs as the same application.</p>
+
+<p class="note"><strong>Note:</strong> You should generally use multiple APKs to support
+different device configurations <strong>only when your APK is too large</strong> (greater than
+50MB). Using a single APK to support different configurations is always the best practice,
+because it makes the path for application updates simple and clear for users (and also makes
+your life simpler by avoiding development and publishing complexity). Read the section below about
+<a href="#SingleAPK">Using a Single APK Instead</a> to
+consider your options before publishing multiple APKs.</p>
+
+
+<h2 id="Concepts">Publishing Concepts</h2>
+
+<p>Before you start publishing multiple APKs on Android Market, you must understand a few
+concepts regarding how the Android Market publisher site works.</p>
+
+<h3 id="Active">Active APKs</h3>
+
+<div class="sidebox-wrapper">
+<div class="sidebox">
+  <h4>The difference between "Publish" and "Save"</h4>
+  <p>When editing your application, there are two buttons on the top-right side of the page. The
+first button is either <strong>Publish</strong> or <strong>Unpublish</strong> and the second
+button is always <strong>Save</strong> (but its behavior changes).</p>
+  <p>When your application is new or you have unpublished it from Market, the first
+button says <strong>Publish</strong>. Clicking it will publish any APKs listed as
+Active, making them available on Android Market. Also while your application is new
+or unpublished, clicking <strong>Save</strong> will save any changes you've made, such
+as information added to the Product details and APKs you've uploaded, but nothing is made visible on
+Android Market&mdash;this allows you to save your changes and sign out of the publisher site before
+deciding to publish.</p>
+ <p>Once you've published your application, the first button changes to
+<strong>Unpublish</strong>. Clicking it in this state unpublishes your application so that none
+of the APKs are available on Android Market. Also while published, the behavior of the
+<strong>Save</strong> button is different. In this state, clicking <strong>Save</strong> not
+only saves all your changes, but also publishes them to Android Market. For example, if you've
+already published your application and then make changes to your product details or activate new
+APKs, clicking <strong>Save</strong> makes all those changes live on Android Market.</p>
+</div>
+</div>
+
+
+<p>Before you can publish your application (whether publishing one or multiple APKs), you
+must "activate" your APK(s) from the <strong>APK files</strong> tab. When you activate an APK, it
+moves into the list of <em>Active</em> APKs. This list allows you to preview which APK(s)
+you're about to publish.</p>
+
+<p>If there are no errors, any "active" APK will be published to
+Android Market when you click the <strong>Publish</strong> button (if the application is
+unpublished) or when you click the <strong>Save</strong> button (if the application is
+already published).</p>
+
+
+<h3 id="SimpleAndAdvanced">Simple mode and advanced mode</h3>
+
+<p>The Android Market publisher site provides two modes for managing the APKs associated with
+your application: <em>simple mode</em> and <em>advanced mode</em>. You can switch between these by
+clicking the
+link at the top-right corner of the <strong>APK files</strong> tab.</p>
+
+<p>Simple mode is the traditional way to publish an application, using one APK at a time. In
+simple mode, only one APK can be activated at a time. If you upload a new APK to update
+the application, clicking "Activate" on the new APK deactivates the currently
+active APK (you must then click <strong>Save</strong> to publish the new APK).</p>
+
+<p>Advanced mode allows you to activate and publish multiple APKs that are each designed for a
+specific set of device configurations. However, there are several rules based on the manifest
+declarations in each APK that determine whether you're allowed to activate each APK along with
+others. When you activate an APK and it violates one of the rules, you will receive an error or
+warning message. If it's an error, you cannot publish until you resolve the problem; if it's a
+warning, you can publish the activated APKs, but there might be unintended consequences as to
+whether your application is available for different devices. These rules are discussed more
+below.</p>
+
+
+<h2 id="HowItWorks">How Multiple APKs Work</h2>
+
+<p>The concept for using multiple APKs on Android Market is that you have just one entry in
+Android Market for your application, but different devices might download a different APK. This
+means that:</p>
+
+<ul>
+  <li>You maintain only one set of product details (app description, icons, screenshots, etc.).
+This also means you <em>cannot</em> charge a different price for different APKs.</li>
+  <li>All users see only one version of your application on Android Market, so they are not
+confused by different versions you may have published that are "for tablets" or
+"for phones."</li>
+  <li>All user reviews are applied to the same application listing, even though users on different
+devices may have different APKs.</li>
+  <li>If you publish different APKs for different versions of Android (for different API levels),
+then when a user's device receives a system update that qualifies them for a different APK you've
+published, Android Market updates the user's application to the APK designed for the higher version
+of Android. Any system data associated with the application is retained (the same as with normal
+application updates when using a single APK).</li>
+</ul>
+
+<p>To publish multiple APKs for the same application, you must enable <strong>Advanced mode</strong>
+in your application's <strong>APK files</strong> tab (as discussed in the previous section). Once
+in advanced mode, you can upload, activate, then publish multiple APKs for the same application. The
+following sections describe more about how it works.</p>
+
+
+<h3 id="SupportedFilters">Supported filters</h3>
+
+<p>Which devices receive each APK is determined by <a
+href="{@docRoot}guide/appendix/market-filters.html">Android Market filters</a> that are specified by
+elements in the manifest file of each APK. However, Android Market allows you to publish multiple
+APKs only when each APK uses filters to support a variation of the following
+device characteristics:</p>
+
+<ul>
+  <li><strong>OpenGL texture compression formats</strong>
+    <p>This is based on your manifest file's <a
+href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code
+&lt;supports-gl-texture&gt;}</a> element(s).</p>
+    <p>For example, when developing a game that uses OpenGL ES, you can provide one APK for
+devices that support ATI texture compression and a separate APK for devices
+that support PowerVR compression (among many others).</p>
+  <br/>
+  </li>
+
+  <li><strong>Screen size (and, optionally, screen density)</strong>
+    <p>This is based on your manifest file's <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> <em>or</em> <a
+href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens&gt;}</a> element. You should never use both elements and you should use only
+<a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> when possible.</p>
+    <p>For example, you can provide one APK that supports small and normal size screens and another
+APK that supports large and xlarge screens.</p>
+
+    <p class="note"><strong>Note:</strong> The Android system provides strong support for
+applications to support all screen configurations with a single APK. You should avoid creating
+multiple APKs to support different screens unless absolutely necessary and instead follow the guide
+to <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
+Screens</a> so that your application is flexible and can adapt to all screen configurations
+with a single APK.</p>
+    <p class="caution"><strong>Caution:</strong> By default, all screen size attributes in the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element are "true" if you do not declare them otherwise. However,
+because the {@code android:xlargeScreens} attribute was added in Android 2.3 (API level
+9), Android Market will assume that it is "false" if your application does not set either <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> or <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to "9" or higher.</p>
+    <p class="caution"><strong>Caution:</strong> You should not combine both <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> and <a
+href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
+&lt;compatible-screens&gt;}</a> elements in your manifest file. Using both increases the chances
+that you'll introduce an error due to conflicts between them. For help deciding which to use, read
+<a href="{@docRoot}guide/practices/screens-distribution.html">Distributing to Specific Screens</a>.
+If you can't avoid using both, be aware that for any conflicts in agreement between a given size,
+"false" will win.</p>
+  <br/>
+  </li>
+
+  <li><strong>API level</strong>
+    <p>This is based on your manifest file's <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a> element.
+You
+can use both the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> and <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#max">{@code android:maxSdkVersion}</a>
+attributes to specify support for different API levels.</p>
+    <p>For example, you can publish your application with one APK that supports API levels 4 - 7
+(Android 1.6 - 2.1)&mdash;using only APIs available since API level 4 or lower&mdash;and another
+APK that supports API levels 8 and above (Android 2.2+)&mdash;using APIs available since API level 8
+or lower.</p>
+    <div class="note">
+      <p><strong>Note:</strong></p>
+      <ul>
+        <li>If you use this characteristic as the factor to distinguish multiple APKs, then the APK
+with a higher <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> value must have a higher <a
+href="{@docRoot}guide/topics/manifest/manifest-element.html#vcode">{@code android:versionCode}</a>
+value. This is also true if two APKs overlap their device support based on a different supported
+filter. This ensures that when a device receives a system update, Android Market can offer the user
+an update for your application (because updates are based on an increase in the app version code).
+This requirement is described further in the section below about <a href="#Rules">Rules for
+multiple APKs</a>.</li>
+        <li>You should avoid using <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#max">{@code
+android:maxSdkVersion}</a> in general, because as long as you've properly developed your
+application with public APIs, it is always compatible with future versions of Android. If you want
+to publish a different APK for higher API levels, you still do not need to specify the
+maximum version, because if the <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> is {@code "4"} in one APK and {@code "8"} in another, devices that
+support API level 8 or higher will always receive the second APK (because it's version code is
+higher, as per the previous note).</li>
+    </ul>
+  </div>
+  </li>
+</ul>
+
+<p>Other manifest elements that enable <a
+href="{@docRoot}guide/appendix/market-filters.html">Android Market filters</a>&mdash;but are not
+listed above&mdash;are still applied for each APK as usual. However, Android Market does not allow
+you to publish multiple APKs based on variations of them. Thus, you cannot publish
+multiple APKs if the above listed filters are the same for each APK (but the APKs differ based on
+other characteristics in the manifest file). For
+example, you cannot provide different APKs that differ purely on the <a
+href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">{@code
+&lt;uses-configuration&gt;}</a> characteristics.</p>
+
+
+
+<h3 id="Rules">Rules for multiple APKs</h3>
+
+<p>Before you enable advanced mode to publish multiple APKs for your application, you need to
+understand the following rules that define how publishing multiple APKs works:</p>
+
+<ul>
+  <li>All APKs you publish for the same application <strong>must have the same package
+name and be signed with the same certificate key</strong>.</li>
+
+  <li>Each APK <strong>must have a different version code</strong>, specified by the
+<a href="{@docRoot}guide/topics/manifest/manifest-element.html#vcode">{@code
+android:versionCode}</a> attribute.</li>
+
+  <li>Each APK <strong>must not exactly match the configuration support of another APK</strong>.
+    <p>That is, each APK must declare slightly different support for at least one of
+the <a href="#MarketFiltersSupported">supported Market filters</a> (listed above).</p>
+    <p>Usually, you will differentiate your APKs based on a specific characteristic (such as the
+supported texture compression formats), and thus, each APK will declare support for different
+devices. However, it's OK to publish multiple APKs that overlap their support slightly. When two
+APKs do overlap (they support some of the same device configurations), a device that falls within
+that overlap range will receive the APK with a higher version code (defined by <a
+href="{@docRoot}guide/topics/manifest/manifest-element.html#vcode">{@code
+android:versionCode}</a>).</p></li>
+
+  <li>You cannot activate a new APK that has a version code lower than that of the APK it's
+replacing. For example, say you have an active APK for screen sizes small - normal with version code
+0400, then try to replace it with an APK for the same screen sizes with version code 0300. This
+raises an error, because it means users of the previous APK will not be able to update the
+application.</li>
+
+  <li>An APK that requires a <strong>higher API level</strong> must have a <strong>higher
+version code</strong>.
+    <p>This is true only when either: the APKs differ based <em>only</em> on the
+supported API levels (no other <a href="#SupportedMarketFilters">supported market filters</a>
+distinguish the APKs from each other) <em>or</em> when the APKs do use another supported filter, but
+there is an overlap between the APKs within that filter.</p>
+    <p>This is important because a user's device receives an application update from
+Android Market only if the version code for the APK on Android Market is higher than the version
+code of the APK currently on the device. This ensures that if a device receives a system update that
+then qualifies it to install the APK for higher API levels, the device receives an application
+update because the version code increases.</p>
+<p class="note"><strong>Note:</strong> The size of the version code increase is irrelevant; it
+simply needs to be larger in the version that supports higher API levels.</p>
+    <p>Here are some examples:</p>
+    <ul>
+      <li>If an APK you've uploaded for API levels 4 and above (Android 1.6+) has a version code of
+{@code 0400}, then an APK for API levels 8 and above (Android 2.2+) must be {@code 0401} or
+greater. In this case, the API level is the only supported filter used, so the version codes
+<strong>must increase</strong> in correlation with the API level support for each APK, so that users
+get an update when they receive a system update.</li>
+      <li>If you have one APK that's for API level 4 (and above) <em>and</em> small -
+large screens, and another APK for API level 8 (and above) <em>and</em> large - xlarge screens, then
+the version codes <strong>must increase</strong>. In this case, the API level filter is used to
+distinguish each APK, but so is the screen size. Because the screen sizes overlap (both APKs
+support large screens), the version codes must still be in order. This ensures that a large screen
+device that receives a system update to API level 8 will receive an update for the second
+APK.</li>
+      <li>If you have one APK that's for API level 4 (and above) <em>and</em> small -
+normal screens, and another APK for API level 8 (and above) <em>and</em> large - xlarge
+screens, then the version codes <strong>do not need to increase</strong> in correlation with the API
+levels. Because there is no overlap within the screen size filter, there are no devices that
+could potentially move between these two APKs, so there's no need for the version codes to
+increase from the lower API level to the higher API level.</li>
+    </ul>
+  </li>
+
+</ul>
+
+<p>Failure to abide by the above rules results in an error on the Android Market publisher site
+when you activate your APKs&mdash;you will be unable to publish your application until you
+resolve the error.</p>
+
+<p>There are other conflicts that might occur when you activate your APKs, but which will result
+in warnings rather than errors. Warnings can be caused by the following:</p>
+
+<ul>
+  <li>When you modify an APK to "shrink" the support for a device's characteristics and no other
+APKs support the devices that then fall outside the supported range. For example, if an APK
+currently supports small and normal size screens and you change it to support only small screens,
+then you have shrunk the pool of supported devices and some devices will no longer see your
+application in Android Market. You can resolve this by adding another APK that supports normal size
+screens so that all previously-supported devices are still supported.</li>
+
+  <li>When there are "overlaps" between two or more APKs. For example, if an APK supports screen
+sizes small, normal, and large, while another APK supports sizes large and xlarge, there is an
+overlap, because both APKs support large screens. If you do not resolve this, then devices that
+qualify for both APKs (large screen devices in the example) will receive whichever APK has the
+highest version code.</li>
+</ul>
+
+<p>When such conflicts occur, you will see a warning message, but you can still publish your
+application.</p>
+
+
+
+<h2 id="CreatingApks">Creating Multiple APKs</h2>
+
+<p>Once you decide to publish multiple APKs, you probably need to create separate
+Android projects for each APK you intend to publish so that you can appropriately develop them
+separately. You can do this by simply duplicating your existing project and give it a new name.
+(Alternatively, you might use a build system that can output different resources&mdash;such
+as textures&mdash;based on the build configuration.)</p>
+
+<p class="note"><strong>Tip:</strong> One way to avoid duplicating large portions of your
+application code is to use a <a
+href="{@docRoot}guide/developing/projects/index.html#LibraryProjects">library project</a>. A library
+project holds shared code and resources, which you can include in your actual application
+projects.</p>
+
+<p>When creating multiple projects for the same application, it's a good practice to identify each
+one with a name that indicates the device restrictions to be placed on the APK, so you can
+easily identify them. For example, "HelloWorld_8" might be a good name for an
+application designed for API level 8 and above.</p>
+
+<p class="note"><strong>Note:</strong> All APKs you publish for the same application
+<strong>must have the same package name and be signed with the same certificate key</strong>. Be
+sure you also understand each of the <a href="#Rules">Rules for multiple APKs</a>.</p>
+
+
+<h3 id="VersionCodes">Assigning version codes</h3>
+
+<p>Each APK for the same application <strong>must have a unique version code</strong>, specified by
+the <a href="{@docRoot}guide/topics/manifest/manifest-element.html#vcode">{@code
+android:versionCode}</a> attribute. You must be careful about assigning version codes when
+publishing multiple APKs, because they must each be different, but in some
+cases, must or should be defined in a specific order, based on the configurations that each APK
+supports.</p>
+
+<h4>Ordering version codes</h4>
+
+<p>An APK that requires a higher API level must usually have a higher version code. For example, if
+you create two APKs to support different API levels, the APK for the higher API levels must have the
+higher version code. This ensures that if a device receives a system update that then qualifies it
+to install the APK for higher API levels, the user receives a notification to update the app. For
+more information about how this requirement applies, see the section above about <a
+href="#Rules">Rules for multiple APKs</a>.</p>
+
+<p>You should also consider how the order of version codes might affect which APK your users
+receive either due to overlap between coverage of different APKs or future changes you might make to
+your APKs.</p>
+
+<p>For example, if you have different APKs based on screen size, such as one for small - normal and
+one for large - xlarge, but foresee a time when you will change the APKs to be one for small and one
+for normal - xlarge, then you should make the version code for the large - xlarge APK be higher.
+That way, a normal size device will receive the appropriate update when you make the change, because
+the version code increases from the existing APK to the new APK that now supports the device. </p>
+
+<p>Also, when creating multiple APKs that differ based on support for different OpenGL texture
+compression formats, be aware that many devices support multiple formats. Because a device
+receives the APK with the highest version code when there is an overlap in coverage between two
+APKs, you should order the version codes among your APKs so that the APK with the
+preferred compression format has the highest version code. For example, you might want to perform
+separate builds for your app using PVRTC, ATITC, and ETC1 compression formats. If you prefer these
+formats in this exact order, then the APK that uses PVRTC should have the highest version code, the
+APK that uses ATITC has a lower version code, and the version with ETC1 has the lowest. Thus, if a
+device supports both PVRTC and ETC1, it receives the APK with PVRTC, because it has the highest
+version code.</p>
+
+
+<h4>Using a version code scheme</h4>
+
+<p>In order to allow different APKs to update their version codes independent of others (for
+example, when you fix a bug in only one APK, so don't need to update all APKs), you should use a
+scheme for your version codes that
+provides sufficient room between each APK so that you can increase the code in one without requiring
+an increase in others. You should also include your actual version name in the code (that is, the
+user visible version assigned to <a
+href="{@docRoot}guide/topics/manifest/manifest-element.html#vname">{@code android:versionName}</a>),
+so that it's easy for you to associate the version code and version name.</p>
+
+<p class="note"><strong>Note:</strong> When you increase the version code for an APK, Android
+Market will prompt users of the previous version to update the application. Thus, to avoid
+unnecessary updates, you should not increase the version code for APKs that do not actually
+include changes.</p>
+
+<p>We suggest using a version code with at least 7 digits: integers that represent
+the supported configurations are in the higher order bits, and the version name (from <a
+href="{@docRoot}guide/topics/manifest/manifest-element.html#vname">{@code
+android:versionName}</a>) is in the lower order bits. For example, when the application version
+name is 3.1.0, version codes for an API level 4
+APK and an API level 11 APK would be something like 0400310 and 1100310, respectively. The first
+two digits are reserved for the API Level (4 and 11, respectively), the middle two digits are for
+either screen sizes or GL texture formats (not used in these examples), and the last three digits
+are for the application's version name (3.1.0). Figure 1 shows two examples that split based on both
+the platform version (API Level) and screen size.</p>
+
+<img src="{@docRoot}images/market/version-codes.png" alt="" />
+<p class="img-caption"><strong>Figure 1.</strong> A suggested scheme for your version codes,
+using the first two digits for the API Level, the second and third digits for the minimum and
+maximum screen size (1 - 4 indicating each of the four sizes) or to denote the texture formats
+and the last three digits for the app version.</p>
+
+<p>This scheme for version codes is just a suggestion for how you should establish a
+pattern that is scalable as your application evolves. In particular, this scheme doesn't
+demonstrate a solution for identifying different texture compression formats. One option might be
+to define your own table that specifies a different integer to each of the different
+compression formats your application supports (for example, 1 might correspond to ETC1 and 2 is
+ATITC, and so on).</p>
+
+<p>You can use any scheme you want, but you should carefully consider how future versions of your
+application will need to increase their version codes and how devices can receive updates when
+either the device configuration changes (for example, due to a system update) or when you modify the
+configuration support for one or several of the APKs.</p>
+
+
+
+
+<h2 id="SingleAPK">Using a Single APK Instead</h2>
+
+<p><strong>Creating multiple APKs for your application is not the normal procedure</strong> for
+publishing an application on Android Market. In most cases, you should be able to publish your
+application to most users with a single APK and we encourage that you do so. When you encounter
+a situation in which using a single APK becomes difficult, you should carefully consider all your
+options before deciding to publish multiple APKs.</p>
+
+<p>First of all, there are a few key benefits to developing a single APK that supports all
+devices:</p>
+
+<ul>
+  <li><strong>Publishing and managing your application is easier.</strong>
+    <p>With only one APK to worry about at any given time, you're less likely to become confused by
+which APK is what. You also don't have to keep track of multiple version codes for each
+APK&mdash;by using only one APK, you can simply increase the version code with each release and
+be done.</p>  </li>
+  <li><strong>You need to manage only a single code base.</strong>
+    <p>Although you can use a <a
+href="{@docRoot}guide/developing/projects/index.html#LibraryProjects">library project</a>
+to share code between multiple Android projects, it's still likely that you'll reproduce some code
+across each project and this could become difficult to manage, especially when resolving
+bugs.</p></li>
+  <li><strong>Your application can adapt to device configuration changes.</strong>
+    <p>By creating a single APK that contains all the resources for each device configuration, your
+application can adapt to configuration changes that occur at runtime. For example, if the user docks
+or otherwise connects a handset device to a larger screen, there's a chance that this will invoke a
+system configuration change to support the larger screen. If you include all resources for different
+screen configurations in the same APK, then your application will load alternative resources and
+optimize the user experience for the new interface.</p>
+  </li>
+  <li><strong>App restore across devices just works.</strong>
+    <p>If a user has enabled data backup on his or her current device and then buys a new device
+that has a different configuration, then when the user's apps are automatically restored during
+setup, the user receives your application and it runs using the resources optimized for that device.
+For example, on a new tablet, the user receives your application and it runs with your
+tablet-optimized resources. This restore
+process does not work across different APKs, because each APK can potentially have different
+permissions that the user has not agreed to, so Android Market may not restore the application at
+all. (If you use multiple APKs, the user receives either the exact same APK if it's compatible or
+nothing at all and must manually download your application to get the APK designed for the new
+device.)</p></li>
+</ul>
+
+<p>The following sections describe some of the other options you should use to support multiple
+device configurations before deciding to publish multiple APKs.</p>
+
+
+
+<h3 id="TextureOptions">Supporting multiple GL textures</h3>
+
+<p>To support multiple types of GL textures with a single APK, your application should query the GL
+texture formats supported on the device and then use the appropriate resources or download
+them from a web server. For example, in order to keep the size of your APK small, you can query the
+device's support for different GL texture formats when the application starts for the first time and
+then download only the textures you need for that device.</p>
+
+<p>For maximum performance and compatibility, your application should use ETC1 textures wherever it
+doesn't impact the visual quality. However, because ETC1 cannot deal with images that have drastic
+chroma changes, such as line art and (most) text, and doesn't support alpha, it may not the best
+format for all textures.</p>
+
+<p>With a single APK, you should try to use ETC1 textures and uncompressed textures whenever
+reasonable, and consider the use of PVRTC, ATITC, or DXTC as a last resort when ETC1 does not
+suffice.</p>
+
+<p>Here's an example query for supported texture compression formats from inside a
+{@link android.opengl.GLSurfaceView.Renderer GLSurfaceView.Renderer}:</p>
+
+<pre>
+public void onSurfaceChanged(GL10 gl, int w, int h) {
+    String extensions = gl.glGetString(GL10.GL_EXTENSIONS);
+    Log.d("ExampleActivity", extensions);
+}
+</pre>
+
+<p>This returns a string that lists each of the supported compression formats.</p>
+
+
+
+<h3 id="ScreenOptions">Supporting multiple screens</h3>
+
+<p>Unless your APK file exceeds the Android Market size limit of 50MB, supporting multiple screens
+should always be done with a single APK. Since Android 1.6, the Android system manages most of the
+work required for your application to run successfully on a variety of screen sizes and
+densities.</p>
+
+<p>To further optimize your application for different screen sizes and densities, you should provide
+<a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
+resources</a> such as bitmap drawables at different resolutions and different layout designs for
+different screen sizes.</p>
+
+<p>For more information about how to support multiple screens with a single APK, read <a
+href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p>
+
+<p>Additionally, you should consider using a support library from the <a
+href="{@docRoot}sdk/compatibility-library.html">Compatibility Package</a> so that you can add <a
+href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> to your activity designs
+when running on larger screens such as tablets.</p>
+
+
+
+<h3 id="ApiLevelOptions">Supporting multiple API levels</h3>
+
+<p>If you want to support as many versions of the Android platform as possible, you should use
+only APIs available in the lowest reasonable version. For example, your application may not require
+APIs newer than Android 2.1 (API Level 7), which makes an application available to
+over 95% of Android-powered devices (as indicated by the <a
+href="{@docRoot}resources/dashboard/platform-versions.html">Platform Versions</a> dashboard).</p>
+
+<p>By using a support library from the <a
+href="{@docRoot}sdk/compatibility-library.html">Compatibility Package</a>, you can also use APIs
+from some of the latest versions (such as Android 3.0) while
+still supporting versions as low as Android 1.6. The support library includes APIs for <a
+href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a>, <a
+href="{@docRoot}guide/topics/fundamentals/loaders.html">Loaders</a>, and more. Using the fragment
+APIs is particularly valuable so that you can optimize your user interface for large devices such as
+tablets.</p>
+
+<p>Alternatively, if you want to use some APIs that are available only in newer versions of Android
+(which your application can still function without), then you should consider using reflection. By
+using reflection, you can check whether the current device supports certain APIs. If the APIs are
+not available, your application can gracefully disable and hide the feature.</p>
+
+<p>Another way to use new APIs only when running on a version that supports them is to check the
+API level of the current device. That is, you can query the value of {@link
+android.os.Build.VERSION#SDK_INT} and create different code paths depending on the API level
+supported by the device. For example:</p>
+
+<pre>
+if (android.os.Build.VERSION.SDK_INT >= 11) {
+    // Use APIs supported by API level 11 (Android 3.0) and up
+} else {
+    // Do something different to support older versions
+}
+</pre>
+
diff --git a/docs/html/guide/practices/design/jni.jd b/docs/html/guide/practices/design/jni.jd
index 39624f5..1d0e26e 100644
--- a/docs/html/guide/practices/design/jni.jd
+++ b/docs/html/guide/practices/design/jni.jd
@@ -6,7 +6,6 @@
 
 <h2>In this document</h2>
 <ol>
-  <li><a href="#what">What is JNI?</a></li>
   <li><a href="#JavaVM_and_JNIEnv">JavaVM and JNIEnv</a></li>
   <li><a href="#threads">Threads</a></li>
   <li><a href="#jclass_jmethodID_and_jfieldID">jclass, jmethodID, and jfieldID</a></li>
@@ -27,9 +26,6 @@
 </div>
 </div>
 
-<a name="what_is_jni" id="what_is_jni"></a>
-<h2>What is JNI?</h2>
-
 <p>JNI is the Java Native Interface.  It defines a way for code written in the
 Java programming language to interact with native
 code, e.g. functions written in C/C++.  It's VM-neutral, has support for loading code from
diff --git a/docs/html/guide/practices/screen-compat-mode.jd b/docs/html/guide/practices/screen-compat-mode.jd
new file mode 100644
index 0000000..a792386
--- /dev/null
+++ b/docs/html/guide/practices/screen-compat-mode.jd
@@ -0,0 +1,257 @@
+page.title=Screen Compatibility Mode
+parent.title=Supporting Multiple Screens
+parent.link=screens_support.html
+
+@jd:body
+
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+<ol>
+  <li><a href="#Disable">Disabling Screen Compatibility Mode</a></li>
+  <li><a href="#Enable">Enabling Screen Compatibility Mode</a></li>
+</ol>
+<h2>See also</h2>
+<ol>
+  <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li>
+  <li><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a></li>
+</ol>
+</div>
+</div>
+
+<div class="figure" style="width:500px;">
+<a href="{@docRoot}images/screens_support/compat-zoom.png">
+<img src="{@docRoot}images/screens_support/compat-zoom-thumb.png" alt="" />
+</a>
+<p class="img-caption"><strong>Figure 1.</strong> An application running in compatibility mode
+on an Android 3.2 tablet.</p>
+</div>
+
+<div class="figure" style="width:500px;">
+<a href="{@docRoot}images/screens_support/compat-stretch.png">
+<img src="{@docRoot}images/screens_support/compat-stretch-thumb.png" alt="" />
+</a>
+<p class="img-caption"><strong>Figure 2.</strong> The same application from figure 1, with
+compatibility mode disabled.</p>
+</div>
+
+<p class="caution"><strong>Notice:</strong> If you've developed an application for a version of
+Android lower than Android 3.0, but it does resize properly for larger screens such as tablets, you
+should disable screen compatibility mode in order to maintain the best user experience. To learn how
+to quickly disable the user option, jump to <a href="#Disable">Disabling Screen Compatibility
+Mode</a>.</p>
+
+<p>Screen compatibility mode is an escape hatch for applications that are not properly designed
+to resize for larger screens such as tablets. Since Android 1.6, Android has supported a
+variety of screen sizes and does most of the work to resize application layouts so that they
+properly fit each screen. However, if your application does not successfully follow the guide to
+<a href="{@docRoot}guide/topics/practices/screens_support.html">Supporting Multiple Screens</a>,
+then it might encounter some rendering issues on larger screens. For applications with this
+problem, screen compatibility mode can make the application a little more usable on larger
+screens.</p>
+
+<p>There are two versions of screen compatibility mode with slightly different behaviors:</p>
+<dl>
+  <dt>Version 1 (Android 1.6 - 3.1)</dt>
+  <dd>The system draws the application's UI in a "postage stamp"
+window. That is, the system draws the application's layout the same as it would on a
+normal size handset (emulating a 320dp x 480dp screen), with a black border that fills
+the remaining area of the screen.
+
+<p>This was introduced with Android 1.6 to handle apps that were designed only for the
+original screen size of 320dp x 480dp. Because there are so few active devices remaining that run
+Android 1.5, almost all applications should be developed against Android 1.6 or greater and
+should not have version 1 of screen compatibility mode enabled for larger screens. This version
+is considered obsolete.</p>
+  <p>To disable this version of screen compatibility mode, you simply need to set <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> or <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "4"} or higher, or set <a
+href="guide/topics/manifest/supports-screens-element.html#resizeable">{@code
+android:resizeable}</a> to {@code "true"}.</p>
+  </dd>
+  
+  <dt>Version 2 (Android 3.2 and greater)</dt>
+  <dd>The system draws the application's layout the same as
+it would on a normal size handset (approximately emulating a 320dp x 480dp screen), then scales it
+up to fill the screen. This essentially "zooms" in on your layout to make it bigger,
+which will usually cause artifacts such as blurring and pixelation in your UI.
+  <p>This was introduced with Android 3.2 to further
+assist applications on the latest tablet devices when the applications have not yet
+implemented techniques for <a
+href="{@docRoot}guide/topics/practices/screens_support.html">Supporting Multiple
+Screens</a>.</p>
+  <p>In general, large screen devices running Android 3.2 or higher allow users to enable
+screen compatibility mode when the application does not <strong>explicitly declare that it supports
+large screens</strong> in the manifest file. When this is the case, an icon (with
+outward-pointing arrows) appears next to the clock in the system bar, which allows the user to
+toggle screen compatibility mode on and off (figure 3). An application can also explicitly
+declare that it <em>does not</em> support large screens such that screen compatibility mode
+is always enabled and the user cannot disable it. (How to declare your application's
+support for large screens is discussed in the following sections.)</p></dd>
+</dl>
+
+<img src="{@docRoot}images/screens_support/compat-toggle.png" alt="" />
+<p class="img-caption"><strong>Figure 3.</strong> The pop up menu to toggle screen compatibility
+mode (currently disabled, so normal resizing occurs).</p>
+
+<p>As a developer, you have control over when your application uses screen compatibility mode. The
+following sections describe how you can choose to disable or enable screen compatibility mode for
+larger screens when running Android 3.2 or higher.</p>
+
+
+<h2 id="Disable">Disabling Screen Compatibility Mode</h2>
+
+<p>If you've developed your application primarily for versions of Android lower than 3.0, but
+<strong>your application does resize properly</strong> for larger screens such as tablets,
+<strong>you should disable screen compatibility mode</strong> in order to maintain the best user
+experience. Otherwise, users may enable screen compatibility mode and experience your application in
+a less-than-ideal format.</p>
+
+<p>By default, screen compatibility mode for devices running Android 3.2 and higher is offered to
+users as an optional feature when one of the following is true:</p>
+
+<ul>
+  <li>Your application has set both <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
+and <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "10"} or lower and <strong>does not explicitly
+declare support</strong> for large screens using the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element.</li>
+
+  <li>Your application has set either <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
+or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "11"} or higher and <strong>explicitly declares that it does
+not support</strong> large screens, using the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element.</li>
+</ul>
+
+<p>To completely disable the user option for screen compatibility mode and remove the icon in the
+system bar, you can do one of the following:</p>
+
+<ul>
+  <li><strong>Easiest:</strong>
+    <p>In your manifest file, add the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element and specify the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#xlarge">{@code
+android:xlargeScreens}</a> attribute to {@code "true"}:</p>
+<pre>
+&lt;supports-screens android:xlargeScreens="true" /&gt;
+</pre>
+  <p>That's it. This declares that your application supports all larger screen sizes, so the
+system will always resize your layout to fit the screen. This works regardless of what values
+you've set in the <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+attributes.</p> 
+  </li>
+  
+  <li><strong>Easy but has other effects:</strong>
+    <p>In your manifest's <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
+element, set <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "11"} or higher:</p>
+<pre>
+&lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" /&gt;
+</pre>
+  <p>This declares that your application supports Android 3.0 and, thus, is designed to
+work on larger screens such as tablets.</p>
+  <p class="caution"><strong>Caution:</strong> When running on Android 3.0 and greater, this also
+has the effect of enabling the Holographic theme for you UI, adding the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> to your activities, and removing the
+Options Menu button in the system bar.</p>
+  <p>If screen compatibility mode is still enabled after you change this, check your manifest's <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> and be sure that there are no attributes set {@code "false"}. The best
+practice is to always explicitly declare your support for different screen sizes using the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element, so you should use this element anyway.</p>
+  <p>For more information about updating your application to target Android 3.0 devices, read <a
+href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android
+3.0</a>.</p>
+  </li>
+<!--
+  <li><strong>Most control</strong> (but you must compile against Android 3.2 or higher):
+    <p>In your manifest file, add the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element and specify the {@code android:compatibleWidthLimitDp}
+attribute to any value <em>higher than</em> {@code "320"}:</p>
+<pre>
+&lt;supports-screens android:compatibleWidthLimitDp="720" /&gt;
+</pre>
+  <p>Using this technique allows you to specify exactly what your application's limit is for
+layout resizing. Normally, only applications that are already built against Android 3.2 (or
+higher) use this attribute, because the primary intention is to specify at what size should screen
+compatibility mode actually be offered to users.</p>
+  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates
+handset screens with a 320dp width, so screen compatibility mode is not applied to any device if
+your value for {@code android:compatibleWidthLimitDp} is larger than 320.</p>
+  </li>
+  -->
+</ul>
+
+
+
+<h2 id="Enable">Enabling Screen Compatibility Mode</h2>
+
+<p>When your application is targeting Android 3.2 (API level 13) or higher, you can affect
+whether compatibility mode is enabled for certain screens by using the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens>}</a> element.</p>
+
+<p class="note"><strong>Note:</strong> Screen compatibility mode is <strong>not</strong> a mode in
+which you should want your application to run&mdash;it causes pixelation and blurring in your UI,
+due to zooming. The proper way to make your application work well on large screens is to follow the
+guide to <a
+href="{@docRoot}guide/topics/practices/screens_support.html">Supporting Multiple Screens</a> and
+provide alternative layouts for different screen sizes.</p>
+
+<p>By default, when you've set either <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+android:minSdkVersion}</a> or <a
+href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+android:targetSdkVersion}</a> to {@code "11"} or higher, screen compatibility mode is
+<strong>not</strong> available to users. If either of these are true and your application does not
+resize properly for larger screens, you can choose to enable screen compatibility mode in one
+of the following ways:</p>
+
+<ul>
+  <li>In your manifest file, add the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element and specify the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
+android:compatibleWidthLimitDp}</a> attribute to {@code "320"}:</p>
+<pre>
+&lt;supports-screens android:compatibleWidthLimitDp="320" /&gt;
+</pre>
+  <p>This indicates that the maximum "smallest screen width" for which your application is designed
+is 320dp. This way, any devices with their smallest side being larger than this value will offer
+screen compatibility mode as a user-optional feature.</p>
+  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates
+handset screens with a 320dp width, so screen compatibility mode is not applied to any device if
+your value for <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
+android:compatibleWidthLimitDp}</a> is larger than 320.</p>
+  </li>
+
+  <li>If your application is functionally broken when resized for large screens and you want to
+force users into screen compatibility mode (rather than simply providing the option), you can use
+the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html#largestWidth">{@code
+android:largestWidthLimitDp}</a> attribute:
+<pre>
+&lt;supports-screens android:largestWidthLimitDp="320" /&gt;
+</pre>
+  <p>This works the same as <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">{@code
+android:compatibleWidthLimitDp}</a> except it force-enables
+screen compatibility mode and does not allow users to disable it.</p>
+  </li>
+</ul>
\ No newline at end of file
diff --git a/docs/html/guide/practices/screens-distribution.jd b/docs/html/guide/practices/screens-distribution.jd
index 0c5193b..951e364cc 100644
--- a/docs/html/guide/practices/screens-distribution.jd
+++ b/docs/html/guide/practices/screens-distribution.jd
@@ -17,6 +17,7 @@
   <ol>
     <li><a href="#FilteringHansetApps">Filtering a Handset Application from Tablets</a></li>
     <li><a href="#FilteringTabletApps">Filtering a Tablet Application from Handsets</a></li>
+    <li><a href="#MultiApks">Publishing Multiple APKs for Different Screens</a></li>
   </ol>
 
   <h2>See also</h2>
@@ -43,7 +44,7 @@
 should understand the techniques for <a
 href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a> and implement
 them to the best of your ability. By supporting multiple screens, your application can be made
-available to the greatest number of users with different devices, using a single {@code .apk}.</p>
+available to the greatest number of users with different devices, using a single APK.</p>
 
 
 
@@ -144,9 +145,9 @@
 with <em>larger</em> screens) and set the larger screen size attributes to {@code "false"}, then
 external services such as Android Market <strong>do not</strong> apply filtering. Your application
 will still be available to larger screens, but when it runs, it will not resize to fit the screen.
-Instead, the system will draw it in a "postage stamp" window that's the same relative size as the
-screen size that your application does support (see <a
-href="screens-support-1.5.html#CompatMode">compatibility mode</a> for more information). If you want
+Instead, the system will emulate a handset screen size (about 320dp x 480dp; see <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">Screen Compatibility Mode</a> for more
+information). If you want
 to prevent your application from being downloaded on larger screens, use <a
 href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">{@code
 &lt;compatible-screens>}</a>, as discussed in the previous section about <a
@@ -162,3 +163,24 @@
 or you have decided to provide different versions of your application for different sets of screen
 configurations.</p>
 
+
+
+<h2 id="MultiApks">Publishing Multiple APKs for Different Screens</h2>
+
+<p>Although we recommend that you publish one APK for your application, Android Market allows
+you to publish multiple APKs for the same
+application when each APK supports a different set of screen configurations (as declared in
+the manifest file). For example, if you want to publish both a handset version and a tablet
+version of your application, but you're unable to make the same APK work for both screen sizes,
+you can actually publish two APKs for the same application listing. Depending on each device's
+screen configuration, Android Market will deliver it the APK that you've declared to support that
+device's screen.</p>
+
+<p>Beware, however, that publishing multiple APKs for the same application is
+considered an advanced feature and <strong>most applications should publish only one
+APK that can support a wide range of device configurations</strong>. Supporting multiple screen
+sizes, especially, is within reason using a single APK, as long as you follow the guide to
+<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p>
+
+<p>If you need more information about how to publish multiple APKs on Android Market, read <a
+href="{@docRoot}guide/market/publishing/multiple-apks.html">Multiple APK Support</a>.</p>
diff --git a/docs/html/guide/practices/screens-support-1.5.jd b/docs/html/guide/practices/screens-support-1.5.jd
index 6fd36bb..9f033b4 100644
--- a/docs/html/guide/practices/screens-support-1.5.jd
+++ b/docs/html/guide/practices/screens-support-1.5.jd
@@ -18,7 +18,6 @@
   <h2>In this document</h2>
   <ol>
     <li><a href="#strategies">Adding Multiple Screens Support</a></li>
-    <li><a href="#CompatMode">Compatibility Mode</a></li>
   </ol>
 
   <h2>See also</h2>
@@ -47,11 +46,13 @@
 default, an application written for Android 1.5 or below that does not set the <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> set to {@code "4"} or higher runs in <a
-href="#CompatMode">compatibility mode</a> when on a device with a screen larger than the
+href="screen-compat-mode">screen compatibility mode</a> when on a device with a screen larger than
+the
 <em>normal</em> screen size (basically, the system displays the application in a small window
 that is roughly the size of the normal screen size).</p>
 
-<p>This document describes how to get your application out of <a href="#CompatMode">compatibility
+<p>This document describes how to get your application out of <a
+href="screen-compat-mode.html">screen compatibility
 mode</a> and instead support multiple screens, but also maintain compatibility with Android 1.5 and
 below.</p>
 
@@ -144,43 +145,3 @@
 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> to add
 complete support for different screen configurations.</p>
 
-
-<h2 id="CompatMode">Compatibility Mode</h2>
-
-<div class="figure" style="width:450px;margin:0">
-<img src="{@docRoot}images/screens_support/compat-mode-on.png" alt="" />
-<p class="img-caption"><strong>Figure 1.</strong> An application running in compatibility mode
-on an extra large screen.</p>
-</div>
-
-<p>To allow applications to run on larger screens without stretching the UI, Android provides a
-compatibility mode that draws an application's UI in a "postage stamp" window when on larger
-screens. That is, the system displays the application at the baseline size (<em>normal</em>) and
-density (<em>mdpi</em>), with a black border that fills the rest of the screen.</p>
-
-<p>Compatibility mode exists primarily to support application's developed for Android 1.5 (or lower)
-when running on larger screens, because multiple screen support was not added until Android 1.6,
-older applications were not designed to support different screen configurations.</p>
-
-<p>As such, if you've set your <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
-android:minSdkVersion}</a> to {@code "3"} or lower and have <em>not</em> set the <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
-android:targetSdkVersion}</a> to {@code "4"} or higher, then compatibility mode is enabled and
-the system will not scale your application, because your application implicitly declares that it
-only supports the baseline screen configuration (normal screen size and medium density).</p>
-
-<p>To disable compatibility mode, set either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
-android:minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
-android:targetSdkVersion}</a> to {@code "4"} or higher. For more information, see the previous
-section about <a href="#strategies">Adding Multiple Screens Support</a>.</p>
-
-<p>You can also affect whether compatibility mode is enabled by using the <a
-href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
-&lt;supports-screens>}</a> element (you can enable it by setting {@code android:resizeable} or
-specific screen sizes to {@code "false"}). However, you should not explicitly enable compatibility
-mode for your application, but should instead apply the necessary techniques to <a
-href="{@docRoot}guide/practices/screens_support.html">supporting multiple screens</a> and allow your
-application to properly fit the screen on all screen sizes.</p>
diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd
index 14de152..6dec4b3 100644
--- a/docs/html/guide/practices/screens_support.jd
+++ b/docs/html/guide/practices/screens_support.jd
@@ -25,6 +25,13 @@
         <li><a href="#qualifiers">Using configuration qualifiers</a></li>
         <li><a href="#DesigningResources">Designing alternative layouts and drawables</a></li>
       </ol></li>
+    <li><a href="#DeclaringTabletLayouts">Declaring Tablet Layouts for Android 3.2</a> <span
+class="new">new!</span>
+      <ol>
+        <li><a href="#NewQualifiers">Using new size qualifiers</a></li>
+        <li><a href="#ConfigurationExamples">Configuration examples</a></li>
+        <li><a href="#DeclaringScreenSizeSupport">Declaring screen size support</a></li>
+      </ol></li>
     <li><a href="#screen-independence">Best Practices</a></li>
     <li><a href="#DensityConsiderations">Additional Density Considerations</a>
       <ol>
@@ -57,15 +64,15 @@
 applications, the Android system provides a consistent development environment across devices and
 handles most of the work to adjust each application's user interface to the screen on which it is
 displayed. At the same time, the system provides APIs that allow you to control your
-application's UI on specific screen sizes and densities, in order to modify and optimize your UI
+application's UI for specific screen sizes and densities, in order to optimize your UI
 design for different screen configurations. For example, you might want a UI for tablets
-that's different from the design for handsets.</p>
+that's different from the UI for handsets.</p>
 
-<p>Although the system performs sufficient scaling and resizing to make your application work on
+<p>Although the system performs scaling and resizing to make your application work on
 different screens, you should make the effort to optimize your application for different screen
 sizes and densities. In doing so, you maximize the user experience for all devices and your users
 believe that your application was actually designed for <em>their</em> devices&mdash;rather than
-simply stretched to fit their devices.</p>
+simply stretched to fit the screen on their devices.</p>
 
 <p>By following the practices described in this document, you can create an application that
 displays properly and provides an optimized user experience on all supported screen configurations,
@@ -74,7 +81,14 @@
 <p class="note"><strong>Note:</strong> The information in this document assumes that your
 application is designed for Android 1.6 (API Level 4) or higher. If your application supports
 Android 1.5 or lower, please first read <a
-href="{@docRoot}guide/practices/screens-support-1.5.html">Strategies for Android 1.5</a>.</p>
+href="{@docRoot}guide/practices/screens-support-1.5.html">Strategies for Android 1.5</a>.
+<br/><br/>
+Also, be aware that <strong>Android 3.2 has introduced new APIs</strong> that allow you to more
+precisely control the layout resources your application uses for different screen sizes. These new
+features are especially important if you're developing an application that's optimized for tablets.
+For details, see the section about <a href="#DeclaringTabletLayouts">Declaring Tablet Layouts for
+Android 3.2</a>.
+</p>
 
 
 
@@ -143,9 +157,16 @@
 <li>A set of four generalized <strong>sizes</strong>: <em>small</em>, <em>normal</em>,
 <em>large</em>,
 and <em>xlarge</em></em>
+<p class="note"><strong>Note:</strong> Beginning with Android 3.2 (API level 13), these size groups
+are deprecated in favor of a new technique for managing screen sizes based on the available screen
+width. If you're developing for Android 3.2 and greater, see <a
+href="#DeclaringTabletLayouts">Declaring Tablet Layouts for Android 3.2</a> for more
+information.</p>
+</li>
 <li>A set of four generalized <strong>densities</strong>: <em>ldpi</em> (low), <em>mdpi</em>
 (medium),
 <em>hdpi</em> (high), and <em>xhdpi</em> (extra high)
+</li>
 </ul>
 
 <p>The generalized sizes and densities are arranged around a
@@ -154,7 +175,7 @@
 G1, which has an HVGA screen (until Android 1.6, this was the only screen configuration that Android
 supported).</p>
 
-<p>Each generalized size or density spans a range of actual screen sizes or density. For example,
+<p>Each generalized size and density spans a range of actual screen sizes and densities. For example,
 two devices that both report a screen size of <em>normal</em> might have actual screen sizes and
 aspect ratios that are slightly different when measured by hand. Similarly, two devices that report
 a screen density of <em>hdpi</em> might have real pixel densities that are slightly different.
@@ -168,11 +189,30 @@
 Illustration of how Android roughly maps actual sizes and densities
 to generalized sizes and densities (figures are not exact).</p>
 
+<p>As you design your UI for different screen sizes, you'll discover that each design requires a
+minimum amount of space. So, each generalized screen size above has an associated minimum
+resolution that's defined by the system. These minimum sizes are in "dp" units&mdash;the same units
+you should use when defining your layouts&mdash;which allows the system to avoid worrying about
+changes in screen density.</p>
+
+<ul>
+  <li><em>xlarge</em> screens are at least 960dp x 720dp</li>
+  <li><em>large</em> screens are at least 640dp x 480dp</li>
+  <li><em>normal</em> screens are at least 470dp x 320dp</li>
+  <li><em>small</em> screens are at least 426dp x 320dp</li>
+</ul>
+
+<p class="note"><strong>Note:</strong> These minimum screen sizes were not as well defined prior to
+Android 3.0, so you may encounter some devices that are mis-classified between normal and large. 
+These are also based on the physical resolution of the screen, so may vary across devices&mdash;for
+example a 1024x720 tablet with a system bar actually has a bit less space available to the
+application due to it being used by the system bar.</p>
+
 <p>To optimize your application's UI for the different screen sizes and densities, you can provide
 <a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
 resources</a> for any of the generalized sizes and densities. Typically, you should
 provide alternative layouts for some of the different screen sizes and alternative bitmap images for
-different screen densities. At runtime, the system uses the appropriate size or density resources
+different screen densities. At runtime, the system uses the appropriate resources
 for your application, based on the generalized size or density of the current device screen.</p>
 
 <p>You do not need to provide alternative resources for every combination of screen size and
@@ -221,7 +261,7 @@
 </ul>
 
 <p>In figure 2, the text view and bitmap drawable have dimensions specified in pixels ({@code px}
-units), so the elements are physically larger on a low density screen and smaller on a high density
+units), so the views are physically larger on a low density screen and smaller on a high density
 screen. This is because although the actual screen sizes may be the same, the high density screen
 has more pixels per inch (the same amount of pixels fit in a smaller area). In figure 3, the layout
 dimensions are specified in density-independent pixels ({@code dp} units). Because the baseline for
@@ -255,6 +295,18 @@
 however, you should also:</p>
 
 <ul>
+  <li><strong>Explicitly declare in the manifest which screen sizes your application
+supports</strong>
+    <p>By declaring which screen sizes your application supports, you can ensure that only
+devices with the screens you support can download your application. Declaring support for
+different screen sizes can also affect how the system draws your application on larger
+screens&mdash;specifically, whether your application runs in <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a>.</p>
+    <p>To declare the screen sizes your application supports, you should include the
+<a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code
+&lt;supports-screens&gt;}</a> element in your manifest file.</p>
+  </li>
+  
   <li><strong>Provide different layouts for different screen sizes</strong>
     <p>By default, Android resizes your application layout to fit the current device screen. In most
 cases, this works fine. In other cases, your UI might not look as good and might need adjustments
@@ -264,6 +316,12 @@
     <p>The configuration qualifiers you can use to provide size-specific resources are
 <code>small</code>, <code>normal</code>, <code>large</code>, and <code>xlarge</code>. For
 example, layouts for an extra large screen should go in {@code layout-xlarge/}.</p>
+    <p>Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you
+should instead use the {@code sw&lt;N&gt;dp} configuration qualifier to define the smallest
+available width required by your layout resources. For example, if your multi-pane tablet layout
+requires at least 600dp of screen width, you should place it in {@code layout-sw600dp/}. Using the
+new techniques for declaring layout resources is discussed further in the section about <a
+href="#DeclaringTabletLayouts">Declaring Tablet Layouts for Android 3.2</a>.</p>
   </li>
   
   <li><strong>Provide different bitmap drawables for different screen densities</strong>
@@ -386,7 +444,7 @@
 </tr>
 
 <tr>
-<td rowspan="5">Density</td>
+<td rowspan="6">Density</td>
 <td><code>ldpi</code></td>
 <td>Resources for low-density (<em>ldpi</em>) screens (~120dpi).</td>
 </tr>
@@ -408,7 +466,15 @@
 <td>Resources for all densities. These are density-independent resources. The system does not
 scale resources tagged with this qualifier, regardless of the current screen's density.</td>
 </tr>
-
+<tr>
+<td><code>tvdpi</code></td>
+<td>Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not
+considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't
+need it&mdash;providing mdpi and hdpi resources is sufficient for most apps and the system will
+scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them
+at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x
+133px for tvdpi.</td>
+</tr>
 <tr>
 <td rowspan="2">Orientation</td>
 <td><code>land</code></td>
@@ -432,6 +498,12 @@
 </tr>
 </table>
 
+<p class="note"><strong>Note:</strong> If you're developing your application for Android 3.2 and
+higher, see the section about <a
+href="#DeclaringTabletLayouts">Declaring Tablet Layouts for Android 3.2</a> for information about
+new configuration qualifiers that you should use when declaring layout resources for specific
+screen sizes (instead of using the size qualifiers in table 1).</p></p>
+
 <p>For more information about how these qualifiers roughly correspond to real screen
 sizes and densities, see <a href="#range">Range of Screens Supported</a>, earlier in this
 document.</p>
@@ -457,6 +529,20 @@
 <a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">
 Providing Alternative Resources</a>.</p>
 
+<p>Be aware that, when the Android system picks which resources to use at runtime, it uses
+certain logic to determing the "best matching" resources. That is, the qualifiers you use don't
+have to exactly match the current screen configuration in all cases in order for the system to
+use them. Specifically, when selecting resources based on the size qualifiers, the system will
+use resources designed for a screen smaller than the current screen if there are no resources
+that better match (for example, a large-size screen will use normal-size screen resources if
+necessary). However, if the only available resources are <em>larger</em> than the current screen,
+the system will not use them and your application will crash if no other resources match the device
+configuration (for example, if all layout resources are tagged with the {@code xlarge} qualifier,
+but the device is a normal-size screen). For more information about how the system selects
+resources, read <a
+href="{@docRoot}guide/topics/resources/providing-resources.html#BestMatch">How Android Finds the
+Best-matching Resource</a>.</p>
+
   <p class="note"><strong>Tip:</strong> If you have some drawable resources that the system
 should never scale (perhaps because you perform some adjustments to the image yourself at
 runtime), you should place them in a directory with the {@code nodpi} configuration qualifier.
@@ -554,6 +640,291 @@
 
 
 
+
+<h2 id="DeclaringTabletLayouts">Declaring Tablet Layouts for Android 3.2</h2>
+
+<p>For the first generation of tablets running Android 3.0, the proper way to declare tablet
+layouts was to put them in a directory with the {@code xlarge} configuration qualifier (for example,
+ {@code res/layout-xlarge/}). In order to accommodate other types of tablets and screen
+sizes&mdash;in particular, 7" tablets&mdash;Android 3.2 introduces a new way to specify resources
+for more discrete screen sizes. The new technique is based on the amount of space your layout needs
+(such as 600dp of width), rather than trying to make your layout fit the generalized size groups
+(such as <em>large</em> or <em>xlarge</em>).</p>
+
+<p>The reason designing for 7" tablets is tricky when using the generalized size groups is
+that a 7" tablet is technically in the same group as a 5" handset (the <em>large</em> group). While
+these two devices are seemingly close to each other in size, the amount of space for an
+application's UI is significantly different, as is the style of user interaction. Thus, a 7" and 5"
+screen should not always use the same layout. To make it possible for you to provide different
+layouts for these two kinds of screens, Android now allows you to specify your layout resources
+based on the width and/or height that's actually available for your application's layout, specified
+in dp units.</p>
+
+<p>For example, after you've designed the layout you want to use for tablet-style devices, you might
+determine that the layout stops working well when the screen is less than 600dp wide. This threshold
+thus becomes the minimum size that you require for your tablet layout. As
+such, you can now specify that these layout resources should be used only when there is at least
+600dp of width available for your application's UI.</p>
+
+<p>You should either pick a width and design to it as your minimum size, or test what is the
+smallest width your layout supports once it's complete.</p>
+
+<p class="note"><strong>Note:</strong> Remember that all the figures used with these new size APIs
+are density-indpendent pixel (dp) values and your layout dimensions should also always be defined
+using dp units, because what you care about is the amount of screen space available after the system
+accounts for screen density (as opposed to using raw pixel resolution). For more information about
+density-indpendent pixels, read <a href="#terms">Terms and concepts</a>, earlier in this
+document.</p>
+
+
+<h3 id="NewQualifiers">Using new size qualifiers</h3>
+
+<p>The different resource configurations that you can specify based on the space available for your
+layout are summarized in table 2. These new qualifiers offer you more control over the specific
+screen sizes your application supports, compared to the traditional screen size groups (small,
+normal, large, and xlarge).</p>
+
+<p class="note"><strong>Note:</strong> The sizes that you specify using these qualifiers are
+<strong>not the actual screen sizes</strong>. Rather, the sizes are for the width or height in dp
+units that are <strong>available to your activity's window</strong>. The Android system
+might use some of the screen for system UI (such as the system bar at the bottom of the screen or
+the status bar at the top), so some of the screen might not be available for your layout. Thus, the
+sizes you declare should be specifically about the sizes needed by your activity&mdash;the system
+accounts for any space used by system UI when declaring how much space it provides for your layout.
+Also beware that the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> is considered
+a part of your application's window space, although your layout does not declare it, so it reduces
+the space available for your layout and you must account for it in your design.</p>
+
+<p class="table-caption"><strong>Table 2.</strong> New configuration qualifers for screen size
+(introduced in Android 3.2).</p>
+<table>
+  <tr><th>Screen configuration</th><th>Qualifier values</th><th>Description</th></tr>
+  <tr><td>smallestWidth</td>
+      <td><code>sw&lt;N&gt;dp</code><br/><br/>
+        Examples:<br/>
+        <code>sw600dp</code><br/>
+        <code>sw720dp</code><br/>
+      </td>
+      <td>
+        <p>The fundamental size of a screen, as indicated by the shortest dimension of the available
+screen area. Specifically, the device's smallestWidth is the shortest of the screen's available
+height and width (you may also think of it as the "smallest possible width" for the screen). You can
+use this qualifier to ensure that, regardless of the screen's current orientation, your
+application's has at least {@code &lt;N&gt;} dps of width available for it UI.</p>
+        <p>For example, if your layout requires that its smallest dimension of screen area be at
+least 600 dp at all times, then you can use this qualifer to create the layout resources, {@code
+res/layout-sw600dp/}. The system will use these resources only when the smallest dimension of
+available screen is at least 600dp, regardless of whether the 600dp side is the user-perceived
+height or width. The smallestWidth is a fixed screen size characteristic of the device; <strong>the
+device's smallestWidth does not change when the screen's orientation changes</strong>.</p>
+  <p>The smallestWidth of a device takes into account screen decorations and system UI. For
+example, if the device has some persistent UI elements on the screen that account for space along
+the axis of the smallestWidth, the system declares the smallestWidth to be smaller than the actual
+screen size, because those are screen pixels not available for your UI.</p>
+  <p>This is an alternative to the generalized screen size qualifiers (small, normal, large, xlarge)
+that allows you to define a discrete number for the effective size available for your UI.
+Using smallestWidth to determine the general screen size is useful because width is
+often the driving factor in designing a layout. A UI will often scroll vertically, but have fairly
+hard constraints on the minimum space it needs horizontally. The available width is also the key
+factor in determining whether to use a one-pane layout for handsets or multi-pane layout for
+tablets. Thus, you likely care most about what the smallest possible width will be on each
+device.</p>
+    </td>
+  </tr>
+    <tr>
+      <td>Available screen width</td>
+      <td><code>w&lt;N&gt;dp</code><br/><br/>
+        Examples:<br/>
+        <code>w720dp</code><br/>
+        <code>w1024dp</code><br/>
+      </td>
+      <td>
+        <p>Specifies a minimum available width in dp units at which the resources should be
+used&mdash;defined by the <code>&lt;N&gt;</code> value. The system's corresponding value for the
+width changes when the screen's orientation switches between landscape and portrait to
+reflect the current actual width that's available for your UI.</p>
+        <p>This is often useful to determine whether to use a multi-pane layout, because even on a
+tablet device, you often won't want the same multi-pane layout for portrait orientation as you do
+for landscape. Thus, you can use this to specify the minimum width required for the layout, instead
+of using both the screen size and orientation qualifiers together.</p>
+      </td>
+    </tr>
+    <tr>
+      <td>Available screen height</td>
+      <td><code>h&lt;N&gt;dp</code><br/><br/>
+        Examples:<br/>
+        <code>h720dp</code><br/>
+        <code>h1024dp</code><br/>
+        etc.
+      </td>
+      <td>
+        <p>Specifies a minimum screen height in dp units at which the resources should be
+used&mdash;defined by the <code>&lt;N&gt;</code> value. The system's corresponding value for
+the height changes when the screen's orientation switches between landscape and portrait to
+reflect the current actual height that's available for your UI.</p>
+        <p>Using this to define the
+height required by your layout is useful in the same way as <code>w&lt;N&gt;dp</code> is for
+defining the required width, instead of using both the screen size and orientation qualifiers.
+However, most apps won't need this qualifier, considering that UIs often scroll vertically and are
+thus more flexible with how much height is available, whereas the width is more rigid.</p>
+      </td>
+    </tr>
+</table>
+
+<p>While using these qualifiers might seem more complicated than using screen size groups, it should
+actually be simpler once you determine the requirements for your UI.  When you design your UI,
+the main thing you probably care about is the actual size at which your application switches between
+a handset-style UI and a tablet-style UI that uses multiple panes. The exact point of this switch
+will depend on your particular design&mdash;maybe you need a 720dp width for your tablet layout,
+maybe 600dp is enough, or 480dp, or some number between these. Using these qualifiers in table 2,
+you are in control of the precise size at which your layout changes.</p>
+
+<p>For more discussion about these size configuration qualifiers, see the <a
+href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
+Providing Resources</a> document.</p>
+
+
+<h3 id="ConfigurationExamples">Configuration examples</h3>
+
+<p>To help you target some of your designs for different types of devices, here are some
+numbers for typical screen widths:</p>
+
+<ul>
+  <li>320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).</li>
+  <li>480dp: a tweener tablet like the Streak (480x800 mdpi).</li>
+  <li>600dp: a 7” tablet (600x1024 mdpi).</li>
+  <li>720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).</li>
+</ul>
+
+<p>Using the size qualifiers from table 2, your application can switch between your different layout
+resources for handsets and tablets using any number you want for width and/or height.  For example,
+if 600dp is the smallest available width supported by your tablet layout, you can provide these two
+sets of layouts:</p>
+
+<pre class="classic">
+res/layout/main_activity.xml           # For handsets
+res/layout-sw600dp/main_activity.xml   # For tablets
+</pre>
+
+<p>In this case, the smallest width of the available screen space must be 600dp in order for the
+tablet layout to be applied.</p>
+
+<p>For other cases in which you want to further customize your UI to differentiate between sizes
+such as 7” and 10” tablets, you can define additional smallest width layouts:</p>
+
+<pre class="classic">
+res/layout/main_activity.xml           # For handsets (smaller than 600dp available width)
+res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
+res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)
+</pre>
+
+<p>Notice that the previous two sets of example resources use the "smallest width" qualifer, {@code
+sw&lt;N&gt;dp}, which specifies the smallest of the screen's two sides, regardless of the
+device's current orientation. Thus, using {@code sw&lt;N&gt;dp} is a simple way to specify the
+overall screen size available for your layout by ignoring the screen's orientation.</p>
+
+<p>However, in some cases, what might be
+important for your layout is exactly how much width or height is <em>currently</em> available. For
+example, if you have a two-pane layout with two fragments side by side, you might want to use it
+whenever the screen provides at least 600dp of width, whether the device is in landscape or
+portrait orientation. In this case, your resources might look like this:</p>
+
+<pre class="classic">
+res/layout/main_activity.xml         # For handsets (smaller than 600dp available width)
+res/layout-w600dp/main_activity.xml  # Multi-pane (any screen with 600dp available width or more)
+</pre>
+
+<p>Notice that the second set is using the "available width" qualifier, {@code w&lt;N&gt;dp}. This
+way, one device may actually use both layouts, depending on the orientation of the screen (if
+the available width is at least 600dp in one orientation and less than 600dp in the other
+orientation).</p>
+
+<p>If the available height is a concern for you, then you can do the same using the {@code
+h&lt;N&gt;dp} qualifier. Or, even combine the {@code w&lt;N&gt;dp} and {@code h&lt;N&gt;dp}
+qualifiers if you need to be really specific.</p>
+
+
+<h3 id="DeclaringScreenSizeSupport">Declaring screen size support</h3>
+
+<p>Once you've implemented your layouts for different screen sizes, it's equally important that you
+declare in your manifest file which screens your application supports.</p>
+
+<p>Along with the new configuration qualifiers for screen size, Android 3.2 introduces new
+attributes for the <a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a>
+manifest element:</p>
+
+<dl>
+  
+  <dt><a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">
+{@code android:requiresSmallestWidthDp}</a></dt>
+  <dd>Specifies the minimum smallestWidth required. The smallestWidth is the shortest dimension of
+the screen space (in {@code dp} units) that must be available to your application UI&mdash;that is,
+the shortest of the available screen's two dimensions. So, in order for a device to be considered
+compatible with your application, the device's smallestWidth must be equal to or greater than this
+value. (Usually, the value you supply for this is the "smallest width" that your layout supports,
+regardless of the screen's current orientation.)
+  <p>For example, if your application is only for tablet-style devices with a 600dp
+smallest available width:</p>
+<pre>
+&lt;manifest ... &gt;
+    &lt;supports-screens android:requiresSmallestWidthDp="600" /&gt;
+    ...
+&lt;/manifest&gt;
+</pre>
+  <p>However, if your application supports all screen sizes supported by Android (as small as
+426dp x 320dp), then you don't need to declare this attribute, because the smallest width your
+application requires is the smallest possible on any device.</p>
+
+  <p class="caution"><strong>Caution:</strong> The Android system does not pay attention to this
+attribute, so it does not affect how your application behaves at runtime. Instead, it is used
+to enable filtering for your application on services such as Android Market. However,
+<strong>Android Market currently does not support this attribute for filtering</strong> (on Android
+3.2), so you should continue using the other size attributes if your application does not support
+small screens.</p>
+</dd>
+
+  <dt><a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#compatibleWidth">
+{@code android:compatibleWidthLimitDp}</a></dt>
+  <dd>This attribute allows you to enable <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> as a
+user-optional feature by specifying the maximum "smallest width" that your application
+supports. If the smallest side of a device's available screen is greater than your value here,
+users can still install your application, but are offered to run it in screen compatibility mode. By
+default, screen compatibility mode is disabled and your layout is resized to fit the screen as
+usual, but a button is available in the system bar that allows users to toggle screen compatibility
+mode on and off.
+  <p class="note"><strong>Note:</strong> If your application's layout properly resizes for large
+screens, you do not need to use this attribute. We recommend that you avoid using this
+attribute and instead ensure your layout resizes for larger screens by following the
+recommendations in this document.</p></dd>
+
+  <dt><a
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#largestWidth">
+{@code android:largestWidthLimitDp}</a></dt>
+  <dd>This attribute allows you to force-enable <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> by specifying
+the maximum "smallest width" that your application supports. If the smallest
+side of a device's available screen is greater than your value here, the application runs in screen
+compatibility mode with no way for the user to disable it.
+  <p class="note"><strong>Note:</strong> If your application's layout properly resizes for large
+screens, you do not need to use this attribute.  We recommend that you avoid using this
+attribute and instead ensure your layout resizes for larger screens by following the
+recommendations in this document.</p></dd>
+</dl>
+
+<p class="caution"><strong>Caution:</strong> When developing for Android 3.2 and higher, you
+should not use the older screen size attributes in combination with the attributes
+listed above. Using both the new attributes and the older size attributes might cause
+unexpected behavior.</p>
+
+<p>For more information about each of these attributes, follow the respective links above.</p>
+
+
+
+
 <h2 id="screen-independence">Best Practices</h2>
 
 <p>The objective of supporting multiple screens is to create an application that can function
@@ -875,7 +1246,7 @@
 the {@code &lt;sdk&gt;/tools/} directory (on all platforms). Figure 6 shows the Android SDK and
 AVD Manager with a selection of AVDs, for testing various screen configurations.</p>
 
-<p>Table 2 shows the various emulator skins that are available in the Android SDK, which you can use
+<p>Table 3 shows the various emulator skins that are available in the Android SDK, which you can use
 to emulate some of the most common screen configurations.</p>
 
 <p>For more information about creating and using AVDs to test your application, see <a
@@ -883,7 +1254,7 @@
 Manager</a>.</p>
 
 
-<p class="table-caption" id="screens-table"><strong>Table 2.</strong> Various screen
+<p class="table-caption" id="screens-table"><strong>Table 3.</strong> Various screen
 configurations available from emulator skins in the Android SDK (indicated in bold) and other
 representative resolutions.</p>
 
diff --git a/docs/html/guide/publishing/preparing.jd b/docs/html/guide/publishing/preparing.jd
index f471961..69aecd4 100644
--- a/docs/html/guide/publishing/preparing.jd
+++ b/docs/html/guide/publishing/preparing.jd
@@ -78,9 +78,6 @@
 and performance. However, we strongly recommend that you test your application
 on an actual target device before publishing it. </li>
 
-<li>If you are targeting the <a href="http://www.t-mobileg1.com/">T-Mobile
-G1</a> device for your application, make sure that your UI handles screen
-orientation changes. </li>
 </ul>
 
 <h3 id="eula">2. Consider adding an End User License Agreement in your 
diff --git a/docs/html/guide/publishing/publishing.jd b/docs/html/guide/publishing/publishing.jd
index 95d89fa..fa677e6 100644
--- a/docs/html/guide/publishing/publishing.jd
+++ b/docs/html/guide/publishing/publishing.jd
@@ -39,7 +39,7 @@
 <div id="qv-extra">
   <img id="rule" src="{@docRoot}assets/images/grad-rule-qv.png">
   <div id="qv-sub-rule">
-    <img src="{@docRoot}assets/images/icon_market.jpg" style="float:left;margin:0;padding:0;">
+    <img src="{@docRoot}assets/images/icon_market.jpg" style="float:left;margin:0;padding:0 5px;">
     <h2 style="color:#669999;">Interested in publishing your app on Android Market?</h2>
     <p><a href="http://market.android.com/publish">Go to Android Market</a> to
 create a developer account and upload your application. For more information about the
@@ -155,48 +155,43 @@
 
 <p>To help users discover your published applications, you can use two special Android Market URIs
 that direct users to your application's details page or perform a search for all of your published
-applications in Android Market. You can use these URIs to do the following:</p>
+applications in Android Market. You can use these URIs to create a button in your application or a
+link on a web page that:</p>
 
 <ul>
-  <li>Create a button in your application or a link on a web page that opens one of your
-application's details page in the Android Market application or web site.</li>
-  <li>Create a button in your application or a link on a web page that searches for all your
-published applications in the Android Market application or web site.</li>
+  <li>Opens your application's details page in the Android Market application or web site.</li>
+  <li>Searches for all your published applications in the Android Market application or web
+site.</li>
 </ul>
 
 <p>You can launch the Android Market application or web site in the following ways:</p>
 <ul>
   <li>Initiate an {@link android.content.Intent} from your application that launches the
-Android Market application on the user's device. The intent must use the {@link
-android.content.Intent#ACTION_VIEW} action, and include intent data with the appropriate
-Android Market URI scheme.</li>
-  <li>Provide a hyperlink on a web page that opens the Android Market web site.</li>
+Android Market application on the user's device.</li>
+  <li>Provide a link on a web page that opens the Android Market web site (but will also
+open the Android Market application if clicked from a device).</li>
 </ul>
 
-<p>In both cases, you need to create a URI that indicates either the application you'd like to view
-in Android Market or the search you'd like to perform. The URI is quite similar whether you want
-to open the application or open the web site. The only difference is the URI prefix.</p>
+<p>In both cases, whether you want to initiate the action from your application or from a web
+page, the URIs are quite similar. The only difference is the URI prefix.</p>
 
-<p>To open the Android Market application on the device, the prefix for the intent's data URI
-is:</p>
+<p>To open the Android Market application from your application, the prefix for the intent's data
+URI is:</p>
 
 <p style="margin-left:2em"><code>market://</code></p>
 
-<p>To open the Android Market web site, the prefix for the link URI is:</p>
+<p>To open Android Market from your web site, the prefix for the link URI is:</p>
 
 <p style="margin-left:2em"><code>http://market.android.com/</code></p>
 
-<p>To complete each URI, you must append a string that specifies either the
-application for which you want to view or the search to execute. The following sections
-describe how to create a complete URI for each case.</p>
+<p>The following sections describe how to create a complete URI for each action.</p>
 
-<p class="note"><strong>Note:</strong> If you create a link to open the Android Market web site and
-the user selects it from an Android-powered device, the Android Market application will also resolve
-the link so the user can use the native application instead of the web site. Also, because the
-Android Market application also reads the {@code http://} URIs, you can also use them in an intent,
-but you should usually use the {@code market://} URIs for an intent, so that the native application
-is opened by default. You should use {@code http://} URIs only when creating links from a web
-page.</p>
+<p class="note"><strong>Note:</strong> If you create a link to open Android Market from your web
+site and the user selects it from an Android-powered device, the device's Market application will
+resolve the link so the user can use the Market application instead of opening the web
+site. As such, you should always use {@code http://market.android.com/} URIs when creating a link on
+a web page. When pointing to your apps from within your Android app, use the
+{@code market://} URIs in an intent, so that the Market application always opens.</p>
 
 
 <h3 id="OpeningDetails">Opening an app's details page</h3>
@@ -209,22 +204,23 @@
 
 <p style="margin-left:2em"><code>&lt;URI_prefix&gt;<b>details?id=</b>&lt;package_name&gt;</code></p>
 
-<p>The <code>&lt;package_name&gt;</code> is a placeholder for the target application's fully
-qualified package name, as declared in the <a
+<p>The <code>&lt;package_name&gt;</code> is a placeholder for the target application's
+fully-qualified package name, as declared in the <a
 href="{@docRoot}guide/topics/manifest/manifest-element.html#package">{@code
 package}</a> attribute of the <a href="{@docRoot}guide/topics/manifest/manifest-element.html">{@code
-&lt;manifest&gt;}</a> element in the application's manifest file.</p>
+&lt;manifest&gt;}</a> element.</p>
 
 
-<h4>Opening details in the Android Market application</h4>
+<h4>Opening the app details page from your Android app</h4>
 
-<p>To open the details page in the Android Market application, create an intent with the
-{@link android.content.Intent#ACTION_VIEW} action and include a data URI in this format:</p>
+<p>To open the Android Market details page from your application,
+create an intent with the {@link android.content.Intent#ACTION_VIEW} action and include a data URI
+in this format:</p>
 
 <p style="margin-left:2em"><code>market://details?id=&lt;package_name&gt;</code></p>
 
-<p>For example, here's how you can create an intent and open an application's details page in the
-Android Market application:</p>
+<p>For example, here's how you can create an intent and open an application's details page in
+Android Market:</p>
 
 <pre>
 Intent intent = new Intent(Intent.ACTION_VIEW);
@@ -232,23 +228,30 @@
 startActivity(intent);
 </pre>
 
+<p>This will open the Android Market application on the device to view the {@code
+com.android.example} application.</p>
 
-<h4>Opening details on the Android Market web site</h4>
 
-<p>To open the details page on the Android Market web site, create a link with a URI in this
+<h4>Opening the app details page from a web site</h4>
+
+<p>To open the details page from your web site, create a link with a URI in this
 format:</p>
 
 <p style="margin-left:2em">
   <code>http://market.android.com/details?id=&lt;package_name&gt;</code>
 </p>
 
-<p>For example, here's a link that opens an application's details page on the Android Market web
-site:</p>
+<p>For example, here's a link that opens an application's details page on Android Market:</p>
 
 <pre>
 &lt;a href="http://market.android.com/details?id=com.android.example">App Link&lt;/a>
 </pre>
 
+<p>When clicked from a desktop web browser, this opens the Android Market web site to view the
+{@code com.android.example} application. When clicked from an Android-powered device, users are
+given the option to use either their web browser or the Android Market application to view the
+application.</p>
+
 
 
 <h3 id="PerformingSearch">Performing a search</h3>
@@ -274,9 +277,9 @@
 </ul>
 
 
-<h4>Searching the Android Market application</h4>
+<h4>Searching from your Android app</h4>
 
-<p>To perform a search in the Android Market application, create an intent with the
+<p>To initiate a search on Android Market from your application, create an intent with the
 {@link android.content.Intent#ACTION_VIEW} action and include a data URI in this format:</p>
 
 <p style="margin-left:2em"><code>market://search?q=&lt;query&gt;</code></p>
@@ -292,13 +295,13 @@
 startActivity(intent);
 </pre>
 
-<p>The search result shows all applications published by the publisher and which are compatible with
-the current device.</p>
+<p>This opens the Android Market application to perform the search. The search result shows all
+applications published by the publisher that are compatible with the current device.</p>
 
 
-<h4>Searching the Android Market web site</h4>
+<h4>Searching from a web site</h4>
 
-<p>To perform a search on the Android Market web site, create a link with a URI in this
+<p>To initiate a search on Android Market from your web site, create a link with a URI in this
 format:</p>
 
 <p style="margin-left:2em">
@@ -307,26 +310,31 @@
 
 <p>The query may include the {@code pub:} parameter described above.</p>
 
-<p>For example, here's a link that initiates a search on the Android Market web site, based on the
+<p>For example, here's a link that initiates a search on Android Market, based on the
 publisher name:</p>
 
 <pre>
 &lt;a href="http://market.android.com/search?q=pub:Your Publisher Name">Search Link&lt;/a>
 </pre>
 
-<p>The search result shows all applications published by the publisher.</p>
+<p>When clicked from a desktop web browser, this opens the Android Market web site and performs the
+search. When clicked from an Android-powered device, users are given the option to use either their
+web browser or the Android Market application to perform the search.</p>
 
 
 
 <h3 id="BuildaButton">Build an Android Market button</h3>
 
-<p>Use the following form to input either your application's package name or your publisher name
-and generate a button that you can use on your web site. The button will take users to Android
-Market to view your application details or view a list of all applications you've published.</p>
+<p>Use the following form to generate an "Available in Android Market" button that you can use on
+your web site. Input either your application's package name or publisher name and the button will
+take users to Android Market to either view your application's information or view a list of
+your published apps. If users click the button while on an Android-powered device, the Android
+Market application will respond to show users your application(s).</p>
 
-<p>This form offers four versions of the official "Available in Android Market" badge at
-recommended sizes. If you would like to create a different size, you can download an EPS file for
-the badges from the <a href="http://www.android.com/branding.html">Android Brand Guidelines</a>.</p>
+<p>This form offers four versions of the official "Available in Android Market" button at
+recommended sizes. If you want to create a different size, you can download an EPS file for
+the button images from the <a href="http://www.android.com/branding.html">Android Brand
+Guidelines</a>.</p>
 
 <style type="text/css">
   
@@ -548,4 +556,3 @@
 </tr>
 
 </table>
-
diff --git a/docs/html/guide/topics/graphics/animation.jd b/docs/html/guide/topics/graphics/animation.jd
index 31e7c4b..e7a07e0 100644
--- a/docs/html/guide/topics/graphics/animation.jd
+++ b/docs/html/guide/topics/graphics/animation.jd
@@ -12,28 +12,33 @@
           <ol>
             <li><a href="#how">How property animation works</a></li>
           </ol>
-            </li>
+        </li>
 
-            <li><a href="#value-animator">Animating with ValueAnimator</a></li>
+        <li><a href="#value-animator">Animating with ValueAnimator</a></li>
 
-            <li><a href="#object-animator">Animating with ObjectAnimator</a></li>
+        <li><a href="#object-animator">Animating with ObjectAnimator</a></li>
 
-            <li><a href="#choreography">Choreographing Multiple Animations with
-            AnimatorSet</a></li>            
-            
-            <li><a href="#listeners">Animation Listeners</a></li>
+        <li><a href="#choreography">Choreographing Multiple Animations with
+        AnimatorSet</a></li>
 
-            <li><a href="#type-evaluator">Using a TypeEvaluator</a></li>
+        <li><a href="#listeners">Animation Listeners</a></li>
 
-            <li><a href="#interpolators">Using Interpolators</a></li>
+        <li><a href="#type-evaluator">Using a TypeEvaluator</a></li>
 
-            <li><a href="#keyframes">Specifying Keyframes</a></li>
-            <li><a href="#layout">Animating Layout Changes to ViewGroups</a></li>
+        <li><a href="#interpolators">Using Interpolators</a></li>
 
-            <li><a href="#views">Animating Views</a></li>
+        <li><a href="#keyframes">Specifying Keyframes</a></li>
 
-            <li><a href="#declaring-xml">Declaring Animations in XML</a></li>
-      </ol>     
+        <li><a href="#layout">Animating Layout Changes to ViewGroups</a></li>
+
+        <li><a href="#views">Animating Views</a>
+          <ol>
+            <li><a href="#view-prop-animator">ViewPropertyAnimator</a></li>
+          </ol>
+        </li>
+
+        <li><a href="#declaring-xml">Declaring Animations in XML</a></li>
+      </ol>
 
       <h2>Key classes</h2>
 
@@ -63,13 +68,13 @@
   You can define an animation to change any object property over time, regardless of whether it
   draws to the screen or not.The property animation system also has a few advantages over the view
   animation system, which makes it more flexible to use.</p>
-  
+
   <p>The view animation system provides the capability to only animate View objects, so if
   you wanted to animate non-View objects, you had to implement your own code to do so. The view
   animation system also was constrained in the fact that it only exposed a few aspects of a View
   object to animate, such as the scaling and rotation of a View but not the background color for
   instance.</p>
-  
+
   <p>Another disadvantage of the view animation system is that it only modified where the
   View was drawn, and not the actual View itself. For instance, if you animated a button to move
   across the screen, the button draws correctly, but the actual location where you can click the
@@ -80,7 +85,7 @@
   <p>The view animation system, however, takes less time to setup and requires less code to write.
   If view animation accomplishes everything that you need to do, or if your existing code already
   works the way you want, there is no need to use the property animation system.</p>
-  
+
     <p class="note"><strong>Tip:</strong> To see how the ADT layout editor allows you to develop and
 preview animations in your layout, watch the <a
 href="http://www.youtube.com/watch?v=Oq05KqjXTvs&feature=player_detailpage#t=1709s">Android
@@ -114,7 +119,7 @@
     default is set to  refresh every 10 ms, but the speed in which your application can refresh frames is
     ultimately dependent on how busy the system is overall and how fast the system can service the underlying timer.</li>
   </ul>
-  
+
 
   <h3 id="how">How the property animation system works</h3>
 
@@ -254,7 +259,7 @@
         </tr>
       </table>
 
-    
+
       <p>Evaluators tell the property animation system how to calculate values for a given
       property. They take the timing data that is provided by an {@link android.animation.Animator}
       class, the animation's start and end value, and calculate the animated values of the property
@@ -299,9 +304,9 @@
           information on how to write a custom evaluator.</td>
         </tr>
       </table>
- 
-      
- 
+
+
+
 
       <p>A time interpolator defines how specific values in an animation are calculated as a
       function of time. For example, you can specify animations to happen linearly across the whole
@@ -397,7 +402,7 @@
   <pre>
 ValueAnimator animation = ValueAnimator.ofFloat(0f, 1f);
 animation.setDuration(1000);
-animation.start();        
+animation.start();
 </pre>
 
   <p>In this code, the {@link android.animation.ValueAnimator} starts calculating the values of the
@@ -408,7 +413,7 @@
   <pre>
 ValueAnimator animation = ValueAnimator.ofObject(new MyTypeEvaluator(), startPropertyValue, endPropertyValue);
 animation.setDuration(1000);
-animation.start();        
+animation.start();
 </pre>
 
   <p>In this code, the {@link android.animation.ValueAnimator} starts calculating the values of the
@@ -483,7 +488,7 @@
 
     <li>Depending on what property or object you are animating, you might need to call the {@link
     android.view.View#invalidate invalidate()} method on a View force the screen to redraw itself with the
-    updated animated values. You do this in the 
+    updated animated values. You do this in the
     {@link android.animation.ValueAnimator.AnimatorUpdateListener#onAnimationUpdate onAnimationUpdate()}
     callback. For example, animating the color property of a Drawable object only cause updates to the
     screen when that object redraws itself. All of the property setters on View, such as
@@ -492,7 +497,7 @@
     methods with new values. For more information on listeners, see the section about <a href="#listeners">Animation Listeners</a>.
     </li>
   </ul>
-  
+
   <h2 id="choreography">Choreographing Multiple Animations with AnimatorSet</h2>
 
   <p>In many cases, you want to play an animation that depends on when another animation starts or
@@ -576,12 +581,12 @@
           {@link android.view.View#invalidate invalidate()} on a View to force that area of the
           screen to redraw itself with the new animated values. For example, animating the
           color property of a Drawable object only cause updates to the screen when that object
-          redraws itself. All of the property setters on View, 
+          redraws itself. All of the property setters on View,
           such as {@link android.view.View#setAlpha setAlpha()} and
           {@link android.view.View#setTranslationX setTranslationX()} invalidate the View
           properly, so you do not need to invalidate the View when calling these methods with new values.
           </p>
-          
+
         </li>
       </ul>
     </li>
@@ -658,7 +663,7 @@
     android:layout_width="wrap_content"
     android:layout_height="match_parent"
     android:id="@+id/verticalContainer"
-    android:animateLayoutChanges="true" /&gt;  
+    android:animateLayoutChanges="true" /&gt;
 </pre>
 
   <p>Setting this attribute to true automatically animates Views that are added or removed from the
@@ -872,16 +877,55 @@
 ObjectAnimator.ofFloat(myView, "rotation", 0f, 360f);
 </pre>
 
-For more information on creating animators, see the sections on animating with
-<a href="#value-animator">ValueAnimator</a> and <a href="#object-animator">ObjectAnimator</a>
+<p>For more information on creating animators, see the sections on animating with
+<a href="#value-animator">ValueAnimator</a> and <a href="#object-animator">ObjectAnimator</a>.
+</p>
 
+<h3 id="view-prop-animator">Animating with ViewPropertyAnimator</h3>
+<p>The {@link android.view.ViewPropertyAnimator} provides a simple way to animate several
+properties of a {@link android.view.View} in parallel, using a single underlying {@link
+android.animation.Animator}
+object. It behaves much like an {@link android.animation.ObjectAnimator}, because it modifies the
+actual values of the view's properties, but is more efficient when animating many properties at
+once. In addition, the code for using the {@link android.view.ViewPropertyAnimator} is much
+more concise and easier to read. The following code snippets show the differences in using multiple
+{@link android.animation.ObjectAnimator} objects, a single
+{@link android.animation.ObjectAnimator}, and the {@link android.view.ViewPropertyAnimator} when
+simultaneously animating the <code>x</code> and <code>y</code> property of a view.</p>
+
+<p><strong>Multiple ObjectAnimator objects</strong></p>
+<pre>
+ObjectAnimator animX = ObjectAnimator.ofFloat(myView, "x", 50f);
+ObjectAnimator animY = ObjectAnimator.ofFloat(myView, "y", 100f);
+AnimatorSet animSetXY = new AnimatorSet();
+animSetXY.playTogether(animX, animY);
+animSetXY.start();
+</pre>
+
+<p><strong>One ObjectAnimator</strong></p>
+<pre>
+PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("x", 50f);
+PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("y", 100f);
+ObjectAnimator.ofPropertyValuesHolder(myView, pvhX, pvyY).start();
+</pre>
+
+<p><strong>ViewPropertyAnimator</strong></p>
+<pre>
+myView.animate().x(50f).y(100f);
+</pre>
+
+<p>
+For more detailed information about {@link
+android.view.ViewPropertyAnimator}, see the corresponding Android Developers
+<a href="http://android-developers.blogspot.com/2011/05/introducing-viewpropertyanimator.html">blog
+post</a>.</p>
 
 <h2 id="declaring-xml">Declaring Animations in XML</h2>
 
   <p>The property animation system lets you declare property animations with XML instead of doing
   it programmatically. By defining your animations in XML, you can easily reuse your animations
 in multiple activities and more easily edit the animation sequence.</p>
-  
+
 <p>To distinguish animation files that use the new property animation APIs from those that use the
 legacy <a href="{@docRoot}guide/topics/graphics/view-animation.html">view animation</a> framework,
 starting with Android 3.1, you should save the XML files for property animations in the {@code
diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd
index 743832c..b2a78fe 100644
--- a/docs/html/guide/topics/manifest/activity-element.jd
+++ b/docs/html/guide/topics/manifest/activity-element.jd
@@ -28,7 +28,9 @@
           android:<a href="#proc">process</a>="<i>string</i>"
           android:<a href="#screen">screenOrientation</a>=["unspecified" | "user" | "behind" |
                                      "landscape" | "portrait" |
-                                     "sensor" | "nosensor"]
+                                     "reverseLandscape" | "reversePortrait" |
+                                     "sensorLandscape" | "sensorPortrait" |
+                                     "sensor" | "fullSensor" | "nosensor"]
           android:<a href="#state">stateNotNeeded</a>=["true" | "false"]
           android:<a href="#aff">taskAffinity</a>="<i>string</i>"
           android:<a href="#theme">theme</a>="<i>resource or theme</i>"
@@ -589,12 +591,6 @@
        uses, and therefore the choices made in specific contexts, may differ 
        from device to device.</td>
 </tr><tr>
-   <td>"{@code landscape}"</td>
-   <td>Landscape orientation (the display is wider than it is tall).</td>
-</tr><tr>
-   <td>"{@code portrait}"</td>
-   <td>Portrait orientation (the display is taller than it is wide).</td>
-</tr><tr>
    <td>"{@code user}"</td>
    <td>The user's current preferred orientation.</td>
 </tr><tr>
@@ -602,16 +598,47 @@
    <td>The same orientation as the activity that's immediately beneath it in 
        the activity stack.</td>
 </tr><tr>
+   <td>"{@code landscape}"</td>
+   <td>Landscape orientation (the display is wider than it is tall).</td>
+</tr><tr>
+   <td>"{@code portrait}"</td>
+   <td>Portrait orientation (the display is taller than it is wide).</td>
+</tr><tr>
+   <td>"{@code reverseLandscape}"</td>
+   <td>Landscape orientation in the opposite direction from normal landscape.
+<em>Added in API level 9.</em></td>
+</tr><tr>
+   <td>"{@code reversePortrait}"</td>
+   <td>Portrait orientation in the opposite direction from normal portrait.
+<em>Added in API level 9.</em></td>
+</tr><tr>
+   <td>"{@code sensorLandscape}"</td>
+   <td>Landscape orientation, but can be either normal or reverse landscape based on the device
+sensor.
+<em>Added in API level 9.</em></td>
+</tr><tr>
+   <td>"{@code sensorPortrait}"</td>
+   <td>Portrait orientation, but can be either normal or reverse portrait based on the device
+sensor.
+<em>Added in API level 9.</em></td>
+</tr><tr>
    <td>"{@code sensor}"</td>
-   <td>The orientation determined by a physical orientation sensor.  The 
-       orientation of the display depends on how the user is holding the device; 
-       it changes when the user rotates the device.</td>
+   <td>The orientation is determined by the device orientation sensor.  The orientation of the
+display depends on how the user is holding the device; it changes when the user rotates the
+device. Some devices, though, will not rotate to all four possible orientations, by default. To
+allow all four orientations, use {@code "fullSensor"}.</td>
+</tr><tr>
+   <td>"{@code fullSensor}"</td>
+   <td>The orientation is determined by the device orientation sensor for any of the 4 orientations.
+This is similar to {@code "sensor"} except this allows any of the 4 possible screen orientations,
+regardless of what the device will normally do (for example, some devices won't normally use reverse
+portrait or reverse landscape, but this enables those). <em>Added in API level 9.</em></td>
 </tr><tr>
    <td>"{@code nosensor}"</td>
-   <td>An orientation determined without reference to a physical orientation sensor.  
-       The sensor is ignored, so the display will not rotate based on how the user 
-       moves the device.  Except for this distinction, the system chooses the 
-       orientation using the same policy as for the "{@code unspecified}" setting.</td>
+   <td>The orientation is determined without reference to a physical orientation sensor.  The sensor
+is ignored, so the display will not rotate based on how the user moves the device.  Except for this
+distinction, the system chooses the orientation using the same policy as for the "{@code
+unspecified}" setting.</td>
 </tr>
 </table></dd>
 
diff --git a/docs/html/guide/topics/manifest/supports-screens-element.jd b/docs/html/guide/topics/manifest/supports-screens-element.jd
index 605a2bb..81d6e27 100644
--- a/docs/html/guide/topics/manifest/supports-screens-element.jd
+++ b/docs/html/guide/topics/manifest/supports-screens-element.jd
@@ -8,15 +8,15 @@
 <dt>syntax:</dt>
 <dd>
 <pre class="stx">
-&lt;supports-screens android:<a href="#requiresSmallest">requiresSmallestWidthDp</a>="<em>integer</em>"
-                  android:<a href="#compatibleWidth">compatibleWidthLimitDp</a>="<em>integer</em>"
-                  android:<a href="#largestWidth">largestWidthLimitDp</a>="<em>integer</em>"
-                  android:<a href="#resizeable">resizeable</a>=["true"| "false"]
+&lt;supports-screens android:<a href="#resizeable">resizeable</a>=["true"| "false"]
                   android:<a href="#small">smallScreens</a>=["true" | "false"]
                   android:<a href="#normal">normalScreens</a>=["true" | "false"]
                   android:<a href="#large">largeScreens</a>=["true" | "false"]
                   android:<a href="#xlarge">xlargeScreens</a>=["true" | "false"]
-                  android:<a href="#any">anyDensity</a>=["true" | "false"]  /&gt;
+                  android:<a href="#any">anyDensity</a>=["true" | "false"]
+                  android:<a href="#requiresSmallest">requiresSmallestWidthDp</a>="<em>integer</em>"
+                  android:<a href="#compatibleWidth">compatibleWidthLimitDp</a>="<em>integer</em>"
+                  android:<a href="#largestWidth">largestWidthLimitDp</a>="<em>integer</em>"/&gt;
 </pre>
 </dd>
 
@@ -24,37 +24,38 @@
 <dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
 
 <dt>description:</dt>
-<dd>Lets you specify the screen sizes your application supports and enable screen
-compatibility mode for screens larger than what your application supports. By default, a modern
-application (using API Level 4 or higher) supports all screen sizes; older applications are assumed
-to support only the "normal" screen size. Screen size is determined by the number of pixels on the
-screen after the system accounts for screen density scaling.
+<dd>Lets you specify the screen sizes your application supports and enable <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> for screens
+larger than what your application supports. It's important that you always use this element in your
+application to specify the screen sizes your application supports.
 
 <p>An application "supports" a given screen size if it resizes properly to fill the entire screen.
-By default, the system resizes your application UI to fill the screen if you have set
-either <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
-minSdkVersion}</a> or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
-targetSdkVersion}</a> to {@code "4"} or higher. Normal resizing works well for most applications and
-you don't have to do any extra work to make your application work on screens larger than a
-handset device.</p>
-
-<p>In addition to allowing the system to resize your application to fit the current screen, you can
-optimize your UI for different screen sizes by providing <a
+Normal resizing applied by the system works well for most applications and you don't have to do any
+extra work to make your application work on screens larger than a handset device. However, it's
+often important that you optimize your application's UI for different screen sizes by providing <a
 href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">alternative
-layout resources</a> for different sizes. For instance, you might want to modify the layout
-of an activity when it is on a tablet or similar device that has an <em>xlarge</em> screen.</p>
+layout resources</a>. For instance, you might want to modify the layout of an activity
+when it is on a tablet compared to when running on a handset device.</p>
 
-<p>However, if your application does not work well when resized to fit different screen sizes,
-you can use the attributes of the {@code &lt;supports-screens&gt;} element to control whether
-your application should be distributed to smaller screens or have its UI scaled up to fit larger
-screens using the system's screen compatibility mode. When you have not designed for larger screen
-sizes and the normal resizing does not achieve the appropriate results, <em>screen compatibility
-mode</em> will scale your UI by emulating a <em>normal</em> size screen and then zooming in on it so
-that it fills the entire screen&mdash;thus achieving the same layout as a normal handset device on
-the large screen (but this usually causes pixelation and blurring of your UI).</p>
+<p>However, if your application does not work well when resized to fit different screen sizes, you
+can use the attributes of the {@code &lt;supports-screens&gt;} element to control whether your
+application should be distributed to smaller screens or have its UI scaled up ("zoomed") to fit
+larger screens using the system's <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a>. When you
+have not designed for larger screen sizes and the normal resizing does not achieve the appropriate
+results, screen compatibility mode will scale your UI by emulating a <em>normal</em> size
+screen and medium density, then zooming in so that it fills the entire screen. Beware that this
+causes pixelation and blurring of your UI, so it's better if you optimize your UI for large
+screens.</p>
+
+<p class="note"><strong>Note:</strong> Android 3.2 introduces new attributes: {@code
+android:requiresSmallestWidthDp}, {@code android:compatibleWidthLimitDp}, and {@code
+android:largestWidthLimitDp}. If you're developing your application for Android 3.2 and higher,
+you should use these attributes to declare your screen size support, instead of the attributes
+based on generalized screen sizes.</p>
 
 <p>For more information about how to properly support different screen sizes so that you can avoid
-using screen compatibility mode, read
+using screen compatibility mode with your application, read
 <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.</p>
 
 
@@ -62,17 +63,90 @@
 
 <dd>
 <dl class="attr">
+
+  <dt><a name="resizeable"></a>{@code android:resizeable}</dt>
+  <dd>Indicates whether the application is resizeable for different screen sizes. This attribute is
+true, by default. If set false, the system will run your application in <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> on large
+screens.</p>
+
+  <p><strong>This attribute is deprecated</strong>. It was introduced to help applications
+transition from Android 1.5 to 1.6, when support for multiple screens was first introduced. You
+should not use it.</p>
+  </dd>
+  
+  <dt><a name="small"></a>{@code android:smallScreens}</dt>
+  <dd>Indicates whether the application supports smaller screen form-factors.
+     A small screen is defined as one with a smaller aspect ratio than
+     the "normal" (traditional HVGA) screen.  An application that does
+     not support small screens <em>will not be available</em> for
+     small screen devices from external services (such as Android Market), because there is little
+the platform can do to make such an application work on a smaller screen. This is {@code "true"} by
+default.
+  </dd>
+  
+  <dt><a name="normal"></a>{@code android:normalScreens}</dt>
+  <dd>Indicates whether an application supports the "normal" screen
+     form-factors.  Traditionally this is an HVGA medium density
+     screen, but WQVGA low density and WVGA high density are also
+     considered to be normal.  This attribute is "true" by default.
+  </dd>
+  
+  <dt><a name="large"></a>{@code android:largeScreens}</dt>
+  <dd>Indicates whether the application supports larger screen form-factors.
+     A large screen is defined as a screen that is significantly larger
+     than a "normal" handset screen, and thus might require some special care
+     on the application's part to make good use of it, though it may rely on resizing by the
+system to fill the screen.
+  <p>The default value for this actually varies between some versions, so it's better if
+you explicitly declare this attribute at all times. Beware that setting it "false" will
+generally enable <a href="{@docRoot}guide/practices/screen-compat-mode.html">screen
+compatibility mode</a>.</p>
+  </dd>
+
+  <dt><a name="xlarge"></a>{@code android:xlargeScreens}</dt>
+  <dd>Indicates whether the application supports extra large screen form-factors.
+     An xlarge screen is defined as a screen that is significantly larger
+     than a "large" screen, such as a tablet (or something larger) and may require special care
+     on the application's part to make good use of it, though it may rely on resizing by the
+system to fill the screen.
+  <p>The default value for this actually varies between some versions, so it's better if
+you explicitly declare this attribute at all times. Beware that setting it "false" will
+generally enable <a href="{@docRoot}guide/practices/screen-compat-mode.html">screen
+compatibility mode</a>.</p>
+     <p>This attribute was introduced in API level 9.</p>
+  </dd>
+  
+  <dt><a name="any"></a>{@code android:anyDensity}</dt>
+  <dd>Indicates whether the application includes resources to accommodate any screen
+     density.
+     <p>For applications that support Android 1.6 (API level 4) and higher, this is "true"
+by default and <strong>you should not set it "false"</strong> unless you're absolutely certain that
+it's necessary for your application to work. The only time it might be necessary to disable this
+is if your app directly manipulates bitmaps (see the <a
+href="{@docRoot}guide/practices/screens_support.html#DensityConsiderations">Supporting Multiple
+Screens</a> document for more information).</p>
+  </dd>
   
   <dt id="requiresSmallest">{@code android:requiresSmallestWidthDp}</dt>
-  <dd>This attribute specifies the minimum "smallest screen width" with which your
-application is compatible. In order for a device to be considered compatible with your
-application, the shortest side of the available screen space must be equal to or greater than this
-value.
-<p>The width against which your value is compared takes into account screen decorations and system
-UI. For example, if the device has some persistent UI elements on the left or right edge of the
-display, the system declares the device's available width as one that is smaller than the actual
-screen size, accounting for these UI elements because those are screen pixels not available for your
-UI. Thus, the value you use should be the actual smallest width required by your layout.</p>
+  <dd>Specifies the minimum smallestWidth required. The smallestWidth is the shortest dimension of
+the screen space (in {@code dp} units) that must be available to your application UI&mdash;that is,
+the shortest of the available screen's two dimensions. So, in order for a device to be considered
+compatible with your application, the device's smallestWidth must be equal to or greater than this
+value. (Usually, the value you supply for this is the "smallest width" that your layout supports,
+regardless of the screen's current orientation.) 
+
+  <p>For example, a typical handset screen has a smallestWidth of 320dp, a 7" tablet has a
+smallestWidth of 600dp, and a 10" tablet has a smallestWidth of 720dp. These values are generally
+the smallestWidth because they are the shortest dimension of the screen's available space.</p>
+
+<p>The size against which your value is compared takes into account screen decorations and system
+UI. For example, if the device has some persistent UI elements on the display, the system declares
+the device's smallestWidth as one that is smaller than the actual screen size, accounting for these
+UI elements because those are screen pixels not available for your UI. Thus, the value you use
+should be the minimum width required by your layout, regardless of the screen's current
+orientation.</p>
+
 <p>If your application properly resizes for smaller screen sizes (down to the
 <em>small</em> size or a minimum width of 320dp), you do
 not need to use this attribute. Otherwise, you should use a value for this attribute that
@@ -80,12 +154,14 @@
 href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
 smallest screen width qualifier</a> ({@code sw&lt;N&gt;dp}).</p>
 
-<p>For example, a typical handset screen has a minimum width of 320dp, a 7" tablet has a minimum
-width of 600dp, and a 10" tablet has a minimum width of 720dp. If the smallest available screen
-width on a device is less than the value you supply here, then the application is considered
-incompatible with that
-device. External services such as Android Market use this to determine whether a device
-is compatible with your application and prevent incompatible devices from installing it.</p>
+  <p class="caution"><strong>Caution:</strong> The Android system does not pay attention to this
+attribute, so it does not affect how your application behaves at runtime. Instead, it is used
+to enable filtering for your application on services such as Android Market. However,
+<strong>Android Market currently does not support this attribute for filtering</strong> (on Android
+3.2), so you should continue using the other size attributes if your application does not support
+small screens.</p>
+
+<!--
 <p>Beginning with Android 3.2 (API level 13), using this attribute is the preferred way to
 specify the minimum screen size your application requires, instead of using the other attributes
 for small, normal, large, and xlarge screens. The advantage of using this attribute is that you
@@ -95,29 +171,32 @@
 <code><a href="#small">smallScreens</a></code>, <code><a href="#normal">normalScreens</a></code>,
 <code><a href="#large">largeScreens</a></code>, or <code><a href="#xlarge">xlargeScreens</a></code>
 attributes are used instead to determine the smallest screen required.</p>
+-->
      <p>This attribute was introduced in API level 13.</p>
   </dd>
 
   <dt id="compatibleWidth">{@code android:compatibleWidthLimitDp}</dt>
-  <dd>This attribute allows you to enable screen compatibility mode as a user-optional feature by
-specifying the maximum "smallest screen width" for which your application is designed. If the value
-you supply here is less than the shortest side of the available screen space, users can still
-install your application, but are offered to run it in screen compatibility mode. By default, screen
-compatibility mode is disabled and your layout is resized to fit the screen as usual, but a
-button is available in the system bar that allows the user to toggle screen compatibility mode on
-and off.
+  <dd>This attribute allows you to enable <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> as a
+user-optional feature by specifying the maximum "smallest screen width" for which your application
+is designed. If the smallest side of a device's available screen is greater than your value here,
+users can still install your application, but are offered to run it in screen compatibility mode. By
+default, screen compatibility mode is disabled and your layout is resized to fit the screen as
+usual, but a button is available in the system bar that allows the user to toggle screen
+compatibility mode on and off.
   <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
 not need to use this attribute.</p>
-  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates handset
+  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode emulates only handset
 screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
 android:compatibleWidthLimitDp} is larger than 320.</p>
      <p>This attribute was introduced in API level 13.</p>
   </dd>
 
   <dt id="largestWidth">{@code android:largestWidthLimitDp}</dt>
-  <dd>This attribute allows you to force enable screen compatibility mode by specifying the maximum
-"smallest screen width" for which your application is designed. If the value you supply here is less
-than the shortest side of the available screen space, the application runs in screen
+  <dd>This attribute allows you to force-enable <a
+href="{@docRoot}guide/practices/screen-compat-mode.html">screen compatibility mode</a> by specifying
+the maximum "smallest screen width" for which your application is designed. If the smallest side of
+a device's available screen is greater than your value here, the application runs in screen
 compatibility mode with no way for the user to disable it.
   <p>If your application is compatible with all screen sizes and its layout properly resizes, you do
 not need to use this attribute. Otherwise, you should first consider using the <a
@@ -125,102 +204,11 @@
 {@code android:largestWidthLimitDp} attribute only when your application is functionally broken when
 resized for larger screens and screen compatibility mode is the only way that users should use
 your application.</p>
-  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode only emulates handset
+  <p class="note"><strong>Note:</strong> Currently, screen compatibility mode emulates only handset
 screens with a 320dp width, so screen compatibility mode is not applied if your value for {@code
 android:largestWidthLimitDp} is larger than 320.</p>
      <p>This attribute was introduced in API level 13.</p>
   </dd>
-
-  <dt><a name="resizeable"></a>{@code android:resizeable}</dt>
-  <dd>Indicates whether the application is resizeable for different screen sizes. This attribute is
-true, by default, if you have set either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
-{@code "4"} or higher. Otherwise, it is false by default. If set false, the system will not resize
-your application when run on <em>large</em> or <em>xlarge</em> screens. Instead, the
-application appears in a "postage stamp" that equals the <em>normal</em> screen size that your
-application does support. This is less than an ideal experience for users, because the
-application appears smaller than the available screen, but it might help your application run
-normally if it were designed only for the <em>normal</em> screen size and some behaviors do not work
-when resized.</p>
-  <p>To provide the best experience on all screen sizes, you should allow resizing and, if your
-application does not work well on larger screens, follow the guide to <a
-href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> to enable
-additional screen support.</p>
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
-  
-  
-  <dt><a name="small"></a>{@code android:smallScreens}</dt>
-  <dd>Indicates whether the application supports smaller screen form-factors.
-     A small screen is defined as one with a smaller aspect ratio than
-     the "normal" (traditional HVGA) screen.  An application that does
-     not support small screens <em>will not be available</em> for
-     small screen devices from external services (such as Android Market), because there is little
-the platform can do
-     to make such an application work on a smaller screen. If the application has set either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
-{@code "4"} or higher,
-the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
-{@code "false"}.
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
-  
-  <dt><a name="normal"></a>{@code android:normalScreens}</dt>
-  <dd>Indicates whether an application supports the "normal" screen
-     form-factors.  Traditionally this is an HVGA medium density
-     screen, but WQVGA low density and WVGA high density are also
-     considered to be normal.  This attribute is "true" by default,
-     and applications currently should leave it that way.
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
-  
-  <dt><a name="large"></a>{@code android:largeScreens}</dt>
-  <dd>Indicates whether the application supports larger screen form-factors.
-     A large screen is defined as a screen that is significantly larger
-     than a "normal" handset screen, and thus might require some special care
-     on the application's part to make good use of it, though it may rely on resizing by the
-system to fill the screen. If the application has set either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
-{@code "4"} or higher,
-the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
-{@code "false"}.
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
-
-  <dt><a name="xlarge"></a>{@code android:xlargeScreens}</dt>
-  <dd>Indicates whether the application supports extra large screen form-factors.
-     An xlarge screen is defined as a screen that is significantly larger
-     than a "large" screen, such as a tablet (or something larger) and may require special care
-     on the application's part to make good use of it, though it may rely on resizing by the
-system to fill the screen. If the application has set either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
-{@code "4"} or higher,
-the default value for this is {@code "true"}, any value less than {@code "4"} results in this set to
-{@code "false"}.
-     <p>This attribute was introduced in API level 9.</p>
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
-  
-  <dt><a name="any"></a>{@code android:anyDensity}</dt>
-  <dd>Indicates whether the application includes resources to accommodate any screen
-     density.  Older applications (before API Level 4) are assumed unable to
-     accomodate all densities and this is {@code "false"} by default. If the application has set
-either <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> or <a
-href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to
-{@code "4"} or higher,
-the default value for this is {@code "true"}. Otherwise, it is {@code "false"}.
-     You can explicitly supply your abilities here.
-     <p>Based on the "standard" device screen density (medium dpi), the Android framework will scale
-down application assets by a factor of 0.75 (low dpi screens) or scale them up by a factor of 1.5
-(high dpi screens), when you don't provide alternative resources for a specifc screen density. The
-screen density is expressed as dots-per-inch (dpi).</p>
-  <p><strong>This attribute is deprecated</strong> as of API level 13.</p>
-  </dd>
   
 
 </dl></dd>
diff --git a/docs/html/guide/topics/resources/animation-resource.jd b/docs/html/guide/topics/resources/animation-resource.jd
index 3df669c..480ca78 100644
--- a/docs/html/guide/topics/resources/animation-resource.jd
+++ b/docs/html/guide/topics/resources/animation-resource.jd
@@ -10,8 +10,8 @@
       <li><a href="#Property">Property Animation</a></li>
       <li><a href="#View">View Animation</a>
         <ol>
-          <li><a href="Tween">Tween animation</li>
-          <li><a href="Frame">Frame animation</li>
+          <li><a href="Tween">Tween animation</a></li>
+          <li><a href="Frame">Frame animation</a></li>
         </ol>      
       </li>
     </ol>
diff --git a/docs/html/guide/topics/resources/drawable-resource.jd b/docs/html/guide/topics/resources/drawable-resource.jd
index 89c85e2..912b6fd 100644
--- a/docs/html/guide/topics/resources/drawable-resource.jd
+++ b/docs/html/guide/topics/resources/drawable-resource.jd
@@ -1418,7 +1418,7 @@
 The filename is used as the resource ID.</dd>
 
 <dt>compiled resource datatype:</dt>
-<dd>Resource pointer to a {@link android.graphics.drawable.ShapeDrawable}.</dd>
+<dd>Resource pointer to a {@link android.graphics.drawable.GradientDrawable}.</dd>
 
 <dt>resource reference:</dt>
 
@@ -1458,9 +1458,7 @@
         android:bottom="<em>integer</em>" /&gt;
     &lt;<a href="#size-element">size</a>
         android:width="<em>integer</em>"
-        android:color="<em>color</em>"
-        android:dashWidth="<em>integer</em>"
-        android:dashGap="<em>integer</em>" /&gt;
+        android:height="<em>integer</em>" /&gt;
     &lt;<a href="#solid-element">solid</a>
         android:color="<em>color</em>" /&gt;
     &lt;<a href="#stroke-element">stroke</a>
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index ea778c1..252c153 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -334,7 +334,7 @@
       </td>
     </tr>
     <tr id="SmallestScreenWidthQualifier">
-      <td>Smallest screen width</td>
+      <td>smallestWidth</td>
       <td><code>sw&lt;N&gt;dp</code><br/><br/>
         Examples:<br/>
         <code>sw320dp</code><br/>
@@ -343,18 +343,23 @@
         etc.
       </td>
       <td>
-        <p>Specifies the "smallest width" in {@code dp} units that must be available to your
-        application in order for the resources to be used, regardless of the screen's current
-        orientation. For example, if your layout requires that its shortest side be at least 600
-        dp in length at all times, then you can use this to create the layout resources, {@code
-        res/layout-sw600dp/}, and the system will use them only when the shortest side of
-        available screen space it at least 600dp.</p>
-        <p>The width against which the system compares your value takes into account screen
-        decorations and system UI. For example, if the device has some persistent UI elements on the
-        left or right edge of the display, the system declares its own available width as one that
-        is smaller than the actual screen size, accounting for these UI elements because those are
-        screen pixels not available for your UI. Thus, the value you use should be the actual
-        smallest width required by your layout.</p>
+        <p>The fundamental size of a screen, as indicated by the shortest dimension of the available
+screen area. Specifically, the device's smallestWidth is the shortest of the screen's available
+height and width (you may also think of it as the "smallest possible width" for the screen). You can
+use this qualifier to ensure that, regardless of the screen's current orientation, your
+application's has at least {@code &lt;N&gt;} dps of width available for it UI.</p>
+        <p>For example, if your layout requires that its smallest dimension of screen area be at
+least 600 dp at all times, then you can use this qualifer to create the layout resources, {@code
+res/layout-sw600dp/}. The system will use these resources only when the smallest dimension of
+available screen is at least 600dp, regardless of whether the 600dp side is the user-perceived
+height or width. The smallestWidth is a fixed screen size characteristic of the device; <strong>the
+device's smallestWidth does not change when the screen's orientation changes</strong>.</p>
+        <p>The smallestWidth of a device takes into account screen decorations and system UI. For
+example, if the device has some persistent UI elements on the screen that account for space along
+the axis of the smallestWidth, the system declares the smallestWidth to be smaller than the actual
+screen size, because those are screen pixels not available for your UI. Thus, the value you use
+should be the actual smallest dimension <em>required by your layout</em> (usually, this value is the
+"smallest width" that your layout supports, regardless of the screen's current orientation).</p>
         <p>Some values you might use here for common screen sizes:</p>
         <ul>
           <li>320, for devices with screen configurations such as:
@@ -369,19 +374,22 @@
           <li>720, for screens such as 720x1280 mdpi (10" tablet).</li>
         </ul>
         <p>When your application provides multiple resource directories with different values for
-        this qualifier, the system uses the one closest to (without exceeding) the smallest width
-        for the available space. </p>
+        the smallestWidth qualifier, the system uses the one closest to (without exceeding) the
+device's smallestWidth. </p>
         <p><em>Added in API level 13.</em></p>
         <p>Also see the <a
-        href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">{@code
-        android:requiresSmallestWidthDp}</a> attribute, which declares the smallest available width
-        with which your application is compatible, and the {@link
-        android.content.res.Configuration#smallestScreenWidthDp} configuration field, which holds
-        the current smallest screen width for the device.</p>
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html#requiresSmallest">{@code
+android:requiresSmallestWidthDp}</a> attribute, which declares the minimum smallestWidth with which
+your application is compatible, and the {@link
+android.content.res.Configuration#smallestScreenWidthDp} configuration field, which holds the
+device's smallestWidth value.</p>
+        <p>For more information about designing for different screens and using this
+qualifier, see the <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+Multiple Screens</a> developer guide.</p>
       </td>
     </tr>
     <tr id="ScreenWidthQualifier">
-      <td>Screen width</td>
+      <td>Available width</td>
       <td><code>w&lt;N&gt;dp</code><br/><br/>
         Examples:<br/>
         <code>w720dp</code><br/>
@@ -389,7 +397,7 @@
         etc.
       </td>
       <td>
-        <p>Specifies a minimum screen width, in {@code dp} units at which the resource
+        <p>Specifies a minimum available screen width, in {@code dp} units at which the resource
           should be used&mdash;defined by the <code>&lt;N&gt;</code> value.  This
           configuration value will change when the orientation
           changes between landscape and portrait to match the current actual width.</p>
@@ -403,10 +411,13 @@
         <p><em>Added in API level 13.</em></p>
         <p>Also see the {@link android.content.res.Configuration#screenWidthDp}
           configuration field, which holds the current screen width.</p>
+        <p>For more information about designing for different screens and using this
+qualifier, see the <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+Multiple Screens</a> developer guide.</p>
       </td>
     </tr>
     <tr id="ScreenHeightQualifier">
-      <td>Screen height</td>
+      <td>Available height</td>
       <td><code>h&lt;N&gt;dp</code><br/><br/>
         Examples:<br/>
         <code>h720dp</code><br/>
@@ -414,7 +425,7 @@
         etc.
       </td>
       <td>
-        <p>Specifies a minimum screen height, in "dp" units at which the resource
+        <p>Specifies a minimum available screen height, in "dp" units at which the resource
           should be used&mdash;defined by the <code>&lt;N&gt;</code> value.  This
           configuration value will change when the orientation
           changes between landscape and portrait to match the current actual height.</p>
@@ -432,6 +443,9 @@
         <p><em>Added in API level 13.</em></p>
         <p>Also see the {@link android.content.res.Configuration#screenHeightDp}
           configuration field, which holds the current screen width.</p>
+        <p>For more information about designing for different screens and using this
+qualifier, see the <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+Multiple Screens</a> developer guide.</p>
       </td>
     </tr>
     <tr id="ScreenSizeQualifier">
@@ -444,30 +458,35 @@
       </td>
       <td>
         <ul class="nolist">
-        <li>{@code small}: Screens based on the space available on a
-        low-density QVGA screen.  Considering a portrait HVGA display, this has
-        the same available width but less height&mdash;it is 3:4 vs. HVGA's
-        2:3 aspect ratio.  The minimum layout size for this screen configuration
+        <li>{@code small}: Screens that are of similar size to a
+        low-density QVGA screen. The minimum layout size for a small screen
         is approximately 320x426 dp units.  Examples are QVGA low density and VGA high
         density.</li>
-        <li>{@code normal}: Screens based on the traditional
-        medium-density HVGA screen.  A screen is considered to be normal if it is
-        at least this size (independent of density) and not larger.  The minimum
-        layout size for this screen configuration is approximately 320x470 dp units.  Examples
+        <li>{@code normal}: Screens that are of similar size to a
+        medium-density HVGA screen. The minimum
+        layout size for a normal screen is approximately 320x470 dp units.  Examples
         of such screens a WQVGA low density, HVGA medium density, WVGA
         high density.</li>
-        <li>{@code large}: Screens based on the space available on a
-        medium-density VGA screen.  Such a screen has significantly more
-        available space in both width and height than an HVGA display.
-        The minimum layout size for this screen configuration is approximately 480x640 dp units.
+        <li>{@code large}: Screens that are of similar size to a
+        medium-density VGA screen.
+        The minimum layout size for a large screen is approximately 480x640 dp units.
         Examples are VGA and WVGA medium density screens.</li>
         <li>{@code xlarge}: Screens that are considerably larger than the traditional
-        medium-density HVGA screen. The minimum layout size for this screen configuration
+        medium-density HVGA screen. The minimum layout size for an xlarge screen
         is approximately 720x960 dp units.  In most cases, devices with extra large
         screens would be too large to carry in a pocket and would most likely
         be tablet-style devices. <em>Added in API level 9.</em></li>
         </ul>
+        <p class="note"><strong>Note:</strong> Using a size qualifier does not imply that the
+resources are <em>only</em> for screens of that size. If you do not provide alternative
+resources with qualifiers that better match the current device configuration, the system may use
+whichever resources are the <a href="#BestMatch">best match</a>.</p>
+        <p class="caution"><strong>Caution:</strong> If all your resources use a size qualifier that
+is <em>larger</em> than the current screen, the system will <strong>not</strong> use them and your
+application will crash at runtime (for example, if all layout resources are tagged with the {@code
+xlarge} qualifier, but the device is a normal-size screen).</p>
         <p><em>Added in API level 4.</em></p>
+        
         <p>See <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
 Screens</a> for more information.</p>
         <p>Also see the {@link android.content.res.Configuration#screenLayout} configuration field,
@@ -557,7 +576,8 @@
         <code>mdpi</code><br/>
         <code>hdpi</code><br/>
         <code>xhdpi</code><br/>
-        <code>nodpi</code>
+        <code>nodpi</code><br/>
+        <code>tvdpi</code>
       </td>
       <td>
         <ul class="nolist">
@@ -569,21 +589,23 @@
 Level 8</em></li>
           <li>{@code nodpi}: This can be used for bitmap resources that you do not want to be scaled
 to match the device density.</li>
+          <li>{@code tvdpi}: Screens somewhere between mdpi and hdpi; approximately 213dpi. This is
+not considered a "primary" density group. It is mostly intended for televisions and most
+apps shouldn't need it&mdash;providing mdpi and hdpi resources is sufficient for most apps and
+the system will scale them as appropriate. This qualifier was introduced with API level 13.</li>
         </ul>
-        <p><em>Added in API level 4.</em></p>
-        <p>There is thus a 3:4:6:8 scaling ratio between the four densities, so a 9x9 bitmap
-         in ldpi is 12x12 in mdpi, 18x18 in hdpi and 24x24 in xhdpi.</p>
-        <p>When Android selects which resource files to use,
-         it handles screen density differently than the other qualifiers.
-         In step 1 of <a href="#BestMatch">How Android finds the best
-         matching directory</a> (below), screen density is always considered to
-         be a match. In step 4, if the qualifier being considered is screen
-         density, Android selects the best final match at that point,
-         without any need to move on to step 5.
-         </p>
+        <p>There is a 3:4:6:8 scaling ratio between the four primary densities (ignoring the
+tvdpi density). So, a 9x9 bitmap in ldpi is 12x12 in mdpi, 18x18 in hdpi and 24x24 in xhdpi.</p>
+        <p>If you decide that your image resources don't look good enough on a television or
+other certain devices and want to try tvdpi resources, the scaling factor is 1.33*mdpi. For
+example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.</p>
+        <p class="note"><strong>Note:</strong> Using a density qualifier does not imply that the
+resources are <em>only</em> for screens of that density. If you do not provide alternative
+resources with qualifiers that better match the current device configuration, the system may use
+whichever resources are the <a href="#BestMatch">best match</a>.</p>
         <p>See <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
-Screens</a> for more information about how to handle screen sizes and how Android might scale
-your bitmaps.</p>
+Screens</a> for more information about how to handle different screen densities and how Android
+might scale your bitmaps to fit the current density.</p>
        </td>
     </tr>
     <tr id="TouchscreenQualifier">
@@ -993,7 +1015,10 @@
 </p>
 
 <p>By comparing the device configuration to the available alternative resources, Android selects
-drawables from {@code drawable-en-port}. It arrives at this decision using the following logic:</p>
+drawables from {@code drawable-en-port}.</p>
+
+<p>The system arrives at its decision for which resources to use with the following
+logic:</p>
 
 
 <div class="figure" style="width:280px">
@@ -1069,6 +1094,14 @@
 something other than English is never included in the pool of resources checked (though a
 resource directory <em>without</em> the language qualifier is still included).</p>
 
+<p>When selecting resources based on the screen size qualifiers, the system will use resources
+designed for a screen smaller than the current screen if there are no resources that better match
+(for example, a large-size screen will use normal-size screen resources if necessary). However, if
+the only available resources are <em>larger</em> than the current screen, the system will
+<strong>not</strong> use them and your application will crash if no other resources match the device
+configuration (for example, if all layout resources are tagged with the {@code xlarge} qualifier,
+but the device is a normal-size screen).</p>
+
 <p class="note"><strong>Note:</strong> The <em>precedence</em> of the qualifier (in <a
 href="#table2">table 2</a>) is more important
 than the number of qualifiers that exactly match the device. For example, in step 4 above, the last
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index 2db38f1..ecd2d48 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -107,7 +107,7 @@
 String string = {@link android.content.Context#getString(int) getString}(R.string.hello);
 </pre>
 <p>You can use either {@link android.content.Context#getString(int)} or
-{@link android.content.Context#getText(int)} to retieve a string. {@link
+{@link android.content.Context#getText(int)} to retrieve a string. {@link
 android.content.Context#getText(int)} will retain any rich text styling applied to the string.</p>
 
 </dd> <!-- end example -->
@@ -233,9 +233,9 @@
 
 <p>Note that the selection is made based on grammatical necessity. A string for <code>zero</code>
 in English will be ignored even if the quantity is 0, because 0 isn't grammatically different
-from 2, or any other number except 1 ("zero books", "one book", "two books", et cetera).
+from 2, or any other number except 1 ("zero books", "one book", "two books", and so on).
 Don't be misled either by the fact that, say, <code>two</code> sounds like it could only apply to
-the quantity 2: a language may require that 2, 12, 102 (et cetera) are all treated like one
+the quantity 2: a language may require that 2, 12, 102 (and so on) are all treated like one
 another but differently to other quantities. Rely on your translator to know what distinctions
 their language actually insists upon.
 
@@ -359,8 +359,15 @@
 int count = getNumberOfsongsAvailable();
 Resources res = {@link android.content.Context#getResources()};
 String songsFound = res.{@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString}(R.plurals.numberOfSongsAvailable, count);
+getQuantityString}(R.plurals.numberOfSongsAvailable, count, count);
 </pre>
+<p>When using the {@link android.content.res.Resources#getQuantityString(int,int)
+getQuantityString()} method, you need to pass the {@code count} twice if your string includes
+<a href="#FormattingAndStyling">string formatting</a> with a number. For example, for the string
+{@code %d songs found}, the first {@code count} parameter selects the appropriate plural string and
+the second {@code count} parameter is inserted into the {@code %d} placeholder. If your plural
+strings do not include string formatting, you don't need to pass the third parameter to {@link
+android.content.res.Resources#getQuantityString(int,int) getQuantityString}.</p>
 </dd> <!-- end example -->
 
 </dl>
@@ -405,7 +412,7 @@
 </pre>
 
 <p>In this example, the format string has two arguments: {@code %1$s} is a string and {@code %2$d}
-is a decimal number. You can format the string with arguements from your application like this:</p>
+is a decimal number. You can format the string with arguments from your application like this:</p>
 
 <pre>
 Resources res = {@link android.content.Context#getResources()};
diff --git a/docs/html/guide/topics/usb/adk.jd b/docs/html/guide/topics/usb/adk.jd
index b5a3f30..463ec9c 100644
--- a/docs/html/guide/topics/usb/adk.jd
+++ b/docs/html/guide/topics/usb/adk.jd
@@ -59,7 +59,6 @@
         <li><a href="https://dl-ssl.google.com/android/adk/adk_release_0512.zip">ADK package</a></li>
       </ol>
 
-
       <h2>See also</h2>
 
       <ol>
@@ -70,22 +69,29 @@
       <h2>Where to buy</h2>
 
       <ol>
+
+      <li><a href="http://store.arduino.cc/">
+        Arduino Store</a></li>
+
+      <li><a href="https://store.diydrones.com/ProductDetails.asp?ProductCode=BR-PhoneDrone">
+        DIY Drones</a></li>
+
+      <li><a href=
+        "http://www.microchip.com/android">
+        Microchip</a></li>
+
       <li><a href="http://shop.moderndevice.com/products/freeduino-usb-host-board">
         Modern Device</a></li>
 
+      <li><a href=
+        "http://www.rt-net.jp/shop/index.php?main_page=product_info&cPath=3_4&products_id=1">
+        RT Corp</a></li>
+
       <li><a href="http://www.seeedstudio.com/depot/seeeduino-adk-main-board-p-846.html">
         Seeed Studio</a></li>
 
-        <li><a href=
-        "http://www.rt-net.jp/shop/index.php?main_page=product_info&cPath=3_4&products_id=1">
-        RT Corp</a></li>
-
-        <li><a href=
-        "http://www.microchip.com/android">
-        Microchip</a></li>
-
-        <li><a href="https://store.diydrones.com/ProductDetails.asp?ProductCode=BR-PhoneDrone">
-        DIY Drones</a></li>
+      <li><a href="http://www.sparkfun.com/products/10748">
+        SparkFun</a></li>
 
       </ol>
     </div>
@@ -114,22 +120,31 @@
   development boards:</p>
 
   <ul>
-    <li><a href="http://shop.moderndevice.com/products/freeduino-usb-host-board">Modern
-    Device</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
 
-    <li><a href="http://www.seeedstudio.com/depot/seeeduino-adk-main-board-p-846.html">
-    Seeed Studio</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
-
-    <li><a href="http://www.rt-net.jp/shop/index.php?main_page=product_info&cPath=3_4&products_id=1">
-    RT Corp</a> provides an Arduino-compatible board based on the Android ADK board design.</li>
-
-    <li><a href="http://www.microchip.com/android">Microchip</a> provides a A PIC based USB
-    microcontroller board.</li>
+    <li>The <a href="http://store.arduino.cc/">Arduino Store</a> provides the Arduino Mega ADK
+    (in <a href="http://store.arduino.cc/eu/index.php?main_page=product_info&cPath=11_12&products_id=144">EU nations</a>
+    or <a href="http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11_12&products_id=144">non-EU nations</a>)
+    that is based on the ATmega2560 and supports the ADK firmware.</li>
 
     <li><a href="https://store.diydrones.com/ProductDetails.asp?ProductCode=BR-PhoneDrone">DIY
     Drones</a> provides an Arduino-compatible board geared towards RC (radio controlled) and UAV
     (unmanned aerial vehicle) enthusiasts.</li>
 
+    <li><a href="http://www.microchip.com/android">Microchip</a> provides a PIC based USB
+    microcontroller board.</li>
+
+    <li><a href="http://shop.moderndevice.com/products/freeduino-usb-host-board">Modern
+    Device</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
+
+    <li><a href="http://www.rt-net.jp/shop/index.php?main_page=product_info&cPath=3_4&products_id=1">
+    RT Corp</a> provides an Arduino-compatible board based on the Android ADK board design.</li>
+
+    <li><a href="http://www.seeedstudio.com/depot/seeeduino-adk-main-board-p-846.html">
+    Seeed Studio</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
+
+    <li><a href="http://www.sparkfun.com/products/10748">
+    SparkFun</a>'s IOIO board now has beta support for the ADK firmware.</li>
+
   </ul>
 
   <p>We expect more hardware distributers to create a variety of kits, so please stay tuned for
@@ -140,7 +155,7 @@
   accessory that is based on the <a href="http://www.arduino.cc/">Arduino open source electronics
   prototyping platform</a>, the accessory's hardware design files, code that implements the
   accessory's firmware, and the Android application that interacts with the accessory. The hardware
-  design files and firmware code are contained in the <a href=ctive 
+  design files and firmware code are contained in the <a href=
   "https://dl-ssl.google.com/android/adk/adk_release_0512.zip">ADK package download</a>.</p>
   <p>The main hardware and software components of the ADK include:</p>
 
@@ -347,7 +362,7 @@
     2.3.4 devices that support accessory mode. This library is also forward compatible with Android
     3.1 or newer devices that support accessory mode. If you only care about Android 3.1 or newer
     devices, all you need is API Level 12. For more information on deciding which API level to use,
-    see the <a href="{@docRoot}guide/topics/USB/accessory.html#choosing">USB Accessory</a>
+    see the <a href="{@docRoot}guide/topics/usb/accessory.html#choosing">USB Accessory</a>
     documentation.</li>
 
     <li>Click <strong>File &gt; New &gt; Project...</strong>, then select <strong>Android &gt;
@@ -885,4 +900,4 @@
 </pre>
 
   <p>See the <code>firmware/demokit/demokit.pde</code> file for information about how the ADK board
-  reads and writes data.</p>
\ No newline at end of file
+  reads and writes data.</p>
diff --git a/docs/html/guide/topics/usb/host.jd b/docs/html/guide/topics/usb/host.jd
index 942708d..4967033 100644
--- a/docs/html/guide/topics/usb/host.jd
+++ b/docs/html/guide/topics/usb/host.jd
@@ -264,11 +264,7 @@
 UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
 ...  
 HashMap&lt;String, UsbDevice&gt; deviceList = manager.getDeviceList();
-Iterator&lt;UsbDevice&gt; deviceIterator  = deviceList.values().iterator();
-while(deviceIterator.hasNext()){
-    UsbDevice device = deviceIterator.next();
-    // your code
-}
+UsbDevice device = deviceList.get("deviceName");
 </pre>
 
   <p>If desired, you can also just obtain an iterator from the hash map and process each device one
diff --git a/docs/html/images/home/market_icon.png b/docs/html/images/home/market_icon.png
new file mode 100644
index 0000000..ceb76f3
--- /dev/null
+++ b/docs/html/images/home/market_icon.png
Binary files differ
diff --git a/docs/html/images/market/version-codes.png b/docs/html/images/market/version-codes.png
new file mode 100644
index 0000000..c0c9858
--- /dev/null
+++ b/docs/html/images/market/version-codes.png
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index dce46f9..a8b61bf 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -11,15 +11,14 @@
                             </div><!-- end homeTitle -->
                             <div id="announcement-block">
                             <!-- total max width is 520px -->
-                                  <img src="{@docRoot}assets/images/home/IO-logo-2011.png"
-alt="Android at Google IO 2011" width="200px"
-style="padding-left:22px;padding-bottom:15px;padding-top:15px;"/>
+                                  <img src="{@docRoot}images/home/market_icon.png"
+alt="Android Market" width="120px" style="padding:10px 53px 5px"/>
                                   <div id="announcement" style="width:275px">
-    <p>Thanks to everybody who joined us at Google I/O! If you couldn't make it or would like to
-review any of the Android sessions, they're now available on YouTube at the <a
-href="http://www.youtube.com/googledevelopers">Google Developers</a> channel, along with the keynote
-and other developer sessions. You can also find all the Google I/O Android sessions on this site, on
-the <a href="{@docRoot}videos/index.html">Videos</a> page.</p>
+    <p>We've completely redesigned Android Market for phones to make it easier to
+explore Android apps, games, and other content. Look for the new version coming to your
+Android phone!</p> <p><a
+href="http://android-developers.blogspot.com/2011/07/new-android-market-for-phones.html">Learn more
+&raquo;</a></p>
                                 </div> <!-- end annoucement -->
                             </div> <!-- end annoucement-block -->
                         </div><!-- end topAnnouncement -->
@@ -130,14 +129,14 @@
     'sdk': {
       'layout':"imgLeft",
       'icon':"sdk-small.png",
-      'name':"Android 3.1",
+      'name':"Android 3.2",
       'img':"honeycomb-android.png",
-      'title':"Android 3.1 now available!",
-      'desc': "<p>Android 3.1 includes new developer features such as APIs for USB "
-+ "accessories, MTP/PTP, and RTP, as well as new input events from mice, trackballs, joysticks, "
-+ "and more.</p>"
-+ "<p>For more information about all the new APIs in Android 3.1, read the "
-+ "<a href='{@docRoot}sdk/android-3.1.html'>version notes</a>.</p>"
+      'title':"Android 3.2 is here!",
+      'desc': "<p>Android 3.2 is a minor feature update that includes new APIs that allow you to "
++ "better target your layouts for specific screen sizes and other miscellaneous new APIs.</p>"
++ "<p>For more information about all the changes in Android 3.2, read the "
++ "<a href='{@docRoot}sdk/android-3.2.html'>version notes</a> and <a "
++ "href='{@docRoot}sdk/api_diff/13/changes.html'>diff report</a>.</p>"
 /*
 + "<p>If you have an existing SDK, add Android 3.0 as an "
 + "<a href='{@docRoot}sdk/adding-components.html'>SDK "
@@ -153,10 +152,11 @@
       'img':"GTV_icon_large.png",
       'title':"Google TV!",
       'desc': "<p>Build something big. By big, we mean <em>worthy-of-the-living-room</em> big.</p>"
-	        +  " <p>Use <a href='http://code.google.com/tv'>Google TV</a> to bring the power of Android" 
+	        +  " <p>Google TV brings the power of Android" 
 	        +  " and Google Chrome to television."
-			+  " The average American watches five hours of TV per day. Give them the web and apps"
-			+  " to update their status, listen to music, watch web videos, and much more...</p>"
+		+  " The average American watches five hours of TV per day. Give them the apps"
+		+  " to update their status, listen to music, watch web videos, and more.</p>"
+                +  "<p><a href='http://code.google.com/tv'>Develop for Google TV &raquo;</a></p>"
     },
 
 
diff --git a/docs/html/resources/tutorials/views/hello-gallery.jd b/docs/html/resources/tutorials/views/hello-gallery.jd
index 00757f5..5f2ed32 100644
--- a/docs/html/resources/tutorials/views/hello-gallery.jd
+++ b/docs/html/resources/tutorials/views/hello-gallery.jd
@@ -34,10 +34,10 @@
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
 
-    Gallery g = (Gallery) findViewById(R.id.gallery);
-    g.setAdapter(new ImageAdapter(this));
+    Gallery gallery = (Gallery) findViewById(R.id.gallery);
+    gallery.setAdapter(new ImageAdapter(this));
 
-    g.setOnItemClickListener(new OnItemClickListener() {
+    gallery.setOnItemClickListener(new OnItemClickListener() {
         public void onItemClick(AdapterView parent, View v, int position, long id) {
             Toast.makeText(HelloGallery.this, "" + position, Toast.LENGTH_SHORT).show();
         }
@@ -101,10 +101,10 @@
 
     public ImageAdapter(Context c) {
         mContext = c;
-        TypedArray a = obtainStyledAttributes(R.styleable.HelloGallery);
-        mGalleryItemBackground = a.getResourceId(
+        TypedArray attr = mContext.obtainStyledAttributes(R.styleable.HelloGallery);
+        mGalleryItemBackground = attr.getResourceId(
                 R.styleable.HelloGallery_android_galleryItemBackground, 0);
-        a.recycle();
+        attr.recycle();
     }
 
     public int getCount() {
@@ -120,14 +120,14 @@
     }
 
     public View getView(int position, View convertView, ViewGroup parent) {
-        ImageView i = new ImageView(mContext);
+        ImageView imageView = new ImageView(mContext);
 
-        i.setImageResource(mImageIds[position]);
-        i.setLayoutParams(new Gallery.LayoutParams(150, 100));
-        i.setScaleType(ImageView.ScaleType.FIT_XY);
-        i.setBackgroundResource(mGalleryItemBackground);
+        imageView.setImageResource(mImageIds[position]);
+        imageView.setLayoutParams(new Gallery.LayoutParams(150, 100));
+        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
+        imageView.setBackgroundResource(mGalleryItemBackground);
 
-        return i;
+        return imageView;
     }
 }
 </pre>
diff --git a/docs/html/sdk/android-2.1.jd b/docs/html/sdk/android-2.1.jd
index 6eba6f09..3f28551 100644
--- a/docs/html/sdk/android-2.1.jd
+++ b/docs/html/sdk/android-2.1.jd
@@ -73,51 +73,44 @@
 {@sdkPlatformVersion} platforms are installed in your SDK environment, refer to
 the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
 
-<script type="text/javascript">
-function toggleDiv(link) {
-  var toggleable = $(link).parent();
-  if (toggleable.hasClass("closed")) {
-    //$(".toggleme", toggleable).slideDown("fast");
-    toggleable.removeClass("closed");
-    toggleable.addClass("open");
-    $(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png"));
-  } else {
-    //$(".toggleme", toggleable).slideUp("fast");
-    toggleable.removeClass("open");
-    toggleable.addClass("closed");
-    $(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png"));
-  }
-  return false;
-}
-</script>
-<style>
-.toggleable {
-  padding: .25em 1em 0em 1em;
-  margin-bottom: 0;
-}
-.toggleme {
-  padding: 1em 1em 0 2em;
-  line-height:1em;
-}
-.toggleable a {
-  text-decoration:none;
-}
-.toggleme a {
-  text-decoration:underline;
-}
-.toggleable.closed .toggleme {
-  display:none;
-}
-#jd-content .toggle-img {
-  margin:0;
-}
-</style>
 
-<div class="toggleable opened">
-  <a href="#" onclick="return toggleDiv(this)">
-        <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" />
-        Android 2.1, Revision 2</a> <em>(May 2010)</em></a>
-  <div class="toggleme">
+<div class="toggle-content opened" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-opened.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 3</a> <em>(July 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
+<dl>
+<dt>Dependencies:</dt>
+<dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or
+higher.</p>
+</dd>
+<dt>Notes:</dt>
+<dd>
+<p>Improvements to the platform's rendering library to support the visual layout editor in the ADT
+Eclipse plugin. This revision allows for more drawing features in ADT and fixes several
+bugs in the previous rendering library. It also unlocks several editor features that were added in
+ADT 12.</p>
+</dd>
+</dl>
+
+</div>
+</div>
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 2</a> <em>(May 2010)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
 <dl>
 <dt>Dependencies:</dt>
 <dd>
@@ -136,11 +129,15 @@
  </div>
 </div>
 
-<div class="toggleable closed">
-  <a href="#" onclick="return toggleDiv(this)">
-        <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px" />
-        Android 2.1, Revision 1</a> <em>(January 2010)</em></a>
-  <div class="toggleme">
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 1</a> <em>(January 2010)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
 <dl>
 <dt>Dependencies:</dt>
 <dd>
diff --git a/docs/html/sdk/android-2.2.jd b/docs/html/sdk/android-2.2.jd
index 063a10f..c22220c 100644
--- a/docs/html/sdk/android-2.2.jd
+++ b/docs/html/sdk/android-2.2.jd
@@ -74,54 +74,46 @@
 {@sdkPlatformVersion} platforms are installed in your SDK environment, refer to
 the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
 
-<script type="text/javascript">
-function toggleDiv(link) {
-  var toggleable = $(link).parent();
-  if (toggleable.hasClass("closed")) {
-    //$(".toggleme", toggleable).slideDown("fast");
-    toggleable.removeClass("closed");
-    toggleable.addClass("open");
-    $(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png"));
-  } else {
-    //$(".toggleme", toggleable).slideUp("fast");
-    toggleable.removeClass("open");
-    toggleable.addClass("closed");
-    $(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png"));
-  }
-  return false;
-}
-</script>
-<style>
-.toggleable {
-  padding: .25em 1em 0em 1em;
-  margin-bottom: 0;
-}
-.toggleme {
-  padding: 1em 1em 0 2em;
-  line-height:1em;
-}
-.toggleable a {
-  text-decoration:none;
-}
-.toggleme a {
-  text-decoration:underline;
-}
-.toggleable.closed .toggleme {
-  display:none;
-}
-#jd-content .toggle-img {
-  margin:0;
-}
-</style>
 
-<div class="toggleable opened">
-  <a href="#" onclick="return toggleDiv(this)">
-        <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" />
-        Android {@sdkPlatformVersion}, Revision 2</a> <em>(July 2010)</em></a>
-  <div class="toggleme">
+<div class="toggle-content opened" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-opened.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 3</a> <em>(July 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
 <dl>
 <dt>Dependencies:</dt>
 <dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or
+higher.</p>
+</dd>
+<dt>Notes:</dt>
+<dd>
+<p>Improvements to the platform's rendering library to support the visual layout editor in the ADT
+Eclipse plugin. This revision allows for more drawing features in ADT and fixes several
+bugs in the previous rendering library. It also unlocks several editor features that were added in
+ADT 12.</p>
+</dd>
+</dl>
+
+</div>
+</div>
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 2</a> <em>(July 2010)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+<dt>Dependencies:</dt>
+<dd>
 <p>Requires SDK Tools r6 or higher.</p>
 </dd>
 
@@ -138,11 +130,15 @@
  </div>
 </div>
 
-<div class="toggleable closed">
-  <a href="#" onclick="return toggleDiv(this)">
-        <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px" />
-        Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2010)</em></a>
-  <div class="toggleme">
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2010)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
 <dl>
 <dt>Dependencies:</dt>
 <dd>
diff --git a/docs/html/sdk/android-2.3.3.jd b/docs/html/sdk/android-2.3.3.jd
index 10fc049..7a5b044 100644
--- a/docs/html/sdk/android-2.3.3.jd
+++ b/docs/html/sdk/android-2.3.3.jd
@@ -65,59 +65,52 @@
 {@sdkPlatformVersion} platforms are installed in your SDK environment, refer to
 the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
 
-<script type="text/javascript">
-function toggleDiv(link) {
-  var toggleable = $(link).parent();
-  if (toggleable.hasClass("closed")) {
-    //$(".toggleme", toggleable).slideDown("fast");
-    toggleable.removeClass("closed");
-    toggleable.addClass("open");
-    $(".toggle-img", toggleable).attr("title", "hide").attr("src", (toRoot + "assets/images/triangle-opened.png"));
-  } else {
-    //$(".toggleme", toggleable).slideUp("fast");
-    toggleable.removeClass("open");
-    toggleable.addClass("closed");
-    $(".toggle-img", toggleable).attr("title", "show").attr("src", (toRoot + "assets/images/triangle-closed.png"));
-  }
-  return false;
-}
-</script>
-<style>
-.toggleable {
-  padding: .25em 1em 0em 1em;
-  margin-bottom: 0;
-}
-.toggleme {
-  padding: 1em 1em 0 2em;
-  line-height:1em;
-}
-.toggleable a {
-  text-decoration:none;
-}
-.toggleme a {
-  text-decoration:underline;
-}
-.toggleable.closed .toggleme {
-  display:none;
-}
-#jd-content .toggle-img {
-  margin:0;
-}
-</style>
 
-<div class="toggleable opened">
-  <a href="#" onclick="return toggleDiv(this)">
-        <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" />
-        Android {@sdkPlatformVersion}, Revision 1</a> <em>(February 2011)</em></a>
-  <div class="toggleme">
+<div class="toggle-content opened" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-opened.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 2</a> <em>(July 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
+<dl>
+<dt>Dependencies:</dt>
+<dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or
+higher.</p>
+</dd>
+<dt>Notes:</dt>
+<dd>
+<p>Improvements to the platform's rendering library to support the visual layout editor in the ADT
+Eclipse plugin. This revision allows for more drawing features in ADT and fixes several
+bugs in the previous rendering library. It also unlocks several editor features that were added in
+ADT 12.</p>
+</dd>
+</dl>
+
+</div>
+</div>
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 1</a> <em>(February 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
 <dl>
 <dt>Dependencies:</dt>
 <dd>
 <p>Requires SDK Tools r9 or higher.</p>
 </dd>
-
 </dl>
- </div>
+
+</div>
 </div>
 
 
diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd
index d73bd63..7b04446 100644
--- a/docs/html/sdk/android-3.0.jd
+++ b/docs/html/sdk/android-3.0.jd
@@ -62,25 +62,52 @@
 refer to the "Installed Packages" listing in the Android SDK and AVD Manager.</p>
 
 
+
 <div class="toggle-content opened" style="padding-left:1em;">
 
-  <p><a href="#" onclick="return toggleContent(this)">
-    <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" alt="" />
-    Android {@sdkPlatformVersion}, Revision 1</a> <em>(February 2011)</em>
-  </a></p>
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-opened.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 2</a> <em>(July 2011)</em>
+</a></p>
 
-  <div class="toggle-content-toggleme" style="padding-left:2em;">
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
+<dl>
+<dt>Dependencies:</dt>
+<dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or
+higher.</p>
+</dd>
+<dt>Notes:</dt>
+<dd>
+<p>Improvements to the platform's rendering library to support the visual layout editor in the ADT
+Eclipse plugin. This revision allows for more drawing features in ADT and fixes several
+bugs in the previous rendering library. It also unlocks several editor features that were added in
+ADT 12.</p>
+</dd>
+</dl>
+
+</div>
+</div>
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 1</a> <em>(February 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
     
 <dl>
-  
 <dt>Dependencies:</dt>
 <dd>
 <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r10</a> or higher.</p>
 </dd>
-
 </dl>
 
-  </div>
+</div>
 </div>
 
 
diff --git a/docs/html/sdk/android-3.1.jd b/docs/html/sdk/android-3.1.jd
index 1614722..0d2d7f8 100644
--- a/docs/html/sdk/android-3.1.jd
+++ b/docs/html/sdk/android-3.1.jd
@@ -68,25 +68,79 @@
 
 <div class="toggle-content opened" style="padding-left:1em;">
 
-  <p><a href="#" onclick="return toggleContent(this)">
-    <img src="{@docRoot}assets/images/triangle-opened.png"
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-opened.png"
 class="toggle-content-img" alt="" />
-    Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2011)</em>
-  </a></p>
+  Android {@sdkPlatformVersion}, Revision 3</a> <em>(July 2011)</em>
+</a></p>
 
-  <div class="toggle-content-toggleme" style="padding-left:2em;">
+<div class="toggle-content-toggleme" style="padding-left:2em;">
 
 <dl>
+<dt>Dependencies:</dt>
+<dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or
+higher.</p>
+</dd>
+<dt>Notes:</dt>
+<dd>
+<p>Improvements to the platform's rendering library to support the visual layout editor in the ADT
+Eclipse plugin. This revision allows for more drawing features in ADT and fixes several
+bugs in the previous rendering library. It also unlocks several editor features that were added in
+ADT 12.</p>
+</dd>
+</dl>
 
+</div>
+</div>
+
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 2</a> <em>(May 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
+<dl>
 <dt>Dependencies:</dt>
 <dd>
 <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r11</a> or
 higher.</p>
 </dd>
-
+<dt>Notes:</dt>
+<dd>
+<p>Fixes an issue with the visual layout editor rendering library that prevented Android 3.1 from
+running in ADT.</p>
+</dd>
 </dl>
 
-  </div>
+</div>
+</div>
+
+
+<div class="toggle-content closed" style="padding-left:1em;">
+
+<p><a href="#" onclick="return toggleContent(this)">
+  <img src="{@docRoot}assets/images/triangle-closed.png"
+class="toggle-content-img" alt="" />
+  Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2011)</em>
+</a></p>
+
+<div class="toggle-content-toggleme" style="padding-left:2em;">
+
+<dl>
+<dt>Dependencies:</dt>
+<dd>
+<p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r11</a> or
+higher.</p>
+</dd>
+</dl>
+
+</div>
 </div>
 
 
diff --git a/docs/html/sdk/compatibility-library.jd b/docs/html/sdk/compatibility-library.jd
index d4669e5..c8cd5b2 100644
--- a/docs/html/sdk/compatibility-library.jd
+++ b/docs/html/sdk/compatibility-library.jd
@@ -1,4 +1,4 @@
-page.title=Compatibility Library
+page.title=Compatibility Package
 
 @jd:body
 
@@ -8,9 +8,10 @@
 <h2>In this document</h2>
 <ol>
   <li><a href="#Notes">Revisions</a></li>
-  <li><a href="#Installing">Installing the Compatibility Library</a></li>
-  <li><a href="#SettingUp">Setting Up a Project to Use the Library</a></li>
-  <li><a href="#Using">Using Some of the Library APIs</a></li>
+  <li><a href="#Downloading">Downloading the Compatibility Package</a></li>
+  <li><a href="#SettingUp">Setting Up a Project to Use a Library</a></li>
+  <li><a href="#Using">Using the v4 Library APIs</a></li>
+  <li><a href="#Docs">Reference Docs</a></li>
   <li><a href="#Samples">Samples</a></li>
 </ol>
 
@@ -26,42 +27,92 @@
 
 <p><em>Minimum API level supported:</em> <b>4</b></p>
 
-<p>The Compatibility Library is a static library you can add to your Android application in order to
-use APIs not available in older versions of the Android platform. The primary goal of the library is
-to provide APIs introduced in Andriod 3.0 for older versions of Android so that all applications can
-use them.</p>
+<p>The Compatibility Package includes static "support libraries" that you can add to your Android
+application in order to use APIs that are either not available for older platform versions or that
+offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your
+development by offering more APIs that you can bundle with your application so you can
+worry less about platform versions.</p>
 
-<p>If you're not able to use APIs introduced in Android 3.0 directly, because you want to remain
-backward-compatible, the Compatibility Library provides your application access to self-contained
-versions of some of the latest APIs that you can use with older versions of Android. Most
-importantly, the library provides implementations of the {@link android.app.Fragment} and {@link
-android.content.Loader} APIs, so you can use them in a way that's compatible with devices running
-Android 1.6 (API level 4) and higher. Thus, you can more easily create a single APK that supports a
-majority of devices and provide larger devices (such as tablets) a fully optimized experience by
-using <a href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> in your activity
-design.</p>
+<p class="note"><strong>Note:</strong> The Compatibility Package includes more than one support
+library. Each one has a different <em>minimum API level</em>. For example, one library requires API
+level 4 or higher, while another requires API level 13 or higher. The minimum version is indicated
+by the directory name, such as {@code v4/} and {@code v13/}.</p>
 
 
 <h2 id="Notes">Revisions</h2>
 
 <p>The sections below provide notes about successive releases of
-the Compatibility Library, as denoted by revision number.</p>
+the Compatibility Package, as denoted by revision number.</p>
 
 
 <div class="toggle-content open">
 
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" />
-    Compatibility Library, revision 2 (May 2011)
+    Compatibility Package, revision 3 (July 2011)
   </a></p>
 
   <div class="toggle-content-toggleme" style="padding-left:2em"> 
     <dl>
-    <dt>Changes:</dt>
+      <dt>Changes for v4 support library:</dt>
+      <dd>
+        <ul>
+          <li>Adds support for {@link android.app.Fragment.SavedState}</li>
+          <li>Adds {@code MotionEventCompat} to support newer {@link
+android.view.MotionEvent} APIs</li>
+          <li>Adds {@code VelocityTrackerCompat} to support a newer {@link
+android.view.VelocityTracker} APIs</li>
+          <li>Adds {@code ViewConfigurationCompat} to support a newer {@link
+android.view.ViewConfiguration} APIs</li>
+          <li>All new APIs (available only in the support library) that allow you to create UIs
+with horizontal paging, allowing users to swipe left and right between content views. Classes to
+support this include:
+            <ul>
+              <li>{@code ViewPager}: A {@link android.view.ViewGroup} that manages the
+layout for the child views, which the user can swipe between.</li>
+              <li>{@code PagerAdapter}: An adapter that populates the {@code ViewPager} with the
+views that represent each page.</li>
+              <li>{@code FragmentPagerAdapter}: An extension of {@code PagerAdapter} for flipping
+between fragments.</li>
+              <li>{@code FragmentStatePagerAdapter}: An extension of {@code PagerAdapter} for
+flipping between fragments that uses the library's support for {@link
+android.app.Fragment.SavedState}.</li>
+            </ul>
+          </li>
+        </ul>
+      </dd>
+      <dt>New v13 support library:</dt>
+      <dd>
+        <ul>
+          <li>Includes the {@code FragmentPagerAdapter} and {@code FragmentStatePagerAdapter}
+to support the horizontal paging.
+          <p>These are exactly the same as the APIs added to the v4 support library, but rely on
+other platform components in Android 3.2. Use this library instead of v4 if you're developing for
+Android 3.2 and higher (all other APIs in the v4 library are already available with API level
+13).</p>
+          </li>
+        </ul>
+      </dd>
+    </dl>
+  </div>
+
+</div>
+
+
+<div class="toggle-content closed">
+
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
+    Compatibility Package, revision 2 (May 2011)
+  </a></p>
+
+  <div class="toggle-content-toggleme" style="padding-left:2em"> 
+    <dl>
+    <dt>Changes for v4 library:</dt>
     <dd>
       <ul>
-        <li>Support for fragment animations.</li>
-        <li>Fix {@code Fragment.onActivityResult()} bug.</li>
+        <li>Support for fragment animations</li>
+        <li>Fix {@code Fragment.onActivityResult()} bug</li>
       </ul>
     </dd>
     </dl>
@@ -74,21 +125,21 @@
 
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
-    Compatibility Library, revision 1 (March 2011)
+    Compatibility Package, revision 1 (March 2011)
   </a></p>
 
   <div class="toggle-content-toggleme" style="padding-left:2em"> 
-      <p>Initial release of the library.</p>
+      <p>Initial release with the v4 library.</p>
   </div>
 
 </div>
 
 
 
-<h2 id="Installing">Installing the Compatibility Library</h2>
+<h2 id="Downloading">Downloading the Compatibility Package</h2>
 
-<p>The Compatibility Library is provided as a downloadable package from the Android SDK and AVD
-Manager. To install the library:</p>
+<p>The Compatibility Package is provided as a downloadable package from the Android SDK and AVD
+Manager. To install:</p>
 
 <ol>
   <li>Launch the SDK and AVD Manager. 
@@ -101,43 +152,53 @@
   <li>Proceed to install the package.</li>
 </ol>
 
-<p>When done, all files (including source code, samples, and the {@code .jar} file) are saved
-into the <code>&lt;sdk&gt;/extras/android/compatibility/</code> directory. The next directory
-name is {@code v4}, which indicates the lowest compatible version for the library within. That
-is, the code in {@code v4/} supports API level 4 and above. (There may be future libraries that
-have a different minimum version, so they will be saved alongside this one.)</p>
+<p>When done, all files (including source code, samples, and the {@code .jar} files) are saved
+into the <code>&lt;sdk&gt;/extras/android/compatibility/</code> directory. This directory contains
+each of the different support libraries, such as the library for API level 4 and up and the library
+for API level 13 and up, each named with the respective version (such as {@code v4/}).</p>
 
 
-<h2 id="SettingUp">Setting Up a Project to Use the Library</h2>
+<h2 id="SettingUp">Setting Up a Project to Use a Library</h2>
 
-<p>To add the Compatibility Library to your Android project:</p>
+<p>To add one of the libraries to your Android project:</p>
 <ol>
   <li>In your Android project, create a directory named {@code libs} at the root of your
 project (next to {@code src/}, {@code res/}, etc.)</li>
-  <li>Navigate to {@code &lt;sdk&gt;/extras/android/compatibility/v4/}.</li>
-  <li>Copy the {@code android-support-v4.jar} file into your project {@code libs/} directory.</li>
-  <li>Add the JAR to your project build path. In Eclipse, right-click the JAR file in the
-Package Explorer, select <strong>Build Path</strong> &gt; <strong>Add to Build Path</strong>.
-You should then see the JAR file appear in a new directory called Referenced Libraries.</li>
+  <li>Locate the JAR file for the library you want to use and copy it into the {@code
+libs/} directory.
+    <p>For example, the library that supports API level 4 and up is located at {@code
+&lt;sdk&gt;/extras/android/compatibility/v4/android-support-v4.jar}.</p>
+  </li>
+  <li>Add the JAR to your project build path. 
+    <p>In Eclipse, right-click the JAR file in the Package Explorer, select <strong>Build
+Path</strong> &gt; <strong>Add to Build Path</strong>. You should then see the JAR file appear in a
+new directory called Referenced Libraries.</p>
+  </li>
 </ol>
 
-<p>Your application is now ready to use fragments, loaders and other APIs from the library. All the
-provided APIs are in the {@code android.support.v4} package.</p>
+<p>Your application is now ready to use the library APIs. All the
+provided APIs are available in the {@code android.support} package (for
+example, {@code android.support.v4}).</p>
+
+<p class="note"><strong>Tip:</strong> To see the library APIs in action, take a look at the sample
+apps in {@code extras/android/compatibility/&lt;version&gt;/samples/}.</p>
 
 <p class="warning"><strong>Warning:</strong> Be certain that you not confuse the standard
-{@code android} packages with those in {@code android.support.v4}. Some code completion tools might
+{@code android} packages with those in {@code android.support} library. Some code completion tools
+might
 get this wrong, especially if you're building against recent versions of the platform. To be safe,
 keep your build target set to the same version as you have defined for your <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a>
-and double check the import statements for classes that are duplicated in the Compatibility
-Library, such as {@code SimpleCursorAdapter}.</p>
+and double check the import statements for classes that also exist in the support library, such as
+{@code SimpleCursorAdapter}.</p>
 
 
-<h2 id="Using">Using Some of the Library APIs</h2>
+<h2 id="Using">Using the v4 Library APIs</h2>
 
-<p>The Compatibility Library provides access to several classes introduced with Android 3.0, plus
-some updated version of existing classes. Some of the most useful and notable classes in the
-library are:</p>
+<p>The support library for v4 provides access to several classes introduced with Android 3.0 and
+beyond, plus some updated version of existing classes, and even some APIs that currently don't
+exist in the Android platform. Some of the most useful and notable classes that have
+counterparts in the v4 support library are:</p>
 
 <ul>
   <li>{@link android.app.Fragment}</li>
@@ -152,8 +213,8 @@
 </ul>
 
 <p>For each of the classes above (and others not listed), the APIs work almost exactly the same
-as the counterparts in the latest version of the Android platform. Thus, you can usually refer to
-the latest reference documentation for information about the supported APIs. There are some
+as the counterparts in the latest Android platform. Thus, you can usually refer to
+the online documentation for information about the supported APIs. There are some
 differences, however. Most notably:</p>
 
 <ul>
@@ -181,18 +242,6 @@
 </li>
 </ul>
 
-<p>The Compatibility Library currently does not provide reference documentation for the included
-APIs. To generate your own set, using the {@code javadoc} tool, perform the
-following from a command line:</p>
-
-<pre class="no-pretty-print">
-cd &lt;sdk&gt;/extras/android/compatibility/v4/
-mkdir docs
-javadoc -sourcepath src/java/ -subpackages android.support.v4 -d docs
-</pre>
-<p>Open the {@code docs/index.html} file to begin browsing the generated documentation.</p>
-
-
 <div class="note"><p><strong>Tip:</strong> To enable the Holographic theme on devices
 running Android 3.0 or higher, declare in your manifest file that your application targets
 API level 11. For example:</p>
@@ -208,16 +257,30 @@
 Apps for Android 3.0</a>.</p>
 
 
+<h2 id="Docs">Reference Docs</h2>
+
+<p>The libraries currently do not provide reference documentation for the included APIs. To generate
+your own set using the {@code javadoc} tool, perform the following from a command (as appropriate
+for the library version you're using). In this example, documentation is generated for the v4
+library:</p>
+
+<pre class="no-pretty-print">
+cd &lt;sdk&gt;/extras/android/compatibility/v4/
+mkdir docs
+javadoc -sourcepath src/java/ -subpackages android.support.v4 -d docs
+</pre>
+<p>Open the {@code docs/index.html} file to begin browsing the generated documentation.</p>
+
+
 <h2 id="Samples">Samples</h2>
 
-<p>If you want to see some sample code that uses the Compatibility Library, take a look at the
-<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/support/index.html">API
-Demos</a> sample code that's included with the Samples package you can download from the AVD and SDK
-Manager.</p>
+<p>If you want to see some code that uses the support libraries, samples are included with the
+Compatibility Package, inside each support library directory. For example, at {@code
+extras/android/compatibility/v4/samples/}.</p>
 
 <p>Additionally, the <a href="http://code.google.com/p/iosched/">Google I/O App</a> is a complete
-application that uses the library to provide a single APK for both handsets and tablets and also
-demonstrates some of Android's best practices in Android UI design.</p>
+application that uses the v4 support library to provide a single APK for both handsets and tablets
+and also demonstrates some of Android's best practices in Android UI design.</p>
 
 
 
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index 829ed52..1b1fc8d 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -145,8 +145,8 @@
       <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r12</a> <span
 class="new">new!</span></li>
       <li><a href="<?cs var:toroot ?>sdk/win-usb.html">Google USB Driver, r4</a></li>
-      <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Compatibility Library,
-r2</a></li>
+      <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Compatibility Package,
+r3</a> <span class="new">new!</span></li>
     </ul>
   </li>
   <li>
@@ -183,8 +183,8 @@
       <span style="display:none" class="zh-TW"></span>
     </h2>
     <ul>
-      <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r6 <span
-       class="new">new!</span></a>
+      <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r6</a> 
+        <span class="new">new!</span>
         </li>
       <li><a href="<?cs var:toroot ?>sdk/ndk/overview.html">What is the NDK?</a></li>
     </ul>
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java
index 2220f96..7efdc6c 100644
--- a/graphics/java/android/graphics/drawable/AnimationDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java
@@ -33,7 +33,7 @@
  * <p>
  * The simplest way to create a frame-by-frame animation is to define the animation in an XML
  * file, placed in the res/drawable/ folder, and set it as the background to a View object. Then, call
- * {@link #run()} to start the animation.
+ * {@link #start()} to run the animation.
  * <p>
  * An AnimationDrawable defined in XML consists of a single <code>&lt;animation-list></code> element,
  * and a series of nested <code>&lt;item></code> tags. Each item defines a frame of the animation.
diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java
index 63e7dd1..2e55c48 100644
--- a/graphics/java/android/renderscript/BaseObj.java
+++ b/graphics/java/android/renderscript/BaseObj.java
@@ -97,6 +97,13 @@
         }
     }
 
+    /**
+     * @return name of the renderscript object
+     */
+    public String getName() {
+        return mName;
+    }
+
     protected void finalize() throws Throwable {
         if (!mDestroyed) {
             if(mID != 0 && mRS.isAlive()) {
diff --git a/include/powermanager/IPowerManager.h b/include/powermanager/IPowerManager.h
new file mode 100644
index 0000000..1723f04
--- /dev/null
+++ b/include/powermanager/IPowerManager.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_IPOWERMANAGER_H
+#define ANDROID_IPOWERMANAGER_H
+
+#include <utils/Errors.h>
+#include <binder/IInterface.h>
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+// must be kept in sync with interface defined in IPowerManager.aidl
+class IPowerManager : public IInterface
+{
+public:
+    DECLARE_META_INTERFACE(PowerManager);
+
+    virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag) = 0;
+    virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_IPOWERMANAGER_H
diff --git a/include/powermanager/PowerManager.h b/include/powermanager/PowerManager.h
new file mode 100644
index 0000000..4590174
--- /dev/null
+++ b/include/powermanager/PowerManager.h
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_POWERMANAGER_H
+#define ANDROID_POWERMANAGER_H
+
+namespace android {
+
+// must be kept in sync with definitions in PowerManager.java
+enum {
+    POWERMANAGER_PARTIAL_WAKE_LOCK = 1, // equals PowerManager.PARTIAL_WAKE_LOCK constant
+};
+
+}; // namespace android
+
+#endif // ANDROID_POWERMANAGER_H
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 0c536b0..dd75497 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -191,6 +191,10 @@
         if (texture.id) glDeleteTextures(1, &texture.id);
     }
 
+    inline void deleteFbo() {
+        if (fbo) glDeleteFramebuffers(1, &fbo);
+    }
+
     inline void allocateTexture(GLenum format, GLenum storage) {
         glTexImage2D(renderTarget, 0, format, getWidth(), getHeight(), 0, format, storage, NULL);
     }
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 36083af..89c35da 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -69,6 +69,7 @@
 void LayerCache::deleteLayer(Layer* layer) {
     if (layer) {
         mSize -= layer->getWidth() * layer->getHeight() * 4;
+        layer->deleteFbo();
         layer->deleteTexture();
         delete layer;
     }
@@ -111,17 +112,21 @@
         glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
 #if DEBUG_LAYERS
-        size_t size = mCache.size();
-        for (size_t i = 0; i < size; i++) {
-            const LayerEntry& entry = mCache.itemAt(i);
-            LAYER_LOGD("  Layer size %dx%d", entry.mWidth, entry.mHeight);
-        }
+        dump();
 #endif
     }
 
     return layer;
 }
 
+void LayerCache::dump() {
+    size_t size = mCache.size();
+    for (size_t i = 0; i < size; i++) {
+        const LayerEntry& entry = mCache.itemAt(i);
+        LAYER_LOGD("  Layer size %dx%d", entry.mWidth, entry.mHeight);
+    }
+}
+
 bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) {
     // TODO: We should be smarter and see if we have a texture of the appropriate
     //       size already in the cache, and reuse it instead of creating a new one
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 81b8bf3..a0eae59 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -101,6 +101,11 @@
      */
     uint32_t getSize();
 
+    /**
+     * Prints out the content of the cache.
+     */
+    void dump();
+
 private:
     void deleteLayer(Layer* layer);
 
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 1fa343b..81816f6 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -167,7 +167,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque) {
-    LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height);
+    LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height);
 
     GLuint fbo = Caches::getInstance().fboCache.get();
     if (!fbo) {
@@ -288,16 +288,22 @@
 
 void LayerRenderer::destroyLayer(Layer* layer) {
     if (layer) {
-        LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", layer->getFbo());
+        LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d",
+                layer->getWidth(), layer->getHeight(), layer->getFbo());
 
         if (layer->getFbo()) {
             Caches::getInstance().fboCache.put(layer->getFbo());
         }
 
         if (!Caches::getInstance().layerCache.put(layer)) {
+            LAYER_RENDERER_LOGD("  Destroyed!");
             layer->deleteTexture();
             delete layer;
         } else {
+            LAYER_RENDERER_LOGD("  Cached!");
+#if DEBUG_LAYERS
+            Caches::getInstance().layerCache.dump();
+#endif
             layer->region.clear();
         }
     }
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index f926fdd..fbdbf92 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -165,7 +165,7 @@
 
 void TextureCache::clear() {
     mCache.clear();
-    TEXTURE_LOGD("TextureCache:clear(), miSize = %d", mSize);
+    TEXTURE_LOGD("TextureCache:clear(), mSize = %d", mSize);
 }
 
 void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool regenerate) {
diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh
index 4768bbe..d939fb3 100644
--- a/libs/rs/scriptc/rs_core.rsh
+++ b/libs/rs/scriptc/rs_core.rsh
@@ -269,6 +269,7 @@
 extern void __attribute__((overloadable))
 rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
 
+#if !defined(RS_VERSION) || (RS_VERSION < 14)
 _RS_RUNTIME float4 __attribute__((overloadable))
 rsMatrixMultiply(rs_matrix4x4 *m, float4 in);
 
@@ -286,6 +287,25 @@
 
 _RS_RUNTIME float2 __attribute__((overloadable))
 rsMatrixMultiply(rs_matrix2x2 *m, float2 in);
+#else
+_RS_RUNTIME float4 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix4x4 *m, float4 in);
+
+_RS_RUNTIME float4 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix4x4 *m, float3 in);
+
+_RS_RUNTIME float4 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix4x4 *m, float2 in);
+
+_RS_RUNTIME float3 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix3x3 *m, float3 in);
+
+_RS_RUNTIME float3 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix3x3 *m, float2 in);
+
+_RS_RUNTIME float2 __attribute__((overloadable))
+rsMatrixMultiply(const rs_matrix2x2 *m, float2 in);
+#endif
 
 // Returns true if the matrix was successfully inversed
 extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m);
diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh
index fb5c4f6..1d36cc6 100644
--- a/libs/rs/scriptc/rs_math.rsh
+++ b/libs/rs/scriptc/rs_math.rsh
@@ -249,7 +249,16 @@
     uint32_t arrayEnd;
 } rs_script_call_t;
 
-#if 1//(RS_VERSION >= 14)
+#if !defined(RS_VERSION) || (RS_VERSION < 14)
+extern void __attribute__((overloadable))
+    rsForEach(rs_script script, rs_allocation input,
+              rs_allocation output, const void * usrData,
+              const rs_script_call_t *);
+
+extern void __attribute__((overloadable))
+    rsForEach(rs_script script, rs_allocation input,
+              rs_allocation output, const void * usrData);
+#else
 extern void __attribute__((overloadable))
     rsForEach(rs_script script, rs_allocation input, rs_allocation output);
 
@@ -260,18 +269,8 @@
 extern void __attribute__((overloadable))
     rsForEach(rs_script script, rs_allocation input, rs_allocation output,
               const void * usrData, size_t usrDataLen, const rs_script_call_t *);
-#else
-extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input,
-              rs_allocation output, const void * usrData,
-              const rs_script_call_t *);
 #endif
 
-// Move me once dependant changes are in.
-extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input,
-              rs_allocation output, const void * usrData);
-
 
 /**
  * Atomic add one to the value at addr.
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index 69cfe8c..1af78e3 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -42,11 +42,13 @@
     $(TOP)/frameworks/media/libvideoeditor/vss/common/inc \
     $(TOP)/frameworks/media/libvideoeditor/vss/mcs/inc \
     $(TOP)/frameworks/media/libvideoeditor/vss/stagefrightshells/inc \
+    $(TOP)/frameworks/media/libvideoeditor/include \
     $(TOP)/frameworks/media/libvideoeditor/lvpp \
     $(TOP)/frameworks/media/libvideoeditor/osal/inc
 
 LOCAL_SHARED_LIBRARIES := \
     libcutils \
+    libdl \
     libutils \
     libandroid_runtime \
     libnativehelper \
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 1ec596e..16554c2 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -590,7 +590,7 @@
 audio_io_handle_t AudioRecord::getInput()
 {
     AutoMutex lock(mLock);
-    return getInput_l();
+    return mInput;
 }
 
 // must be called with mLock held
diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp
index f4b3668..eb10ab7 100644
--- a/media/libstagefright/chromium_http/support.cpp
+++ b/media/libstagefright/chromium_http/support.cpp
@@ -25,6 +25,7 @@
 #include "android/net/android_network_library_impl.h"
 #include "base/threading/thread.h"
 #include "net/base/cert_verifier.h"
+#include "net/base/cookie_monster.h"
 #include "net/base/host_resolver.h"
 #include "net/base/ssl_config_service.h"
 #include "net/http/http_auth_handler_factory.h"
@@ -140,6 +141,8 @@
             network_delegate(),
             net_log(),
             NULL));  // backend_factory
+
+    set_cookie_store(new net::CookieMonster(NULL, NULL));
 }
 
 const std::string &SfRequestContext::GetUserAgent(const GURL &url) const {
diff --git a/media/libstagefright/omx/OMXMaster.cpp b/media/libstagefright/omx/OMXMaster.cpp
index 504d470..c8278ab 100644
--- a/media/libstagefright/omx/OMXMaster.cpp
+++ b/media/libstagefright/omx/OMXMaster.cpp
@@ -57,6 +57,9 @@
     typedef OMXPluginBase *(*CreateOMXPluginFunc)();
     CreateOMXPluginFunc createOMXPlugin =
         (CreateOMXPluginFunc)dlsym(
+                mVendorLibHandle, "createOMXPlugin");
+    if (!createOMXPlugin)
+        createOMXPlugin = (CreateOMXPluginFunc)dlsym(
                 mVendorLibHandle, "_ZN7android15createOMXPluginEv");
 
     if (createOMXPlugin) {
@@ -96,11 +99,19 @@
 void OMXMaster::clearPlugins() {
     Mutex::Autolock autoLock(mLock);
 
+    typedef void (*DestroyOMXPluginFunc)(OMXPluginBase*);
+    DestroyOMXPluginFunc destroyOMXPlugin =
+        (DestroyOMXPluginFunc)dlsym(
+                mVendorLibHandle, "destroyOMXPlugin");
+
     mPluginByComponentName.clear();
 
     for (List<OMXPluginBase *>::iterator it = mPlugins.begin();
-         it != mPlugins.end(); ++it) {
-        delete *it;
+            it != mPlugins.end(); ++it) {
+        if (destroyOMXPlugin)
+            destroyOMXPlugin(*it);
+        else
+            delete *it;
         *it = NULL;
     }
 
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index b4fd8ab..adf9664 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -64,4 +64,7 @@
     <!-- Where to place the app icon over the thumbnail -->
     <dimen name="status_bar_recents_app_icon_left_margin">13dp</dimen>
     <dimen name="status_bar_recents_app_icon_top_margin">13dp</dimen>
+
+    <!-- size at which Notification icons will be drawn in the status bar -->
+    <dimen name="status_bar_icon_drawing_size">24dip</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index da28e1e..b02015d 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -48,5 +48,13 @@
 
     <!-- thickness (height) of each notification row, including any separators or padding -->
     <dimen name="notification_height">65dp</dimen>
-</resources>
 
+    <!-- Height of notification icons in the status bar -->
+    <dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
+
+    <!-- size at which Notification icons will be drawn in the status bar -->
+    <dimen name="status_bar_icon_drawing_size">18dip</dimen>
+
+    <!-- opacity at which Notification icons will be drawn in the status bar -->
+    <item type="dimen" name="status_bar_icon_drawing_alpha">40%</item>
+</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index be4b395..1e27233 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -58,6 +58,14 @@
         mNumberPain.setAntiAlias(true);
         mNotification = notification;
         setContentDescription(notification);
+
+        final int outerBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
+        final int imageBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
+        final float scale = (float)imageBounds / (float)outerBounds;
+        setScaleX(scale);
+        setScaleY(scale);
+        final float alpha = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1);
+        setAlpha(alpha);
     }
 
     private static boolean streq(String a, String b) {
@@ -99,6 +107,7 @@
         if (!levelEquals) {
             setImageLevel(icon.iconLevel);
         }
+
         if (!numberEquals) {
             if (icon.number > 0 && mContext.getResources().getBoolean(
                         R.bool.config_statusBarShowNumber)) {
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index a0407b9..fa49592 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -21,7 +21,8 @@
     libhardware \
     libhardware_legacy \
     libeffects \
-    libdl
+    libdl \
+    libpowermanager
 
 LOCAL_STATIC_LIBRARIES := \
     libcpustats \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index cb1f921..4e068b2 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -53,6 +53,7 @@
 #include <audio_effects/effect_visualizer.h>
 
 #include <cpustats/ThreadCpuUsage.h>
+#include <powermanager/PowerManager.h>
 // #define DEBUG_CPU_USAGE 10  // log statistics every n wall clock seconds
 
 // ----------------------------------------------------------------------------
@@ -887,14 +888,18 @@
 AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, int id, uint32_t device)
     :   Thread(false),
         mAudioFlinger(audioFlinger), mSampleRate(0), mFrameCount(0), mChannelCount(0),
-        mFrameSize(1), mFormat(0), mStandby(false), mId(id), mExiting(false), mDevice(device)
+        mFrameSize(1), mFormat(0), mStandby(false), mId(id), mExiting(false),
+        mDevice(device)
 {
+    mDeathRecipient = new PMDeathRecipient(this);
 }
 
 AudioFlinger::ThreadBase::~ThreadBase()
 {
     mParamCond.broadcast();
     mNewParameters.clear();
+    // do not lock the mutex in destructor
+    releaseWakeLock_l();
 }
 
 void AudioFlinger::ThreadBase::exit()
@@ -1061,6 +1066,69 @@
     return NO_ERROR;
 }
 
+void AudioFlinger::ThreadBase::acquireWakeLock()
+{
+    Mutex::Autolock _l(mLock);
+    acquireWakeLock_l();
+}
+
+void AudioFlinger::ThreadBase::acquireWakeLock_l()
+{
+    if (mPowerManager == 0) {
+        // use checkService() to avoid blocking if power service is not up yet
+        sp<IBinder> binder =
+            defaultServiceManager()->checkService(String16("power"));
+        if (binder == 0) {
+            LOGW("Thread %s cannot connect to the power manager service", mName);
+        } else {
+            mPowerManager = interface_cast<IPowerManager>(binder);
+            binder->linkToDeath(mDeathRecipient);
+        }
+    }
+    if (mPowerManager != 0) {
+        sp<IBinder> binder = new BBinder();
+        status_t status = mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK,
+                                                         binder,
+                                                         String16(mName));
+        if (status == NO_ERROR) {
+            mWakeLockToken = binder;
+        }
+        LOGV("acquireWakeLock_l() %s status %d", mName, status);
+    }
+}
+
+void AudioFlinger::ThreadBase::releaseWakeLock()
+{
+    Mutex::Autolock _l(mLock);
+    releaseWakeLock();
+}
+
+void AudioFlinger::ThreadBase::releaseWakeLock_l()
+{
+    if (mWakeLockToken != 0) {
+        LOGV("releaseWakeLock_l() %s", mName);
+        if (mPowerManager != 0) {
+            mPowerManager->releaseWakeLock(mWakeLockToken, 0);
+        }
+        mWakeLockToken.clear();
+    }
+}
+
+void AudioFlinger::ThreadBase::clearPowerManager()
+{
+    Mutex::Autolock _l(mLock);
+    releaseWakeLock_l();
+    mPowerManager.clear();
+}
+
+void AudioFlinger::ThreadBase::PMDeathRecipient::binderDied(const wp<IBinder>& who)
+{
+    sp<ThreadBase> thread = mThread.promote();
+    if (thread != 0) {
+        thread->clearPowerManager();
+    }
+    LOGW("power manager service died !!!");
+}
 
 // ----------------------------------------------------------------------------
 
@@ -1072,6 +1140,8 @@
         mMixBuffer(0), mSuspended(0), mBytesWritten(0), mOutput(output),
         mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false)
 {
+    snprintf(mName, kNameLength, "AudioOut_%d", id);
+
     readOutputParameters();
 
     mMasterVolume = mAudioFlinger->masterVolume();
@@ -1170,12 +1240,7 @@
 
 void AudioFlinger::PlaybackThread::onFirstRef()
 {
-    const size_t SIZE = 256;
-    char buffer[SIZE];
-
-    snprintf(buffer, SIZE, "Playback Thread %p", this);
-
-    run(buffer, ANDROID_PRIORITY_URGENT_AUDIO);
+    run(mName, ANDROID_PRIORITY_URGENT_AUDIO);
 }
 
 // PlaybackThread::createTrack_l() must be called with AudioFlinger::mLock held
@@ -1522,6 +1587,8 @@
     const CentralTendencyStatistics& stats = cpu.statistics();
 #endif
 
+    acquireWakeLock();
+
     while (!exitPending())
     {
 #ifdef DEBUG_CPU_USAGE
@@ -1585,10 +1652,12 @@
 
                     if (exitPending()) break;
 
+                    releaseWakeLock_l();
                     // wait until we have something to do...
                     LOGV("MixerThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
                     LOGV("MixerThread %p TID %d waking up\n", this, gettid());
+                    acquireWakeLock_l();
 
                     if (mMasterMute == false) {
                         char value[PROPERTY_VALUE_MAX];
@@ -1689,6 +1758,8 @@
         mOutput->stream->common.standby(&mOutput->stream->common);
     }
 
+    releaseWakeLock();
+
     LOGV("MixerThread %p exiting", this);
     return false;
 }
@@ -2176,6 +2247,8 @@
     // hardware resources as soon as possible
     nsecs_t standbyDelay = microseconds(activeSleepTime*2);
 
+    acquireWakeLock();
+
     while (!exitPending())
     {
         bool rampVolume;
@@ -2215,9 +2288,11 @@
 
                     if (exitPending()) break;
 
+                    releaseWakeLock_l();
                     LOGV("DirectOutputThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
                     LOGV("DirectOutputThread %p TID %d waking up in active mode\n", this, gettid());
+                    acquireWakeLock_l();
 
                     if (mMasterMute == false) {
                         char value[PROPERTY_VALUE_MAX];
@@ -2436,6 +2511,8 @@
         mOutput->stream->common.standby(&mOutput->stream->common);
     }
 
+    releaseWakeLock();
+
     LOGV("DirectOutputThread %p exiting", this);
     return false;
 }
@@ -2561,6 +2638,8 @@
     uint32_t sleepTime = idleSleepTime;
     Vector< sp<EffectChain> > effectChains;
 
+    acquireWakeLock();
+
     while (!exitPending())
     {
         processConfigEvents();
@@ -2601,9 +2680,12 @@
 
                     if (exitPending()) break;
 
+                    releaseWakeLock_l();
                     LOGV("DuplicatingThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
                     LOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
+                    acquireWakeLock_l();
+
                     if (mMasterMute == false) {
                         char value[PROPERTY_VALUE_MAX];
                         property_get("ro.audio.silent", value, "0");
@@ -2690,6 +2772,8 @@
         effectChains.clear();
     }
 
+    releaseWakeLock();
+
     return false;
 }
 
@@ -3814,6 +3898,9 @@
     mInput(input), mTrack(NULL), mResampler(0), mRsmpOutBuffer(0), mRsmpInBuffer(0)
 {
     mType = ThreadBase::RECORD;
+
+    snprintf(mName, kNameLength, "AudioIn_%d", id);
+
     mReqChannelCount = popcount(channels);
     mReqSampleRate = sampleRate;
     readInputParameters();
@@ -3831,12 +3918,7 @@
 
 void AudioFlinger::RecordThread::onFirstRef()
 {
-    const size_t SIZE = 256;
-    char buffer[SIZE];
-
-    snprintf(buffer, SIZE, "Record Thread %p", this);
-
-    run(buffer, PRIORITY_URGENT_AUDIO);
+    run(mName, PRIORITY_URGENT_AUDIO);
 }
 
 bool AudioFlinger::RecordThread::threadLoop()
@@ -3847,6 +3929,8 @@
 
     nsecs_t lastWarning = 0;
 
+    acquireWakeLock();
+
     // start recording
     while (!exitPending()) {
 
@@ -3863,10 +3947,12 @@
 
                 if (exitPending()) break;
 
+                releaseWakeLock_l();
                 LOGV("RecordThread: loop stopping");
                 // go to sleep
                 mWaitWorkCV.wait(mLock);
                 LOGV("RecordThread: loop starting");
+                acquireWakeLock_l();
                 continue;
             }
             if (mActiveTrack != 0) {
@@ -3907,8 +3993,6 @@
             for (size_t i = 0; i < effectChains.size(); i ++) {
                 effectChains[i]->process_l();
             }
-            // enable changes in effect chain
-            unlockEffectChains(effectChains);
 
             buffer.frameCount = mFrameCount;
             if (LIKELY(mActiveTrack->getNextBuffer(&buffer) == NO_ERROR)) {
@@ -4008,9 +4092,9 @@
                 // clear the overflow.
                 usleep(kRecordThreadSleepUs);
             }
-        } else {
-            unlockEffectChains(effectChains);
         }
+        // enable changes in effect chain
+        unlockEffectChains(effectChains);
         effectChains.clear();
     }
 
@@ -4021,6 +4105,8 @@
 
     mStartStopCond.broadcast();
 
+    releaseWakeLock();
+
     LOGV("RecordThread %p exiting", this);
     return false;
 }
@@ -5581,13 +5667,11 @@
         }
     }
 
-    // Release effect engine here so that it is done immediately. Otherwise it will be released
-    // by the destructor when the last strong reference on the this object is released which can
-    // happen after next process is called on this effect.
-    if (size == 0 && mEffectInterface != NULL) {
-        // release effect engine
-        EffectRelease(mEffectInterface);
-        mEffectInterface = NULL;
+    // Prevent calls to process() and other functions on effect interface from now on.
+    // The effect engine will be released by the destructor when the last strong reference on
+    // this object is released which can happen after next process is called.
+    if (size == 0) {
+        mState = DESTROYED;
     }
 
     return size;
@@ -5637,7 +5721,7 @@
             mState = IDLE;
         }
         break;
-    default: //IDLE , ACTIVE
+    default: //IDLE , ACTIVE, DESTROYED
         break;
     }
 }
@@ -5646,7 +5730,7 @@
 {
     Mutex::Autolock _l(mLock);
 
-    if (mEffectInterface == NULL ||
+    if (mState == DESTROYED || mEffectInterface == NULL ||
             mConfig.inputCfg.buffer.raw == NULL ||
             mConfig.outputCfg.buffer.raw == NULL) {
         return;
@@ -5822,6 +5906,12 @@
     return status;
 }
 
+status_t AudioFlinger::EffectModule::stop()
+{
+    Mutex::Autolock _l(mLock);
+    return stop_l();
+}
+
 status_t AudioFlinger::EffectModule::stop_l()
 {
     if (mEffectInterface == NULL) {
@@ -5858,7 +5948,7 @@
     Mutex::Autolock _l(mLock);
 //    LOGV("command(), cmdCode: %d, mEffectInterface: %p", cmdCode, mEffectInterface);
 
-    if (mEffectInterface == NULL) {
+    if (mState == DESTROYED || mEffectInterface == NULL) {
         return NO_INIT;
     }
     status_t status = (*mEffectInterface)->command(mEffectInterface,
@@ -5907,6 +5997,8 @@
         case ACTIVE:
             mState = STOPPING;
             break;
+        case DESTROYED:
+            return NO_ERROR; // simply ignore as we are being destroyed
         }
         for (size_t i = 1; i < mHandles.size(); i++) {
             sp<EffectHandle> h = mHandles[i].promote();
@@ -5928,6 +6020,7 @@
     case IDLE:
     case STOPPING:
     case STOPPED:
+    case DESTROYED:
     default:
         return false;
     }
@@ -5943,6 +6036,7 @@
         return true;
     case IDLE:
     case STARTING:
+    case DESTROYED:
     default:
         return false;
     }
@@ -6544,6 +6638,10 @@
 
     for (i = 0; i < size; i++) {
         if (effect == mEffects[i]) {
+            // calling stop here will remove pre-processing effect from the audio HAL.
+            // This is safe as we hold the EffectChain mutex which guarantees that we are not in
+            // the middle of a read from audio HAL
+            mEffects[i]->stop();
             if (type == EFFECT_FLAG_TYPE_AUXILIARY) {
                 delete[] effect->inBuffer();
             } else {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index e2cf946..7b6215f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -43,6 +43,8 @@
 
 #include "AudioBufferProvider.h"
 
+#include <powermanager/IPowerManager.h>
+
 namespace android {
 
 class audio_track_cblk_t;
@@ -287,6 +289,8 @@
         status_t dumpBase(int fd, const Vector<String16>& args);
         status_t dumpEffectChains(int fd, const Vector<String16>& args);
 
+        void clearPowerManager();
+
         // base for record and playback
         class TrackBase : public AudioBufferProvider, public RefBase {
 
@@ -386,6 +390,21 @@
             int mParam;
         };
 
+        class PMDeathRecipient : public IBinder::DeathRecipient {
+        public:
+                        PMDeathRecipient(const wp<ThreadBase>& thread) : mThread(thread) {}
+            virtual     ~PMDeathRecipient() {}
+
+            // IBinder::DeathRecipient
+            virtual     void        binderDied(const wp<IBinder>& who);
+
+        private:
+                        PMDeathRecipient(const PMDeathRecipient&);
+                        PMDeathRecipient& operator = (const PMDeathRecipient&);
+
+            wp<ThreadBase> mThread;
+        };
+
         virtual     status_t    initCheck() const = 0;
                     int         type() const { return mType; }
                     uint32_t    sampleRate() const;
@@ -462,6 +481,11 @@
 
     protected:
 
+                    void        acquireWakeLock();
+                    void        acquireWakeLock_l();
+                    void        releaseWakeLock();
+                    void        releaseWakeLock_l();
+
         friend class Track;
         friend class TrackBase;
         friend class PlaybackThread;
@@ -490,6 +514,11 @@
                     Vector< sp<EffectChain> > mEffectChains;
                     uint32_t                mDevice;    // output device for PlaybackThread
                                                         // input + output devices for RecordThread
+                    static const int        kNameLength = 32;
+                    char                    mName[kNameLength];
+                    sp<IPowerManager>       mPowerManager;
+                    sp<IBinder>             mWakeLockToken;
+                    sp<PMDeathRecipient>    mDeathRecipient;
     };
 
     // --- PlaybackThread ---
@@ -995,7 +1024,8 @@
             STARTING,
             ACTIVE,
             STOPPING,
-            STOPPED
+            STOPPED,
+            DESTROYED
         };
 
         int         id() { return mId; }
@@ -1040,6 +1070,7 @@
         status_t         setDevice(uint32_t device);
         status_t         setVolume(uint32_t *left, uint32_t *right, bool controller);
         status_t         setMode(uint32_t mode);
+        status_t         stop();
 
         status_t         dump(int fd, const Vector<String16>& args);
 
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index a583aad..09e88c43 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -386,7 +386,10 @@
         if (mDevice->ops->get_parameters) {
             char *temp = mDevice->ops->get_parameters(mDevice);
             String8 str_parms(temp);
-            free(temp);
+            if (mDevice->ops->put_parameters)
+                mDevice->ops->put_parameters(mDevice, temp);
+            else
+                free(temp);
             parms.unflatten(str_parms);
         }
         return parms;
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 8a21f4f..9a9cc8f 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1985,12 +1985,6 @@
             LinkProperties p = nt.getLinkProperties();
             if (p == null) return;
             Collection<InetAddress> dnses = p.getDnses();
-            try {
-                mNetd.setDnsServersForInterface(p.getInterfaceName(),
-                        NetworkUtils.makeStrings(dnses));
-            } catch (Exception e) {
-                Slog.e(TAG, "exception setting dns servers: " + e);
-            }
             boolean changed = false;
             if (mNetConfigs[netType].isDefault()) {
                 String network = nt.getNetworkInfo().getTypeName();
@@ -2001,7 +1995,7 @@
                 }
             } else {
                 try {
-                    mNetd.setDnsServersForInterface(Integer.toString(netType),
+                    mNetd.setDnsServersForInterface(p.getInterfaceName(),
                             NetworkUtils.makeStrings(dnses));
                 } catch (Exception e) {
                     Slog.e(TAG, "exception setting dns servers: " + e);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3389f33..66f88fc 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1821,7 +1821,7 @@
                 // An application record is attached to a previous process,
                 // clean it up now.
                 if (DEBUG_PROCESSES) Slog.v(TAG, "App died: " + app);
-                handleAppDiedLocked(app, true);
+                handleAppDiedLocked(app, true, true);
             }
         }
 
@@ -2658,8 +2658,8 @@
      * to the process.
      */
     private final void handleAppDiedLocked(ProcessRecord app,
-            boolean restarting) {
-        cleanUpApplicationRecordLocked(app, restarting, -1);
+            boolean restarting, boolean allowRestart) {
+        cleanUpApplicationRecordLocked(app, restarting, allowRestart, -1);
         if (!restarting) {
             mLruProcesses.remove(app);
         }
@@ -2791,7 +2791,7 @@
                 TAG, "Dying app: " + app + ", pid: " + pid
                 + ", thread: " + thread.asBinder());
             boolean doLowMem = app.instrumentationClass == null;
-            handleAppDiedLocked(app, false);
+            handleAppDiedLocked(app, false, true);
 
             if (doLowMem) {
                 // If there are no longer any background processes running,
@@ -3195,7 +3195,7 @@
                     return;
                 }
                 killPackageProcessesLocked(packageName, pkgUid,
-                        SECONDARY_SERVER_ADJ, false, true);
+                        SECONDARY_SERVER_ADJ, false, true, true);
             }
         } finally {
             Binder.restoreCallingIdentity(callingId);
@@ -3358,7 +3358,7 @@
     }
     
     private final boolean killPackageProcessesLocked(String packageName, int uid,
-            int minOomAdj, boolean callerWillRestart, boolean doit) {
+            int minOomAdj, boolean callerWillRestart, boolean allowRestart, boolean doit) {
         ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>();
 
         // Remove all processes this package may have touched: all with the
@@ -3369,6 +3369,10 @@
             final int NA = apps.size();
             for (int ia=0; ia<NA; ia++) {
                 ProcessRecord app = apps.valueAt(ia);
+                if (app.persistent) {
+                    // we don't kill persistent processes
+                    continue;
+                }
                 if (app.removed) {
                     if (doit) {
                         procs.add(app);
@@ -3389,7 +3393,7 @@
         
         int N = procs.size();
         for (int i=0; i<N; i++) {
-            removeProcessLocked(procs.get(i), callerWillRestart);
+            removeProcessLocked(procs.get(i), callerWillRestart, allowRestart);
         }
         return N > 0;
     }
@@ -3419,11 +3423,12 @@
         }
         
         boolean didSomething = killPackageProcessesLocked(name, uid, -100,
-                callerWillRestart, doit);
+                callerWillRestart, false, doit);
         
         for (i=mMainStack.mHistory.size()-1; i>=0; i--) {
             ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i);
-            if (r.packageName.equals(name)) {
+            if (r.packageName.equals(name)
+                    && (r.app == null || !r.app.persistent)) {
                 if (!doit) {
                     return true;
                 }
@@ -3439,7 +3444,8 @@
 
         ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
         for (ServiceRecord service : mServices.values()) {
-            if (service.packageName.equals(name)) {
+            if (service.packageName.equals(name)
+                    && (service.app == null || !service.app.persistent)) {
                 if (!doit) {
                     return true;
                 }
@@ -3471,7 +3477,8 @@
         return didSomething;
     }
 
-    private final boolean removeProcessLocked(ProcessRecord app, boolean callerWillRestart) {
+    private final boolean removeProcessLocked(ProcessRecord app,
+            boolean callerWillRestart, boolean allowRestart) {
         final String name = app.processName;
         final int uid = app.info.uid;
         if (DEBUG_PROCESSES) Slog.d(
@@ -3490,7 +3497,7 @@
                 mPidsSelfLocked.remove(pid);
                 mHandler.removeMessages(PROC_START_TIMEOUT_MSG, app);
             }
-            handleAppDiedLocked(app, true);
+            handleAppDiedLocked(app, true, allowRestart);
             mLruProcesses.remove(app);
             Process.killProcess(pid);
             
@@ -3600,7 +3607,7 @@
         // If this application record is still attached to a previous
         // process, clean it up now.
         if (app.thread != null) {
-            handleAppDiedLocked(app, true);
+            handleAppDiedLocked(app, true, true);
         }
 
         // Tell the process all about itself.
@@ -3783,7 +3790,7 @@
         if (badApp) {
             // todo: Also need to kill application to deal with all
             // kinds of exceptions.
-            handleAppDiedLocked(app, false);
+            handleAppDiedLocked(app, false, true);
             return false;
         }
 
@@ -6643,7 +6650,7 @@
                 for (int i=procsToKill.size()-1; i>=0; i--) {
                     ProcessRecord proc = procsToKill.get(i);
                     Slog.i(TAG, "Removing system update proc: " + proc);
-                    removeProcessLocked(proc, true);
+                    removeProcessLocked(proc, true, false);
                 }
             }
             
@@ -6826,10 +6833,6 @@
                 }
             }
             if (!app.persistent) {
-                // Don't let services in this process be restarted and potentially
-                // annoy the user repeatedly.  Unless it is persistent, since those
-                // processes run critical code.
-                killServicesLocked(app, false);
                 // We don't want to start this process again until the user
                 // explicitly does so...  but for persistent process, we really
                 // need to keep it running.  If a persistent process is actually
@@ -6840,7 +6843,10 @@
                 app.bad = true;
                 mProcessCrashTimes.remove(app.info.processName, app.info.uid);
                 app.removed = true;
-                removeProcessLocked(app, false);
+                // Don't let services in this process be restarted and potentially
+                // annoy the user repeatedly.  Unless it is persistent, since those
+                // processes run critical code.
+                removeProcessLocked(app, false, false);
                 mMainStack.resumeTopActivityLocked(null);
                 return false;
             }
@@ -9120,7 +9126,7 @@
                     
                     // Should the service remain running?  Note that in the
                     // extreme case of so many attempts to deliver a command
-                    // that it failed, that we also will stop it here.
+                    // that it failed we also will stop it here.
                     if (sr.startRequested && (sr.stopIfKilled || canceled)) {
                         if (sr.pendingStarts.size() == 0) {
                             sr.startRequested = false;
@@ -9189,7 +9195,7 @@
      * a process when running in single process mode.
      */
     private final void cleanUpApplicationRecordLocked(ProcessRecord app,
-            boolean restarting, int index) {
+            boolean restarting, boolean allowRestart, int index) {
         if (index >= 0) {
             mLruProcesses.remove(index);
         }
@@ -9221,7 +9227,7 @@
         app.foregroundActivities = false;
         app.hasShownUi = false;
 
-        killServicesLocked(app, true);
+        killServicesLocked(app, allowRestart);
 
         boolean restart = false;
 
@@ -9238,7 +9244,7 @@
                 // See if someone is waiting for this provider...  in which
                 // case we don't remove it, but just let it restart.
                 int i = 0;
-                if (!app.bad) {
+                if (!app.bad && allowRestart) {
                     for (; i<NL; i++) {
                         if (mLaunchingProviders.get(i) == cpr) {
                             restart = true;
@@ -9994,8 +10000,12 @@
             while (it.hasNext()) {
                 ArrayList<ConnectionRecord> c = it.next();
                 for (int i=0; i<c.size(); i++) {
+                    ConnectionRecord cr = c.get(i);
+                    // There is still a connection to the service that is
+                    // being brought down.  Mark it as dead.
+                    cr.serviceDead = true;
                     try {
-                        c.get(i).conn.connected(r.name, null);
+                        cr.conn.connected(r.name, null);
                     } catch (Exception e) {
                         Slog.w(TAG, "Failure disconnecting service " + r.name +
                               " to connection " + c.get(i).conn.asBinder() +
@@ -10526,26 +10536,28 @@
             b.intent.apps.remove(b.client);
         }
 
-        if (DEBUG_SERVICE) Slog.v(TAG, "Disconnecting binding " + b.intent
-                + ": shouldUnbind=" + b.intent.hasBound);
-        if (s.app != null && s.app.thread != null && b.intent.apps.size() == 0
-                && b.intent.hasBound) {
-            try {
-                bumpServiceExecutingLocked(s, "unbind");
-                updateOomAdjLocked(s.app);
-                b.intent.hasBound = false;
-                // Assume the client doesn't want to know about a rebind;
-                // we will deal with that later if it asks for one.
-                b.intent.doRebind = false;
-                s.app.thread.scheduleUnbindService(s, b.intent.intent.getIntent());
-            } catch (Exception e) {
-                Slog.w(TAG, "Exception when unbinding service " + s.shortName, e);
-                serviceDoneExecutingLocked(s, true);
+        if (!c.serviceDead) {
+            if (DEBUG_SERVICE) Slog.v(TAG, "Disconnecting binding " + b.intent
+                    + ": shouldUnbind=" + b.intent.hasBound);
+            if (s.app != null && s.app.thread != null && b.intent.apps.size() == 0
+                    && b.intent.hasBound) {
+                try {
+                    bumpServiceExecutingLocked(s, "unbind");
+                    updateOomAdjLocked(s.app);
+                    b.intent.hasBound = false;
+                    // Assume the client doesn't want to know about a rebind;
+                    // we will deal with that later if it asks for one.
+                    b.intent.doRebind = false;
+                    s.app.thread.scheduleUnbindService(s, b.intent.intent.getIntent());
+                } catch (Exception e) {
+                    Slog.w(TAG, "Exception when unbinding service " + s.shortName, e);
+                    serviceDoneExecutingLocked(s, true);
+                }
             }
-        }
-
-        if ((c.flags&Context.BIND_AUTO_CREATE) != 0) {
-            bringDownServiceLocked(s, false);
+    
+            if ((c.flags&Context.BIND_AUTO_CREATE) != 0) {
+                bringDownServiceLocked(s, false);
+            }
         }
     }
 
@@ -12774,6 +12786,7 @@
                             }
                             if ((cr.flags&Context.BIND_AUTO_CREATE) != 0) {
                                 ProcessRecord client = cr.binding.client;
+                                int clientAdj = adj;
                                 int myHiddenAdj = hiddenAdj;
                                 if (myHiddenAdj > client.hiddenAdj) {
                                     if (client.hiddenAdj >= VISIBLE_APP_ADJ) {
@@ -12782,8 +12795,35 @@
                                         myHiddenAdj = VISIBLE_APP_ADJ;
                                     }
                                 }
-                                int clientAdj = computeOomAdjLocked(
+                                clientAdj = computeOomAdjLocked(
                                     client, myHiddenAdj, TOP_APP, true);
+                                String adjType = null;
+                                if ((cr.flags&Context.BIND_ALLOW_OOM_MANAGEMENT) != 0) {
+                                    // Not doing bind OOM management, so treat
+                                    // this guy more like a started service.
+                                    if (app.hasShownUi) {
+                                        // If this process has shown some UI, let it immediately
+                                        // go to the LRU list because it may be pretty heavy with
+                                        // UI stuff.  We'll tag it with a label just to help
+                                        // debug and understand what is going on.
+                                        if (adj > clientAdj) {
+                                            adjType = "bound-bg-ui-services";
+                                        }
+                                        clientAdj = adj;
+                                    } else {
+                                        if (now >= (s.lastActivity+MAX_SERVICE_INACTIVITY)) {
+                                            // This service has not seen activity within
+                                            // recent memory, so allow it to drop to the
+                                            // LRU list if there is no other reason to keep
+                                            // it around.  We'll also tag it with a label just
+                                            // to help debug and undertand what is going on.
+                                            if (adj > clientAdj) {
+                                                adjType = "bound-bg-services";
+                                            }
+                                            clientAdj = adj;
+                                        }
+                                    }
+                                }
                                 if (adj > clientAdj) {
                                     adj = clientAdj >= VISIBLE_APP_ADJ
                                             ? clientAdj : VISIBLE_APP_ADJ;
@@ -12793,7 +12833,10 @@
                                     if (client.keeping) {
                                         app.keeping = true;
                                     }
-                                    app.adjType = "service";
+                                    adjType = "service";
+                                }
+                                if (adjType != null) {
+                                    app.adjType = adjType;
                                     app.adjTypeCode = ActivityManager.RunningAppProcessInfo
                                             .REASON_SERVICE_IN_USE;
                                     app.adjSource = cr.binding.client;
@@ -13413,7 +13456,7 @@
                             // Ignore exceptions.
                         }
                     }
-                    cleanUpApplicationRecordLocked(app, false, -1);
+                    cleanUpApplicationRecordLocked(app, false, true, -1);
                     mRemovedProcesses.remove(i);
                     
                     if (app.persistent) {
diff --git a/services/java/com/android/server/am/ConnectionRecord.java b/services/java/com/android/server/am/ConnectionRecord.java
index 22acda9..0106114 100644
--- a/services/java/com/android/server/am/ConnectionRecord.java
+++ b/services/java/com/android/server/am/ConnectionRecord.java
@@ -32,6 +32,7 @@
     final int clientLabel;          // String resource labeling this client.
     final PendingIntent clientIntent; // How to launch the client.
     String stringName;              // Caching of toString.
+    boolean serviceDead;            // Well is it?
     
     void dump(PrintWriter pw, String prefix) {
         pw.println(prefix + "binding=" + binding);
@@ -61,6 +62,9 @@
         sb.append("ConnectionRecord{");
         sb.append(Integer.toHexString(System.identityHashCode(this)));
         sb.append(' ');
+        if (serviceDead) {
+            sb.append("DEAD ");
+        }
         sb.append(binding.service.shortName);
         sb.append(":@");
         sb.append(Integer.toHexString(System.identityHashCode(conn.asBinder())));
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index a5a6d8e..ce45998 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -202,7 +202,11 @@
                     sm.start();
                 }
             } else {
-                if (sm != null) {
+                if (isUsb(iface)) {
+                    // ignore usb0 down after enabling RNDIS
+                    // we will handle disconnect in interfaceRemoved instead
+                    Log.d(TAG, "ignoring interface down for " + iface);
+                } else if (sm != null) {
                     sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
                     mIfaces.remove(iface);
                 }
@@ -237,6 +241,7 @@
     }
 
     public void interfaceAdded(String iface) {
+        if (DEBUG) Log.d(TAG, "interfaceAdded " + iface);
         boolean found = false;
         boolean usb = false;
         if (isWifi(iface)) {
@@ -268,6 +273,7 @@
     }
 
     public void interfaceRemoved(String iface) {
+        if (DEBUG) Log.d(TAG, "interfaceRemoved " + iface);
         synchronized (mIfaces) {
             TetherInterfaceSM sm = mIfaces.get(iface);
             if (sm == null) {
@@ -542,6 +548,7 @@
     }
 
     public int setUsbTethering(boolean enable) {
+        if (DEBUG) Log.d(TAG, "setUsbTethering(" + enable + ")");
         UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
 
         synchronized (this) {
diff --git a/services/java/com/android/server/location/GeocoderProxy.java b/services/java/com/android/server/location/GeocoderProxy.java
index e3131fe..b38ea13 100644
--- a/services/java/com/android/server/location/GeocoderProxy.java
+++ b/services/java/com/android/server/location/GeocoderProxy.java
@@ -47,7 +47,9 @@
     public GeocoderProxy(Context context, String serviceName) {
         mContext = context;
         mIntent = new Intent(serviceName);
-        mContext.bindService(mIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
+        mContext.bindService(mIntent, mServiceConnection,
+                Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
+                | Context.BIND_ALLOW_OOM_MANAGEMENT);
     }
 
     /**
@@ -58,7 +60,9 @@
         synchronized (mMutex) {
             mContext.unbindService(mServiceConnection);
             mServiceConnection = new Connection();
-            mContext.bindService(mIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
+            mContext.bindService(mIntent, mServiceConnection,
+                    Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
+                    | Context.BIND_ALLOW_OOM_MANAGEMENT);
         }
     }
 
@@ -67,14 +71,12 @@
         private IGeocodeProvider mProvider;
 
         public void onServiceConnected(ComponentName className, IBinder service) {
-            Log.d(TAG, "onServiceConnected " + className);
             synchronized (this) {
                 mProvider = IGeocodeProvider.Stub.asInterface(service);
             }
         }
 
         public void onServiceDisconnected(ComponentName className) {
-            Log.d(TAG, "onServiceDisconnected " + className);
             synchronized (this) {
                 mProvider = null;
             }
diff --git a/services/java/com/android/server/location/LocationProviderProxy.java b/services/java/com/android/server/location/LocationProviderProxy.java
index 1a1a170..0bc1664 100644
--- a/services/java/com/android/server/location/LocationProviderProxy.java
+++ b/services/java/com/android/server/location/LocationProviderProxy.java
@@ -28,7 +28,6 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.os.SystemClock;
 import android.os.WorkSource;
 import android.util.Log;
 
@@ -65,7 +64,9 @@
         mName = name;
         mIntent = new Intent(serviceName);
         mHandler = handler;
-        mContext.bindService(mIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
+        mContext.bindService(mIntent, mServiceConnection,
+                Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
+                | Context.BIND_ALLOW_OOM_MANAGEMENT);
     }
 
     /**
@@ -76,7 +77,9 @@
         synchronized (mMutex) {
             mContext.unbindService(mServiceConnection);
             mServiceConnection = new Connection();
-            mContext.bindService(mIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
+            mContext.bindService(mIntent, mServiceConnection,
+                    Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
+                    | Context.BIND_ALLOW_OOM_MANAGEMENT);
         }
     }
 
@@ -88,7 +91,6 @@
         private DummyLocationProvider mCachedAttributes;  // synchronized by mMutex
 
         public void onServiceConnected(ComponentName className, IBinder service) {
-            Log.d(TAG, "LocationProviderProxy.onServiceConnected " + className);
             synchronized (this) {
                 mProvider = ILocationProvider.Stub.asInterface(service);
                 if (mProvider != null) {
@@ -98,7 +100,6 @@
         }
 
         public void onServiceDisconnected(ComponentName className) {
-            Log.d(TAG, "LocationProviderProxy.onServiceDisconnected " + className);
             synchronized (this) {
                 mProvider = null;
             }
diff --git a/services/powermanager/Android.mk b/services/powermanager/Android.mk
new file mode 100644
index 0000000..d98b2da
--- /dev/null
+++ b/services/powermanager/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+	IPowerManager.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+	libutils \
+	libbinder
+
+LOCAL_MODULE:= libpowermanager
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp
new file mode 100644
index 0000000..a0f19d4
--- /dev/null
+++ b/services/powermanager/IPowerManager.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "IPowerManager"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <binder/Parcel.h>
+
+#include <powermanager/IPowerManager.h>
+
+namespace android {
+
+// must be kept in sync with IPowerManager.aidl
+enum {
+    ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
+    RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 4,
+};
+
+class BpPowerManager : public BpInterface<IPowerManager>
+{
+public:
+    BpPowerManager(const sp<IBinder>& impl)
+        : BpInterface<IPowerManager>(impl)
+    {
+    }
+
+    virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag)
+    {
+        Parcel data, reply;
+        data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+
+        data.writeInt32(flags);
+        data.writeStrongBinder(lock);
+        data.writeString16(tag);
+        // no WorkSource passed
+        data.writeInt32(0);
+        return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply);
+    }
+
+    virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags)
+    {
+        Parcel data, reply;
+        data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+        data.writeStrongBinder(lock);
+        data.writeInt32(flags);
+        return remote()->transact(RELEASE_WAKE_LOCK, data, &reply);
+    }
+};
+
+IMPLEMENT_META_INTERFACE(PowerManager, "android.os.IPowerManager");
+
+// ----------------------------------------------------------------------------
+
+}; // namespace android
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
index f8c32dd..41e44cb 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
@@ -159,7 +159,7 @@
         // Expose window.gc function to JavaScript. JSC build exposes
         // this function by default, but V8 requires the flag to turn it on.
         // WebView::setJsFlags is noop in JSC build.
-        mWebView.setJsFlags("--expose_gc");
+        mWebView.setJsFlags("--expose_gc --crankshaft=false");
 
         mHandler = new AsyncHandler();
 
diff --git a/voip/jni/rtp/Android.mk b/voip/jni/rtp/Android.mk
index 47ed658..0815294 100644
--- a/voip/jni/rtp/Android.mk
+++ b/voip/jni/rtp/Android.mk
@@ -49,7 +49,8 @@
 	frameworks/base/media/libstagefright/codecs/amrnb/enc/include \
 	frameworks/base/media/libstagefright/codecs/amrnb/enc/src \
 	frameworks/base/media/libstagefright/codecs/amrnb/dec/include \
-	frameworks/base/media/libstagefright/codecs/amrnb/dec/src
+	frameworks/base/media/libstagefright/codecs/amrnb/dec/src \
+	system/media/audio_effects/include
 
 LOCAL_CFLAGS += -fvisibility=hidden
 
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 85ed1c8..529b425 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -40,7 +40,8 @@
 #include <media/AudioRecord.h>
 #include <media/AudioTrack.h>
 #include <media/mediarecorder.h>
-
+#include <media/AudioEffect.h>
+#include <audio_effects/effect_aec.h>
 #include <system/audio.h>
 
 #include "jni.h"
@@ -481,6 +482,7 @@
     bool sendDtmf(int event);
     bool add(AudioStream *stream);
     bool remove(int socket);
+    bool platformHasAec() { return mPlatformHasAec; }
 
 private:
     enum {
@@ -491,6 +493,8 @@
         LAST_MODE = 3,
     };
 
+    bool checkPlatformAec();
+
     AudioStream *mChain;
     int mEventQueue;
     volatile int mDtmfEvent;
@@ -499,6 +503,7 @@
     int mSampleRate;
     int mSampleCount;
     int mDeviceSocket;
+    bool mPlatformHasAec;
 
     class NetworkThread : public Thread
     {
@@ -550,6 +555,7 @@
     mDeviceSocket = -1;
     mNetworkThread = new NetworkThread(this);
     mDeviceThread = new DeviceThread(this);
+    mPlatformHasAec = checkPlatformAec();
 }
 
 AudioGroup::~AudioGroup()
@@ -630,10 +636,6 @@
     if (mode == NORMAL && !strcmp(value, "herring")) {
         mode = ECHO_SUPPRESSION;
     }
-    if (mode == ECHO_SUPPRESSION && AudioSystem::getParameters(
-        0, String8("ec_supported")) == "ec_supported=yes") {
-        mode = NORMAL;
-    }
     if (mMode == mode) {
         return true;
     }
@@ -759,6 +761,25 @@
     return true;
 }
 
+bool AudioGroup::checkPlatformAec()
+{
+    effect_descriptor_t fxDesc;
+    uint32_t numFx;
+
+    if (AudioEffect::queryNumberEffects(&numFx) != NO_ERROR) {
+        return false;
+    }
+    for (uint32_t i = 0; i < numFx; i++) {
+        if (AudioEffect::queryEffect(i, &fxDesc) != NO_ERROR) {
+            continue;
+        }
+        if (memcmp(&fxDesc.type, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) {
+            return true;
+        }
+    }
+    return false;
+}
+
 bool AudioGroup::DeviceThread::threadLoop()
 {
     int mode = mGroup->mMode;
@@ -798,10 +819,6 @@
     }
     LOGD("latency: output %d, input %d", track.latency(), record.latency());
 
-    // Initialize echo canceler.
-    EchoSuppressor echo(sampleCount,
-        (track.latency() + record.latency()) * sampleRate / 1000);
-
     // Give device socket a reasonable buffer size.
     setsockopt(deviceSocket, SOL_SOCKET, SO_RCVBUF, &output, sizeof(output));
     setsockopt(deviceSocket, SOL_SOCKET, SO_SNDBUF, &output, sizeof(output));
@@ -810,6 +827,33 @@
     char c;
     while (recv(deviceSocket, &c, 1, MSG_DONTWAIT) == 1);
 
+    // check if platform supports echo cancellation and do not active local echo suppression in
+    // this case
+    EchoSuppressor *echo = NULL;
+    AudioEffect *aec = NULL;
+    if (mode == ECHO_SUPPRESSION) {
+        if (mGroup->platformHasAec()) {
+            aec = new AudioEffect(FX_IID_AEC,
+                                    NULL,
+                                    0,
+                                    0,
+                                    0,
+                                    record.getSessionId(),
+                                    record.getInput());
+            status_t status = aec->initCheck();
+            if (status == NO_ERROR || status == ALREADY_EXISTS) {
+                aec->setEnabled(true);
+            } else {
+                delete aec;
+                aec = NULL;
+            }
+        }
+        // Create local echo suppressor if platform AEC cannot be used.
+        if (aec == NULL) {
+             echo = new EchoSuppressor(sampleCount,
+                                       (track.latency() + record.latency()) * sampleRate / 1000);
+        }
+    }
     // Start AudioRecord before AudioTrack. This prevents AudioTrack from being
     // disabled due to buffer underrun while waiting for AudioRecord.
     if (mode != MUTED) {
@@ -843,7 +887,7 @@
                     track.releaseBuffer(&buffer);
                 } else if (status != TIMED_OUT && status != WOULD_BLOCK) {
                     LOGE("cannot write to AudioTrack");
-                    return true;
+                    goto exit;
                 }
             }
 
@@ -859,7 +903,7 @@
                     record.releaseBuffer(&buffer);
                 } else if (status != TIMED_OUT && status != WOULD_BLOCK) {
                     LOGE("cannot read from AudioRecord");
-                    return true;
+                    goto exit;
                 }
             }
         }
@@ -870,15 +914,18 @@
         }
 
         if (mode != MUTED) {
-            if (mode == NORMAL) {
-                send(deviceSocket, input, sizeof(input), MSG_DONTWAIT);
-            } else {
-                echo.run(output, input);
-                send(deviceSocket, input, sizeof(input), MSG_DONTWAIT);
+            if (echo != NULL) {
+                LOGV("echo->run()");
+                echo->run(output, input);
             }
+            send(deviceSocket, input, sizeof(input), MSG_DONTWAIT);
         }
     }
-    return false;
+
+exit:
+    delete echo;
+    delete aec;
+    return true;
 }
 
 //------------------------------------------------------------------------------
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 74c6b49..de49eb4 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -217,16 +217,20 @@
 
     /* Start the soft access point */
     static final int CMD_START_AP                         = BASE + 21;
+    /* Indicates soft ap start succeded */
+    static final int CMD_START_AP_SUCCESS                 = BASE + 22;
+    /* Indicates soft ap start failed */
+    static final int CMD_START_AP_FAILURE                 = BASE + 23;
     /* Stop the soft access point */
-    static final int CMD_STOP_AP                          = BASE + 22;
+    static final int CMD_STOP_AP                          = BASE + 24;
     /* Set the soft access point configuration */
-    static final int CMD_SET_AP_CONFIG                    = BASE + 23;
+    static final int CMD_SET_AP_CONFIG                    = BASE + 25;
     /* Get the soft access point configuration */
-    static final int CMD_GET_AP_CONFIG                    = BASE + 24;
+    static final int CMD_GET_AP_CONFIG                    = BASE + 26;
     /* Set configuration on tether interface */
-    static final int CMD_TETHER_INTERFACE                 = BASE + 25;
+    static final int CMD_TETHER_INTERFACE                 = BASE + 27;
 
-    static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE   = BASE + 26;
+    static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE   = BASE + 28;
 
     /* Supplicant commands */
     /* Is supplicant alive ? */
@@ -376,10 +380,6 @@
     private static final int MIN_RSSI = -200;
     private static final int MAX_RSSI = 256;
 
-    /* Constants to indicate if soft ap is running or stopped */
-    private static final int SOFT_AP_STOPPED = 0;
-    private static final int SOFT_AP_RUNNING = 1;
-
     /* Default parent state */
     private State mDefaultState = new DefaultState();
     /* Temporary initial state */
@@ -423,6 +423,8 @@
     /* Waiting for WPS to be completed*/
     private State mWaitForWpsCompletionState = new WaitForWpsCompletionState();
 
+    /* Soft ap is starting up */
+    private State mSoftApStartingState = new SoftApStartingState();
     /* Soft ap is running */
     private State mSoftApStartedState = new SoftApStartedState();
     /* Soft ap is running and we are tethered through connectivity service */
@@ -561,6 +563,7 @@
                 addState(mDriverStoppingState, mSupplicantStartedState);
                 addState(mDriverStoppedState, mSupplicantStartedState);
             addState(mSupplicantStoppingState, mDefaultState);
+            addState(mSoftApStartingState, mDefaultState);
             addState(mSoftApStartedState, mDefaultState);
                 addState(mTetheredState, mSoftApStartedState);
             addState(mWaitForP2pDisableState, mDefaultState);
@@ -1639,28 +1642,27 @@
         WifiNative.reconnectCommand();
     }
 
-    private boolean startSoftApWithConfig(WifiConfiguration config, int currentStatus) {
+    /* Current design is to not set the config on a running hostapd but instead
+     * stop and start tethering when user changes config on a running access point
+     *
+     * TODO: Add control channel setup through hostapd that allows changing config
+     * on a running daemon
+     */
+    private boolean startSoftApWithConfig(WifiConfiguration config) {
         if (config == null) {
             config = WifiApConfigStore.getApConfiguration();
         } else {
             WifiApConfigStore.setApConfiguration(config);
         }
         try {
-            if (currentStatus == SOFT_AP_STOPPED) {
-                nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE);
-            } else if (currentStatus == SOFT_AP_RUNNING) {
-                //nwService.setAccessPoint(config, mInterfaceName, SOFTAP_IFACE);
-                //TODO: when we have a control channel to hostapd, we should not need to do this
-                nwService.stopAccessPoint(mInterfaceName);
-                nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE);
-            }
+            nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE);
         } catch (Exception e) {
             Log.e(TAG, "Exception in softap start " + e);
             try {
                 nwService.stopAccessPoint(mInterfaceName);
                 nwService.startAccessPoint(config, mInterfaceName, SOFTAP_IFACE);
-            } catch (Exception ee) {
-                Log.e(TAG, "Exception during softap restart : " + ee);
+            } catch (Exception e1) {
+                Log.e(TAG, "Exception in softap re-start " + e1);
                 return false;
             }
         }
@@ -1722,6 +1724,8 @@
                 case CMD_START_DRIVER:
                 case CMD_STOP_DRIVER:
                 case CMD_START_AP:
+                case CMD_START_AP_SUCCESS:
+                case CMD_START_AP_FAILURE:
                 case CMD_STOP_AP:
                 case CMD_TETHER_INTERFACE:
                 case CMD_START_SCAN:
@@ -1903,14 +1907,7 @@
                     }
                     break;
                 case CMD_START_AP:
-                    if (startSoftApWithConfig((WifiConfiguration) message.obj, SOFT_AP_STOPPED)) {
-                        Log.d(TAG, "Soft AP start successful");
-                        setWifiApState(WIFI_AP_STATE_ENABLED);
-                        transitionTo(mSoftApStartedState);
-                    } else {
-                        Log.d(TAG, "Soft AP start failed");
-                        sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0));
-                    }
+                    transitionTo(mSoftApStartingState);
                     break;
                 default:
                     return NOT_HANDLED;
@@ -3061,6 +3058,67 @@
         }
     }
 
+    class SoftApStartingState extends State {
+        @Override
+        public void enter() {
+            if (DBG) Log.d(TAG, getName() + "\n");
+            EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
+
+            final Message message = Message.obtain(getCurrentMessage());
+            final WifiConfiguration config = (WifiConfiguration) message.obj;
+
+            // start hostapd on a seperate thread
+            new Thread(new Runnable() {
+                public void run() {
+                    if (startSoftApWithConfig(config)) {
+                        Log.d(TAG, "Soft AP start successful");
+                        sendMessage(CMD_START_AP_SUCCESS);
+                    } else {
+                        Log.d(TAG, "Soft AP start failed");
+                        sendMessage(CMD_START_AP_FAILURE);
+                    }
+                }
+            }).start();
+        }
+        @Override
+        public boolean processMessage(Message message) {
+            if (DBG) Log.d(TAG, getName() + message.toString() + "\n");
+            switch(message.what) {
+                case CMD_LOAD_DRIVER:
+                case CMD_UNLOAD_DRIVER:
+                case CMD_START_SUPPLICANT:
+                case CMD_STOP_SUPPLICANT:
+                case CMD_START_AP:
+                case CMD_STOP_AP:
+                case CMD_START_DRIVER:
+                case CMD_STOP_DRIVER:
+                case CMD_SET_SCAN_MODE:
+                case CMD_SET_SCAN_TYPE:
+                case CMD_SET_HIGH_PERF_MODE:
+                case CMD_SET_COUNTRY_CODE:
+                case CMD_SET_FREQUENCY_BAND:
+                case CMD_START_PACKET_FILTERING:
+                case CMD_STOP_PACKET_FILTERING:
+                case CMD_TETHER_INTERFACE:
+                case WifiP2pService.P2P_ENABLE_PENDING:
+                    deferMessage(message);
+                    break;
+                case CMD_START_AP_SUCCESS:
+                    setWifiApState(WIFI_AP_STATE_ENABLED);
+                    transitionTo(mSoftApStartedState);
+                    break;
+                case CMD_START_AP_FAILURE:
+                    // initiate driver unload
+                    sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0));
+                    break;
+                default:
+                    return NOT_HANDLED;
+            }
+            EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what);
+            return HANDLED;
+        }
+    }
+
     class SoftApStartedState extends State {
         @Override
         public void enter() {
@@ -3083,17 +3141,9 @@
                     transitionTo(mDriverLoadedState);
                     break;
                 case CMD_START_AP:
-                    Log.d(TAG,"SoftAP set on a running access point");
-                    if (startSoftApWithConfig((WifiConfiguration) message.obj, SOFT_AP_RUNNING)) {
-                        Log.d(TAG, "Soft AP start successful");
-                        setWifiApState(WIFI_AP_STATE_ENABLED);
-                        transitionTo(mSoftApStartedState);
-                    } else {
-                        Log.d(TAG, "Soft AP start failed");
-                        sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_AP_STATE_FAILED, 0));
-                    }
+                    // Ignore a start on a running access point
                     break;
-                /* Fail client mode operation when soft AP is enabled */
+                    /* Fail client mode operation when soft AP is enabled */
                 case CMD_START_SUPPLICANT:
                     Log.e(TAG,"Cannot start supplicant with a running soft AP");
                     setWifiState(WIFI_STATE_UNKNOWN);