Fix resource contention in Fake STHAL

Fix mistake in fake STHAL where setting resource contention does
not cause startRecognition to properly return RESOURCE_CONTENTION
error code.

Test: atest AlwaysOnHotwordDetectorTest
Fixes: 276396670
Change-Id: I097390cbbb185f7bb5c6eb8bffff7e2b0b52948d
This commit is contained in:
Atneya Nair
2023-03-30 23:03:54 -07:00
parent d5ef486c31
commit 585f818580

View File

@@ -465,7 +465,9 @@ public class FakeSoundTriggerHal extends ISoundTriggerHw.Stub {
if (session == null) {
Slog.wtf(TAG, "Attempted to start recognition with invalid handle");
}
if (mIsResourceContended) {
throw new ServiceSpecificException(Status.RESOURCE_CONTENTION);
}
if (session.getIsUnloaded()) {
// TODO(b/274470274) this is a deficiency in the existing HAL API, there is no way
// to handle this race gracefully