[RESTRICT AUTOMERGE] Fix audio AppOps refcount mismatch
Iea630bb2bf1b54697ab6a95ee9f65db5cc4d134a
I8a3498a08a31543219279cb063c043fd0c767cd7
The state of the appop corresponding to a recording must be consistent
with the APS notion of whether a recording is silenced. Ensure that when
we start recording, we only un-silence the track if the op is allowed
from the appop side. This requires plumbing the exact perm state through
the startRecording API.
Correctly handle virtual sources by checking only their associated op
state, rather than OP_RECORD. Update the appop callback
listening/handling as well, by only listening/evaluating OP_RECORD for
relevant sources.
Ie7d2661b4027b5ce6bee9b6c63b70f0b120dcbcc
When AppOp restrictions are in place, starting an op will return
SOFT_DENY, but leave the op in a paused state, which can restart
unexpectedly when the restriction is removed (despite no data delivery
occurring). Work around this by first checking if recording is
restricted, and avoiding the start call in that case. Instead, use a
note call in order to maintain a rejected op for listeners (for
prompting the mic unblock dialogue).
Idd4389e7e79ee819c29ec2676d2e22d5a4b12249
Un-require RECORD_OP for VOICE_DOWNLINK
Ibc735ea463aa6e09f8a24fc3cb50c39b70bbbea8
Handle targetSdk failures for recording
Test: atest CtsMediaAudioPermissionTestCases
Test: atest CtsMediaAudioTestCases
Test: atest RuntimePermissionsAppOpTrackingTest
Test: atest SensorPrivacyMicrophoneTest
Test: atest AppOpsControllerTest
Test: atest AudioPlaybackCaptureTest with mic blocked
Test: sts-tradefed run sts-dynamic-develop -m \
CtsMediaAudioPermissionTestCases
Test: manual oboetester app recording in background silenced
Test: manual recorder with mic toggle disabled no indicator
Test: manual poc
Bug: 293603271
Flag: EXEMPT security
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2893ef4fa48c958f341883680626ab38330d41d8)
Merged-In: Iea630bb2bf1b54697ab6a95ee9f65db5cc4d134a
Change-Id: Iea630bb2bf1b54697ab6a95ee9f65db5cc4d134a
6 files changed