diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2012-01-05 15:34:53 -0800 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2012-01-06 10:24:01 -0800 |
commit | b7feb1c91f1053adb1815bc522c43db3f2c3f598 (patch) | |
tree | 7ca9c3301b21b0772ffac64bd0fdfd988ec4e750 | |
parent | dacbf67ab915fa8b987f6fb9f044160af92652cd (diff) | |
download | frameworks_base-b7feb1c91f1053adb1815bc522c43db3f2c3f598.zip frameworks_base-b7feb1c91f1053adb1815bc522c43db3f2c3f598.tar.gz frameworks_base-b7feb1c91f1053adb1815bc522c43db3f2c3f598.tar.bz2 |
Switch camera sounds to always use the system enforced audio stream.
Instead of picking between the music stream and the enforced audio
stream, change the camera service to always play sounds through
enforced system stream. Also update the currently-hidden CameraSound
API to match.
Bug: 5778365
Change-Id: I3cc64b1d1ff567dbac8020a665d5b19846197ff3
-rw-r--r-- | core/java/android/hardware/CameraSound.java | 8 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 12 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 1 |
3 files changed, 2 insertions, 19 deletions
diff --git a/core/java/android/hardware/CameraSound.java b/core/java/android/hardware/CameraSound.java index 32de0cd..dc97ff0 100644 --- a/core/java/android/hardware/CameraSound.java +++ b/core/java/android/hardware/CameraSound.java @@ -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() { diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index bb0e664..52d9bf35 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -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); diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index cdfbc56..bad41f5 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -76,7 +76,6 @@ private: void setCameraFree(int cameraId); // sounds - audio_stream_type_t mAudioStreamType; MediaPlayer* newMediaPlayer(const char *file); Mutex mSoundLock; |