Check effect command reply size in AudioFlinger

Bug: 29251553
Change-Id: I1bcc1281f1f0542bb645f6358ce31631f2a8ffbf

status_t AudioFlinger::EffectModule::addHandle(EffectHandle *handle)
{
 status_t status;

 Mutex::Autolock _l(mLock);
 int priority = handle->priority();
 size_t size = mHandles.size();
 EffectHandle *controlHandle = NULL;
 size_t i;
 for (i = 0; i < size; i++) {
 EffectHandle *h = mHandles[i];
 if (h == NULL || h->destroyed_l()) {
 continue;
 }
 if (controlHandle == NULL) {
            controlHandle = h;
 }
 if (h->priority() <= priority) {
 break;
 }
 }
 if (i == 0) {
 bool enabled = false;
 if (controlHandle != NULL) {
            enabled = controlHandle->enabled();
            controlHandle->setControl(false/*hasControl*/, true /*signal*/, enabled /*enabled*/);
 }
        handle->setControl(true /*hasControl*/, false /*signal*/, enabled /*enabled*/);
        status = NO_ERROR;
 } else {
        status = ALREADY_EXISTS;
 }
    ALOGV("addHandle() %p added handle %p in position %d", this, handle, i);
    mHandles.insertAt(handle, i);
 return status;
}

status_t AudioFlinger::EffectModule::addHandle(EffectHandle *handle)
{
 status_t status;

 Mutex::Autolock _l(mLock);
 int priority = handle->priority();
 size_t size = mHandles.size();
 EffectHandle *controlHandle = NULL;
 size_t i;
 for (i = 0; i < size; i++) {
 EffectHandle *h = mHandles[i];
 if (h == NULL || h->destroyed_l()) {
 continue;
 }
 if (controlHandle == NULL) {
            controlHandle = h;
 }
 if (h->priority() <= priority) {
 break;
 }
 }
 if (i == 0) {
 bool enabled = false;
 if (controlHandle != NULL) {
            enabled = controlHandle->enabled();
            controlHandle->setControl(false/*hasControl*/, true /*signal*/, enabled /*enabled*/);
 }
        handle->setControl(true /*hasControl*/, false /*signal*/, enabled /*enabled*/);
        status = NO_ERROR;
 } else {
        status = ALREADY_EXISTS;
 }
    ALOGV("addHandle() %p added handle %p in position %d", this, handle, i);
    mHandles.insertAt(handle, i);
 return status;
}
