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

Commit 30fa3068 authored by Hochi Huang's avatar Hochi Huang Committed by Android Git Automerger
Browse files

am f53eaf49: fix FM no sound issue

* commit 'f53eaf49':
  fix FM no sound issue
parents 6bbf27e5 f53eaf49
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;
    }