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

Commit 4e8794fc authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

policy_hal: Use session id to check open direct outputs.

Audio policy manager now uses session id instead of client id
to check for already open direct outputs. Updated custom policy
manager to reflect this change.

CRs-Fixed: 2050699

Change-Id: I077d4fca3c2eed4e2e121469e9000926c2abe1bb
parent 94380811
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1453,8 +1453,7 @@ status_t AudioPolicyManagerCustom::getOutputForAttr(const audio_attributes_t *at

audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        audio_devices_t device,
        audio_session_t session __unused,
        uid_t clientUid,
        audio_session_t session,
        audio_stream_type_t stream,
        uint32_t samplingRate,
        audio_format_t format,
@@ -1792,14 +1791,15 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                    if ((samplingRate == outputDesc->mSamplingRate) &&
                            audio_formats_match(format, outputDesc->mFormat) &&
                            (channelMask == outputDesc->mChannelMask)) {
                        if (clientUid == outputDesc->mDirectClientUid) {
                        if (session == outputDesc->mDirectClientSession) {
                            outputDesc->mDirectOpenCount++;
                            ALOGV("getOutput() reusing direct output %d", mOutputs.keyAt(i));
                            ALOGV("getOutput() reusing direct output %d for session %d",
                            mOutputs.keyAt(i), session);
                            return mOutputs.keyAt(i);
                        } else {
                            ALOGV("getOutput() do not reuse direct output because current client (%ld) "
                                  "is not the same as requesting client (%ld)",
                                  (long)outputDesc->mDirectClientUid, (long)clientUid);
                            ALOGV("getOutput() do not reuse direct output because current client (%d) "
                                  "is not the same as requesting client (%d)",
                                  outputDesc->mDirectClientSession, session);
                            goto non_direct_output;
                        }
                    }
@@ -1870,7 +1870,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        outputDesc->mRefCount[stream] = 0;
        outputDesc->mStopTime[stream] = 0;
        outputDesc->mDirectOpenCount = 1;
        outputDesc->mDirectClientUid = clientUid;
        outputDesc->mDirectClientSession = session;

        audio_io_handle_t srcOutput = getOutputForEffect();
        addOutput(output, outputDesc);
+0 −1
Original line number Diff line number Diff line
@@ -165,7 +165,6 @@ private:
        audio_io_handle_t getOutputForDevice(
                audio_devices_t device,
                audio_session_t session,
                uid_t client,
                audio_stream_type_t stream,
                uint32_t samplingRate,
                audio_format_t format,