Handle null audio attributes

Test: SoundPreferenceControllerTest
Fixes: 358540739
Flag: EXEMPT bugfix
Change-Id: I9a0e6066ccc2315b276564178c13ed59dd22162b
This commit is contained in:
Julia Reynolds
2024-11-12 15:25:21 -05:00
parent 2bab900fa0
commit d6c932cd7e
2 changed files with 22 additions and 0 deletions

View File

@@ -101,6 +101,8 @@ public class SoundPreferenceController extends NotificationPreferenceController
public boolean handlePreferenceTreeClick(Preference preference) {
if (KEY_SOUND.equals(preference.getKey()) && mFragment != null) {
NotificationSoundPreference pref = (NotificationSoundPreference) preference;
// default to notification
pref.setRingtoneType(RingtoneManager.TYPE_NOTIFICATION);
if (mChannel != null && mChannel.getAudioAttributes() != null) {
if (USAGE_ALARM == mChannel.getAudioAttributes().getUsage()) {
pref.setRingtoneType(RingtoneManager.TYPE_ALARM);