merge in mnc-mr1-release history after reset to mnc-dr-dev
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index d4b54c3..a705bcc 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -187,17 +187,6 @@
     return mDecodeThread != NULL;
 }
 
-sp<Sample> SoundPool::findSample(int sampleID)
-{
-    Mutex::Autolock lock(&mLock);
-    return findSample_l(sampleID);
-}
-
-sp<Sample> SoundPool::findSample_l(int sampleID)
-{
-    return mSamples.valueFor(sampleID);
-}
-
 SoundChannel* SoundPool::findChannel(int channelID)
 {
     for (int i = 0; i < mMaxChannels; ++i) {
@@ -222,21 +211,18 @@
 {
     ALOGV("load: fd=%d, offset=%" PRId64 ", length=%" PRId64 ", priority=%d",
             fd, offset, length, priority);
-    int sampleID;
-    {
-        Mutex::Autolock lock(&mLock);
-        sampleID = ++mNextSampleID;
-        sp<Sample> sample = new Sample(sampleID, fd, offset, length);
-        mSamples.add(sampleID, sample);
-        sample->startLoad();
-    }
-    // mDecodeThread->loadSample() must be called outside of mLock.
-    // mDecodeThread->loadSample() may block on mDecodeThread message queue space;
-    // the message queue emptying may block on SoundPool::findSample().
-    //
-    // It theoretically possible that sample loads might decode out-of-order.
-    mDecodeThread->loadSample(sampleID);
-    return sampleID;
+    Mutex::Autolock lock(&mLock);
+    sp<Sample> sample = new Sample(++mNextSampleID, fd, offset, length);
+    mSamples.add(sample->sampleID(), sample);
+    doLoad(sample);
+    return sample->sampleID();
+}
+
+void SoundPool::doLoad(sp<Sample>& sample)
+{
+    ALOGV("doLoad: loading sample sampleID=%d", sample->sampleID());
+    sample->startLoad();
+    mDecodeThread->loadSample(sample->sampleID());
 }
 
 bool SoundPool::unload(int sampleID)
@@ -251,6 +237,7 @@
 {
     ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
             sampleID, leftVolume, rightVolume, priority, loop, rate);
+    sp<Sample> sample;
     SoundChannel* channel;
     int channelID;
 
@@ -260,7 +247,7 @@
         return 0;
     }
     // is sample ready?
-    sp<Sample> sample(findSample_l(sampleID));
+    sample = findSample(sampleID);
     if ((sample == 0) || (sample->state() != Sample::READY)) {
         ALOGW("  sample %d not READY", sampleID);
         return 0;
diff --git a/media/jni/soundpool/SoundPool.h b/media/jni/soundpool/SoundPool.h
index 98d2fa2..4aacf53 100644
--- a/media/jni/soundpool/SoundPool.h
+++ b/media/jni/soundpool/SoundPool.h
@@ -180,7 +180,6 @@
 
     // called from SoundPoolThread
     void sampleLoaded(int sampleID);
-    sp<Sample> findSample(int sampleID);
 
     // called from AudioTrack thread
     void done_l(SoundChannel* channel);
@@ -192,7 +191,8 @@
 private:
     SoundPool() {} // no default constructor
     bool startThreads();
-    sp<Sample> findSample_l(int sampleID);
+    void doLoad(sp<Sample>& sample);
+    sp<Sample> findSample(int sampleID) { return mSamples.valueFor(sampleID); }
     SoundChannel* findChannel (int channelID);
     SoundChannel* findNextChannel (int channelID);
     SoundChannel* allocateChannel_l(int priority, int sampleID);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 3917bab..f1550a0 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -34,7 +34,6 @@
 import android.os.Handler;
 import android.os.SystemClock;
 import android.os.UserHandle;
-import android.provider.Settings;
 import android.util.MutableBoolean;
 import android.view.Display;
 import android.view.LayoutInflater;
@@ -281,12 +280,6 @@
     @ProxyFromPrimaryToCurrentUser
     @Override
     public void showRecents(boolean triggeredFromAltTab, View statusBarView) {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         if (mSystemServicesProxy.isForegroundUserOwner()) {
             showRecentsInternal(triggeredFromAltTab);
         } else {
@@ -311,12 +304,6 @@
     @ProxyFromPrimaryToCurrentUser
     @Override
     public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         if (mSystemServicesProxy.isForegroundUserOwner()) {
             hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey);
         } else {
@@ -343,12 +330,6 @@
     @ProxyFromPrimaryToCurrentUser
     @Override
     public void toggleRecents(Display display, int layoutDirection, View statusBarView) {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         if (mSystemServicesProxy.isForegroundUserOwner()) {
             toggleRecentsInternal();
         } else {
@@ -372,12 +353,6 @@
     @ProxyFromPrimaryToCurrentUser
     @Override
     public void preloadRecents() {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         if (mSystemServicesProxy.isForegroundUserOwner()) {
             preloadRecentsInternal();
         } else {
@@ -494,12 +469,6 @@
 
     @Override
     public void showNextAffiliatedTask() {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         // Keep track of when the affiliated task is triggered
         MetricsLogger.count(mContext, "overview_affiliated_task_next", 1);
         showRelativeAffiliatedTask(true);
@@ -507,12 +476,6 @@
 
     @Override
     public void showPrevAffiliatedTask() {
-        // Ensure the device has been provisioned before allowing the user to interact with
-        // recents
-        if (!isDeviceProvisioned()) {
-            return;
-        }
-
         // Keep track of when the affiliated task is triggered
         MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1);
         showRelativeAffiliatedTask(false);
@@ -925,14 +888,6 @@
     }
 
     /**
-     * @return whether this device is provisioned.
-     */
-    private boolean isDeviceProvisioned() {
-        return Settings.Global.getInt(mContext.getContentResolver(),
-                Settings.Global.DEVICE_PROVISIONED, 0) != 0;
-    }
-
-    /**
      * Returns the preloaded load plan and invalidates it.
      */
     public static RecentsTaskLoadPlan consumeInstanceLoadPlan() {