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

Commit e17378d1 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: re enable setForceUse for system apps.

Some system apps (not having system AIDs) still need this
hidden API due to lack of better option for media use case routing.

Add protection by privileged permission MODIFY_AUDIO_ROUTING instead.

Bug: 79475856
Test: manual regression for music playback over speaker and bluetooth
Change-Id: Icaa585a9fa4c043c291f24c9bab4a93f02406955
parent 183eb5fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -876,7 +876,8 @@ status_t BnAudioPolicyService::onTransact(
        case SET_DEVICE_CONNECTION_STATE:
        case HANDLE_DEVICE_CONFIG_CHANGE:
        case SET_PHONE_STATE:
        case SET_FORCE_USE:
//FIXME: Allow SET_FORCE_USE calls from system apps until a better use case routing API is available
//      case SET_FORCE_USE:
        case INIT_STREAM_VOLUME:
        case SET_STREAM_VOLUME:
        case REGISTER_POLICY_MIXES:
+3 −1
Original line number Diff line number Diff line
@@ -121,9 +121,11 @@ status_t AudioPolicyService::setForceUse(audio_policy_force_use_t usage,
    if (mAudioPolicyManager == NULL) {
        return NO_INIT;
    }
    if (!settingsAllowed()) {

    if (!modifyAudioRoutingAllowed()) {
        return PERMISSION_DENIED;
    }

    if (usage < 0 || usage >= AUDIO_POLICY_FORCE_USE_CNT) {
        return BAD_VALUE;
    }