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/services/soundtrigger/SoundTriggerHwService.h b/services/soundtrigger/SoundTriggerHwService.h
index 4258ec0..43ad611 100644
--- a/services/soundtrigger/SoundTriggerHwService.h
+++ b/services/soundtrigger/SoundTriggerHwService.h
@@ -47,10 +47,12 @@
virtual ~SoundTriggerHwService();
// ISoundTriggerHwService
- 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);
- virtual status_t attach(const sound_trigger_module_handle_t handle,
+ virtual status_t attach(const String16& opPackageName,
+ const sound_trigger_module_handle_t handle,
const sp<ISoundTriggerClient>& client,
sp<ISoundTrigger>& module);
@@ -133,7 +135,8 @@
void setCaptureState_l(bool active);
- sp<ModuleClient> addClient(const sp<ISoundTriggerClient>& client);
+ sp<ModuleClient> addClient(const sp<ISoundTriggerClient>& client,
+ const String16& opPackageName);
void detach(const sp<ModuleClient>& moduleClient);
@@ -156,7 +159,8 @@
public:
ModuleClient(const sp<Module>& module,
- const sp<ISoundTriggerClient>& client);
+ const sp<ISoundTriggerClient>& client,
+ const String16& opPackageName);
virtual ~ModuleClient();
@@ -190,6 +194,7 @@
mutable Mutex mLock;
wp<Module> mModule;
sp<ISoundTriggerClient> mClient;
+ const String16 mOpPackageName;
}; // class ModuleClient
class CallbackThread : public Thread {