Avoid storing 'this' in a wp<AudioEffect> while in constructor
Storing 'this' into wp<AudioEffect> while running the constructor
of an AudioEffect can lead to premature instance destruction
because the owner of this weak pointer may promote to sp<>
on a thread running in parallel to the constructor.
Fixed by removing a call to AudioEffect::set from the constructor
and moving the responsibility for calling it to client code.
Bug: 162323621
Bug: 174222126
Test: repro steps from the bug
atest android.media.cts.VisualizerTest
Change-Id: Ice5f510b1c9020b5ba73bd6223c1669ab8eae24c
Merged-In: Ice5f510b1c9020b5ba73bd6223c1669ab8eae24c
3 files changed