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

Commit 59a8ef01 authored by Jaekyun Seok's avatar Jaekyun Seok
Browse files

Read media files from /product/media/audio

Bug: 64195575
Test: tested reading media files from /product/media/audio after moving
files from /system/media/audio to /product/media/audio

Change-Id: Ib5cf79181962ba2b0a70980b44dd7608410c3855
parent b2eb24b6
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);