summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/notification/SoundSettings.java
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2016-01-28 10:37:44 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-01-28 12:35:19 -0800
commit5895648eb44b3d18180888bf6f1eb5ba3caa5c97 (patch)
tree3c7a92174038d182724bc4d0bca17f77511d6778 /src/com/android/settings/notification/SoundSettings.java
parent456e21e42b0b62a9b5630e197eb8a544295c0114 (diff)
downloadpackages_apps_Settings-5895648eb44b3d18180888bf6f1eb5ba3caa5c97.zip
packages_apps_Settings-5895648eb44b3d18180888bf6f1eb5ba3caa5c97.tar.gz
packages_apps_Settings-5895648eb44b3d18180888bf6f1eb5ba3caa5c97.tar.bz2
Settings : Fix linked volume crash + inconsistent state
- Ensure we fetch from Secure, not System - Don't initialize every time we toggle - Set the checkbox state from Settings value since the preference assumes a default of 0 CYNGNOS-1638 Change-Id: Ia519cef2295a6b6083b2b168f4c16df78f423cee
Diffstat (limited to 'src/com/android/settings/notification/SoundSettings.java')
-rw-r--r--src/com/android/settings/notification/SoundSettings.java20
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 679eb97..bc8eea4 100644
--- a/src/com/android/settings/notification/SoundSettings.java
+++ b/src/com/android/settings/notification/SoundSettings.java
@@ -139,7 +139,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab
private int mLockscreenSelectedValue;
private ComponentName mSuppressor;
private int mRingerMode = -1;
-
+ private SwitchPreference mVolumeLinkNotificationSwitch;
private UserManager mUserManager;
@Override
@@ -174,6 +174,8 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab
mRingPreference =
initVolumePreference(KEY_RING_VOLUME, AudioManager.STREAM_RING,
com.android.internal.R.drawable.ic_audio_ring_notif_mute);
+ mVolumeLinkNotificationSwitch = (SwitchPreference)
+ volumes.findPreference(KEY_VOLUME_LINK_NOTIFICATION);
} else {
volumes.removePreference(volumes.findPreference(KEY_RING_VOLUME));
volumes.removePreference(volumes.findPreference(KEY_VOLUME_LINK_NOTIFICATION));
@@ -248,17 +250,17 @@ public class SoundSettings extends SettingsPreferenceFragment implements Indexab
}
private void updateNotificationPreferenceState() {
- mNotificationPreference = initVolumePreference(KEY_NOTIFICATION_VOLUME,
- AudioManager.STREAM_NOTIFICATION,
- com.android.internal.R.drawable.ic_audio_ring_notif_mute);
+ if (mNotificationPreference == null) {
+ mNotificationPreference = initVolumePreference(KEY_NOTIFICATION_VOLUME,
+ AudioManager.STREAM_NOTIFICATION,
+ com.android.internal.R.drawable.ic_audio_ring_notif_mute);
+ }
if (mVoiceCapable) {
- final boolean enabled = Settings.System.getInt(getContentResolver(),
+ final boolean enabled = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1;
-
- if (mNotificationPreference != null) {
- boolean show = !enabled;
- mNotificationPreference.setEnabled(show);
+ if (mVolumeLinkNotificationSwitch != null){
+ mVolumeLinkNotificationSwitch.setChecked(enabled);
}
}
}