Merge "Camera framework change required for 0-memcpy recording"
diff --git a/Android.mk b/Android.mk
index c71d72e..0af2302 100644
--- a/Android.mk
+++ b/Android.mk
@@ -607,6 +607,10 @@
 # Build ext.jar
 # ============================================================
 
+# NOTICE notes for non-obvious sections
+# apache-http - covered by the Apache Commons section.
+
+
 ext_dirs := \
 	../../external/nist-sip/java \
 	../../external/apache-http/src \
diff --git a/NOTICE b/NOTICE
index 2006201..8d6f583 100644
--- a/NOTICE
+++ b/NOTICE
@@ -17,7 +17,7 @@
    =========================================================================
 
 Apache Commons
-Copyright 1999-2004 The Apache Software Foundation
+Copyright 1999-2006 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
@@ -53,6 +53,26 @@
 These files are Copyright 1998 - 2009 PacketVideo, but released under
 the Apache2 License.
 
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the TagSoup code.                                 ==
+   =========================================================================
+
+This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
+
+TagSoup is licensed under the Apache License,
+Version 2.0.  You may obtain a copy of this license at
+http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
+additional legal rights not granted by this license.
+
+TagSoup is distributed in the hope that it will be useful, but
+unless required by applicable law or agreed to in writing, TagSoup
+is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, either express or implied; not even the implied warranty
+of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
                                Apache License
                            Version 2.0, January 2004
                         http://www.apache.org/licenses/
diff --git a/api/current.xml b/api/current.xml
index 29de36d..6da4a33 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -19972,6 +19972,21 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="onTabReselected"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="tab" type="android.app.ActionBar.Tab">
+</parameter>
+<parameter name="ft" type="android.app.FragmentTransaction">
+</parameter>
+</method>
 <method name="onTabSelected"
  return="void"
  abstract="true"
@@ -203876,6 +203891,19 @@
 <parameter name="l" type="android.view.View.OnCreateContextMenuListener">
 </parameter>
 </method>
+<method name="setOnDragListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="l" type="android.view.View.OnDragListener">
+</parameter>
+</method>
 <method name="setOnFocusChangeListener"
  return="void"
  abstract="false"
@@ -205285,6 +205313,29 @@
 </parameter>
 </method>
 </interface>
+<interface name="View.OnDragListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onDrag"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="v" type="android.view.View">
+</parameter>
+<parameter name="event" type="android.view.DragEvent">
+</parameter>
+</method>
+</interface>
 <interface name="View.OnFocusChangeListener"
  abstract="true"
  static="true"
@@ -237543,6 +237594,19 @@
 <parameter name="iconified" type="boolean">
 </parameter>
 </method>
+<method name="setMaxWidth"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="maxpixels" type="int">
+</parameter>
+</method>
 <method name="setOnCloseListener"
  return="void"
  abstract="false"
@@ -244054,7 +244118,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/cmds/am/Android.mk b/cmds/am/Android.mk
index 170849d..8b321b3 100644
--- a/cmds/am/Android.mk
+++ b/cmds/am/Android.mk
@@ -12,3 +12,20 @@
 $(TARGET_OUT)/bin/am : $(LOCAL_PATH)/am | $(ACP)
 	$(transform-prebuilt-to-target)
 
+NOTICE_FILE := NOTICE
+files_noticed := bin/am
+
+# Generate rules for a single file. The argument is the file path relative to
+# the installation root
+define make-notice-file
+
+$(TARGET_OUT_NOTICE_FILES)/src/$(1).txt: $(LOCAL_PATH)/$(NOTICE_FILE)
+	@echo Notice file: $$< -- $$@
+	@mkdir -p $$(dir $$@)
+	@cat $$< >> $$@
+
+$(TARGET_OUT_NOTICE_FILES)/hash-timestamp: $(TARGET_OUT_NOTICE_FILES)/src/$(1).txt
+
+endef
+
+$(foreach file,$(files_noticed),$(eval $(call make-notice-file,$(file))))
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index 29f2e30..7df9295 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -470,5 +470,15 @@
          *        will be executed in a single transaction.
          */
         public void onTabUnselected(Tab tab, FragmentTransaction ft);
