Reduce the frequency of calls to get_device_api_level

This API call is made more than 100 times a second, and it's
contributing to more than 1% of total CPU cycles in the Audio Codec HAL
process.

Given that this is static information that doesn't change frequently, we
can move the API call to the constructor and cache the information to be
used later.

Test: manual testing by playing a video

Bug link: https://buganizer.corp.google.com/issues/244443227

Change-Id: I35b215d834bd71d9c725b76dcbc0d9aa597faa34
(cherry picked from commit 47c2b5713a2af22940fb78b7230f344bb51ac3e2)
Merged-In: I35b215d834bd71d9c725b76dcbc0d9aa597faa34
2 files changed