Merge "Fix MPEG4Extractor to extract sampling frequency correctly when SBR is enabled." into gingerbread
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 8bd5a10f..f0ee838 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -409,7 +409,7 @@
         public static final String CONTACT_PRESENCE = "contact_presence";
 
         /**
-         * Contact Chat Capabilities. See {@link StatusColumns#CHAT_CAPABILITY} for individual
+         * Contact Chat Capabilities. See {@link StatusUpdates} for individual
          * definitions.
          * <p>Type: NUMBER</p>
          */
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 31e5a7b..f00389b 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -919,7 +919,7 @@
                 Log.e(TAG, "Error:Adapter Property at index" + i + "is null");
                 continue;
             }
-            if (name.equals("Devices")) {
+            if (name.equals("Devices") || name.equals("UUIDs")) {
                 StringBuilder str = new StringBuilder();
                 len = Integer.valueOf(properties[++i]);
                 for (int j = 0; j < len; j++) {
diff --git a/docs/html/guide/developing/eclipse-adt.jd b/docs/html/guide/developing/eclipse-adt.jd
index 66379a3..9c77ece 100644
--- a/docs/html/guide/developing/eclipse-adt.jd
+++ b/docs/html/guide/developing/eclipse-adt.jd
@@ -785,6 +785,8 @@
 have first started <a href="{@docRoot}guide/developing/tools/ddms.html">DDMS</a>). </p>
 
 
+
+
 <!-- TODO: clean this up and expand it to cover more wizards and features
 <h3>ADT Wizards</h3>
 
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index 1de3a4f..5ab72cd 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -385,8 +385,6 @@
     if (surface == 0) {
        surface = new Surface(data, binder);
        sCachedSurfaces.add(binder, surface);
-    } else {
-        LOGW("Reusing surface!");
     }
     if (surface->mSurface == 0) {
       surface = 0;
@@ -1024,4 +1022,3 @@
 
 // ----------------------------------------------------------------------------
 }; // namespace android
-
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 7d07e4b..9ceda7e 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -424,8 +424,7 @@
      * {@link LocationListener#onLocationChanged} method will be called for
      * each location update
      *
-     * @throws IllegalArgumentException if provider is null or doesn't exist
-     * @throws IllegalArgumentException if listener is null
+     * @throws IllegalArgumentException if provider or listener is null
      * @throws RuntimeException if the calling thread has no Looper
      * @throws SecurityException if no suitable permission is present for the provider.
      */
@@ -977,7 +976,7 @@
      * @return true if the provider is enabled
      *
      * @throws SecurityException if no suitable permission is present for the provider.
-     * @throws IllegalArgumentException if provider is null or doesn't exist
+     * @throws IllegalArgumentException if provider is null
      */
     public boolean isProviderEnabled(String provider) {
         if (provider == null) {
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index bcda06e..ec13557 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -230,9 +230,6 @@
     if (pContext == NULL) {
         return -EINVAL;
     }
-    if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
-        return -ENODATA;
-    }
 
     if (inBuffer == NULL || inBuffer->raw == NULL ||
         outBuffer == NULL || outBuffer->raw == NULL ||
@@ -269,6 +266,9 @@
             memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount * 2 * sizeof(int16_t));
         }
     }
+    if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
+        return -ENODATA;
+    }
     return 0;
 }   // end Visualizer_process
 
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 7e528af..b38a5c8 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2948,7 +2948,8 @@
 status_t AudioFlinger::PlaybackThread::Track::start()
 {
     status_t status = NO_ERROR;
-    LOGV("start(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+    LOGV("start(%d), calling thread %d session %d",
+            mName, IPCThreadState::self()->getCallingPid(), mSessionId);
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -5366,9 +5367,9 @@
 
     // Send volume indication if EFFECT_FLAG_VOLUME_IND is set and read back altered volume
     // if controller flag is set (Note that controller == TRUE => EFFECT_FLAG_VOLUME_CTRL set)
-    if (isEnabled() &&
-            (mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL ||
-            (mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_IND) {
+    if ((mState >= ACTIVE) &&
+            ((mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL ||
+            (mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_IND)) {
         status_t cmdStatus;
         uint32_t volume[2];
         uint32_t *pVolume = NULL;
@@ -5749,7 +5750,8 @@
 AudioFlinger::EffectChain::EffectChain(const wp<ThreadBase>& wThread,
                                         int sessionId)
     : mThread(wThread), mSessionId(sessionId), mActiveTrackCnt(0), mOwnInBuffer(false),
-            mVolumeCtrlIdx(-1), mLeftVolume(0), mRightVolume(0)
+            mVolumeCtrlIdx(-1), mLeftVolume(0), mRightVolume(0),
+            mNewLeftVolume(0), mNewRightVolume(0)
 {
 
 }
@@ -5980,25 +5982,34 @@
 
     // first update volume controller
     for (size_t i = size; i > 0; i--) {
-        if (mEffects[i - 1]->isEnabled() &&
+        if ((mEffects[i - 1]->state() >= EffectModule::ACTIVE) &&
             (mEffects[i - 1]->desc().flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL) {
             ctrlIdx = i - 1;
+            hasControl = true;
             break;
         }
     }
 
     if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) {
-        return false;
+        if (hasControl) {
+            *left = mNewLeftVolume;
+            *right = mNewRightVolume;
+        }
+        return hasControl;
     }
 
+    if (mVolumeCtrlIdx != -1) {
+        hasControl = true;
+    }
     mVolumeCtrlIdx = ctrlIdx;
-    mLeftVolume = *left;
-    mRightVolume = *right;
+    mLeftVolume = newLeft;
+    mRightVolume = newRight;
 
     // second get volume update from volume controller
     if (ctrlIdx >= 0) {
         mEffects[ctrlIdx]->setVolume(&newLeft, &newRight, true);
-        hasControl = true;
+        mNewLeftVolume = newLeft;
+        mNewRightVolume = newRight;
     }
     // then indicate volume to all other effects in chain.
     // Pass altered volume to effects before volume controller
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 4507a48..99816f9 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1110,6 +1110,9 @@
         int mVolumeCtrlIdx;         // index of insert effect having control over volume
         uint32_t mLeftVolume;       // previous volume on left channel
         uint32_t mRightVolume;      // previous volume on right channel
+        uint32_t mNewLeftVolume;       // new volume on left channel
+        uint32_t mNewRightVolume;      // new volume on right channel
+
     };
 
     friend class RecordThread;
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 8519e2c..3bcf427 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1613,8 +1613,6 @@
             }
         } catch (SecurityException se) {
             throw se;
-        } catch (IllegalArgumentException iae) {
-            throw iae;
         } catch (Exception e) {
             Slog.e(TAG, "isProviderEnabled got exception:", e);
             return false;
@@ -1638,7 +1636,7 @@
 
         LocationProviderInterface p = mProvidersByName.get(provider);
         if (p == null) {
-            throw new IllegalArgumentException("provider=" + provider);
+            return false;
         }
         return isAllowedBySettingsLocked(provider);
     }
@@ -1650,8 +1648,6 @@
             }
         } catch (SecurityException se) {
             throw se;
-        } catch (IllegalArgumentException iae) {
-            throw iae;
         } catch (Exception e) {
             Slog.e(TAG, "getLastKnownLocation got exception:", e);
             return null;
@@ -1663,7 +1659,7 @@
 
         LocationProviderInterface p = mProvidersByName.get(provider);
         if (p == null) {
-            throw new IllegalArgumentException("provider=" + provider);
+            return null;
         }
 
         if (!isAllowedBySettingsLocked(provider)) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint.java b/tools/layoutlib/bridge/src/android/graphics/Paint.java
index 619ab30..d13b5fe 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint.java
@@ -283,6 +283,8 @@
             mStyle = src.mStyle;
             mFlags = src.mFlags;
 
+            updateFontObject();
+
             super.set(src);
         }
     }