+
+        /**
+         * Called when a tab that is already selected is chosen again by the user.
+         * Some applications may use this action to return to the top level of a category.
+         *
+         * @param tab The tab that was reselected.
+         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
+         *        once this method returns.
+         */
+        public void onTabReselected(Tab tab, FragmentTransaction ft);
     }
 }
diff --git a/core/java/android/app/ProgressDialog.java b/core/java/android/app/ProgressDialog.java
index 07a5a22..4c5d28e 100644
--- a/core/java/android/app/ProgressDialog.java
+++ b/core/java/android/app/ProgressDialog.java
@@ -74,10 +74,7 @@
     private Handler mViewUpdateHandler;
     
     public ProgressDialog(Context context) {
-        this(context,
-                context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB
-                ? com.android.internal.R.style.Theme_Holo_Dialog_Alert
-                : com.android.internal.R.style.Theme_Dialog_Alert);
+        super(context);
     }
 
     public ProgressDialog(Context context, int theme) {
diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java
index 58ed986..be818da 100644
--- a/core/java/android/os/Vibrator.java
+++ b/core/java/android/os/Vibrator.java
@@ -50,7 +50,7 @@
         }
         try {
             mService.vibrate(milliseconds, mToken);
-        } catch (Exception e) {
+        } catch (RemoteException e) {
             Log.w(TAG, "Failed to vibrate.", e);
         }
     }
@@ -80,7 +80,7 @@
         if (repeat < pattern.length) {
             try {
                 mService.vibratePattern(pattern, repeat, mToken);
-            } catch (Exception e) {
+            } catch (RemoteException e) {
                 Log.w(TAG, "Failed to vibrate.", e);
             }
         } else {
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 36e2c56..baf3505 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -6642,6 +6642,19 @@
              * <P>Type: boolean</P>
              */
             public static final String IM_ISPRIMARY = "im_isprimary";
+
+            /**
+             * The extra field that allows the client to supply multiple rows of
+             * arbitrary data for the contact (insert or edit). It is a list of
+             * ContentValues, one per data row. Supplying this extra is
+             * basically equivalent to inserting multiple rows into the
+             * {@link Data} table, except the user gets a chance to see and edit
+             * them before saving. Each ContentValues object must have a value
+             * for {@link Data#MIMETYPE}.
+             *
+             * @hide
+             */
+            public static final String DATA = "data";
         }
     }
 }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2b63eff..baa749a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1943,6 +1943,8 @@
 
     private OnTouchListener mOnTouchListener;
 
+    private OnDragListener mOnDragListener;
+
     /**
      * The application environment this view lives in.
      * This field should be made private, so it is hidden from the SDK.
@@ -2739,6 +2741,14 @@
     }
 
     /**
+     * Register a callback to be invoked when a drag event is sent to this view.
+     * @param l The drag listener to attach to this view
+     */
+    public void setOnDragListener(OnDragListener l) {
+        mOnDragListener = l;
+    }
+
+    /**
      * Give this view focus. This will cause {@link #onFocusChanged} to be called.
      *
      * Note: this does not check whether this {@link View} should get focus, it just
@@ -9994,10 +10004,13 @@
 
     /**
      * Views typically don't need to override dispatchDragEvent(); it just calls
-     * onDragEvent(what, event) and passes the result up appropriately.
-     *
+     * onDragEvent(event) and passes the result up appropriately.
      */
     public boolean dispatchDragEvent(DragEvent event) {
+        if (mOnDragListener != null && (mViewFlags & ENABLED_MASK) == ENABLED
+                && mOnDragListener.onDrag(this, event)) {
+            return true;
+        }
         return onDragEvent(event);
     }
 
