Use package name, pid, uid to check permission of capturing hotword.
Package name will be cached in ModuleClient when attaching a client. It
will be used when querying permission of capturing hotword.
Test: test with logging.
Bug: 74078996
Bug: 122721589
Change-Id: Icd2911f5d331d243c9eb5d58003ce5525c70c81e
diff --git a/include/soundtrigger/ISoundTriggerHwService.h b/include/soundtrigger/ISoundTriggerHwService.h
index ae0cb01..1faeb0f 100644
--- a/include/soundtrigger/ISoundTriggerHwService.h
+++ b/include/soundtrigger/ISoundTriggerHwService.h
@@ -33,12 +33,14 @@
DECLARE_META_INTERFACE(SoundTriggerHwService);
- virtual status_t listModules(struct sound_trigger_module_descriptor *modules,
+ virtual status_t listModules(const String16& opPackageName,
+ struct sound_trigger_module_descriptor *modules,
uint32_t *numModules) = 0;
- virtual status_t attach(const sound_trigger_module_handle_t handle,
- const sp<ISoundTriggerClient>& client,
- sp<ISoundTrigger>& module) = 0;
+ virtual status_t attach(const String16& opPackageName,
+ const sound_trigger_module_handle_t handle,
+ const sp<ISoundTriggerClient>& client,
+ sp<ISoundTrigger>& module) = 0;
virtual status_t setCaptureState(bool active) = 0;
};
diff --git a/include/soundtrigger/SoundTrigger.h b/include/soundtrigger/SoundTrigger.h
index 2e2ff7a..ccc61dc 100644
--- a/include/soundtrigger/SoundTrigger.h
+++ b/include/soundtrigger/SoundTrigger.h
@@ -36,10 +36,12 @@
virtual ~SoundTrigger();
- static status_t listModules(struct sound_trigger_module_descriptor *modules,
+ static status_t listModules(const String16& opPackageName,
+ struct sound_trigger_module_descriptor *modules,
uint32_t *numModules);
- static sp<SoundTrigger> attach(const sound_trigger_module_handle_t module,
- const sp<SoundTriggerCallback>& callback);
+ static sp<SoundTrigger> attach(const String16& opPackageName,
+ const sound_trigger_module_handle_t module,
+ const sp<SoundTriggerCallback>& callback);
static status_t setCaptureState(bool active);