File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
services/camera/libcameraservice Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -278,9 +278,20 @@ void CameraService::setCameraFree(int cameraId) {
278278// media players.
279279
280280static 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);
You can’t perform that action at this time.
0 commit comments