@@ -10288,6 +10301,26 @@
     }
 
     /**
+     * Interface definition for a callback to be invoked when a drag is being dispatched
+     * to this view.  The callback will be invoked before the hosting view's own
+     * onDrag(event) method.  If the listener wants to fall back to the hosting view's
+     * onDrag(event) behavior, it should return 'false' from this callback.
+     */
+    public interface OnDragListener {
+        /**
+         * Called when a drag event is dispatched to a view. This allows listeners
+         * to get a chance to override base View behavior.
+         *
+         * @param v The view the drag has been dispatched to.
+         * @param event The DragEvent object containing full information
+         *        about the event.
+         * @return true if the listener consumed the DragEvent, false in order to fall
+         *         back to the view's default handling.
+         */
+        boolean onDrag(View v, DragEvent event);
+    }
+
+    /**
      * Interface definition for a callback to be invoked when the focus state of
      * a view changed.
      */
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 4eea2d2..f34fd63 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -954,7 +954,8 @@
 
         // If none of our children could handle the event, try here
         if (!retval) {
-            retval = onDragEvent(event);
+            // Call up to the View implementation that dispatches to installed listeners
+            retval = super.dispatchDragEvent(event);
         }
         return retval;
     }
@@ -4626,7 +4627,10 @@
                     next = sRecycleBin;
                     sRecycleBin = this;
                     sRecycledCount += 1;
+                } else {
+                    next = null;
                 }
+                child = null;
             }
         }
     }
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 17860fd..be1af65 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2763,7 +2763,7 @@
     public int findAll(String find) {
         if (0 == mNativeClass) return 0; // client isn't initialized
         int result = find != null ? nativeFindAll(find.toLowerCase(),
-                find.toUpperCase()) : 0;
+                find.toUpperCase(), find.equalsIgnoreCase(mLastFind)) : 0;
         invalidate();
         mLastFind = find;
         return result;
@@ -7427,7 +7427,8 @@
     private native boolean  nativeEvaluateLayersAnimations();
     private native boolean  nativeDrawGL(Rect rect, float scale, int extras);
     private native void     nativeExtendSelection(int x, int y);
-    private native int      nativeFindAll(String findLower, String findUpper);
+    private native int      nativeFindAll(String findLower, String findUpper,
+            boolean sameAsLastSearch);
     private native void     nativeFindNext(boolean forward);
     /* package */ native int      nativeFocusCandidateFramePointer();
     /* package */ native boolean  nativeFocusCandidateHasNextTextfield();
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 361b27e..847651c 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -56,6 +56,15 @@
  * Provides the user interface elements for the user to enter a search query and submit a
  * request to a search provider. Shows a list of query suggestions or results, if
  * available and allows the user to pick a suggestion or result to launch into.
