Fix APS death notification

Our death recipient object was being kept alive only by the reference
held by the remote process, the one we want the death notifications
from. When it dies, we have a race condition between the death call
and the listener being garbage collected.

Furthermore, since the global APS reference may get replaced by a new
one as part of clearAudioConfigCache(), we keep the old reference
around, or else our death listener becomes invalidated silently.

(cherry picked from commit d9f8283b957dcd1fa78c86b503b0302689620323)
(cherry picked from commit a46b6d3ea608120af74ec7975427eb7f5311f720)

Bug: 165780067
Test: Manual verification of sound trigger recovery after killing
      audioserver multiple times, while generating touch sounds.
Merged-In: If24c59ec3e3d01f418fbf575b8cc32ae0ba7fa2e
Change-Id: If24c59ec3e3d01f418fbf575b8cc32ae0ba7fa2e
1 file changed