Workaround for a database update callback that claims that the data doesn't exist.
It's probably some intermediate state when updating the volumes that's causing
the row to be missing.
diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index a264594..970d520 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -230,10 +230,14 @@
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
-
if (mSeekBar != null) {
- mSeekBar.setProgress(System.getInt(mContext.getContentResolver(),
- System.VOLUME_SETTINGS[mStreamType], 0));
+ int volume = System.getInt(mContext.getContentResolver(),
+ System.VOLUME_SETTINGS[mStreamType], -1);
+ // Works around an atomicity problem with volume updates
+ // TODO: Fix the actual issue, probably in AudioService
+ if (volume >= 0) {
+ mSeekBar.setProgress(volume);
+ }
}
}
};