+ *
+ * <p>
+ * <b>XML attributes</b>
+ * <p>
+ * See {@link android.R.styleable#SearchView SearchView Attributes},
+ * {@link android.R.styleable#View View Attributes}
+ *
+ * @attr ref android.R.styleable#SearchView_iconifiedByDefault
+ * @attr ref android.R.styleable#SearchView_maxWidth
  */
 public class SearchView extends LinearLayout {
 
@@ -80,6 +89,7 @@
     private CharSequence mQueryHint;
     private boolean mQueryRefinement;
     private boolean mClearingFocus;
+    private int mMaxWidth;
 
     private SearchableInfo mSearchable;
 
@@ -198,6 +208,10 @@
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SearchView, 0, 0);
         setIconifiedByDefault(a.getBoolean(R.styleable.SearchView_iconifiedByDefault, true));
+        int maxWidth = a.getDimensionPixelSize(R.styleable.SearchView_maxWidth, -1);
+        if (maxWidth != -1) {
+            setMaxWidth(maxWidth);
+        }
         a.recycle();
 
         // Save voice intent for later queries/launching
@@ -434,6 +448,30 @@
         return mSuggestionsAdapter;
     }
 
+    /**
+     * Makes the view at most this many pixels wide
+     *
+     * @attr ref android.R.styleable#SearchView_maxWidth
+     */
+    public void setMaxWidth(int maxpixels) {
+        mMaxWidth = maxpixels;
+
+        requestLayout();
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+        int width = MeasureSpec.getSize(widthMeasureSpec);
+
+        if ((widthMode == MeasureSpec.AT_MOST || widthMode == MeasureSpec.EXACTLY) && mMaxWidth > 0
+                && width > mMaxWidth) {
+            super.onMeasure(MeasureSpec.makeMeasureSpec(mMaxWidth, widthMode), heightMeasureSpec);
+        } else {
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        }
+    }
+
     private void updateViewsVisibility(final boolean collapsed) {
         mIconified = collapsed;
         // Visibility of views that are visible when collapsed
@@ -447,6 +485,8 @@
         mSubmitButton.setVisibility(mSubmitButtonEnabled && hasText ? visExpanded : GONE);
         mSearchEditFrame.setVisibility(visExpanded);
         updateVoiceButton(!hasText);
+        requestLayout();
+        invalidate();
     }
 
     private void setImeVisibility(boolean visible) {
@@ -537,6 +577,7 @@
         //closeSuggestionsAdapter();
 
         mQueryTextView.setDropDownAnimationStyle(0); // no animation
+        mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
 
         // attach the suggestions adapter, if suggestions are available
         // The existence of a suggestions authority is the proxy for "suggestions available here"
@@ -594,6 +635,8 @@
         boolean hasText = !TextUtils.isEmpty(text);
         if (isSubmitButtonEnabled()) {
             mSubmitButton.setVisibility(hasText ? VISIBLE : GONE);
+            requestLayout();
+            invalidate();
         }
         updateVoiceButton(!hasText);
         if (mOnQueryChangeListener != null) {
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index cf029d2..3015363 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -326,18 +326,21 @@
 
     @Override
     public void selectTab(Tab tab) {
-        if (mSelectedTab == tab) {
-            return;
-        }
-
-        mActionView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
         final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction();
-        if (mSelectedTab != null) {
-            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
-        }
-        mSelectedTab = (TabImpl) tab;
-        if (mSelectedTab != null) {
-            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
+
+        if (mSelectedTab == tab) {
+            if (mSelectedTab != null) {
+                mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
+            }
+        } else {
+            mActionView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
+            if (mSelectedTab != null) {
+                mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
+            }
+            mSelectedTab = (TabImpl) tab;
+            if (mSelectedTab != null) {
+                mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
+            }
         }
 
         if (!trans.isEmpty()) {
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java
index 998a177..cbdb947 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/core/java/com/android/internal/app/ShutdownThread.java
@@ -409,7 +409,13 @@
         } else if (SHUTDOWN_VIBRATE_MS > 0) {
             // vibrate before shutting down
             Vibrator vibrator = new Vibrator();
-            vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
+            try {
+                vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
+            } catch (Exception e) {
+                // Failure to vibrate shouldn't interrupt shutdown.  Just log it.
+                Log.w(TAG, "Failed to vibrate during shutdown.", e);
+            }
+
             // vibrator is asynchronous so we need to wait to avoid shutting down too soon.
             try {
                 Thread.sleep(SHUTDOWN_VIBRATE_MS);
diff --git a/core/res/res/drawable-xlarge-mdpi/default_wallpaper.jpg b/core/res/res/drawable-xlarge-mdpi/default_wallpaper.jpg
new file mode 100644
index 0000000..5acad94
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/default_wallpaper.jpg
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_alarm.png b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_alarm.png
new file mode 100644
index 0000000..336a820
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_alarm.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_charging.png b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_charging.png
new file mode 100644
index 0000000..ebef531
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_charging.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_lock.png b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_lock.png
new file mode 100644
index 0000000..405e218
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_lock.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_low_battery.png b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_low_battery.png
new file mode 100644
index 0000000..f349b63
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/ic_lock_idle_low_battery.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/unlock_default.png b/core/res/res/drawable-xlarge-mdpi/unlock_default.png
new file mode 100644
index 0000000..0a441c0
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/unlock_default.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/unlock_halo.png b/core/res/res/drawable-xlarge-mdpi/unlock_halo.png
new file mode 100644
index 0000000..09b0526
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/unlock_halo.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/unlock_ring.png b/core/res/res/drawable-xlarge-mdpi/unlock_ring.png
new file mode 100644
index 0000000..1ac6d54
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/unlock_ring.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/unlock_wave.png b/core/res/res/drawable-xlarge-mdpi/unlock_wave.png
new file mode 100644
index 0000000..21bfa24
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/unlock_wave.png
Binary files differ
diff --git a/core/res/res/drawable/activated_background_holo_dark.xml b/core/res/res/drawable/activated_background_holo_dark.xml
new file mode 100644
index 0000000..f71235e
--- /dev/null
+++ b/core/res/res/drawable/activated_background_holo_dark.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_activated="true" android:drawable="@android:drawable/list_selector_activated_holo_dark" />
+    <item android:drawable="@color/transparent" />
+</selector>
diff --git a/core/res/res/drawable/activated_background_holo_light.xml b/core/res/res/drawable/activated_background_holo_light.xml
new file mode 100644
index 0000000..615033d
--- /dev/null
+++ b/core/res/res/drawable/activated_background_holo_light.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_activated="true" android:drawable="@android:drawable/list_selector_activated_holo_light" />
+    <item android:drawable="@color/transparent" />
+</selector>
diff --git a/core/res/res/drawable/list_selector_background.xml b/core/res/res/drawable/list_selector_background.xml
index 0a51152..6fb0661 100644
--- a/core/res/res/drawable/list_selector_background.xml
+++ b/core/res/res/drawable/list_selector_background.xml
@@ -24,6 +24,5 @@
     <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="true"                                                             android:drawable="@drawable/list_selector_background_focused" />
-    <item                                                                                          android:drawable="@drawable/list_selector_background_default" />
     
 </selector>
diff --git a/core/res/res/drawable/list_selector_background_light.xml b/core/res/res/drawable/list_selector_background_light.xml
index 9b7980c..4da7e21 100644
--- a/core/res/res/drawable/list_selector_background_light.xml
+++ b/core/res/res/drawable/list_selector_background_light.xml
@@ -24,6 +24,5 @@
     <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_light" />
     <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_light" />
     <item android:state_focused="true"                                                             android:drawable="@drawable/list_selector_background_focused_light" />
-    <item                                                                                          android:drawable="@drawable/list_selector_background_default_light" />
 
 </selector>
diff --git a/core/res/res/drawable/list_selector_holo_dark.xml b/core/res/res/drawable/list_selector_holo_dark.xml
index 3456e1e..9cc993a 100644
--- a/core/res/res/drawable/list_selector_holo_dark.xml
+++ b/core/res/res/drawable/list_selector_holo_dark.xml
@@ -24,5 +24,4 @@
     <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="true"                                                             android:drawable="@drawable/list_selector_focused_holo_dark" />
-    <item                                                                                          android:drawable="@drawable/list_selector_focused_holo_dark" />
 </selector>
diff --git a/core/res/res/drawable/list_selector_holo_light.xml b/core/res/res/drawable/list_selector_holo_light.xml
index 2dc39f6..f2def40 100644
--- a/core/res/res/drawable/list_selector_holo_light.xml
+++ b/core/res/res/drawable/list_selector_holo_light.xml
@@ -24,6 +24,5 @@
     <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
     <item android:state_focused="true"                                                             android:drawable="@drawable/list_selector_focused_holo_light" />
-    <item                                                                                          android:drawable="@drawable/list_selector_focused_holo_light" />
 
 </selector>
diff --git a/core/res/res/layout/search_view.xml b/core/res/res/layout/search_view.xml
index b60261e..b5d917d 100644
--- a/core/res/res/layout/search_view.xml
+++ b/core/res/res/layout/search_view.xml
@@ -21,7 +21,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/search_bar"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
+    android:layout_height="match_parent"
     android:orientation="horizontal"
     >
 
@@ -40,82 +40,91 @@
 
     <ImageView
         android:id="@+id/search_button"
-        android:layout_height="36dip"
-        android:layout_width="match_parent"
-        android:layout_marginRight="7dip"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
         android:layout_gravity="center_vertical"
         android:src="@android:drawable/ic_btn_search"
     />
 
-    <!-- Inner layout contains the app icon, button(s) and EditText -->
     <LinearLayout
         android:id="@+id/search_edit_frame"
-        android:layout_width="300dp"
-        android:layout_height="match_parent"
-        android:visibility="gone"
-        android:orientation="horizontal"
-        android:background="?android:attr/editTextBackground">
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_gravity="center_vertical"
+        android:orientation="horizontal">
 
-        <ImageView
-            android:id="@+id/search_app_icon"
-            android:layout_height="24dip"
-            android:layout_width="24dip"
-            android:layout_marginRight="7dip"
-            android:layout_gravity="bottom"
-            android:src="@android:drawable/ic_btn_search"
-        />
-
-        <AutoCompleteTextView
-            android:id="@+id/search_src_text"
+        <!-- Inner layout contains the app icon, button(s) and EditText -->
+        <LinearLayout
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_width="match_parent"
             android:layout_weight="1"
-            android:layout_gravity="bottom"
-            android:paddingLeft="8dip"
-            android:paddingRight="6dip"
-            android:drawablePadding="2dip"
-            android:singleLine="true"
-            android:ellipsize="end"
-            android:background="@null"
-            android:inputType="text|textAutoComplete"
-            android:imeOptions="actionSearch"
-            android:dropDownWidth="300dp"
-            android:dropDownHeight="wrap_content"
-            android:dropDownAnchor="@id/search_edit_frame"
-            android:dropDownVerticalOffset="0dip"
-            android:dropDownHorizontalOffset="0dip"
-            android:popupBackground="@android:drawable/search_dropdown_background"
-        />
+            android:layout_gravity="center_vertical"
+            android:orientation="horizontal"
+            android:background="?android:attr/editTextBackground">
 
-        <!-- TODO: Use the generic dialog close drawable -->
+            <ImageView
+                android:id="@+id/search_app_icon"
+                android:layout_height="24dip"
+                android:layout_width="24dip"
+                android:layout_marginRight="7dip"
+                android:layout_gravity="bottom"
+                android:src="@android:drawable/ic_btn_search"
+            />
+
+            <AutoCompleteTextView
+                android:id="@+id/search_src_text"
+                android:layout_height="wrap_content"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:minWidth="100dp"
+                android:layout_gravity="bottom"
+                android:paddingLeft="8dip"
+                android:paddingRight="6dip"
+                android:drawablePadding="2dip"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:background="@null"
+                android:inputType="text|textAutoComplete"
+                android:imeOptions="actionSearch"
+                android:dropDownHeight="wrap_content"
+                android:dropDownAnchor="@id/search_edit_frame"
+                android:dropDownVerticalOffset="0dip"
+                android:dropDownHorizontalOffset="0dip"
+                android:popupBackground="@android:drawable/search_dropdown_background"
+            />
+
+            <!-- TODO: Use the generic dialog close drawable -->
+            <ImageView
+                android:id="@+id/search_close_btn"
+                android:layout_width="24dp"
+                android:layout_height="24dp"
+                android:layout_gravity="bottom"
+                android:src="@android:drawable/btn_close"
+            />
+
+        </LinearLayout>
+
         <ImageView
-            android:id="@+id/search_close_btn"
-            android:layout_width="24dp"
-            android:layout_height="24dp"
+            android:id="@+id/search_go_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:layout_gravity="bottom"
-            android:src="@android:drawable/btn_close"
+            android:layout_marginLeft="4dip"
+            android:layout_marginRight="4dip"
+            android:src="@android:drawable/ic_btn_find_next"
         />
     </LinearLayout>
 
-    <ImageView
-        android:id="@+id/search_go_btn"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_marginLeft="4dip"
-        android:layout_marginRight="4dip"
-        android:src="@android:drawable/ic_btn_find_next"
-    />
-
     <ImageButton
         android:id="@+id/search_voice_btn"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:layout_marginLeft="0dip"
-        android:layout_marginTop="-6.5dip"
-        android:layout_marginBottom="-7dip"
-        android:layout_marginRight="-5dip"
-        android:background="@drawable/btn_search_dialog_voice"
+        android:layout_gravity="center_vertical"
+        android:layout_marginLeft="4dip"
+        android:layout_marginRight="4dip"
         android:src="@android:drawable/ic_btn_speak_now"
+        android:background="@android:color/transparent"
         android:visibility="gone"
     />
 </LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b419a91..663f247 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -4271,6 +4271,8 @@
         <!-- The default state of the SearchView. If true, it will be iconified when not in
              use and expanded when clicked. -->
         <attr name="iconifiedByDefault" format="boolean"/>
+        <!-- An optional maximum width of the SearchView. -->
+        <attr name="maxWidth" />
     </declare-styleable>
 
     <declare-styleable name="ButtonGroup">
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 2ecb4d0..d180ed5 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -577,6 +577,7 @@
     <!-- Default style for {@link android.app.FragmentBreadCrumbs} view. -->
     <style name="Widget.FragmentBreadCrumbs">
         <item name="android:padding">4dp</item>
+        <item name="android:animateLayoutChanges">true</item>
     </style>
 
     <style name="Widget.KeyboardView" parent="android:Widget">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index d7954a7..88dd862 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -706,7 +706,7 @@
 
         <item name="listChoiceBackgroundIndicator">@android:drawable/list_selector_holo_dark</item>
 
-        <item name="activatedBackgroundIndicator">@android:drawable/list_selector_activated_holo_dark</item>
+        <item name="activatedBackgroundIndicator">@android:drawable/activated_background_holo_dark</item>
 
         <item name="listDividerAlertDialog">@android:drawable/divider_horizontal_holo_dark</item>
 
@@ -936,7 +936,7 @@
 
         <item name="listChoiceBackgroundIndicator">@android:drawable/list_selector_holo_light</item>
 
-        <item name="activatedBackgroundIndicator">@android:drawable/list_selector_activated_holo_light</item>
+        <item name="activatedBackgroundIndicator">@android:drawable/activated_background_holo_light</item>
 
         <item name="expandableListPreferredItemPaddingLeft">40dip</item>
         <item name="expandableListPreferredChildPaddingLeft">
diff --git a/media/java/android/media/videoeditor/AudioTrack.java b/media/java/android/media/videoeditor/AudioTrack.java
index 076cc31..6303b9d 100755
--- a/media/java/android/media/videoeditor/AudioTrack.java
+++ b/media/java/android/media/videoeditor/AudioTrack.java
@@ -20,7 +20,7 @@
 

 /**

  * This class allows to handle an audio track. This audio file is mixed with the

- * audio samples of the MediaItems.

+ * audio samples of the media items.

  * {@hide}

  */

 public class AudioTrack {

@@ -43,7 +43,7 @@
 

     // Ducking variables

     private int mDuckingThreshold;

-    private int mDuckingLowVolume;

+    private int mDuckedTrackVolume;

     private boolean mIsDuckingEnabled;

 

     // The audio waveform filename

@@ -98,7 +98,7 @@
 

         // Ducking is enabled by default

         mDuckingThreshold = 0;

-        mDuckingLowVolume = 0;

+        mDuckedTrackVolume = 0;

         mIsDuckingEnabled = true;

 

         // The audio waveform file is generated later

@@ -120,12 +120,18 @@
      * @param loop true to loop the audio track

      * @param volume The volume in percentage

      * @param muted true if the audio track is muted

+     * @param threshold Ducking will be activated when the relative energy in

+     *      the media items audio signal goes above this value. The valid

+     *      range of values is 0 to 100.

+     * @param duckedTrackVolume The relative volume of the audio track when ducking

+     *      is active. The valid range of values is 0 to 100.

      * @param audioWaveformFilename The name of the waveform file

      *

      * @throws IOException if file is not found

      */

     AudioTrack(VideoEditor editor, String audioTrackId, String filename, long startTimeMs,

             long beginMs, long endMs, boolean loop, int volume, boolean muted,

+            boolean duckingEnabled, int duckThreshold, int duckedTrackVolume,

             String audioWaveformFilename) throws IOException {

         mUniqueId = audioTrackId;

         mFilename = filename;

@@ -150,6 +156,10 @@
         mLoop = loop;

         mMuted = muted;

 

+        mIsDuckingEnabled = duckingEnabled;

+        mDuckingThreshold = duckThreshold;

+        mDuckedTrackVolume = duckedTrackVolume;

+

         mAudioWaveformFilename = audioWaveformFilename;

     }

 

@@ -347,15 +357,26 @@
     }

 

     /**

-     * TODO DEFINE

+     * Enable ducking by specifying the required parameters

      *

-     * @param threshold

-     * @param lowVolume

-     * @param volume

+     * @param threshold Ducking will be activated when the relative energy in

+     *      the media items audio signal goes above this value. The valid

+     *      range of values is 0 to 100.

+     * @param duckedTrackVolume The relative volume of the audio track when ducking

+     *      is active. The valid range of values is 0 to 100.

      */

-    public void enableDucking(int threshold, int lowVolume, int volume) {

+    public void enableDucking(int threshold, int duckedTrackVolume) {

+        if (threshold < 0 || threshold > 100) {

+            throw new IllegalArgumentException("Invalid threshold value: " + threshold);

+        }

+

+        if (duckedTrackVolume < 0 || duckedTrackVolume > 100) {

+            throw new IllegalArgumentException("Invalid duckedTrackVolume value: "

+                    + duckedTrackVolume);

+        }

+

         mDuckingThreshold = threshold;

-        mDuckingLowVolume = lowVolume;

+        mDuckedTrackVolume = duckedTrackVolume;

         mIsDuckingEnabled = true;

     }

 

@@ -374,10 +395,10 @@
     }

 

     /**

-     * @return The ducking low level

+     * @return The ducked track volume

      */

-    public int getDuckingLowVolume() {

-        return mDuckingLowVolume;

+    public int getDuckedTrackVolume() {

+        return mDuckedTrackVolume;

     }

 

     /**

diff --git a/media/java/android/media/videoeditor/VideoEditorTestImpl.java b/media/java/android/media/videoeditor/VideoEditorTestImpl.java
index a4dabff..f4842b5 100644
--- a/media/java/android/media/videoeditor/VideoEditorTestImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorTestImpl.java
@@ -90,6 +90,9 @@
     private static final String ATTR_END_RECT_B = "end_b";
     private static final String ATTR_LOOP = "loop";
     private static final String ATTR_MUTED = "muted";
+    private static final String ATTR_DUCK_ENABLED = "ducking_enabled";
+    private static final String ATTR_DUCK_THRESHOLD = "ducking_threshold";
+    private static final String ATTR_DUCKED_TRACK_VOLUME = "ducking_volume";
 
     // Instance variables
     private long mDurationMs;
@@ -716,6 +719,9 @@
             serializer.attribute("", ATTR_BEGIN_TIME, Long.toString(at.getBoundaryBeginTime()));
             serializer.attribute("", ATTR_END_TIME, Long.toString(at.getBoundaryEndTime()));
             serializer.attribute("", ATTR_VOLUME, Integer.toString(at.getVolume()));
+            serializer.attribute("", ATTR_DUCK_ENABLED, Boolean.toString(at.isDuckingEnabled()));
+            serializer.attribute("", ATTR_DUCKED_TRACK_VOLUME, Integer.toString(at.getDuckedTrackVolume()));
+            serializer.attribute("", ATTR_DUCK_THRESHOLD, Integer.toString(at.getDuckingThreshhold()));
             serializer.attribute("", ATTR_MUTED, Boolean.toString(at.isMuted()));
             serializer.attribute("", ATTR_LOOP, Boolean.toString(at.isLooping()));
             if (at.getAudioWaveformFilename() != null) {
@@ -1017,10 +1023,13 @@
         final int volume = Integer.parseInt(parser.getAttributeValue("", ATTR_VOLUME));
         final boolean muted = Boolean.parseBoolean(parser.getAttributeValue("", ATTR_MUTED));
         final boolean loop = Boolean.parseBoolean(parser.getAttributeValue("", ATTR_LOOP));
+        final boolean duckingEnabled = Boolean.parseBoolean(parser.getAttributeValue("", ATTR_DUCK_ENABLED));
+        final int duckThreshold = Integer.parseInt(parser.getAttributeValue("", ATTR_DUCK_THRESHOLD));
+        final int duckedTrackVolume = Integer.parseInt(parser.getAttributeValue("", ATTR_DUCKED_TRACK_VOLUME));
         final String waveformFilename = parser.getAttributeValue("", ATTR_AUDIO_WAVEFORM_FILENAME);
         try {
             final AudioTrack audioTrack = new AudioTrack(this, audioTrackId, filename, startTimeMs,
-                    beginMs, endMs, loop, volume, muted, waveformFilename);
+                    beginMs, endMs, loop, volume, muted, duckingEnabled, duckThreshold, duckedTrackVolume, waveformFilename);
 
             return audioTrack;
         } catch (IOException ex) {