Add locking to performance hint NDK

This patch adds thread safety to the NDK, locking everything behind a
single mutex to avoid multiple lock acquisitions when operating on
shared state. All calls are asynchronous, except for createSession and
setThreads which don't need to hold the lock during their call, so the
risk of contesting the mutex is low.

Test: atest PerformanceHintNativeTest
Bug: 343817997
Change-Id: Ib08c11d6b7c84c30e83cca6613b15c62bcd8a68f
1 file changed