soundtrigger: add size check on sound model and recogntion data

Bug: 30148546

Change-Id: I082f535a853c96571887eeea37c6d41ecee7d8c0
(cherry picked from commit bb00d8f139ff51336ab3c810d35685003949bcf8)
(cherry picked from commit ef0c91518446e65533ca8bab6726a845f27c73fd)

static bool tryLock(Mutex& mutex)
{
 bool locked = false;
 for (int i = 0; i < kDumpLockRetries; ++i) {
 if (mutex.tryLock() == NO_ERROR) {
            locked = true;
 break;
 }
        usleep(kDumpLockSleep);
 }
 return locked;
}

static bool tryLock(Mutex& mutex)
{
 bool locked = false;
 for (int i = 0; i < kDumpLockRetries; ++i) {
 if (mutex.tryLock() == NO_ERROR) {
            locked = true;
 break;
 }
        usleep(kDumpLockSleep);
 }
 return locked;
}
