getInputForAttr perm check cleanup pt1
Pull permission checking logic out of main function.
No behavior changes for now.
Test: Compiles
Bug: 374870131
Bug: 343523722
Flag: EXEMPT mechanical refactoring
Change-Id: I3a3dc2b876612f63757570fd6fe9b2f9d5437fa9
diff --git a/media/utils/ServiceUtilities.cpp b/media/utils/ServiceUtilities.cpp
index ee0f2bc..39a172f 100644
--- a/media/utils/ServiceUtilities.cpp
+++ b/media/utils/ServiceUtilities.cpp
@@ -77,15 +77,24 @@
return packages[0];
}
+// NOTE/TODO(b/379754682):
+// AUDIO_SOURCE_VOICE_DOWNLINK and AUDIO_SOURCE_VOICE_CALL are handled specially:
+// DOWNLINK is an output source, but we still require RecordOp in addition to
+// OP_RECORD_INCOMING_PHONE_AUDIO
+// CALL includes both uplink and downlink, but we attribute RECORD_OP (only), since
+// there is not support for noting multiple ops.
int32_t getOpForSource(audio_source_t source) {
switch (source) {
+ // BEGIN output sources
case AUDIO_SOURCE_FM_TUNER:
return AppOpsManager::OP_NONE;
case AUDIO_SOURCE_ECHO_REFERENCE: // fallthrough
case AUDIO_SOURCE_REMOTE_SUBMIX:
+ // TODO -- valid in all cases?
return AppOpsManager::OP_RECORD_AUDIO_OUTPUT;
case AUDIO_SOURCE_VOICE_DOWNLINK:
return AppOpsManager::OP_RECORD_INCOMING_PHONE_AUDIO;
+ // END output sources
case AUDIO_SOURCE_HOTWORD:
return AppOpsManager::OP_RECORD_AUDIO_HOTWORD;
case AUDIO_SOURCE_DEFAULT:
@@ -99,6 +108,7 @@
case AUDIO_SOURCE_FM_TUNER:
case AUDIO_SOURCE_ECHO_REFERENCE: // fallthrough
case AUDIO_SOURCE_REMOTE_SUBMIX:
+ // case AUDIO_SOURCE_VOICE_DOWNLINK:
return false;
default:
return true;