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

Commit f53eaf49 authored by Hochi Huang's avatar Hochi Huang Committed by leozwang
Browse files

fix FM no sound issue

    Review: https://partner-android-review.git.corp.google.com/#/c/184276



    Signed-off-by: default avatarCarson Liao <carson.liao@mediatek.com>

Change-Id: I0847c8a6e6d054a9258b52402c914105d902c573
parent e86f4be5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ bool captureHotwordAllowed() {
    return ok;
}

bool captureFmTunerAllowed() {
    static const String16 sCaptureFmTunerAllowed("android.permission.ACCESS_FM_RADIO");
    bool ok = checkCallingPermission(sCaptureFmTunerAllowed);
    if (!ok) ALOGE("android.permission.ACCESS_FM_RADIO");
    return ok;
}

bool settingsAllowed() {
    if (getpid_cached == IPCThreadState::self()->getCallingPid()) return true;
    static const String16 sAudioSettings("android.permission.MODIFY_AUDIO_SETTINGS");
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ extern pid_t getpid_cached;
bool recordingAllowed();
bool captureAudioOutputAllowed();
bool captureHotwordAllowed();
bool captureFmTunerAllowed();
bool settingsAllowed();
bool modifyAudioRoutingAllowed();
bool dumpAllowed();
+4 −2
Original line number Diff line number Diff line
@@ -238,11 +238,13 @@ audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource,
        return 0;
    }
    // already checked by client, but double-check in case the client wrapper is bypassed
    if (inputSource >= AUDIO_SOURCE_CNT && inputSource != AUDIO_SOURCE_HOTWORD) {
    if (inputSource >= AUDIO_SOURCE_CNT && inputSource != AUDIO_SOURCE_HOTWORD &&
        inputSource != AUDIO_SOURCE_FM_TUNER) {
        return 0;
    }

    if ((inputSource == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) {
    if (((inputSource == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) ||
        ((inputSource == AUDIO_SOURCE_FM_TUNER) && !captureFmTunerAllowed())) {
        return 0;
    }
    audio_io_handle_t input;
+4 −2
Original line number Diff line number Diff line
@@ -228,11 +228,13 @@ audio_io_handle_t AudioPolicyService::getInput(audio_source_t inputSource,
        return 0;
    }
    // already checked by client, but double-check in case the client wrapper is bypassed
    if (inputSource >= AUDIO_SOURCE_CNT && inputSource != AUDIO_SOURCE_HOTWORD) {
    if (inputSource >= AUDIO_SOURCE_CNT && inputSource != AUDIO_SOURCE_HOTWORD &&
        inputSource != AUDIO_SOURCE_FM_TUNER) {
        return 0;
    }

    if ((inputSource == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) {
    if (((inputSource == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) ||
        ((inputSource == AUDIO_SOURCE_FM_TUNER) && !captureFmTunerAllowed())) {
        return 0;
    }