Merge "Configuration for lock and UI sound levels" into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6a5f9f6ddb
@ -76,6 +76,13 @@
|
|||||||
<item>0</item> <item>5</item> <!-- default: always increase volume by 5% -->
|
<item>0</item> <item>5</item> <!-- default: always increase volume by 5% -->
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
|
<!-- The attenuation in dB applied to the sound effects played
|
||||||
|
through AudioManager.playSoundEffect() when no volume is specified. -->
|
||||||
|
<integer name="config_soundEffectVolumeDb">-6</integer>
|
||||||
|
|
||||||
|
<!-- The attenuation in dB applied to the lock/unlock sounds. -->
|
||||||
|
<integer name="config_lockSoundVolumeDb">-6</integer>
|
||||||
|
|
||||||
<!-- Flag indicating whether the AUDIO_BECOMING_NOISY notification should
|
<!-- Flag indicating whether the AUDIO_BECOMING_NOISY notification should
|
||||||
be sent during a change to the audio output device. -->
|
be sent during a change to the audio output device. -->
|
||||||
<bool name="config_sendAudioBecomingNoisy">true</bool>
|
<bool name="config_sendAudioBecomingNoisy">true</bool>
|
||||||
|
@ -276,6 +276,8 @@
|
|||||||
<java-symbol type="integer" name="db_wal_autocheckpoint" />
|
<java-symbol type="integer" name="db_wal_autocheckpoint" />
|
||||||
<java-symbol type="integer" name="max_action_buttons" />
|
<java-symbol type="integer" name="max_action_buttons" />
|
||||||
<java-symbol type="integer" name="config_wifi_driver_stop_delay" />
|
<java-symbol type="integer" name="config_wifi_driver_stop_delay" />
|
||||||
|
<java-symbol type="integer" name="config_soundEffectVolumeDb" />
|
||||||
|
<java-symbol type="integer" name="config_lockSoundVolumeDb" />
|
||||||
|
|
||||||
<java-symbol type="color" name="tab_indicator_text_v4" />
|
<java-symbol type="color" name="tab_indicator_text_v4" />
|
||||||
|
|
||||||
|
@ -167,7 +167,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
private SoundPool mSoundPool;
|
private SoundPool mSoundPool;
|
||||||
private final Object mSoundEffectsLock = new Object();
|
private final Object mSoundEffectsLock = new Object();
|
||||||
private static final int NUM_SOUNDPOOL_CHANNELS = 4;
|
private static final int NUM_SOUNDPOOL_CHANNELS = 4;
|
||||||
private static final int SOUND_EFFECT_VOLUME = 1000;
|
|
||||||
|
|
||||||
// Internally master volume is a float in the 0.0 - 1.0 range,
|
// Internally master volume is a float in the 0.0 - 1.0 range,
|
||||||
// but to support integer based AudioManager API we translate it to 0 - 100
|
// but to support integer based AudioManager API we translate it to 0 - 100
|
||||||
@ -372,10 +371,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
private SoundPoolListenerThread mSoundPoolListenerThread;
|
private SoundPoolListenerThread mSoundPoolListenerThread;
|
||||||
// message looper for SoundPool listener
|
// message looper for SoundPool listener
|
||||||
private Looper mSoundPoolLooper = null;
|
private Looper mSoundPoolLooper = null;
|
||||||
// default volume applied to sound played with playSoundEffect()
|
// volume applied to sound played with playSoundEffect()
|
||||||
private static final int SOUND_EFFECT_DEFAULT_VOLUME_DB = 0;
|
private static int SOUND_EFFECT_VOLUME_DB;
|
||||||
// volume applied to sound played with playSoundEffect() read from ro.config.sound_fx_volume
|
|
||||||
private int SOUND_EFFECT_VOLUME_DB;
|
|
||||||
// getActiveStreamType() will return STREAM_NOTIFICATION during this period after a notification
|
// getActiveStreamType() will return STREAM_NOTIFICATION during this period after a notification
|
||||||
// stopped
|
// stopped
|
||||||
private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
|
private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
|
||||||
@ -422,9 +419,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
"ro.config.vc_call_vol_steps",
|
"ro.config.vc_call_vol_steps",
|
||||||
MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
|
MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
|
||||||
|
|
||||||
SOUND_EFFECT_VOLUME_DB = SystemProperties.getInt(
|
SOUND_EFFECT_VOLUME_DB = context.getResources().getInteger(
|
||||||
"ro.config.sound_fx_volume",
|
com.android.internal.R.integer.config_soundEffectVolumeDb);
|
||||||
SOUND_EFFECT_DEFAULT_VOLUME_DB);
|
|
||||||
|
|
||||||
mVolumePanel = new VolumePanel(context, this);
|
mVolumePanel = new VolumePanel(context, this);
|
||||||
mMode = AudioSystem.MODE_NORMAL;
|
mMode = AudioSystem.MODE_NORMAL;
|
||||||
|
@ -251,7 +251,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
|||||||
private int mLockSoundId;
|
private int mLockSoundId;
|
||||||
private int mUnlockSoundId;
|
private int mUnlockSoundId;
|
||||||
private int mLockSoundStreamId;
|
private int mLockSoundStreamId;
|
||||||
private int mMasterStreamMaxVolume;
|
|
||||||
|
/**
|
||||||
|
* The volume applied to the lock/unlock sounds.
|
||||||
|
*/
|
||||||
|
private final float mLockSoundVolume;
|
||||||
|
|
||||||
InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
|
InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
|
||||||
|
|
||||||
@ -329,6 +333,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
|||||||
if (soundPath == null || mUnlockSoundId == 0) {
|
if (soundPath == null || mUnlockSoundId == 0) {
|
||||||
if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath);
|
if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath);
|
||||||
}
|
}
|
||||||
|
int lockSoundDefaultAttenuation = context.getResources().getInteger(
|
||||||
|
com.android.internal.R.integer.config_lockSoundVolumeDb);
|
||||||
|
mLockSoundVolume = (float)Math.pow(10, lockSoundDefaultAttenuation/20);
|
||||||
IntentFilter userFilter = new IntentFilter();
|
IntentFilter userFilter = new IntentFilter();
|
||||||
userFilter.addAction(Intent.ACTION_USER_SWITCHED);
|
userFilter.addAction(Intent.ACTION_USER_SWITCHED);
|
||||||
userFilter.addAction(Intent.ACTION_USER_REMOVED);
|
userFilter.addAction(Intent.ACTION_USER_REMOVED);
|
||||||
@ -1117,7 +1124,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
|||||||
// If the stream is muted, don't play the sound
|
// If the stream is muted, don't play the sound
|
||||||
if (mAudioManager.isStreamMute(mMasterStreamType)) return;
|
if (mAudioManager.isStreamMute(mMasterStreamType)) return;
|
||||||
|
|
||||||
mLockSoundStreamId = mLockSounds.play(whichSound, 1.0f, 1.0f, 1, 0, 1.0f);
|
mLockSoundStreamId = mLockSounds.play(whichSound,
|
||||||
|
mLockSoundVolume, mLockSoundVolume, 1/*priortiy*/, 0/*loop*/, 1.0f/*rate*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user