Merge change 21235 into eclair

* changes:
  Change the number of volume steps from 6 to 7 per Verizon Requirements
This commit is contained in:
Android (Google) Code Review
2009-08-13 21:33:57 -07:00
2 changed files with 23 additions and 15 deletions

View File

@@ -153,20 +153,6 @@ public class AudioManager {
@Deprecated public static final int NUM_STREAMS = AudioSystem.NUM_STREAMS; @Deprecated public static final int NUM_STREAMS = AudioSystem.NUM_STREAMS;
/** @hide Maximum volume index values for audio streams */
public static final int[] MAX_STREAM_VOLUME = new int[] {
6, // STREAM_VOICE_CALL
8, // STREAM_SYSTEM
8, // STREAM_RING
16, // STREAM_MUSIC
8, // STREAM_ALARM
8, // STREAM_NOTIFICATION
16, // STREAM_BLUETOOTH_SCO
8, // STREAM_SYSTEM_ENFORCED
16, // STREAM_DTMF
16 // STREAM_TTS
};
/** @hide Default volume index values for audio streams */ /** @hide Default volume index values for audio streams */
public static final int[] DEFAULT_STREAM_VOLUME = new int[] { public static final int[] DEFAULT_STREAM_VOLUME = new int[] {
4, // STREAM_VOICE_CALL 4, // STREAM_VOICE_CALL

View File

@@ -44,6 +44,7 @@ import android.provider.Settings;
import android.provider.Settings.System; import android.provider.Settings.System;
import android.util.Log; import android.util.Log;
import android.view.VolumePanel; import android.view.VolumePanel;
import android.os.SystemProperties;
import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephony;
@@ -54,6 +55,7 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* The implementation of the volume manager service. * The implementation of the volume manager service.
* <p> * <p>
@@ -140,6 +142,19 @@ public class AudioService extends IAudioService.Stub {
{4, -1} // FX_FOCUS_RETURN {4, -1} // FX_FOCUS_RETURN
}; };
/** @hide Maximum volume index values for audio streams */
private int[] MAX_STREAM_VOLUME = new int[] {
6, // STREAM_VOICE_CALL
8, // STREAM_SYSTEM
8, // STREAM_RING
16, // STREAM_MUSIC
8, // STREAM_ALARM
8, // STREAM_NOTIFICATION
16, // STREAM_BLUETOOTH_SCO
8, // STREAM_SYSTEM_ENFORCED
16, // STREAM_DTMF
16 // STREAM_TTS
};
/* STREAM_VOLUME_ALIAS[] indicates for each stream if it uses the volume settings /* STREAM_VOLUME_ALIAS[] indicates for each stream if it uses the volume settings
* of another stream: This avoids multiplying the volume settings for hidden * of another stream: This avoids multiplying the volume settings for hidden
* stream types that follow other stream behavior for volume settings * stream types that follow other stream behavior for volume settings
@@ -231,6 +246,12 @@ public class AudioService extends IAudioService.Stub {
public AudioService(Context context) { public AudioService(Context context) {
mContext = context; mContext = context;
mContentResolver = context.getContentResolver(); mContentResolver = context.getContentResolver();
// Intialized volume
MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = SystemProperties.getInt(
"ro.config.vc_call_vol_steps",
MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
mVolumePanel = new VolumePanel(context, this); mVolumePanel = new VolumePanel(context, this);
mSettingsObserver = new SettingsObserver(); mSettingsObserver = new SettingsObserver();
mMode = AudioSystem.MODE_NORMAL; mMode = AudioSystem.MODE_NORMAL;
@@ -249,6 +270,7 @@ public class AudioService extends IAudioService.Stub {
intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION); intentFilter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
intentFilter.addAction(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION); intentFilter.addAction(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION);
context.registerReceiver(mReceiver, intentFilter); context.registerReceiver(mReceiver, intentFilter);
} }
private void createAudioSystemThread() { private void createAudioSystemThread() {
@@ -945,7 +967,7 @@ public class AudioService extends IAudioService.Stub {
mStreamType = streamType; mStreamType = streamType;
final ContentResolver cr = mContentResolver; final ContentResolver cr = mContentResolver;
mIndexMax = AudioManager.MAX_STREAM_VOLUME[streamType]; mIndexMax = MAX_STREAM_VOLUME[streamType];
mIndex = Settings.System.getInt(cr, mIndex = Settings.System.getInt(cr,
mVolumeIndexSettingName, mVolumeIndexSettingName,
AudioManager.DEFAULT_STREAM_VOLUME[streamType]); AudioManager.DEFAULT_STREAM_VOLUME[streamType]);