Merge change 2182 into donut

* changes:
  location: Replace ILocationCollector interface with new ILocationProvider method
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index f85ea9f8..46fc2d0 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -1052,8 +1052,6 @@
 }
 
 
-#if DEBUG_HEAP_LEAKS
-
 #define CHECK_INTERFACE(interface, data, reply) \
         do { if (!data.enforceInterface(interface::getInterfaceDescriptor())) { \
             LOGW("Call incorrectly routed to " #interface); \
@@ -1085,6 +1083,8 @@
 
     status_t err = BnCameraService::onTransact(code, data, reply, flags);
 
+#if DEBUG_HEAP_LEAKS
+
     LOGD("+++ onTransact err %d code %d", err, code);
 
     if (err == UNKNOWN_TRANSACTION || err == PERMISSION_DENIED) {
@@ -1120,9 +1120,8 @@
             break;
         }
     }
+#endif // DEBUG_HEAP_LEAKS
     return err;
 }
 
-#endif // DEBUG_HEAP_LEAKS
-
 }; // namespace android
diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h
index 6752f26..a421fd3 100644
--- a/camera/libcameraservice/CameraService.h
+++ b/camera/libcameraservice/CameraService.h
@@ -58,10 +58,8 @@
 
             void            removeClient(const sp<ICameraClient>& cameraClient);
 
-#if DEBUG_HEAP_LEAKS
     virtual status_t onTransact(
         uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
-#endif
 
 private:
 
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 343380c..1ff5665 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -31,6 +31,7 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.graphics.drawable.AnimationDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
@@ -103,6 +104,7 @@
     private Button mGoButton;
     private ImageButton mVoiceButton;
     private View mSearchPlate;
+    private AnimationDrawable mWorkingSpinner;
 
     // interaction with searchable application
     private SearchableInfo mSearchable;
@@ -182,6 +184,8 @@
         mGoButton = (Button) findViewById(com.android.internal.R.id.search_go_btn);
         mVoiceButton = (ImageButton) findViewById(com.android.internal.R.id.search_voice_btn);
         mSearchPlate = findViewById(com.android.internal.R.id.search_plate);
+        mWorkingSpinner = (AnimationDrawable) getContext().getResources().
+                getDrawable(com.android.internal.R.drawable.search_spinner);
         
         // attach listeners
         mSearchAutoComplete.addTextChangedListener(mTextWatcher);
@@ -239,7 +243,6 @@
         return doShow(initialQuery, selectInitialQuery, componentName, appSearchData, globalSearch);
     }
     
-    
     /**
      * Called in response to a press of the hard search button in
      * {@link #onKeyDown(int, KeyEvent)}, this method toggles between in-app
@@ -396,6 +399,24 @@
     }
     
     /**
+     * Sets the search dialog to the 'working' state, which shows a working spinner in the
+     * right hand size of the text field.
+     * 
+     * @param working true to show spinner, false to hide spinner
+     */
+    public void setWorking(boolean working) {
+        if (working) {
+            mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
+                    null, null, mWorkingSpinner, null);
+            mWorkingSpinner.start();
+        } else {
+            mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
+                    null, null, null, null);
+            mWorkingSpinner.stop();
+        }
+    }
+    
+    /**
      * Closes and gets rid of the suggestions adapter.
      */
     private void closeSuggestionsAdapter() {
@@ -563,8 +584,8 @@
         // attach the suggestions adapter, if suggestions are available
         // The existence of a suggestions authority is the proxy for "suggestions available here"
         if (mSearchable.getSuggestAuthority() != null) {
-            mSuggestionsAdapter = new SuggestionsAdapter(getContext(), mSearchable, 
-                    mOutsideDrawablesCache);
+            mSuggestionsAdapter = new SuggestionsAdapter(getContext(), this, mSearchable, 
+                    mOutsideDrawablesCache, mGlobalSearchMode);
             mSearchAutoComplete.setAdapter(mSuggestionsAdapter);
         }
     }
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 6a02fc9..2fe9a8d 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -25,6 +25,7 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.os.Bundle;
 import android.server.search.SearchableInfo;
 import android.text.Html;
 import android.text.TextUtils;
