Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60a78ac9 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

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
parent 071ccd5a
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ private:
    void                setCameraFree(int cameraId);

    // sounds
    audio_stream_type_t mAudioStreamType;
    MediaPlayer*        newMediaPlayer(const char *file);

    Mutex               mSoundLock;