Fix sound effect attenuation calculation
The sound effect volume attenuation calculation is wrong: the
division by 20 was always returning 1 or 0.
In AudioService, rename the sound effect attenuation value to
follow the naming conventions for static variables.
Change-Id: I3c36d50f4470ff09ca98cb944aefb5ad0f968782
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 6f85bf8..d2a8298 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -382,7 +382,7 @@
// message looper for SoundPool listener
private Looper mSoundPoolLooper = null;
// volume applied to sound played with playSoundEffect()
- private static int SOUND_EFFECT_VOLUME_DB;
+ private static int sSoundEffectVolumeDb;
// getActiveStreamType() will return STREAM_NOTIFICATION during this period after a notification
// stopped
private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
@@ -439,7 +439,7 @@
"ro.config.vc_call_vol_steps",
MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
- SOUND_EFFECT_VOLUME_DB = context.getResources().getInteger(
+ sSoundEffectVolumeDb = context.getResources().getInteger(
com.android.internal.R.integer.config_soundEffectVolumeDb);
mVolumePanel = new VolumePanel(context, this);
@@ -2882,7 +2882,7 @@
float volFloat;
// use default if volume is not specified by caller
if (volume < 0) {
- volFloat = (float)Math.pow(10, SOUND_EFFECT_VOLUME_DB/20);
+ volFloat = (float)Math.pow(10, (float)sSoundEffectVolumeDb/20);
} else {
volFloat = (float) volume / 1000.0f;
}