audiopolicy: effects: move to orphans when disconnected device

Bug: 267799634
Test: atest AudioPolicyManagerPreProcEffectTest#DeviceDisconnectWhileClientActive

Session pre processing effects are attached to an input.
The device on which is routed this input is disconnected.
The input is closed, effects are still pointing on dead input
io handle.
The client tried to get another input (or device is reconnected),
the session is unchanged, thus, it tries to re associat effects.
It crashes since the associated input to move from has disappeared.

This CL fixes this issue by moving to orphan (aka resetting associated io
handle) all the effects for an input while closed.

Change-Id: Ie490d93c48a4ea71f3f6ff716eca615eebf2efdc
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 884ad96..26eb5ec 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -6769,6 +6769,7 @@
         mpClientInterface->onAudioPatchListUpdate();
     }
 
+    mEffects.putOrphanEffectsForIo(input);
     inputDesc->close();
     mInputs.removeItem(input);