@@ -45,12 +46,18 @@
  * @hide
  */
 class SuggestionsAdapter extends ResourceCursorAdapter {
+    // The value used to query a cursor whether it is still expecting more input,
+    // so we can correctly display (or not display) the 'working' spinner in the search dialog.
+    public static final String IS_WORKING = "isWorking";
+    
     private static final boolean DBG = false;
     private static final String LOG_TAG = "SuggestionsAdapter";
     
+    private SearchDialog mSearchDialog;
     private SearchableInfo mSearchable;
     private Context mProviderContext;
     private WeakHashMap<String, Drawable> mOutsideDrawablesCache;
+    private boolean mGlobalSearchMode;
 
     // Cached column indexes, updated when the cursor changes. 
     private int mFormatCol;
@@ -61,12 +68,13 @@
     private int mIconBitmap1Col;
     private int mIconBitmap2Col;
     
-    public SuggestionsAdapter(Context context, SearchableInfo searchable,
-            WeakHashMap<String, Drawable> outsideDrawablesCache) {
+    public SuggestionsAdapter(Context context, SearchDialog searchDialog, SearchableInfo searchable,
+            WeakHashMap<String, Drawable> outsideDrawablesCache, boolean globalSearchMode) {
         super(context,
                 com.android.internal.R.layout.search_dropdown_item_icons_2line,
                 null,   // no initial cursor
                 true);  // auto-requery
+        mSearchDialog = searchDialog;
         mSearchable = searchable;
         
         // set up provider resources (gives us icons, etc.)
@@ -74,6 +82,7 @@
         mProviderContext = mSearchable.getProviderContext(mContext, activityContext);
         
         mOutsideDrawablesCache = outsideDrawablesCache;
+        mGlobalSearchMode = globalSearchMode;
     }
     
     /**
@@ -118,6 +127,28 @@
             mIconBitmap1Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_1_BITMAP);
             mIconBitmap2Col = c.getColumnIndex(SearchManager.SUGGEST_COLUMN_ICON_2_BITMAP);
         }
+        updateWorking();
+    }
+        
+    @Override
+    public void notifyDataSetChanged() {
+        super.notifyDataSetChanged();
+        updateWorking();
+    }
+    
+    /**
+     * Updates the search dialog according to the current working status of the cursor.
+     */
+    private void updateWorking() {
+        if (!mGlobalSearchMode || mCursor == null) return;
+        
+        Bundle request = new Bundle();
+        request.putString(SearchManager.EXTRA_DATA_KEY, IS_WORKING);
+        Bundle response = mCursor.respond(request);
+        if (response.containsKey(IS_WORKING)) {
+            boolean isWorking = response.getBoolean(IS_WORKING);
+            mSearchDialog.setWorking(isWorking);
+        }
     }
     
     /**
diff --git a/core/res/res/drawable/search_spinner.xml b/core/res/res/drawable/search_spinner.xml
new file mode 100644
index 0000000..34c163d
--- /dev/null
+++ b/core/res/res/drawable/search_spinner.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+<animation-list
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:oneshot="false">
+    <item android:drawable="@drawable/search_spinner_anim1" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim2" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim3" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim4" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim5" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim6" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim7" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim8" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim9" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim10" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim11" android:duration="150" />
+    <item android:drawable="@drawable/search_spinner_anim12" android:duration="150" />
+</animation-list>
+
diff --git a/core/res/res/drawable/search_spinner_anim1.png b/core/res/res/drawable/search_spinner_anim1.png
new file mode 100755
index 0000000..e55b60d
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim1.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim10.png b/core/res/res/drawable/search_spinner_anim10.png
new file mode 100755
index 0000000..9611d97
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim10.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim11.png b/core/res/res/drawable/search_spinner_anim11.png
new file mode 100755
index 0000000..4261704
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim11.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim12.png b/core/res/res/drawable/search_spinner_anim12.png
new file mode 100755
index 0000000..0602314
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim12.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim2.png b/core/res/res/drawable/search_spinner_anim2.png
new file mode 100755
index 0000000..05d58e0
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim2.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim3.png b/core/res/res/drawable/search_spinner_anim3.png
new file mode 100755
index 0000000..69fa9c1
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim3.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim4.png b/core/res/res/drawable/search_spinner_anim4.png
new file mode 100755
index 0000000..9201bac
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim4.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim5.png b/core/res/res/drawable/search_spinner_anim5.png
new file mode 100755
index 0000000..f0c7101
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim5.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim6.png b/core/res/res/drawable/search_spinner_anim6.png
new file mode 100755
index 0000000..99d1d4e
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim6.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim7.png b/core/res/res/drawable/search_spinner_anim7.png
new file mode 100755
index 0000000..8ca3358
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim7.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim8.png b/core/res/res/drawable/search_spinner_anim8.png
new file mode 100755
index 0000000..408d723
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim8.png
Binary files differ
diff --git a/core/res/res/drawable/search_spinner_anim9.png b/core/res/res/drawable/search_spinner_anim9.png
new file mode 100755
index 0000000..42a2c65
--- /dev/null
+++ b/core/res/res/drawable/search_spinner_anim9.png
Binary files differ
diff --git a/core/res/res/layout/google_web_content_helper_layout.xml b/core/res/res/layout/google_web_content_helper_layout.xml
index 40f84bf..546c458 100644
--- a/core/res/res/layout/google_web_content_helper_layout.xml
+++ b/core/res/res/layout/google_web_content_helper_layout.xml
@@ -18,10 +18,28 @@
         android:foregroundGravity="center"
         android:measureAllChildren="false">
         
-    <!-- Include the indeterminate progress dialog's layout. -->
-    <include
-            android:id="@+id/progressContainer"
-            layout="@android:layout/progress_dialog" />
+    <LinearLayout android:id="@+id/progressContainer"
+                  android:orientation="horizontal"
+                  android:layout_gravity="center"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"
+                  android:baselineAligned="false"
+                  android:paddingLeft="8dip"
+                  android:paddingTop="10dip"
+                  android:paddingRight="8dip"
+                  android:paddingBottom="10dip">
+
+        <ProgressBar android:id="@android:id/progress"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:max="10000"
+            android:layout_marginRight="12dip" />
+
+        <TextView android:id="@+id/message"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical" />
+    </LinearLayout>
             
     <WebView
             android:id="@+id/web"
diff --git a/core/res/res/layout/search_bar.xml b/core/res/res/layout/search_bar.xml
index b512490..7b7f8a6 100644
--- a/core/res/res/layout/search_bar.xml
+++ b/core/res/res/layout/search_bar.xml
@@ -71,6 +71,7 @@
                 android:layout_weight="1.0"
                 android:paddingLeft="8dip"
                 android:paddingRight="6dip"
+                android:drawablePadding="2dip"
                 android:singleLine="true"
                 android:inputType="text|textAutoComplete"
                 android:dropDownWidth="fill_parent"
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index e0d2947..8bc410c 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -37,6 +37,7 @@
 namespace android {
 
 const char* cameraPermission = "android.permission.CAMERA";
+const char* recordAudioPermission = "android.permission.RECORD_AUDIO";
 
 static bool checkPermission(const char* permissionString) {
 #ifndef HAVE_ANDROID_OS
@@ -86,6 +87,9 @@
 status_t MediaRecorderClient::setAudioSource(int as)
 {
     LOGV("setAudioSource(%d)", as);
+    if (!checkPermission(recordAudioPermission)) {
+        return PERMISSION_DENIED;
+    }
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL)  {
         LOGE("recorder is not initialized");