Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0b34b93 authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "[soundtrigger] Move audio session out of lock" into main

parents 90c245fe e1468a87
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -135,8 +135,6 @@ to call another module, while having its local mutex(es) held:
    changed while the lock has been released.
  - Release the local lock.
  - Invoke any synchronous callbacks if needed.
- Calling from `SoundTriggerMiddlewareImpl` / `SoundTriggerModule` into the audio policy service via
  `acquireSession()` / `releaseSession()` while holding the local lock is legal.
- `setCaptureState()` calls, originating from Audio Policy Service, into the lower layers of the
  stack may call into the HAL (specifically, they must invoke `stopRecognition()`, but must not
  block on callbacks. For this reason, `SoundTriggerHw2ConcurrentCaptureHandler`, which is the
+2 −4
Original line number Diff line number Diff line
@@ -257,10 +257,9 @@ class SoundTriggerModule implements IBinder.DeathRecipient, ISoundTriggerHal.Glo

        @Override
        public int loadModel(@NonNull SoundModel model) {
            SoundTriggerMiddlewareImpl.AudioSessionProvider.AudioSession audioSession = null;
            final var audioSession = mAudioSessionProvider.acquireSession();
            try {
                synchronized (SoundTriggerModule.this) {
                    audioSession = mAudioSessionProvider.acquireSession();
                    checkValid();
                    Model loadedModel = new Model();
                    return loadedModel.load(model, audioSession);
@@ -279,10 +278,9 @@ class SoundTriggerModule implements IBinder.DeathRecipient, ISoundTriggerHal.Glo

        @Override
        public int loadPhraseModel(@NonNull PhraseSoundModel model) {
            SoundTriggerMiddlewareImpl.AudioSessionProvider.AudioSession audioSession = null;
            final var audioSession = mAudioSessionProvider.acquireSession();
            try {
                synchronized (SoundTriggerModule.this) {
                    audioSession = mAudioSessionProvider.acquireSession();
                    checkValid();
                    Model loadedModel = new Model();
                    int result = loadedModel.load(model, audioSession);