@ -414,6 +414,7 @@ protected:
effect_descriptor_t mDescriptor ; // effect descriptor
effect_descriptor_t mDescriptor ; // effect descriptor
int32_t mId ; // system wide unique effect engine instance ID
int32_t mId ; // system wide unique effect engine instance ID
Mutex mLock ; // Mutex for mEnabled access
Mutex mLock ; // Mutex for mEnabled access
Mutex mConstructLock ; // Mutex for integrality construction
String16 mOpPackageName ; // The package name used for app op checks.
String16 mOpPackageName ; // The package name used for app op checks.
@ -440,12 +441,22 @@ private:
virtual void controlStatusChanged ( bool controlGranted ) {
virtual void controlStatusChanged ( bool controlGranted ) {
sp < AudioEffect > effect = mEffect . promote ( ) ;
sp < AudioEffect > effect = mEffect . promote ( ) ;
if ( effect ! = 0 ) {
if ( effect ! = 0 ) {
{
// Got the mConstructLock means the construction of AudioEffect
// has finished, we should release the mConstructLock immediately.
AutoMutex lock ( effect - > mConstructLock ) ;
}
effect - > controlStatusChanged ( controlGranted ) ;
effect - > controlStatusChanged ( controlGranted ) ;
}
}
}
}
virtual void enableStatusChanged ( bool enabled ) {
virtual void enableStatusChanged ( bool enabled ) {
sp < AudioEffect > effect = mEffect . promote ( ) ;
sp < AudioEffect > effect = mEffect . promote ( ) ;
if ( effect ! = 0 ) {
if ( effect ! = 0 ) {
{
// Got the mConstructLock means the construction of AudioEffect
// has finished, we should release the mConstructLock immediately.
AutoMutex lock ( effect - > mConstructLock ) ;
}
effect - > enableStatusChanged ( enabled ) ;
effect - > enableStatusChanged ( enabled ) ;
}
}
}
}
@ -456,6 +467,11 @@ private:
void * pReplyData ) {
void * pReplyData ) {
sp < AudioEffect > effect = mEffect . promote ( ) ;
sp < AudioEffect > effect = mEffect . promote ( ) ;
if ( effect ! = 0 ) {
if ( effect ! = 0 ) {
{
// Got the mConstructLock means the construction of AudioEffect
// has finished, we should release the mConstructLock immediately.
AutoMutex lock ( effect - > mConstructLock ) ;
}
effect - > commandExecuted (
effect - > commandExecuted (
cmdCode , cmdSize , pCmdData , replySize , pReplyData ) ;
cmdCode , cmdSize , pCmdData , replySize , pReplyData ) ;
}
}
@ -465,6 +481,11 @@ private:
virtual void binderDied ( const wp < IBinder > & /*who*/ ) {
virtual void binderDied ( const wp < IBinder > & /*who*/ ) {
sp < AudioEffect > effect = mEffect . promote ( ) ;
sp < AudioEffect > effect = mEffect . promote ( ) ;
if ( effect ! = 0 ) {
if ( effect ! = 0 ) {
{
// Got the mConstructLock means the construction of AudioEffect
// has finished, we should release the mConstructLock immediately.
AutoMutex lock ( effect - > mConstructLock ) ;
}
effect - > binderDied ( ) ;
effect - > binderDied ( ) ;
}
}
}
}