Merge "Switch camera sounds to always use the system enforced audio stream." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
7944704e6c
@@ -110,7 +110,6 @@ public class CameraSound {
|
||||
|
||||
private static class CameraSoundPlayer implements Runnable {
|
||||
private int mSoundId;
|
||||
private int mAudioStreamType;
|
||||
private MediaPlayer mPlayer;
|
||||
private Thread mThread;
|
||||
private boolean mExit;
|
||||
@@ -147,7 +146,7 @@ public class CameraSound {
|
||||
}
|
||||
mPlayer = new MediaPlayer();
|
||||
try {
|
||||
mPlayer.setAudioStreamType(mAudioStreamType);
|
||||
mPlayer.setAudioStreamType(AudioManager.STREAM_SYSTEM_ENFORCED);
|
||||
mPlayer.setDataSource(soundFilePath);
|
||||
mPlayer.setLooping(false);
|
||||
mPlayer.prepare();
|
||||
@@ -179,11 +178,6 @@ public class CameraSound {
|
||||
|
||||
public CameraSoundPlayer(int soundId) {
|
||||
mSoundId = soundId;
|
||||
if (SystemProperties.get("ro.camera.sound.forced", "0").equals("0")) {
|
||||
mAudioStreamType = AudioManager.STREAM_MUSIC;
|
||||
} else {
|
||||
mAudioStreamType = AudioManager.STREAM_SYSTEM_ENFORCED;
|
||||
}
|
||||
}
|
||||
|
||||
public void play() {
|
||||
|
||||
@@ -97,16 +97,6 @@ void CameraService::onFirstRef()
|
||||
setCameraFree(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Read the system property to determine if we have to use the
|
||||
// AUDIO_STREAM_ENFORCED_AUDIBLE type.
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.camera.sound.forced", value, "0");
|
||||
if (strcmp(value, "0") != 0) {
|
||||
mAudioStreamType = AUDIO_STREAM_ENFORCED_AUDIBLE;
|
||||
} else {
|
||||
mAudioStreamType = AUDIO_STREAM_MUSIC;
|
||||
}
|
||||
}
|
||||
|
||||
CameraService::~CameraService() {
|
||||
@@ -295,7 +285,7 @@ void CameraService::setCameraFree(int cameraId) {
|
||||
MediaPlayer* CameraService::newMediaPlayer(const char *file) {
|
||||
MediaPlayer* mp = new MediaPlayer();
|
||||
if (mp->setDataSource(file, NULL) == NO_ERROR) {
|
||||
mp->setAudioStreamType(mAudioStreamType);
|
||||
mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
|
||||
mp->prepare();
|
||||
} else {
|
||||
LOGE("Failed to load CameraService sounds: %s", file);
|
||||
|
||||
@@ -76,7 +76,6 @@ private:
|
||||
void setCameraFree(int cameraId);
|
||||
|
||||
// sounds
|
||||
audio_stream_type_t mAudioStreamType;
|
||||
MediaPlayer* newMediaPlayer(const char *file);
|
||||
|
||||
Mutex mSoundLock;
|
||||
|
||||
Reference in New Issue
Block a user