Skip to content

Commit 9143aaa

Browse files
author
Chih-Chung Chang
committed
Allow shutter/recording sound to be adjusted unless it's forced.
Change-Id: I7080d5f50a87f92c8e9395d4cf8f927a6760fa70
1 parent 5e3cdc7 commit 9143aaa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

services/camera/libcameraservice/CameraService.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,20 @@ void CameraService::setCameraFree(int cameraId) {
278278
// media players.
279279

280280
static MediaPlayer* newMediaPlayer(const char *file) {
281+
// Read the system property to determine if we have need to use the
282+
// AUDIO_STREAM_ENFORCED_AUDIBLE type.
283+
char value[PROPERTY_VALUE_MAX];
284+
property_get("ro.camera.sound.forced", value, "0");
285+
int audioStreamType;
286+
if (strcmp(value, "0") != 0) {
287+
audioStreamType = AUDIO_STREAM_ENFORCED_AUDIBLE;
288+
} else {
289+
audioStreamType = AUDIO_STREAM_MUSIC;
290+
}
291+
281292
MediaPlayer* mp = new MediaPlayer();
282293
if (mp->setDataSource(file, NULL) == NO_ERROR) {
283-
mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
294+
mp->setAudioStreamType(audioStreamType);
284295
mp->prepare();
285296
} else {
286297
LOGE("Failed to load CameraService sounds: %s", file);

0 commit comments

Comments
 (0)