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

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

audio policy: remove capture restrictions for IN_COMMUNICATION mode

Remove capture restrictions added to prevent apps from capturing
when audio mode is IN_COMMUNICATION if they are not the audio mode
owner.

Bug: 153934174
Bug: 160260850
Test: repro steps in bug.
Test: regression for VoIP calls
Test: atest AudioManagerTest#testAccessMode
Test: atest AudioRecordTest
Change-Id: Iba423e0aceec7e07089440ad1efb9e1325953305
parent 498c4ed2
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -566,11 +566,13 @@ void AudioPolicyService::updateUidStates_l()

        auto canCaptureIfInCallOrCommunication = [&](const auto &recordClient) REQUIRES(mLock) {
            bool canCaptureCall = recordClient->canCaptureOutput;
            bool canCaptureCommunication = recordClient->canCaptureOutput
                || recordClient->uid == mPhoneStateOwnerUid
                || isServiceUid(mPhoneStateOwnerUid);
            return !(isInCall && !canCaptureCall)
                && !(isInCommunication && !canCaptureCommunication);
            return !(isInCall && !canCaptureCall);
//TODO(b/160260850): restore restriction to mode owner once fix for misbehaving apps is merged
//            bool canCaptureCommunication = recordClient->canCaptureOutput
//                || recordClient->uid == mPhoneStateOwnerUid
//                || isServiceUid(mPhoneStateOwnerUid);
//            return !(isInCall && !canCaptureCall)
//                && !(isInCommunication && !canCaptureCommunication);
        };

        // By default allow capture if: