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

Commit dc1ea7ce authored by Nicholas Ambur's avatar Nicholas Ambur
Browse files

fix calling SoundTriggerMiddleware in safeMode

deleteSoundModel is calling into the SoundTriggerModdleware when safe
mode is enabled. Middleware should not be called in this case.

Bug: 152354427
Test: atest SoundTriggerServiceTest#testServiceDisabledInSafeMode
Change-Id: I1fa13fd32a384b59928a5deb9505dc4a1e757efa
parent ba749f87
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -346,14 +346,17 @@ public class SoundTriggerService extends SystemService {
            sEventLogger.log(new SoundTriggerLogger.StringEvent("deleteSoundModel(): id = "
                    + soundModelId));

            if (isInitialized()) {
                // Unload the model if it is loaded.
                mSoundTriggerHelper.unloadGenericSoundModel(soundModelId.getUuid());
            mDbHelper.deleteGenericSoundModel(soundModelId.getUuid());

            // Stop recognition if it is started.
                // Stop tracking recognition if it is started.
                mSoundModelStatTracker.onStop(soundModelId.getUuid());
            }

            mDbHelper.deleteGenericSoundModel(soundModelId.getUuid());
        }

        @Override
        public int loadGenericSoundModel(GenericSoundModel soundModel) {
            enforceCallingPermission(Manifest.permission.MANAGE_SOUND_TRIGGER);