Revert "Revert "Use start/finish app op API for mic use""
This reverts commit 599ec462d94136949e0c90419ea99b0d9ba83eac.
In addition it fixes an incorrect comparison against opPackageName
instead of resolvedOpPackageName creating incorrect short circuit.
Test: atest android.media.cts.AudioRecordAppOpTest
"Okay Google" works fine
bug: 64085448
Change-Id: I77a8486dfd6e4f020efdf05d28a856a32579ef31
(cherry picked from commit 5b81f550759c975fe6716e4e7870b11e523834d0)
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 229e08e..8033382 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3051,6 +3051,7 @@
// check recording permission for visualizer
if ((memcmp(&desc.type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0) &&
+ // TODO: Do we need to start/stop op - i.e. is there recording being performed?
!recordingAllowed(opPackageName, pid, IPCThreadState::self()->getCallingUid())) {
lStatus = PERMISSION_DENIED;
goto Exit;