Merge "audio policy: engine configurable: improve accessibility volume" into nyc-dev
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
index f648bb3..be04e08 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -84,7 +84,7 @@
     def.eDir = OMX_DirInput;
     def.nBufferCountMin = kNumBuffers;
     def.nBufferCountActual = def.nBufferCountMin;
-    def.nBufferSize = 8192;
+    def.nBufferSize = kMaxNumSamplesPerBuffer * sizeof(int16_t);
     def.bEnabled = OMX_TRUE;
     def.bPopulated = OMX_FALSE;
     def.eDomain = OMX_PortDomainAudio;
diff --git a/services/soundtrigger/SoundTriggerHwService.cpp b/services/soundtrigger/SoundTriggerHwService.cpp
index 8f37bed..bb2416a 100644
--- a/services/soundtrigger/SoundTriggerHwService.cpp
+++ b/services/soundtrigger/SoundTriggerHwService.cpp
@@ -545,33 +545,9 @@
     AutoMutex lock(mLock);
 
     if (mModels.size() >= mDescriptor.properties.max_sound_models) {
-        /* Make space for a keyphrase sound model by first trying to swap out a previously loaded
-         * keyphrase sound model, or if needed, another sound model. This decision would optimally
-         * happen in SoundTriggerHelper, but is happening here because state tracking isn't good
-         * enough in SoundTriggerHelper to ensure that state is consistent between it and the HAL,
-         * nor does sufficient error handling exist to recover from inconsistencies.
-         * Once that exists:
-         * TODO: we should return an error instead of unloading a previous sound model here.
-         */
-        if (mModels.size() == 0) {
-            return INVALID_OPERATION;
-        }
-        if (sound_model->type == SOUND_MODEL_TYPE_KEYPHRASE) {
-            ALOGW("loadSoundModel() max number of models exceeded %d making room for a new one",
-                  mDescriptor.properties.max_sound_models);
-            sound_model_handle_t unload_handle = mModels.valueAt(0)->mHandle;
-            for (size_t i = 0; i < mModels.size(); i++) {
-                if (mModels.valueAt(i)->mType == SOUND_MODEL_TYPE_KEYPHRASE) {
-                    unload_handle = mModels.keyAt(i);
-                    break;
-                }
-            }
-            unloadSoundModel_l(unload_handle);
-        } else {
-            ALOGW("loadSoundModel(): Not loading, max number of models (%d) would be exceeded",
-                  mDescriptor.properties.max_sound_models);
-            return INVALID_OPERATION;
-        }
+        ALOGW("loadSoundModel(): Not loading, max number of models (%d) would be exceeded",
+              mDescriptor.properties.max_sound_models);
+        return INVALID_OPERATION;
     }
 
     status_t status = mHwDevice->load_sound_model(mHwDevice, sound_model,