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

Commit 0616db47 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Fix use of deprecated SoundPool API in Keyguard

Don't use stream types for operations other than volume
  control.

Bug: 122901916
Test: verify logcat doesn't show warnings, see bug
Change-Id: I46143e53978226f6f660c92e85e7b0b1b0a37622
parent 31f977a4
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.UserInfo;
import android.hardware.biometrics.BiometricSourceType;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
@@ -750,7 +751,14 @@ public class KeyguardViewMediator extends SystemUI {

        mDeviceInteractive = mPM.isInteractive();

        mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
        mLockSounds = new SoundPool.Builder()
                .setMaxStreams(1)
                .setAudioAttributes(
                        new AudioAttributes.Builder()
                                .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
                                .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                                .build())
                .build();
        String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
        if (soundPath != null) {
            mLockSoundId = mLockSounds.load(soundPath, 1);