Settings: Restart volumizers explicitly on resume.
onBindView is no longer called in all cases, so use
onResume as an additional signal that the user returned
to the settings page. onActivityStop is called in both
cases to cleanup.
Bug: 17461564
Change-Id: I73a6775260951d4fd82ca8c3d8eb852f8dcc7452
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index bd08d8f..c9bc80d 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -82,6 +82,7 @@
private final H mHandler = new H();
private final SettingsObserver mSettingsObserver = new SettingsObserver();
private final Receiver mReceiver = new Receiver();
+ private final ArrayList<VolumeSeekBarPreference> mVolumePrefs = new ArrayList<>();
private Context mContext;
private PackageManager mPM;
@@ -148,6 +149,9 @@
mSettingsObserver.register(true);
mReceiver.register(true);
updateEffectsSuppressor();
+ for (VolumeSeekBarPreference volumePref : mVolumePrefs) {
+ volumePref.onActivityResume();
+ }
}
@Override
@@ -159,11 +163,11 @@
}
// === Volumes ===
-
private VolumeSeekBarPreference initVolumePreference(String key, int stream) {
final VolumeSeekBarPreference volumePref = (VolumeSeekBarPreference) findPreference(key);
volumePref.setCallback(mVolumeCallback);
volumePref.setStream(stream);
+ mVolumePrefs.add(volumePref);
return volumePref;
}
diff --git a/src/com/android/settings/notification/VolumeSeekBarPreference.java b/src/com/android/settings/notification/VolumeSeekBarPreference.java
index 0fdcc19..6050aec 100644
--- a/src/com/android/settings/notification/VolumeSeekBarPreference.java
+++ b/src/com/android/settings/notification/VolumeSeekBarPreference.java
@@ -120,6 +120,12 @@
updateSuppressionText();
}
+ public void onActivityResume() {
+ if (mVolumizer != null) {
+ mVolumizer.start();
+ }
+ }
+
// during initialization, this preference is the SeekBar listener
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {