summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEric Laurent <>2009-03-27 16:27:16 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-27 16:27:16 -0700
commitcbcb00eb7302a166411c0b87e6a9ed70298f65b2 (patch)
tree10560743ea2bf036899e083cf968cc042c6edd6b /camera
parent816c5e2314c8dc241c962efaed6a57c0e20f7330 (diff)
downloadframeworks_native-cbcb00eb7302a166411c0b87e6a9ed70298f65b2.zip
frameworks_native-cbcb00eb7302a166411c0b87e6a9ed70298f65b2.tar.gz
frameworks_native-cbcb00eb7302a166411c0b87e6a9ed70298f65b2.tar.bz2
AI 143177: am: CL 142889 Fix issue #1736153 Camera shutter sound can be muted by new AlarmClock setting.
Current implementation of Camera service plays the camera shutter sound over the ALARM stream so that it cannot be muted by silent mode in order to comply to some country specific requirement. A recent change made it possible for the user to mute the ALARM stream thus making this stream not suitable any more for the camera shutter sound. The fix consists in creating a new stream type only accessible by native code and that cannot be muted and use it to play camera sounds. Original author: elaurent Merged from: //branches/cupcake/... Automated import of CL 143177
Diffstat (limited to 'camera')
-rw-r--r--camera/libcameraservice/CameraService.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 7e5fdbe..cb8ab58 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -32,6 +32,8 @@
#include <media/AudioSystem.h>
#include "CameraService.h"
+#include <cutils/properties.h>
+
namespace android {
extern "C" {
@@ -157,7 +159,13 @@ static sp<MediaPlayer> newMediaPlayer(const char *file)
{
sp<MediaPlayer> mp = new MediaPlayer();
if (mp->setDataSource(file) == NO_ERROR) {
- mp->setAudioStreamType(AudioSystem::ALARM);
+ char value[PROPERTY_VALUE_MAX];
+ property_get("ro.camera.sound.forced", value, "0");
+ if (atoi(value)) {
+ mp->setAudioStreamType(AudioSystem::ENFORCED_AUDIBLE);
+ } else {
+ mp->setAudioStreamType(AudioSystem::SYSTEM);
+ }
mp->prepare();
} else {
mp.clear();