IAudioPolicyService, IAudioFlinger: check C structs on server side

Add more checks on C structs received on server side to avoid string
overflows in particular.
Move sanitization helpers into a specific class in media helper library.

Bug: 169572641
Test: audio smoke tests
Change-Id: I89cb840230c85dcdddd5b128f626bb4fe303832a
Merged-In: I89cb840230c85dcdddd5b128f626bb4fe303832a
7 files changed