summaryrefslogtreecommitdiffstats
path: root/include/media/AudioEffect.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/AudioEffect.h')
-rw-r--r--include/media/AudioEffect.h41
1 files changed, 33 insertions, 8 deletions
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 583695d..5af6c10 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -201,8 +201,12 @@ public:
*/
/* Simple Constructor.
+ *
+ * Parameters:
+ *
+ * opPackageName: The package name used for app op checks.
*/
- AudioEffect();
+ AudioEffect(const String16& opPackageName);
/* Constructor.
@@ -211,6 +215,7 @@ public:
*
* type: type of effect created: can be null if uuid is specified. This corresponds to
* the OpenSL ES interface implemented by this effect.
+ * opPackageName: The package name used for app op checks.
* uuid: Uuid of effect created: can be null if type is specified. This uuid corresponds to
* a particular implementation of an effect type.
* priority: requested priority for effect control: the priority level corresponds to the
@@ -227,6 +232,7 @@ public:
*/
AudioEffect(const effect_uuid_t *type,
+ const String16& opPackageName,
const effect_uuid_t *uuid = NULL,
int32_t priority = 0,
effect_callback_t cbf = NULL,
@@ -239,6 +245,7 @@ public:
* Same as above but with type and uuid specified by character strings
*/
AudioEffect(const char *typeStr,
+ const String16& opPackageName,
const char *uuidStr = NULL,
int32_t priority = 0,
effect_callback_t cbf = NULL,
@@ -406,7 +413,9 @@ protected:
void* mUserData; // client context for callback function
effect_descriptor_t mDescriptor; // effect descriptor
int32_t mId; // system wide unique effect engine instance ID
- Mutex mLock; // Mutex for mEnabled access
+ Mutex mLock; // Mutex for mEnabled access
+
+ String16 mOpPackageName; // The package name used for app op checks.
// IEffectClient
virtual void controlStatusChanged(bool controlGranted);
@@ -420,7 +429,8 @@ protected:
private:
// Implements the IEffectClient interface
- class EffectClient : public android::BnEffectClient, public android::IBinder::DeathRecipient
+ class EffectClient :
+ public android::BnEffectClient, public android::IBinder::DeathRecipient
{
public:
@@ -428,24 +438,39 @@ private:
// IEffectClient
virtual void controlStatusChanged(bool controlGranted) {
- mEffect->controlStatusChanged(controlGranted);
+ sp<AudioEffect> effect = mEffect.promote();
+ if (effect != 0) {
+ effect->controlStatusChanged(controlGranted);
+ }
}
virtual void enableStatusChanged(bool enabled) {
- mEffect->enableStatusChanged(enabled);
+ sp<AudioEffect> effect = mEffect.promote();
+ if (effect != 0) {
+ effect->enableStatusChanged(enabled);
+ }
}
virtual void commandExecuted(uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t replySize,
void *pReplyData) {
- mEffect->commandExecuted(cmdCode, cmdSize, pCmdData, replySize, pReplyData);
+ sp<AudioEffect> effect = mEffect.promote();
+ if (effect != 0) {
+ effect->commandExecuted(
+ cmdCode, cmdSize, pCmdData, replySize, pReplyData);
+ }
}
// IBinder::DeathRecipient
- virtual void binderDied(const wp<IBinder>& who) {mEffect->binderDied();}
+ virtual void binderDied(const wp<IBinder>& who) {
+ sp<AudioEffect> effect = mEffect.promote();
+ if (effect != 0) {
+ effect->binderDied();
+ }
+ }
private:
- AudioEffect *mEffect;
+ wp<AudioEffect> mEffect;
};
void binderDied();