libaudiohal@aidl: Fix setDevicePortConnectedState

`setDevicePortConnectedState` stores iterators on `mPorts`
and then calls `resetUnusedPortConfigs` which can also
invalidate `mPorts`. This becomes more obvious after
renaming `resetUnusedPortConfigs` to `resetUnusedPortConfigsAndPorts`.
This call needs to be moved to the beginning of
`setDevicePortConnectedState` so that iterators on `mPorts`
remain valid.

Bug: 320628427
Test: atest audiosystem_tests audiorouting_tests
Change-Id: Ia187798a815305434c82b1a3e5c54cd81cfbb8c0
3 files changed