Skip to content

Commit 17f2541

Browse files
Chih-Chung ChangAndroid (Google) Code Review
authored andcommitted
Merge "Allow shutter/recording sound to be adjusted unless it's forced."
2 parents 3c02c12 + 9143aaa commit 17f2541

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)