diff options
author | Christopher R. Palmer <crpalmer@gmail.com> | 2015-12-22 20:31:39 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-12-23 12:50:48 -0800 |
commit | b5886584cd24f92652f418567a2577ea8b76fb16 (patch) | |
tree | c66f8b714cf8945982c1e7355dab5755c3bc0556 /src/com/android/settings/notification/SoundSettings.java | |
parent | 684b9978b216e7a4825065be414a70fc9a1b19bf (diff) | |
download | packages_apps_Settings-b5886584cd24f92652f418567a2577ea8b76fb16.zip packages_apps_Settings-b5886584cd24f92652f418567a2577ea8b76fb16.tar.gz packages_apps_Settings-b5886584cd24f92652f418567a2577ea8b76fb16.tar.bz2 |
settings: Fix NPE in sounds settings for wifi only devices
Change-Id: I98864f29db62d517f0f88560ea62af18a43f585e
Diffstat (limited to 'src/com/android/settings/notification/SoundSettings.java')
-rw-r--r-- | src/com/android/settings/notification/SoundSettings.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java index 3957f13..e932740 100644 --- a/src/com/android/settings/notification/SoundSettings.java +++ b/src/com/android/settings/notification/SoundSettings.java @@ -204,7 +204,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab updateNotificationPreferenceState(); mSettingsObserver.register(true); mReceiver.register(true); - updateRingOrNotificationPreference(); + updateRingPreference(); updateEffectsSuppressor(); for (VolumeSeekBarPreference volumePref : mVolumePrefs) { volumePref.onActivityResume(); @@ -259,12 +259,14 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab } } - private void updateRingOrNotificationPreference() { - mRingPreference.showIcon(mSuppressor != null - ? com.android.internal.R.drawable.ic_audio_ring_notif_mute - : mRingerMode == AudioManager.RINGER_MODE_VIBRATE || wasRingerModeVibrate() - ? com.android.internal.R.drawable.ic_audio_ring_notif_vibrate - : com.android.internal.R.drawable.ic_audio_ring_notif); + private void updateRingPreference() { + if (mRingPreference != null) { + mRingPreference.showIcon(mSuppressor != null + ? com.android.internal.R.drawable.ic_audio_ring_notif_mute + : mRingerMode == AudioManager.RINGER_MODE_VIBRATE || wasRingerModeVibrate() + ? com.android.internal.R.drawable.ic_audio_ring_notif_vibrate + : com.android.internal.R.drawable.ic_audio_ring_notif); + } } private boolean wasRingerModeVibrate() { @@ -276,7 +278,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab final int ringerMode = mAudioManager.getRingerModeInternal(); if (mRingerMode == ringerMode) return; mRingerMode = ringerMode; - updateRingOrNotificationPreference(); + updateRingPreference(); } private void updateEffectsSuppressor() { @@ -289,7 +291,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab getSuppressorCaption(suppressor)) : null; mRingPreference.setSuppressionText(text); } - updateRingOrNotificationPreference(); + updateRingPreference(); } private String getSuppressorCaption(ComponentName suppressor) { |