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

Commit dffb0879 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Read media files from /product/media/audio"

parents 81e6eb80 59a8ef01
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -2054,7 +2054,8 @@ MediaPlayer* CameraService::newMediaPlayer(const char *file) {
        mp->prepare();
    } else {
        ALOGE("Failed to load CameraService sounds: %s", file);
        return NULL;
        delete mp;
        return nullptr;
    }
    return mp;
}
@@ -2066,10 +2067,20 @@ void CameraService::loadSound() {
    LOG1("CameraService::loadSound ref=%d", mSoundRef);
    if (mSoundRef++) return;

    mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/product/media/audio/ui/camera_click.ogg");
    if (mSoundPlayer[SOUND_SHUTTER] == nullptr) {
        mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/system/media/audio/ui/camera_click.ogg");
    mSoundPlayer[SOUND_RECORDING_START] = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
    }
    mSoundPlayer[SOUND_RECORDING_START] = newMediaPlayer("/product/media/audio/ui/VideoRecord.ogg");
    if (mSoundPlayer[SOUND_RECORDING_START] == nullptr) {
        mSoundPlayer[SOUND_RECORDING_START] =
                newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
    }
    mSoundPlayer[SOUND_RECORDING_STOP] = newMediaPlayer("/product/media/audio/ui/VideoStop.ogg");
    if (mSoundPlayer[SOUND_RECORDING_STOP] == nullptr) {
        mSoundPlayer[SOUND_RECORDING_STOP] = newMediaPlayer("/system/media/audio/ui/VideoStop.ogg");
    }
}

void CameraService::releaseSound() {
    Mutex::Autolock lock(mSoundLock);