Merge "Fix code issues in APM found with unit tests" am: 47f6a73cd2 am: d5a6361210 am: 3a966e8850 am: de4e12fbb6

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2126456

Change-Id: I2cf1d0a87ba5e686efb3ddd7dc60de5608c23c41
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>