Attribute SOURCE_HOTWORD to OP_RECORD_AUDIO_HOTWORD.
Whenever we startRecording / finishRecording with a source
of SOURCE_HOTWORD, attribute them to OP_RECORD_AUDIO_HOTWORD
instead of OP_RECORD_AUDIO. In either case, OP_RECORD_AUDIO
is checked before the recording commences. Note that we also
check that all recordings with SOURCE_HOTWORD are initiated
by a uid that holds the privileged CAPTURE_AUDIO_HOTWORD
permission.
Note that this change will be superseded in the future once
we have stronger guarantees around hotword handling.
Bug: 162547999
Test: manual with dumpsys appops on AGSA
(cherry picked from commit d127644025c5820e39a2908a249691284b4447d6)
Merged-In: I70e0b652c357597770a18a5a385d62668a69059a
Change-Id: I5ba43828efb0654ec2c1f04fb9737d48a8c4f0bf
diff --git a/media/utils/fuzzers/ServiceUtilitiesFuzz.cpp b/media/utils/fuzzers/ServiceUtilitiesFuzz.cpp
index 3d141b5..183155c 100644
--- a/media/utils/fuzzers/ServiceUtilitiesFuzz.cpp
+++ b/media/utils/fuzzers/ServiceUtilitiesFuzz.cpp
@@ -44,6 +44,7 @@
FuzzedDataProvider data_provider(data, size);
uid_t uid = data_provider.ConsumeIntegral<uid_t>();
pid_t pid = data_provider.ConsumeIntegral<pid_t>();
+ bool isHotword = data_provider.ConsumeBool();
// There is not state here, and order is not significant,
// so we can simply call all of the target functions
@@ -54,8 +55,8 @@
std::string packageNameStr = data_provider.ConsumeRandomLengthString(kMaxStringLen);
android::String16 opPackageName(packageNameStr.c_str());
android::recordingAllowed(opPackageName, pid, uid);
- android::startRecording(opPackageName, pid, uid);
- android::finishRecording(opPackageName, uid);
+ android::startRecording(opPackageName, pid, uid, isHotword);
+ android::finishRecording(opPackageName, uid, isHotword);
android::captureAudioOutputAllowed(pid, uid);
android::captureMediaOutputAllowed(pid, uid);
android::captureHotwordAllowed(opPackageName, pid, uid);