frameworks/av: miscellaneous fixes

fixes for the following issues reported by KW

5978, 8879, 8880, 8881, 8882, 8883, 8889, 8890,
8892, 8893, 9200, 9201, 10210, 11223, 11224, 18001,
83677, 84525, 5897

Change-Id: I9bb98a07af97cbfc746b21738dfce7cd9e128c94
(cherry picked from commit 331e8cc1fe37e0959a56dfd78d3a298e90f6fd4c)